aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>2014-12-17 10:51:13 -0500
committerLinus Walleij <linus.walleij@linaro.org>2015-01-15 11:23:17 -0500
commitd621e8bae5ac9c67de4de90c5cded12adc8ee1e1 (patch)
tree5dc976ffdb54116e4e05916b47278b66d8ae3e36
parent1d6902d3a68e83061c979a57d7411e8ae172df67 (diff)
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>
-rw-r--r--drivers/gpio/gpiolib-of.c17
-rw-r--r--include/linux/of_gpio.h1
2 files changed, 18 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:
204} 204}
205EXPORT_SYMBOL(of_mm_gpiochip_add); 205EXPORT_SYMBOL(of_mm_gpiochip_add);
206 206
207/**
208 * of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank)
209 * @mm_gc: pointer to the of_mm_gpio_chip allocated structure
210 */
211void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc)
212{
213 struct gpio_chip *gc = &mm_gc->gc;
214
215 if (!mm_gc)
216 return;
217
218 gpiochip_remove(gc);
219 iounmap(mm_gc->regs);
220 kfree(gc->label);
221}
222EXPORT_SYMBOL(of_mm_gpiochip_remove);
223
207#ifdef CONFIG_PINCTRL 224#ifdef CONFIG_PINCTRL
208static void of_gpiochip_add_pin_range(struct gpio_chip *chip) 225static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
209{ 226{
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 38fc05036015..69dbe312b11b 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -52,6 +52,7 @@ extern int of_get_named_gpio_flags(struct device_node *np,
52 52
53extern int of_mm_gpiochip_add(struct device_node *np, 53extern int of_mm_gpiochip_add(struct device_node *np,
54 struct of_mm_gpio_chip *mm_gc); 54 struct of_mm_gpio_chip *mm_gc);
55extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc);
55 56
56extern void of_gpiochip_add(struct gpio_chip *gc); 57extern void of_gpiochip_add(struct gpio_chip *gc);
57extern void of_gpiochip_remove(struct gpio_chip *gc); 58extern void of_gpiochip_remove(struct gpio_chip *gc);