diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2014-12-17 16:51:13 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-15 17:23:17 +0100 |
commit | d621e8bae5ac9c67de4de90c5cded12adc8ee1e1 (patch) | |
tree | 5dc976ffdb54116e4e05916b47278b66d8ae3e36 /drivers/gpio/gpiolib-of.c | |
parent | 1d6902d3a68e83061c979a57d7411e8ae172df67 (diff) | |
download | linux-d621e8bae5ac9c67de4de90c5cded12adc8ee1e1.tar.bz2 |
gpio/gpiolib-of: Create of_mm_gpiochip_remove
Create counterpart of of_mm_gpiochip_add(). This way the modules that
can be removable do not duplicate the cleanup code.
Suggested-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-of.c')
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 604dbe60bdee..3e2c6afeab11 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -204,6 +204,23 @@ err0: } EXPORT_SYMBOL(of_mm_gpiochip_add); +/** + * of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank) + * @mm_gc: pointer to the of_mm_gpio_chip allocated structure + */ +void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc) +{ + struct gpio_chip *gc = &mm_gc->gc; + + if (!mm_gc) + return; + + gpiochip_remove(gc); + iounmap(mm_gc->regs); + kfree(gc->label); +} +EXPORT_SYMBOL(of_mm_gpiochip_remove); + #ifdef CONFIG_PINCTRL static void of_gpiochip_add_pin_range(struct gpio_chip *chip) { |