All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: reset: syscon-poweroff: Replace mdelay() with msleep() in syscon_poweroff()
@ 2018-07-30 13:50 Jia-Ju Bai
  2018-08-29 22:46 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-07-30 13:50 UTC (permalink / raw)
  To: sre; +Cc: linux-pm, linux-kernel, Jia-Ju Bai

syscon_poweroff() 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/power/reset/syscon-poweroff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c
index f9f1cb54fbf9..b8b154606dbe 100644
--- a/drivers/power/reset/syscon-poweroff.c
+++ b/drivers/power/reset/syscon-poweroff.c
@@ -36,7 +36,7 @@ static void syscon_poweroff(void)
 	/* Issue the poweroff */
 	regmap_update_bits(map, offset, mask, value);
 
-	mdelay(1000);
+	msleep(1000);
 
 	pr_emerg("Unable to poweroff system\n");
 }
-- 
2.17.0


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

* Re: [PATCH] power: reset: syscon-poweroff: Replace mdelay() with msleep() in syscon_poweroff()
  2018-07-30 13:50 [PATCH] power: reset: syscon-poweroff: Replace mdelay() with msleep() in syscon_poweroff() Jia-Ju Bai
@ 2018-08-29 22:46 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2018-08-29 22:46 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

Hi,

On Mon, Jul 30, 2018 at 09:50:29PM +0800, Jia-Ju Bai wrote:
> syscon_poweroff() 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>
> ---

This is also a shutdown driver, not applying.

-- Sebastian

>  drivers/power/reset/syscon-poweroff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c
> index f9f1cb54fbf9..b8b154606dbe 100644
> --- a/drivers/power/reset/syscon-poweroff.c
> +++ b/drivers/power/reset/syscon-poweroff.c
> @@ -36,7 +36,7 @@ static void syscon_poweroff(void)
>  	/* Issue the poweroff */
>  	regmap_update_bits(map, offset, mask, value);
>  
> -	mdelay(1000);
> +	msleep(1000);
>  
>  	pr_emerg("Unable to poweroff system\n");
>  }
> -- 
> 2.17.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-08-29 22:46 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:50 [PATCH] power: reset: syscon-poweroff: Replace mdelay() with msleep() in syscon_poweroff() Jia-Ju Bai
2018-08-29 22:46 ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.