summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-07-08 15:53:38 +0300
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-07-11 11:15:03 +0300
commitbff23714bc36a1322d0f14519022df0d1a4b21f3 (patch)
treedf64ffc4e17874fd4e4da43a5ff62649053b9149 /drivers/leds
parenta3eac76cdf7225aa1f87aa4514664f0372b9a1c1 (diff)
downloadlinux-bff23714bc36a1322d0f14519022df0d1a4b21f3.tar.xz
leds: leds-gpio: Set of_node for created LED devices
When working with Device Tree we iterate over children of "gpio-leds" compatible node and create LED device for each of them. We take care of all common DT properties (label, default trigger, state, etc.), however some triggers may want to support more of them. It could be useful for timer trigger to support setting delay on/off values with Device Tree property. Or for transient trigger to support e.g. duration property. We obviously should handle such properties in triggers, not in generic code. To let trigger drivers read properties from DT node we need to set of_node to point the relevant node. This change allows using all kind of of helpers in e.g. "activate" callbacks. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-gpio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 8229f063b483..9b991d46ed84 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -165,6 +165,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
return ERR_PTR(-ENOMEM);
device_for_each_child_node(dev, child) {
+ struct gpio_led_data *led_dat = &priv->leds[priv->num_leds];
struct gpio_led led = {};
const char *state = NULL;
@@ -205,12 +206,12 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
if (fwnode_property_present(child, "panic-indicator"))
led.panic_indicator = 1;
- ret = create_gpio_led(&led, &priv->leds[priv->num_leds],
- dev, NULL);
+ ret = create_gpio_led(&led, led_dat, dev, NULL);
if (ret < 0) {
fwnode_handle_put(child);
goto err;
}
+ led_dat->cdev.dev->of_node = np;
priv->num_leds++;
}