Commit 864c329b authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

gpio: unregister gpiochip device before removing it

commit 01cca93a upstream.

Unregister gpiochip device (used to export information through sysfs)
before removing it internally. This way removal will reverse addition.
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 677c040f
...@@ -1265,6 +1265,8 @@ int gpiochip_remove(struct gpio_chip *chip) ...@@ -1265,6 +1265,8 @@ int gpiochip_remove(struct gpio_chip *chip)
int status = 0; int status = 0;
unsigned id; unsigned id;
gpiochip_unexport(chip);
spin_lock_irqsave(&gpio_lock, flags); spin_lock_irqsave(&gpio_lock, flags);
gpiochip_remove_pin_ranges(chip); gpiochip_remove_pin_ranges(chip);
...@@ -1285,9 +1287,6 @@ int gpiochip_remove(struct gpio_chip *chip) ...@@ -1285,9 +1287,6 @@ int gpiochip_remove(struct gpio_chip *chip)
spin_unlock_irqrestore(&gpio_lock, flags); spin_unlock_irqrestore(&gpio_lock, flags);
if (status == 0)
gpiochip_unexport(chip);
return status; return status;
} }
EXPORT_SYMBOL_GPL(gpiochip_remove); EXPORT_SYMBOL_GPL(gpiochip_remove);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment