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()
82 ctl->prefer_pcm_subdevice = -1; in snd_ctl_open()
83 ctl->prefer_rawmidi_subdevice = -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()
148 struct snd_ctl_file *ctl; in snd_ctl_notify() local
157 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_notify()
158 if (!ctl->subscribed) in snd_ctl_notify()
160 spin_lock_irqsave(&ctl->read_lock, flags); in snd_ctl_notify()
161 list_for_each_entry(ev, &ctl->events, list) { in snd_ctl_notify()
171 list_add_tail(&ev->list, &ctl->events); in snd_ctl_notify()
176 wake_up(&ctl->change_sleep); in snd_ctl_notify()
177 spin_unlock_irqrestore(&ctl->read_lock, flags); in snd_ctl_notify()
178 kill_fasync(&ctl->fasync, SIGIO, POLL_IN); in snd_ctl_notify()
683 static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, in snd_ctl_card_info() argument
772 static int snd_ctl_elem_info(struct snd_ctl_file *ctl, in snd_ctl_elem_info() argument
775 struct snd_card *card = ctl->card; in snd_ctl_elem_info()
799 if (vd->owner == ctl) in snd_ctl_elem_info()
810 static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl, in snd_ctl_elem_info_user() argument
818 snd_power_lock(ctl->card); in snd_ctl_elem_info_user()
819 result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); in snd_ctl_elem_info_user()
821 result = snd_ctl_elem_info(ctl, &info); in snd_ctl_elem_info_user()
822 snd_power_unlock(ctl->card); in snd_ctl_elem_info_user()
1342 struct snd_ctl_file *ctl; in snd_ctl_ioctl() local
1349 ctl = file->private_data; in snd_ctl_ioctl()
1350 card = ctl->card; in snd_ctl_ioctl()
1357 return snd_ctl_card_info(card, ctl, cmd, argp); in snd_ctl_ioctl()
1361 return snd_ctl_elem_info_user(ctl, argp); in snd_ctl_ioctl()
1365 return snd_ctl_elem_write_user(ctl, argp); in snd_ctl_ioctl()
1367 return snd_ctl_elem_lock(ctl, argp); in snd_ctl_ioctl()
1369 return snd_ctl_elem_unlock(ctl, argp); in snd_ctl_ioctl()
1371 return snd_ctl_elem_add_user(ctl, argp, 0); in snd_ctl_ioctl()
1373 return snd_ctl_elem_add_user(ctl, argp, 1); in snd_ctl_ioctl()
1375 return snd_ctl_elem_remove(ctl, argp); in snd_ctl_ioctl()
1377 return snd_ctl_subscribe_events(ctl, ip); in snd_ctl_ioctl()
1379 return snd_ctl_tlv_ioctl(ctl, argp, 0); in snd_ctl_ioctl()
1381 return snd_ctl_tlv_ioctl(ctl, argp, 1); in snd_ctl_ioctl()
1383 return snd_ctl_tlv_ioctl(ctl, argp, -1); in snd_ctl_ioctl()
1395 err = p->fioctl(card, ctl, cmd, arg); in snd_ctl_ioctl()
1409 struct snd_ctl_file *ctl; in snd_ctl_read() local
1413 ctl = file->private_data; in snd_ctl_read()
1414 if (snd_BUG_ON(!ctl || !ctl->card)) in snd_ctl_read()
1416 if (!ctl->subscribed) in snd_ctl_read()
1420 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1424 while (list_empty(&ctl->events)) { in snd_ctl_read()
1431 add_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1433 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1435 remove_wait_queue(&ctl->change_sleep, &wait); in snd_ctl_read()
1436 if (ctl->card->shutdown) in snd_ctl_read()
1440 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1442 kev = snd_kctl_event(ctl->events.next); in snd_ctl_read()
1447 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1453 spin_lock_irq(&ctl->read_lock); in snd_ctl_read()
1459 spin_unlock_irq(&ctl->read_lock); in snd_ctl_read()
1467 struct snd_ctl_file *ctl; in snd_ctl_poll() local
1469 ctl = file->private_data; in snd_ctl_poll()
1470 if (!ctl->subscribed) in snd_ctl_poll()
1472 poll_wait(file, &ctl->change_sleep, wait); in snd_ctl_poll()
1475 if (!list_empty(&ctl->events)) in snd_ctl_poll()
1557 struct snd_ctl_file *ctl; in snd_ctl_fasync() local
1559 ctl = file->private_data; in snd_ctl_fasync()
1560 return fasync_helper(fd, file, on, &ctl->fasync); in snd_ctl_fasync()
1616 struct snd_ctl_file *ctl; in snd_ctl_dev_disconnect() local
1626 list_for_each_entry(ctl, &card->ctl_files, list) { in snd_ctl_dev_disconnect()
1627 wake_up(&ctl->change_sleep); in snd_ctl_dev_disconnect()
1628 kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); in snd_ctl_dev_disconnect()