diff options
author | Johan Hovold <johan@kernel.org> | 2015-01-12 11:12:28 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-14 08:26:25 -0500 |
commit | 6798acaa0138d8b12f1c54402ebcb66fea3deb03 (patch) | |
tree | cc57a7a154ac8938a3ff8f359f2edc34c5dd7c52 | |
parent | 00acc3dc248063f982cfacfbe5e78c0d6797ffef (diff) |
gpio: fix sleep-while-atomic in gpiochip_remove
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: 9ef0d6f7628b ("gpiolib: call pin removal in chip removal function")
Fixes: f23f1516b675 ("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>
-rw-r--r-- | drivers/gpio/gpiolib.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 0f8173051edc..37f919dc2cb4 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -330,12 +330,10 @@ void gpiochip_remove(struct gpio_chip *chip) | |||
330 | gpiochip_irqchip_remove(chip); | 330 | gpiochip_irqchip_remove(chip); |
331 | 331 | ||
332 | acpi_gpiochip_remove(chip); | 332 | acpi_gpiochip_remove(chip); |
333 | |||
334 | spin_lock_irqsave(&gpio_lock, flags); | ||
335 | |||
336 | gpiochip_remove_pin_ranges(chip); | 333 | gpiochip_remove_pin_ranges(chip); |
337 | of_gpiochip_remove(chip); | 334 | of_gpiochip_remove(chip); |
338 | 335 | ||
336 | spin_lock_irqsave(&gpio_lock, flags); | ||
339 | for (id = 0; id < chip->ngpio; id++) { | 337 | for (id = 0; id < chip->ngpio; id++) { |
340 | if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) | 338 | if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) |
341 | dev_crit(chip->dev, "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n"); | 339 | dev_crit(chip->dev, "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n"); |