aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2016-09-14 14:55:06 -0400
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-09-15 10:49:41 -0400
commit8ca03da5e0f70a413986221da4c88459bb6f6878 (patch)
tree155eae4ba69c6b76a41a1b54d61f28c7e7f076bf /drivers/leds/leds-gpio.c
parent4580809436fc391aff9d876a14d07f66a5de6b28 (diff)
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: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r--drivers/leds/leds-gpio.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index da4aa8e95a58..171ba2fbb59a 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -159,7 +159,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
159 struct fwnode_handle *child; 159 struct fwnode_handle *child;
160 struct gpio_leds_priv *priv; 160 struct gpio_leds_priv *priv;
161 int count, ret; 161 int count, ret;
162 struct device_node *np;
163 162
164 count = device_get_child_node_count(dev); 163 count = device_get_child_node_count(dev);
165 if (!count) 164 if (!count)
@@ -173,6 +172,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
173 struct gpio_led_data *led_dat = &priv->leds[priv->num_leds]; 172 struct gpio_led_data *led_dat = &priv->leds[priv->num_leds];
174 struct gpio_led led = {}; 173 struct gpio_led led = {};
175 const char *state = NULL; 174 const char *state = NULL;
175 struct device_node *np = to_of_node(child);
176 176
177 led.gpiod = devm_get_gpiod_from_child(dev, NULL, child); 177 led.gpiod = devm_get_gpiod_from_child(dev, NULL, child);
178 if (IS_ERR(led.gpiod)) { 178 if (IS_ERR(led.gpiod)) {
@@ -181,8 +181,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
181 goto err; 181 goto err;
182 } 182 }
183 183
184 np = to_of_node(child);
185
186 if (fwnode_property_present(child, "label")) { 184 if (fwnode_property_present(child, "label")) {
187 fwnode_property_read_string(child, "label", &led.name); 185 fwnode_property_read_string(child, "label", &led.name);
188 } else { 186 } else {