linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio-poweroff: Use gpiod_set_value_cansleep
@ 2018-04-24 11:10 Mike Looijmans
  2018-04-25 21:11 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Looijmans @ 2018-04-24 11:10 UTC (permalink / raw)
  To: linux-pm, sre; +Cc: linux-kernel, Mike Looijmans

The power-off call is done in a context that must be able to sleep, so
use gpiod_set_value_cansleep instead of the atomic gpiod_set_value call.

This fixes a kernel warning at shutdown when the gpio is controlled
through an IO expander for example.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 drivers/power/reset/gpio-poweroff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
index 6273ad3..38206c3 100644
--- a/drivers/power/reset/gpio-poweroff.c
+++ b/drivers/power/reset/gpio-poweroff.c
@@ -35,11 +35,11 @@ static void gpio_poweroff_do_poweroff(void)
 	gpiod_direction_output(reset_gpio, 1);
 	mdelay(100);
 	/* drive inactive, also active->inactive edge */
-	gpiod_set_value(reset_gpio, 0);
+	gpiod_set_value_cansleep(reset_gpio, 0);
 	mdelay(100);
 
 	/* drive it active, also inactive->active edge */
-	gpiod_set_value(reset_gpio, 1);
+	gpiod_set_value_cansleep(reset_gpio, 1);
 
 	/* give it some time */
 	mdelay(timeout);
-- 
1.9.1

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

* Re: [PATCH] gpio-poweroff: Use gpiod_set_value_cansleep
  2018-04-24 11:10 [PATCH] gpio-poweroff: Use gpiod_set_value_cansleep Mike Looijmans
@ 2018-04-25 21:11 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2018-04-25 21:11 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: linux-pm, linux-kernel

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

Hi Mike,

On Tue, Apr 24, 2018 at 01:10:30PM +0200, Mike Looijmans wrote:
> The power-off call is done in a context that must be able to sleep, so
> use gpiod_set_value_cansleep instead of the atomic gpiod_set_value call.
> 
> This fixes a kernel warning at shutdown when the gpio is controlled
> through an IO expander for example.
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/reset/gpio-poweroff.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
> index 6273ad3..38206c3 100644
> --- a/drivers/power/reset/gpio-poweroff.c
> +++ b/drivers/power/reset/gpio-poweroff.c
> @@ -35,11 +35,11 @@ static void gpio_poweroff_do_poweroff(void)
>  	gpiod_direction_output(reset_gpio, 1);
>  	mdelay(100);
>  	/* drive inactive, also active->inactive edge */
> -	gpiod_set_value(reset_gpio, 0);
> +	gpiod_set_value_cansleep(reset_gpio, 0);
>  	mdelay(100);
>  
>  	/* drive it active, also inactive->active edge */
> -	gpiod_set_value(reset_gpio, 1);
> +	gpiod_set_value_cansleep(reset_gpio, 1);
>  
>  	/* give it some time */
>  	mdelay(timeout);
> -- 
> 1.9.1
> 

[-- 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-04-25 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-24 11:10 [PATCH] gpio-poweroff: Use gpiod_set_value_cansleep Mike Looijmans
2018-04-25 21:11 ` Sebastian Reichel

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