summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2015-01-12 17:12:29 +0100
committerLinus Walleij <linus.walleij@linaro.org>2015-01-14 14:27:01 +0100
commit01cca93a9491ed95992523ff7e79dd9bfcdea8e0 (patch)
treecc4ace59913a43506087a87c9655c3bfc91f6962
parent6798acaa0138d8b12f1c54402ebcb66fea3deb03 (diff)
downloadop-kernel-dev-01cca93a9491ed95992523ff7e79dd9bfcdea8e0.zip
op-kernel-dev-01cca93a9491ed95992523ff7e79dd9bfcdea8e0.tar.gz
gpio: unregister gpiochip device before removing it
Unregister gpiochip device (used to export information through sysfs) before removing it internally. This way removal will reverse addition. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpiolib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 37f919d..568aa2b 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -327,6 +327,8 @@ void gpiochip_remove(struct gpio_chip *chip)
unsigned long flags;
unsigned id;
+ gpiochip_unexport(chip);
+
gpiochip_irqchip_remove(chip);
acpi_gpiochip_remove(chip);
@@ -343,7 +345,6 @@ void gpiochip_remove(struct gpio_chip *chip)
list_del(&chip->list);
spin_unlock_irqrestore(&gpio_lock, flags);
- gpiochip_unexport(chip);
kfree(chip->desc);
chip->desc = NULL;
OpenPOWER on IntegriCloud