Lines Matching refs:ctl
52 struct snd_ctl_file *ctl; in snd_ctl_open() local
73 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); in snd_ctl_open()
74 if (ctl == NULL) { in snd_ctl_open()
78 INIT_LIST_HEAD(&ctl->events); in snd_ctl_open()
79 init_waitqueue_head(&ctl->change_sleep); in snd_ctl_open()
80 spin_lock_init(&ctl->read_lock); in snd_ctl_open()
81 ctl->card = card; in snd_ctl_open()
83 ctl->preferred_subdevice[i] = -1; in snd_ctl_open()
84 ctl->pid = get_pid(task_pid(current)); in snd_ctl_open()
85 file->private_data = ctl; in snd_ctl_open()
87 list_add_tail(&ctl->list, &card->ctl_files); in snd_ctl_open()
102 static void snd_ctl_empty_read_queue(struct snd_ctl_file * ctl) in snd_ctl_empty_read_queue() argument
107 spin_lock_irqsave(&ctl->read_lock, flags); in snd_ctl_empty_read_queue()
108 while (!list_empty(&ctl->events)) { in snd_ctl_empty_read_queue()
109 cread = snd_kctl_event(ctl->events.next); in snd_ctl_empty_read_queue()
113 spin_unlock_irqrestore(&ctl->read_lock, flags); in snd_ctl_empty_read_queue()
120 struct snd_ctl_file *ctl; in snd_ctl_release() local
124 ctl = file->private_data; in snd_ctl_release()
126 card = ctl->card; in snd_ctl_release()
128 list_del(&ctl->list); in snd_ctl_release()
133 if (control->vd[idx].owner == ctl) in snd_ctl_release()
136 snd_ctl_empty_read_queue(ctl); in snd_ctl_release()
137 put_pid(ctl->pid); in snd_ctl_release()
138 kfree(ctl); in snd_ctl_release()
158 struct snd_ctl_file *ctl; in snd_ctl_notify() local
167 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_notify()
168 if (!ctl->subscribed) in snd_ctl_notify()
170 spin_lock_irqsave(&ctl->read_lock, flags); in snd_ctl_notify()
171 list_for_each_entry(ev, &ctl->events, list) { in snd_ctl_notify()
181 list_add_tail(&ev->list, &ctl->events); in snd_ctl_notify()
186 wake_up(&ctl->change_sleep); in snd_ctl_notify()
187 spin_unlock_irqrestore(&ctl->read_lock, flags); in snd_ctl_notify()
188 kill_fasync(&ctl->fasync, SIGIO, POLL_IN); in snd_ctl_notify()
719 static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, in snd_ctl_card_info() argument
808 static int snd_ctl_elem_info(struct snd_ctl_file *ctl, in snd_ctl_elem_info() argument
811 struct snd_card *card = ctl->card; in snd_ctl_elem_info()
835 if (vd->owner == ctl) in snd_ctl_elem_info()
846 static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl, in snd_ctl_elem_info_user() argument
854 snd_power_lock(ctl->card); in snd_ctl_elem_info_user()
855 result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); in snd_ctl_elem_info_user()
857 result = snd_ctl_elem_info(ctl, &info); in snd_ctl_elem_info_user()
858 snd_power_unlock(ctl->card); in snd_ctl_elem_info_user()
1462 struct snd_ctl_file *ctl; in snd_ctl_ioctl() local
1469 ctl = file->private_data; in snd_ctl_ioctl()
1470 card = ctl->card; in snd_ctl_ioctl()
1477 return snd_ctl_card_info(card, ctl, cmd, argp); in snd_ctl_ioctl()
1481 return snd_ctl_elem_info_user(ctl, argp); in snd_ctl_ioctl()
1485 return snd_ctl_elem_write_user(ctl, argp); in snd_ctl_ioctl()
1487 return snd_ctl_elem_lock(ctl, argp); in snd_ctl_ioctl()
1489 return snd_ctl_elem_unlock(ctl, argp); in snd_ctl_ioctl()
1491 return snd_ctl_elem_add_user(ctl, argp, 0); in snd_ctl_ioctl()
1493 return snd_ctl_elem_add_user(ctl, argp, 1); in snd_ctl_ioctl()
1495 return snd_ctl_elem_remove(ctl, argp); in snd_ctl_ioctl()
1497 return snd_ctl_subscribe_events(ctl, ip); in snd_ctl_ioctl()
1499 return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ); in snd_ctl_ioctl()
1501 return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE); in snd_ctl_ioctl()
1503 return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD); in snd_ctl_ioctl()
1515 err = p->fioctl(card, ctl, cmd, arg); in snd_ctl_ioctl()
1529 struct snd_ctl_file *ctl; in snd_ctl_read() local
1533 ctl = file->private_data; in snd_ctl_read()
1534 if (snd_BUG_ON(!ctl || !ctl->card)) in snd_ctl_read()
1536 if (!ctl->subscribed) in snd_ctl_read()
1540 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1544 while (list_empty(&ctl->events)) { in snd_ctl_read()
1551 add_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1553 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1555 remove_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1556 if (ctl->card->shutdown) in snd_ctl_read()
1560 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1562 kev = snd_kctl_event(ctl->events.next); in snd_ctl_read()
1567 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1573 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1579 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1587 struct snd_ctl_file *ctl; in snd_ctl_poll() local
1589 ctl = file->private_data; in snd_ctl_poll()
1590 if (!ctl->subscribed) in snd_ctl_poll()
1592 poll_wait(file, &ctl->change_sleep, wait); in snd_ctl_poll()
1595 if (!list_empty(&ctl->events)) in snd_ctl_poll()
1693 struct snd_ctl_file *ctl; in snd_ctl_fasync() local
1695 ctl = file->private_data; in snd_ctl_fasync()
1696 return fasync_helper(fd, file, on, &ctl->fasync); in snd_ctl_fasync()
1763 struct snd_ctl_file *ctl; in snd_ctl_dev_disconnect() local
1766 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_dev_disconnect()
1767 wake_up(&ctl->change_sleep); in snd_ctl_dev_disconnect()
1768 kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); in snd_ctl_dev_disconnect()