From: Rafał Miłecki <rafal@xxxxxxxxxx> This allows core code to access DT info earlier, during LED registration process. Thanks to this we will be able to support DT bindings in LEDs core code. Signed-off-by: Rafał Miłecki <rafal@xxxxxxxxxx> --- drivers/leds/leds-gpio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index d400dcaf4d29..7bdce5df658b 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -172,7 +172,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) struct gpio_led_data *led_dat = &priv->leds[priv->num_leds]; struct gpio_led led = {}; const char *state = NULL; - struct device_node *np = to_of_node(child); + + led_dat->cdev.of_node = to_of_node(child); led.gpiod = devm_get_gpiod_from_child(dev, NULL, child); if (IS_ERR(led.gpiod)) { @@ -181,8 +182,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) } ret = fwnode_property_read_string(child, "label", &led.name); - if (ret && IS_ENABLED(CONFIG_OF) && np) - led.name = np->name; + if (ret && IS_ENABLED(CONFIG_OF) && led_dat->cdev.of_node) + led.name = led_dat->cdev.of_node->name; if (!led.name) { fwnode_handle_put(child); return ERR_PTR(-EINVAL); @@ -211,7 +212,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) fwnode_handle_put(child); return ERR_PTR(ret); } - led_dat->cdev.dev->of_node = np; priv->num_leds++; } -- 2.11.0