* [PATCH 2/3] sound: usb: line6: Replace mdelay with msleep in line6_write_data
@ 2018-03-18 14:51 Jia-Ju Bai
0 siblings, 0 replies; only message in thread
From: Jia-Ju Bai @ 2018-03-18 14:51 UTC (permalink / raw)
To: perex, tiwai; +Cc: alsa-devel, linux-kernel, Jia-Ju Bai
line6_write_data() is never called in atomic context.
The call chains ending up at line6_write_data() are:
[1] line6_write_data() <- toneport_setup() <- toneport_init()
<- line6_probe()
[2] line6_write_data() <- toneport_setup() <- toneport_reset_resume()
line6_probe() is called in toneport_probe(), pod_probe(), podhd_probe()
and variax_probe(), which are set as ".probe" in usb_driver structure.
toneport_reset_resume() is set as ".reset_resume" in usb_driver structure.
These functions are not called in atomic context.
Despite never getting called from atomic context, line6_write_data()
calls mdelay for busy wait.
That is not necessary and can be replaced with msleep to
avoid busy waiting.
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
sound/usb/line6/driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 0ff5a7d..29acd86 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -426,7 +426,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data,
}
for (count = 0; count < LINE6_READ_WRITE_MAX_RETRIES; count++) {
- mdelay(LINE6_READ_WRITE_STATUS_DELAY);
+ msleep(LINE6_READ_WRITE_STATUS_DELAY);
ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
0x67,
--
1.9.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-18 14:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-18 14:51 [PATCH 2/3] sound: usb: line6: Replace mdelay with msleep in line6_write_data Jia-Ju Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).