Skip to contentSkip to conversation

leds: leds-gpio: add shutdown function

PATCH Applied Heiko Schocher 2 participants 2 messages Oct 13, 2015 LED

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 leds: leds-gpio: add shutdown function

add a shutdown function for setting the gpio-leds
into off state when shuting down.

---

 drivers/leds/leds-gpio.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/leds/leds-gpio.c +13 -0
index af1876a..5db4515 100644
@@ -291,9 +291,22 @@ static int gpio_led_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void gpio_led_shutdown(struct platform_device *pdev)
+{
+	struct gpio_leds_priv *priv = platform_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < priv->num_leds; i++) {
+		struct gpio_led_data *led = &priv->leds[i];
+
+		gpio_led_set(&led->cdev, LED_OFF);
+	}
+}
+
 static struct platform_driver gpio_led_driver = {
 	.probe		= gpio_led_probe,
 	.remove		= gpio_led_remove,
+	.shutdown	= gpio_led_shutdown,
 	.driver		= {
 		.name	= "leds-gpio",
 		.of_match_table = of_gpio_leds_match,
Signature · 1 line
2.1.0
#1 lore raw

Hi Heiko,

Quoted 27 lines · Heiko Schocher

add a shutdown function for setting the gpio-leds
into off state when shuting down.

---

  drivers/leds/leds-gpio.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/leds/leds-gpio.c +9 -0
index af1876a..5db4515 100644
@@ -291,9 +291,22 @@ static int gpio_led_remove(struct platform_device *pdev)
  	return 0;
  }
 
+static void gpio_led_shutdown(struct platform_device *pdev)
+{
+	struct gpio_leds_priv *priv = platform_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < priv->num_leds; i++) {
+		struct gpio_led_data *led = &priv->leds[i];
+
+		gpio_led_set(&led->cdev, LED_OFF);

drivers/leds/leds-gpio.c static int gpio_led_remove(struct platform_device *pdev) · line 312

Quoted 10 lines
drivers/leds/leds-gpio.c +4 -0
+	}
+}
+
  static struct platform_driver gpio_led_driver = {
  	.probe		= gpio_led_probe,
  	.remove		= gpio_led_remove,
+	.shutdown	= gpio_led_shutdown,
  	.driver		= {
  		.name	= "leds-gpio",
  		.of_match_table = of_gpio_leds_match,

Merged, thanks.

Signature · 2 lines
Best Regards,
Jacek Anaszewski