linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: usb: pegasus: Replace mdelay() with msleep() in setup_pegasus_II()
@ 2018-07-27  8:36 Jia-Ju Bai
  2018-07-27 21:12 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-07-27  8:36 UTC (permalink / raw)
  To: petkan; +Cc: linux-usb, netdev, linux-kernel, Jia-Ju Bai

setup_pegasus_II() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/usb/pegasus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 6514c86f043e..f4247b275e09 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1067,7 +1067,7 @@ static inline void setup_pegasus_II(pegasus_t *pegasus)
 
 	set_register(pegasus, Reg1d, 0);
 	set_register(pegasus, Reg7b, 1);
-	mdelay(100);
+	msleep(100);
 	if ((pegasus->features & HAS_HOME_PNA) && mii_mode)
 		set_register(pegasus, Reg7b, 0);
 	else
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: usb: pegasus: Replace mdelay() with msleep() in setup_pegasus_II()
  2018-07-27  8:36 [PATCH] net: usb: pegasus: Replace mdelay() with msleep() in setup_pegasus_II() Jia-Ju Bai
@ 2018-07-27 21:12 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-27 21:12 UTC (permalink / raw)
  To: baijiaju1990; +Cc: petkan, linux-usb, netdev, linux-kernel

From: Jia-Ju Bai <baijiaju1990@gmail.com>
Date: Fri, 27 Jul 2018 16:36:29 +0800

> setup_pegasus_II() is never called in atomic context.
> It calls mdelay() to busily wait, which is not necessary.
> mdelay() can be replaced with msleep().
> 
> This is found by a static analysis tool named DCNS written by myself.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-27 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27  8:36 [PATCH] net: usb: pegasus: Replace mdelay() with msleep() in setup_pegasus_II() Jia-Ju Bai
2018-07-27 21:12 ` David Miller

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).