[alsa-devel] [PATCH 14/15] ALSA: line6: Give up hwdep spinlock temporarily during read operation
Andrej Krutak
dev at andree.sk
Thu Aug 11 21:02:26 CEST 2016
Without it, the code hits the 'might_sleep while atomic' debug warning.
Signed-off-by: Andrej Krutak <dev at andree.sk>
---
sound/usb/line6/driver.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 142e0e3..286b6e1 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -600,6 +600,10 @@ line6_hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count,
goto end;
}
+ /* Release lock while copying the stuff. Since there is only one reader,
+ * the data is going nowhere, so this should be safe. */
+ spin_unlock(&line6->buffer_circular.read_lock);
+
if (copy_to_user(buf,
&line6->buffer_circular.data[tail * LINE6_MESSAGE_MAXLEN],
line6->buffer_circular.data_len[tail])
@@ -610,6 +614,7 @@ line6_hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count,
rv = line6->buffer_circular.data_len[tail];
}
+ spin_lock(&line6->buffer_circular.read_lock);
smp_store_release(&line6->buffer_circular.tail,
(tail + 1) & (LINE6_MESSAGE_MAXCOUNT - 1));
--
1.9.1
More information about the Alsa-devel
mailing list