Lines Matching refs:ctl
54 struct snd_ctl_file *ctl; in snd_ctl_open() local
75 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); in snd_ctl_open()
76 if (ctl == NULL) { in snd_ctl_open()
80 INIT_LIST_HEAD(&ctl->events); in snd_ctl_open()
81 init_waitqueue_head(&ctl->change_sleep); in snd_ctl_open()
82 spin_lock_init(&ctl->read_lock); in snd_ctl_open()
83 ctl->card = card; in snd_ctl_open()
85 ctl->preferred_subdevice[i] = -1; in snd_ctl_open()
86 ctl->pid = get_pid(task_pid(current)); in snd_ctl_open()
87 file->private_data = ctl; in snd_ctl_open()
89 list_add_tail(&ctl->list, &card->ctl_files); in snd_ctl_open()
104 static void snd_ctl_empty_read_queue(struct snd_ctl_file * ctl) in snd_ctl_empty_read_queue() argument
109 spin_lock_irqsave(&ctl->read_lock, flags); in snd_ctl_empty_read_queue()
110 while (!list_empty(&ctl->events)) { in snd_ctl_empty_read_queue()
111 cread = snd_kctl_event(ctl->events.next); in snd_ctl_empty_read_queue()
115 spin_unlock_irqrestore(&ctl->read_lock, flags); in snd_ctl_empty_read_queue()
122 struct snd_ctl_file *ctl; in snd_ctl_release() local
126 ctl = file->private_data; in snd_ctl_release()
128 card = ctl->card; in snd_ctl_release()
130 list_del(&ctl->list); in snd_ctl_release()
135 if (control->vd[idx].owner == ctl) in snd_ctl_release()
138 snd_ctl_empty_read_queue(ctl); in snd_ctl_release()
139 put_pid(ctl->pid); in snd_ctl_release()
140 kfree(ctl); in snd_ctl_release()
160 struct snd_ctl_file *ctl; in snd_ctl_notify() local
171 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_notify()
172 if (!ctl->subscribed) in snd_ctl_notify()
174 spin_lock_irqsave(&ctl->read_lock, flags); in snd_ctl_notify()
175 list_for_each_entry(ev, &ctl->events, list) { in snd_ctl_notify()
185 list_add_tail(&ev->list, &ctl->events); in snd_ctl_notify()
190 wake_up(&ctl->change_sleep); in snd_ctl_notify()
191 spin_unlock_irqrestore(&ctl->read_lock, flags); in snd_ctl_notify()
192 kill_fasync(&ctl->fasync, SIGIO, POLL_IN); in snd_ctl_notify()
723 static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, in snd_ctl_card_info() argument
822 static int snd_ctl_elem_info(struct snd_ctl_file *ctl, in snd_ctl_elem_info() argument
825 struct snd_card *card = ctl->card; in snd_ctl_elem_info()
849 if (vd->owner == ctl) in snd_ctl_elem_info()
860 static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl, in snd_ctl_elem_info_user() argument
868 result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); in snd_ctl_elem_info_user()
871 result = snd_ctl_elem_info(ctl, &info); in snd_ctl_elem_info_user()
1539 struct snd_ctl_file *ctl; in snd_ctl_ioctl() local
1546 ctl = file->private_data; in snd_ctl_ioctl()
1547 card = ctl->card; in snd_ctl_ioctl()
1554 return snd_ctl_card_info(card, ctl, cmd, argp); in snd_ctl_ioctl()
1558 return snd_ctl_elem_info_user(ctl, argp); in snd_ctl_ioctl()
1562 return snd_ctl_elem_write_user(ctl, argp); in snd_ctl_ioctl()
1564 return snd_ctl_elem_lock(ctl, argp); in snd_ctl_ioctl()
1566 return snd_ctl_elem_unlock(ctl, argp); in snd_ctl_ioctl()
1568 return snd_ctl_elem_add_user(ctl, argp, 0); in snd_ctl_ioctl()
1570 return snd_ctl_elem_add_user(ctl, argp, 1); in snd_ctl_ioctl()
1572 return snd_ctl_elem_remove(ctl, argp); in snd_ctl_ioctl()
1574 return snd_ctl_subscribe_events(ctl, ip); in snd_ctl_ioctl()
1576 down_read(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1577 err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ); in snd_ctl_ioctl()
1578 up_read(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1581 down_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1582 err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE); in snd_ctl_ioctl()
1583 up_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1586 down_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1587 err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD); in snd_ctl_ioctl()
1588 up_write(&ctl->card->controls_rwsem); in snd_ctl_ioctl()
1601 err = p->fioctl(card, ctl, cmd, arg); in snd_ctl_ioctl()
1615 struct snd_ctl_file *ctl; in snd_ctl_read() local
1619 ctl = file->private_data; in snd_ctl_read()
1620 if (snd_BUG_ON(!ctl || !ctl->card)) in snd_ctl_read()
1622 if (!ctl->subscribed) in snd_ctl_read()
1626 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1630 while (list_empty(&ctl->events)) { in snd_ctl_read()
1637 add_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1639 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1641 remove_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1642 if (ctl->card->shutdown) in snd_ctl_read()
1646 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1648 kev = snd_kctl_event(ctl->events.next); in snd_ctl_read()
1653 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1659 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1665 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1673 struct snd_ctl_file *ctl; in snd_ctl_poll() local
1675 ctl = file->private_data; in snd_ctl_poll()
1676 if (!ctl->subscribed) in snd_ctl_poll()
1678 poll_wait(file, &ctl->change_sleep, wait); in snd_ctl_poll()
1681 if (!list_empty(&ctl->events)) in snd_ctl_poll()
1779 struct snd_ctl_file *ctl; in snd_ctl_fasync() local
1781 ctl = file->private_data; in snd_ctl_fasync()
1782 return fasync_helper(fd, file, on, &ctl->fasync); in snd_ctl_fasync()
1849 struct snd_ctl_file *ctl; in snd_ctl_dev_disconnect() local
1852 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_dev_disconnect()
1853 wake_up(&ctl->change_sleep); in snd_ctl_dev_disconnect()
1854 kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); in snd_ctl_dev_disconnect()