From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: "linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 4/7] leds: gpio: simplify gpio_leds_create
Date: Wed, 14 Sep 2016 20:55:06 +0200 [thread overview]
Message-ID: <e5a8f86e-7ab8-e0f6-eddc-92a4b8467618@gmail.com> (raw)
In-Reply-To: <5432fb03-ea18-a949-ce53-10fedc15f5d9@gmail.com>
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>
---
v2:
- rebased due to removal of patch 2 of the original series
---
drivers/leds/leds-gpio.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index da4aa8e..171ba2f 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)
struct fwnode_handle *child;
struct gpio_leds_priv *priv;
int count, ret;
- struct device_node *np;
count = device_get_child_node_count(dev);
if (!count)
@@ -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 led = {};
const char *state = NULL;
+ struct device_node *np = to_of_node(child);
led.gpiod = devm_get_gpiod_from_child(dev, NULL, child);
if (IS_ERR(led.gpiod)) {
@@ -181,8 +181,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
goto err;
}
- np = to_of_node(child);
-
if (fwnode_property_present(child, "label")) {
fwnode_property_read_string(child, "label", &led.name);
} else {
--
2.9.2
next prev parent reply other threads:[~2016-09-14 18:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5432fb03-ea18-a949-ce53-10fedc15f5d9@gmail.com>
2016-09-13 6:03 ` [PATCH 2/8] leds: gpio: set max_brightness to 1 Heiner Kallweit
2016-09-13 13:35 ` Jacek Anaszewski
2016-09-13 18:42 ` Heiner Kallweit
2016-09-13 6:03 ` [PATCH 3/8] leds: gpio: fix an unhandled error case in create_gpio_led Heiner Kallweit
2016-09-13 6:03 ` [PATCH 4/8] leds: gpio: add helper cdev_to_gpio_led_data Heiner Kallweit
2016-09-13 6:03 ` [PATCH 5/8] leds: gpio: simplify gpio_leds_create Heiner Kallweit
2016-09-13 6:03 ` [PATCH 6/8] leds: gpio: fix and simplify reading property "label" Heiner Kallweit
2016-09-13 6:03 ` [PATCH 7/8] leds: gpio: switch to managed version of led_classdev_register Heiner Kallweit
2016-09-13 6:03 ` [PATCH 8/8] leds: gpio: fix and simplify error handling in gpio_leds_create Heiner Kallweit
2016-09-13 18:53 ` [PATCH 1/6] leds: gpio: fix an unhandled error case in create_gpio_led Heiner Kallweit
2016-09-14 7:13 ` Jacek Anaszewski
2016-09-15 11:48 ` Jacek Anaszewski
2016-09-13 18:54 ` [PATCH 2/6] leds: gpio: add helper cdev_to_gpio_led_data Heiner Kallweit
2016-09-13 18:55 ` [PATCH 3/6] leds: gpio: simplify gpio_leds_create Heiner Kallweit
2016-09-13 18:56 ` [PATCH 4/6] leds: gpio: fix and simplify reading property "label" Heiner Kallweit
2016-09-13 18:57 ` [PATCH 5/6] leds: gpio: switch to managed version of led_classdev_register Heiner Kallweit
2016-09-13 18:57 ` [PATCH 6/6] leds: gpio: fix and simplify error handling in gpio_leds_create Heiner Kallweit
2016-09-14 18:54 ` [PATCH v2 2/7] leds: gpio: fix an unhandled error case in create_gpio_led Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 3/7] leds: gpio: add helper cdev_to_gpio_led_data Heiner Kallweit
2016-09-14 18:55 ` Heiner Kallweit [this message]
2016-09-14 18:55 ` [PATCH v2 5/7] leds: gpio: fix and simplify reading property "label" Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 6/7] leds: gpio: switch to managed version of led_classdev_register Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 7/7] leds: gpio: fix and simplify error handling in gpio_leds_create Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5a8f86e-7ab8-e0f6-eddc-92a4b8467618@gmail.com \
--to=hkallweit1@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).