Skip to content

Commit

Permalink
gpio: unregister gpiochip device before removing it
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Hovold authored and Linus Walleij committed Jan 14, 2015
1 parent 6798aca commit 01cca93
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 01cca93

Please sign in to comment.