Skip to contentSkip to conversation

gpio/pca953x bugfix: mark as can_sleep

PATCH In review David Brownell 2 participants 2 messages Mar 9, 2008 – Mar 10, 2008 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio/pca953x bugfix: mark as can_sleep

The pca953x driver is an I2C driver so gpio_chip->can_sleep should be set. This lets upper layers know they should use the gpio_*_cansleep() calls to access values, and may not access them from nonsleeping contexts.

---
Merge before 2.6.25-final, please. This will for example prevent leds-gpio from issuing blocking I2C calls from timer/irq contexts.

 drivers/gpio/pca953x.c |    1 +
 1 file changed, 1 insertion(+)
drivers/gpio/pca953x.c +1 -0
@@ -184,6 +184,7 @@ static void pca953x_setup_gpio(struct pc
 	gc->direction_output = pca953x_gpio_direction_output;
 	gc->get = pca953x_gpio_get_value;
 	gc->set = pca953x_gpio_set_value;
+	gc->can_sleep = 1;
 
 	gc->base = chip->gpio_start;
 	gc->ngpio = gpios;
#1 lore raw

OK

Quoted 24 lines · David Brownell

The pca953x driver is an I2C driver so gpio_chip->can_sleep should be set.
This lets upper layers know they should use the gpio_*_cansleep() calls to access values, and may not access them from nonsleeping contexts.

---
Merge before 2.6.25-final, please. This will for example prevent leds-gpio from issuing blocking I2C calls from timer/irq contexts.

  drivers/gpio/pca953x.c |    1 +
  1 file changed, 1 insertion(+)

--- g26.orig/drivers/gpio/pca953x.c 2008-03-08 11:17:22.000000000 -0800
+++ g26/drivers/gpio/pca953x.c 2008-03-09 13:51:13.000000000 -0700 @@ -184,6 +184,7 @@ static void pca953x_setup_gpio(struct pc

        gc->direction_output = pca953x_gpio_direction_output;
        gc->get = pca953x_gpio_get_value;
        gc->set = pca953x_gpio_set_value;

+ gc->can_sleep = 1;

        gc->base = chip->gpio_start;
        gc->ngpio = gpios;
Signature · 2 lines
Cheers
- eric