mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
ALSA: line6: Add poll callback for hwdep
At least POD HD500 uses message-based communication, both sides can send messages. Add poll callback so application can wait for device messages without using busy loop. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Link: https://lore.kernel.org/r/20200502193120.79115-3-anarsoul@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
5c2d0de544
commit
c55f569274
1 changed files with 16 additions and 0 deletions
|
@ -630,11 +630,27 @@ line6_hwdep_write(struct snd_hwdep *hwdep, const char __user *data, long count,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __poll_t
|
||||||
|
line6_hwdep_poll(struct snd_hwdep *hwdep, struct file *file, poll_table *wait)
|
||||||
|
{
|
||||||
|
__poll_t rv;
|
||||||
|
struct usb_line6 *line6 = hwdep->private_data;
|
||||||
|
|
||||||
|
poll_wait(file, &line6->messages.wait_queue, wait);
|
||||||
|
|
||||||
|
mutex_lock(&line6->messages.read_lock);
|
||||||
|
rv = kfifo_len(&line6->messages.fifo) == 0 ? 0 : EPOLLIN | EPOLLRDNORM;
|
||||||
|
mutex_unlock(&line6->messages.read_lock);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct snd_hwdep_ops hwdep_ops = {
|
static const struct snd_hwdep_ops hwdep_ops = {
|
||||||
.open = line6_hwdep_open,
|
.open = line6_hwdep_open,
|
||||||
.release = line6_hwdep_release,
|
.release = line6_hwdep_release,
|
||||||
.read = line6_hwdep_read,
|
.read = line6_hwdep_read,
|
||||||
.write = line6_hwdep_write,
|
.write = line6_hwdep_write,
|
||||||
|
.poll = line6_hwdep_poll,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Insert into circular buffer */
|
/* Insert into circular buffer */
|
||||||
|
|
Loading…
Add table
Reference in a new issue