Commit 8ca03da5 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Jacek Anaszewski

leds: gpio: simplify gpio_leds_create

Definition of np can be moved into the loop as well to simplify
the code a little.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
parent 45808094
...@@ -159,7 +159,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) ...@@ -159,7 +159,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
struct fwnode_handle *child; struct fwnode_handle *child;
struct gpio_leds_priv *priv; struct gpio_leds_priv *priv;
int count, ret; int count, ret;
struct device_node *np;
count = device_get_child_node_count(dev); count = device_get_child_node_count(dev);
if (!count) if (!count)
...@@ -173,6 +172,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) ...@@ -173,6 +172,7 @@ 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_data *led_dat = &priv->leds[priv->num_leds];
struct gpio_led led = {}; struct gpio_led led = {};
const char *state = NULL; const char *state = NULL;
struct device_node *np = to_of_node(child);
led.gpiod = devm_get_gpiod_from_child(dev, NULL, child); led.gpiod = devm_get_gpiod_from_child(dev, NULL, child);
if (IS_ERR(led.gpiod)) { if (IS_ERR(led.gpiod)) {
...@@ -181,8 +181,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) ...@@ -181,8 +181,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
goto err; goto err;
} }
np = to_of_node(child);
if (fwnode_property_present(child, "label")) { if (fwnode_property_present(child, "label")) {
fwnode_property_read_string(child, "label", &led.name); fwnode_property_read_string(child, "label", &led.name);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment