linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs
@ 2014-05-20  8:43 Aaron Lu
  2014-05-20  8:50 ` Mika Westerberg
  0 siblings, 1 reply; 6+ messages in thread
From: Aaron Lu @ 2014-05-20  8:43 UTC (permalink / raw)
  To: Mika Westerberg, Linus Walleij, Alexandre Courbot; +Cc: linux-gpio

The GPIO operation region handler should be called where sleep is
allowed, so we should use the *_cansleep version of gpiod_get/set APIs
or we will get a warning message complaining invalid context if the GPIO
chip has the cansleep flag set.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/gpio/gpiolib-acpi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index bf0f8b4..2d398a6 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -17,6 +17,7 @@
 #include <linux/acpi.h>
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
+#include <linux/gpio.h>
 
 #include "gpiolib.h"
 
@@ -449,9 +450,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
 		mutex_unlock(&achip->conn_lock);
 
 		if (function == ACPI_WRITE)
-			gpiod_set_raw_value(desc, !!((1 << i) & *value));
+			gpiod_set_raw_value_cansleep(desc,
+						     !!((1 << i) & *value));
 		else
-			*value |= gpiod_get_raw_value(desc) << i;
+			*value |= gpiod_get_raw_value_cansleep(desc) << i;
 	}
 
 out:
-- 
1.9.0


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

* Re: [PATCH] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs
  2014-05-20  8:43 [PATCH] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs Aaron Lu
@ 2014-05-20  8:50 ` Mika Westerberg
  2014-05-20  8:58   ` Aaron Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Mika Westerberg @ 2014-05-20  8:50 UTC (permalink / raw)
  To: Aaron Lu; +Cc: Linus Walleij, Alexandre Courbot, linux-gpio

On Tue, May 20, 2014 at 04:43:12PM +0800, Aaron Lu wrote:
> The GPIO operation region handler should be called where sleep is
> allowed, so we should use the *_cansleep version of gpiod_get/set APIs
> or we will get a warning message complaining invalid context if the GPIO
> chip has the cansleep flag set.
> 
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
>  drivers/gpio/gpiolib-acpi.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index bf0f8b4..2d398a6 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -17,6 +17,7 @@
>  #include <linux/acpi.h>
>  #include <linux/interrupt.h>
>  #include <linux/mutex.h>
> +#include <linux/gpio.h>

Why the above include?

(Sorry I just noticed this now).

>  
>  #include "gpiolib.h"
>  
> @@ -449,9 +450,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
>  		mutex_unlock(&achip->conn_lock);
>  
>  		if (function == ACPI_WRITE)
> -			gpiod_set_raw_value(desc, !!((1 << i) & *value));
> +			gpiod_set_raw_value_cansleep(desc,
> +						     !!((1 << i) & *value));
>  		else
> -			*value |= gpiod_get_raw_value(desc) << i;
> +			*value |= gpiod_get_raw_value_cansleep(desc) << i;
>  	}
>  
>  out:
> -- 
> 1.9.0

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

* Re: [PATCH] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs
  2014-05-20  8:50 ` Mika Westerberg
@ 2014-05-20  8:58   ` Aaron Lu
  2014-05-20  9:07     ` [PATCH v2] " Aaron Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Aaron Lu @ 2014-05-20  8:58 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: Linus Walleij, Alexandre Courbot, linux-gpio

On 05/20/2014 04:50 PM, Mika Westerberg wrote:
> On Tue, May 20, 2014 at 04:43:12PM +0800, Aaron Lu wrote:
>> The GPIO operation region handler should be called where sleep is
>> allowed, so we should use the *_cansleep version of gpiod_get/set APIs
>> or we will get a warning message complaining invalid context if the GPIO
>> chip has the cansleep flag set.
>>
>> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
>> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>> ---
>>  drivers/gpio/gpiolib-acpi.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
>> index bf0f8b4..2d398a6 100644
>> --- a/drivers/gpio/gpiolib-acpi.c
>> +++ b/drivers/gpio/gpiolib-acpi.c
>> @@ -17,6 +17,7 @@
>>  #include <linux/acpi.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/mutex.h>
>> +#include <linux/gpio.h>
> 
> Why the above include?
> 
> (Sorry I just noticed this now).

My bad - I used the gpio_set_value_cansleep at first which requires the
inclusion of that header file. Later, I found that I should use the
gpiod_set_raw_value_cansleep instead but forgot to remove that header.
Will remove the inclusion in v2, thanks for the remind!

-Aaron

> 
>>  
>>  #include "gpiolib.h"
>>  
>> @@ -449,9 +450,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
>>  		mutex_unlock(&achip->conn_lock);
>>  
>>  		if (function == ACPI_WRITE)
>> -			gpiod_set_raw_value(desc, !!((1 << i) & *value));
>> +			gpiod_set_raw_value_cansleep(desc,
>> +						     !!((1 << i) & *value));
>>  		else
>> -			*value |= gpiod_get_raw_value(desc) << i;
>> +			*value |= gpiod_get_raw_value_cansleep(desc) << i;
>>  	}
>>  
>>  out:
>> -- 
>> 1.9.0


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

* [PATCH v2] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs
  2014-05-20  8:58   ` Aaron Lu
@ 2014-05-20  9:07     ` Aaron Lu
  2014-05-21  2:35       ` Alexandre Courbot
  2014-05-23 12:37       ` Linus Walleij
  0 siblings, 2 replies; 6+ messages in thread
From: Aaron Lu @ 2014-05-20  9:07 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: Linus Walleij, Alexandre Courbot, linux-gpio

The GPIO operation region handler should be called where sleep is
allowed, so we should use the *_cansleep version of gpiod_get/set APIs
or we will get a warning message complaining invalid context if the GPIO
chip has the cansleep flag set.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
v2: remove the inclusion of linux/gpio.h as pointed out by Mika.

 drivers/gpio/gpiolib-acpi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 401add28933f..4a987917c186 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -449,9 +449,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
 		mutex_unlock(&achip->conn_lock);
 
 		if (function == ACPI_WRITE)
-			gpiod_set_raw_value(desc, !!((1 << i) & *value));
+			gpiod_set_raw_value_cansleep(desc,
+						     !!((1 << i) & *value));
 		else
-			*value |= (u64)gpiod_get_raw_value(desc) << i;
+			*value |= (u64)gpiod_get_raw_value_cansleep(desc) << i;
 	}
 
 out:
-- 
1.9.0


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

* Re: [PATCH v2] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs
  2014-05-20  9:07     ` [PATCH v2] " Aaron Lu
@ 2014-05-21  2:35       ` Alexandre Courbot
  2014-05-23 12:37       ` Linus Walleij
  1 sibling, 0 replies; 6+ messages in thread
From: Alexandre Courbot @ 2014-05-21  2:35 UTC (permalink / raw)
  To: Aaron Lu; +Cc: Mika Westerberg, Linus Walleij, linux-gpio@vger.kernel.org

On Tue, May 20, 2014 at 6:07 PM, Aaron Lu <aaron.lu@intel.com> wrote:
> The GPIO operation region handler should be called where sleep is
> allowed, so we should use the *_cansleep version of gpiod_get/set APIs
> or we will get a warning message complaining invalid context if the GPIO
> chip has the cansleep flag set.

Acked-by: Alexandre Courbot <acourbot@nvidia.com>

>
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> v2: remove the inclusion of linux/gpio.h as pointed out by Mika.
>
>  drivers/gpio/gpiolib-acpi.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index 401add28933f..4a987917c186 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -449,9 +449,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
>                 mutex_unlock(&achip->conn_lock);
>
>                 if (function == ACPI_WRITE)
> -                       gpiod_set_raw_value(desc, !!((1 << i) & *value));
> +                       gpiod_set_raw_value_cansleep(desc,
> +                                                    !!((1 << i) & *value));
>                 else
> -                       *value |= (u64)gpiod_get_raw_value(desc) << i;
> +                       *value |= (u64)gpiod_get_raw_value_cansleep(desc) << i;
>         }
>
>  out:
> --
> 1.9.0
>

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

* Re: [PATCH v2] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs
  2014-05-20  9:07     ` [PATCH v2] " Aaron Lu
  2014-05-21  2:35       ` Alexandre Courbot
@ 2014-05-23 12:37       ` Linus Walleij
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2014-05-23 12:37 UTC (permalink / raw)
  To: Aaron Lu; +Cc: Mika Westerberg, Alexandre Courbot, linux-gpio@vger.kernel.org

On Tue, May 20, 2014 at 11:07 AM, Aaron Lu <aaron.lu@intel.com> wrote:

> The GPIO operation region handler should be called where sleep is
> allowed, so we should use the *_cansleep version of gpiod_get/set APIs
> or we will get a warning message complaining invalid context if the GPIO
> chip has the cansleep flag set.
>
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> v2: remove the inclusion of linux/gpio.h as pointed out by Mika.

Patch applied with ALex's ACK.

Yours,
Linus Walleij

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

end of thread, other threads:[~2014-05-23 12:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20  8:43 [PATCH] gpio / ACPI: use *_cansleep version of gpiod_get/set APIs Aaron Lu
2014-05-20  8:50 ` Mika Westerberg
2014-05-20  8:58   ` Aaron Lu
2014-05-20  9:07     ` [PATCH v2] " Aaron Lu
2014-05-21  2:35       ` Alexandre Courbot
2014-05-23 12:37       ` Linus Walleij

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