Skip to content

Commit

Permalink
gpio: fix sleep-while-atomic in gpiochip_remove
Browse files Browse the repository at this point in the history
Move direct and indirect calls to gpiochip_remove_pin_ranges outside of
spin lock as they can end up taking a mutex in pinctrl_remove_gpio_range.

Note that the pin ranges are already added outside of the lock.

Fixes: 9ef0d6f ("gpiolib: call pin removal in chip removal function")
Fixes: f23f151 ("gpiolib: provide provision to register pin ranges")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Johan Hovold authored and Linus Walleij committed Jan 14, 2015
1 parent 00acc3d commit 6798aca
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,10 @@ void gpiochip_remove(struct gpio_chip *chip)
gpiochip_irqchip_remove(chip);

acpi_gpiochip_remove(chip);

spin_lock_irqsave(&gpio_lock, flags);

gpiochip_remove_pin_ranges(chip);
of_gpiochip_remove(chip);

spin_lock_irqsave(&gpio_lock, flags);
for (id = 0; id < chip->ngpio; id++) {
if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
dev_crit(chip->dev, "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n");
Expand Down

0 comments on commit 6798aca

Please sign in to comment.