Skip to content

Commit 01cca93

Browse files
jhovoldlinusw
authored andcommitted
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>
1 parent 6798aca commit 01cca93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpio/gpiolib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ void gpiochip_remove(struct gpio_chip *chip)
327327
unsigned long flags;
328328
unsigned id;
329329

330+
gpiochip_unexport(chip);
331+
330332
gpiochip_irqchip_remove(chip);
331333

332334
acpi_gpiochip_remove(chip);
@@ -343,7 +345,6 @@ void gpiochip_remove(struct gpio_chip *chip)
343345

344346
list_del(&chip->list);
345347
spin_unlock_irqrestore(&gpio_lock, flags);
346-
gpiochip_unexport(chip);
347348

348349
kfree(chip->desc);
349350
chip->desc = NULL;

0 commit comments

Comments
 (0)