[PATCH v2 5/6] led: gpio: Free GPIOs on unregister()

Sebastian Hesselbarth sebastian.hesselbarth at gmail.com
Tue Apr 14 15:53:19 PDT 2015


Free requested GPIOs on unregistration of mono-, bi-, and tri-color
GPIO leds.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
---
Changelog:
v1->v2:
- new patch

Cc: barebox at lists.infradead.org
---
 drivers/led/led-gpio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c
index 807251721fd3..74be2304e868 100644
--- a/drivers/led/led-gpio.c
+++ b/drivers/led/led-gpio.c
@@ -64,6 +64,7 @@ int led_gpio_register(struct gpio_led *led)
 void led_gpio_unregister(struct gpio_led *led)
 {
 	led_unregister(&led->led);
+	gpio_free(led->gpio);
 }
 
 #ifdef CONFIG_LED_GPIO_BICOLOR
@@ -131,6 +132,8 @@ err_gpio_c0:
 void led_gpio_bicolor_unregister(struct gpio_bicolor_led *led)
 {
 	led_unregister(&led->led);
+	gpio_free(led->gpio_c1);
+	gpio_free(led->gpio_c0);
 }
 #endif
 
@@ -195,6 +198,9 @@ err_gpio_r:
 void led_gpio_rgb_unregister(struct gpio_led *led)
 {
 	led_unregister(&led->led);
+	gpio_free(led->gpio_b);
+	gpio_free(led->gpio_g);
+	gpio_free(led->gpio_r);
 }
 #endif /* CONFIG_LED_GPIO_RGB */
 
-- 
2.1.0




More information about the barebox mailing list