Lines Matching refs:ctl
39 struct snd_ctl_file *ctl; in snd_ctl_open() local
60 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); in snd_ctl_open()
61 if (ctl == NULL) { in snd_ctl_open()
65 INIT_LIST_HEAD(&ctl->events); in snd_ctl_open()
66 init_waitqueue_head(&ctl->change_sleep); in snd_ctl_open()
67 spin_lock_init(&ctl->read_lock); in snd_ctl_open()
68 ctl->card = card; in snd_ctl_open()
70 ctl->preferred_subdevice[i] = -1; in snd_ctl_open()
71 ctl->pid = get_pid(task_pid(current)); in snd_ctl_open()
72 file->private_data = ctl; in snd_ctl_open()
74 list_add_tail(&ctl->list, &card->ctl_files); in snd_ctl_open()
89 static void snd_ctl_empty_read_queue(struct snd_ctl_file * ctl) in snd_ctl_empty_read_queue() argument
94 spin_lock_irqsave(&ctl->read_lock, flags); in snd_ctl_empty_read_queue()
95 while (!list_empty(&ctl->events)) { in snd_ctl_empty_read_queue()
96 cread = snd_kctl_event(ctl->events.next); in snd_ctl_empty_read_queue()
100 spin_unlock_irqrestore(&ctl->read_lock, flags); in snd_ctl_empty_read_queue()
107 struct snd_ctl_file *ctl; in snd_ctl_release() local
111 ctl = file->private_data; in snd_ctl_release()
113 card = ctl->card; in snd_ctl_release()
115 list_del(&ctl->list); in snd_ctl_release()
120 if (control->vd[idx].owner == ctl) in snd_ctl_release()
123 snd_ctl_empty_read_queue(ctl); in snd_ctl_release()
124 put_pid(ctl->pid); in snd_ctl_release()
125 kfree(ctl); in snd_ctl_release()
145 struct snd_ctl_file *ctl; in snd_ctl_notify() local
156 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_notify()
157 if (!ctl->subscribed) in snd_ctl_notify()
159 spin_lock_irqsave(&ctl->read_lock, flags); in snd_ctl_notify()
160 list_for_each_entry(ev, &ctl->events, list) { in snd_ctl_notify()
170 list_add_tail(&ev->list, &ctl->events); in snd_ctl_notify()
175 wake_up(&ctl->change_sleep); in snd_ctl_notify()
176 spin_unlock_irqrestore(&ctl->read_lock, flags); in snd_ctl_notify()
177 kill_fasync(&ctl->fasync, SIGIO, POLL_IN); in snd_ctl_notify()
692 static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, in snd_ctl_card_info() argument
791 static int snd_ctl_elem_info(struct snd_ctl_file *ctl, in snd_ctl_elem_info() argument
794 struct snd_card *card = ctl->card; in snd_ctl_elem_info()
818 if (vd->owner == ctl) in snd_ctl_elem_info()
829 static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl, in snd_ctl_elem_info_user() argument
837 result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); in snd_ctl_elem_info_user()
840 result = snd_ctl_elem_info(ctl, &info); in snd_ctl_elem_info_user()
1511 struct snd_ctl_file *ctl; in snd_ctl_ioctl() local
1518 ctl = file->private_data; in snd_ctl_ioctl()
1519 card = ctl->card; in snd_ctl_ioctl()
1526 return snd_ctl_card_info(card, ctl, cmd, argp); in snd_ctl_ioctl()
1530 return snd_ctl_elem_info_user(ctl, argp); in snd_ctl_ioctl()
1534 return snd_ctl_elem_write_user(ctl, argp); in snd_ctl_ioctl()
1536 return snd_ctl_elem_lock(ctl, argp); in snd_ctl_ioctl()
1538 return snd_ctl_elem_unlock(ctl, argp); in snd_ctl_ioctl()
1540 return snd_ctl_elem_add_user(ctl, argp, 0); in snd_ctl_ioctl()
1542 return snd_ctl_elem_add_user(ctl, argp, 1); in snd_ctl_ioctl()
1544 return snd_ctl_elem_remove(ctl, argp); in snd_ctl_ioctl()
1546 return snd_ctl_subscribe_events(ctl, ip); in snd_ctl_ioctl()
1548 down_read(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1549 err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ); in snd_ctl_ioctl()
1550 up_read(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1553 down_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1554 err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE); in snd_ctl_ioctl()
1555 up_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1558 down_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1559 err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD); in snd_ctl_ioctl()
1560 up_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1573 err = p->fioctl(card, ctl, cmd, arg); in snd_ctl_ioctl()
1587 struct snd_ctl_file *ctl; in snd_ctl_read() local
1591 ctl = file->private_data; in snd_ctl_read()
1592 if (snd_BUG_ON(!ctl || !ctl->card)) in snd_ctl_read()
1594 if (!ctl->subscribed) in snd_ctl_read()
1598 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1602 while (list_empty(&ctl->events)) { in snd_ctl_read()
1609 add_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1611 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1613 remove_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1614 if (ctl->card->shutdown) in snd_ctl_read()
1618 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1620 kev = snd_kctl_event(ctl->events.next); in snd_ctl_read()
1625 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1631 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1637 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1645 struct snd_ctl_file *ctl; in snd_ctl_poll() local
1647 ctl = file->private_data; in snd_ctl_poll()
1648 if (!ctl->subscribed) in snd_ctl_poll()
1650 poll_wait(file, &ctl->change_sleep, wait); in snd_ctl_poll()
1653 if (!list_empty(&ctl->events)) in snd_ctl_poll()
1751 struct snd_ctl_file *ctl; in snd_ctl_fasync() local
1753 ctl = file->private_data; in snd_ctl_fasync()
1754 return fasync_helper(fd, file, on, &ctl->fasync); in snd_ctl_fasync()
1821 struct snd_ctl_file *ctl; in snd_ctl_dev_disconnect() local
1824 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_dev_disconnect()
1825 wake_up(&ctl->change_sleep); in snd_ctl_dev_disconnect()
1826 kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); in snd_ctl_dev_disconnect()