Skip to content

Commit

Permalink
gpio: sim: mark the GPIO chip as a one that can sleep
Browse files Browse the repository at this point in the history
commit 5a78d5d upstream.

Simulated chips use a mutex for synchronization in driver callbacks so
they must not be called from interrupt context. Set the can_sleep field
of the GPIO chip to true to force users to only use threaded irqs.

Fixes: cb8c474 ("gpio: sim: new testing module")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Bartosz Golaszewski authored and gregkh committed Aug 16, 2023
1 parent 227bd2c commit b8cd871
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpio/gpio-sim.c
Expand Up @@ -425,6 +425,7 @@ static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev)
gc->set_config = gpio_sim_set_config;
gc->to_irq = gpio_sim_to_irq;
gc->free = gpio_sim_free;
gc->can_sleep = true;

ret = devm_gpiochip_add_data(dev, gc, chip);
if (ret)
Expand Down

0 comments on commit b8cd871

Please sign in to comment.