linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: rtc-mrst: Replace mdelay() with msleep() in mrst_read_time()
@ 2018-07-30 13:59 Jia-Ju Bai
  2018-08-27 20:52 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-07-30 13:59 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: linux-rtc, linux-kernel, Jia-Ju Bai

mrst_read_time() 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/rtc/rtc-mrst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index fcb9de5218b2..e4015f70f9fe 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -91,7 +91,7 @@ static int mrst_read_time(struct device *dev, struct rtc_time *time)
 	unsigned long flags;
 
 	if (vrtc_is_updating())
-		mdelay(20);
+		msleep(20);
 
 	spin_lock_irqsave(&rtc_lock, flags);
 	time->tm_sec = vrtc_cmos_read(RTC_SECONDS);
-- 
2.17.0

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

* Re: [PATCH] rtc: rtc-mrst: Replace mdelay() with msleep() in mrst_read_time()
  2018-07-30 13:59 [PATCH] rtc: rtc-mrst: Replace mdelay() with msleep() in mrst_read_time() Jia-Ju Bai
@ 2018-08-27 20:52 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2018-08-27 20:52 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: a.zummo, linux-rtc, linux-kernel

On 30/07/2018 21:59:03+0800, Jia-Ju Bai wrote:
> mrst_read_time() 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/rtc/rtc-mrst.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2018-08-28  0:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-30 13:59 [PATCH] rtc: rtc-mrst: Replace mdelay() with msleep() in mrst_read_time() Jia-Ju Bai
2018-08-27 20:52 ` Alexandre Belloni

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