[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190424140417.GE14360@amd>
Date: Wed, 24 Apr 2019 16:04:17 +0200
From: Pavel Machek <pavel@....cz>
To: Jacek Anaszewski <jacek.anaszewski@...il.com>
Cc: linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, robh@...nel.org, dtor@...gle.com,
linux@...ck-us.net, Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v4 24/26] leds: gpio: Use generic support for composing
LED names
On Wed 2019-04-17 22:54:37, Jacek Anaszewski wrote:
> Switch to using generic LED support for composing LED class
> device name.
>
> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@...il.com>
> Cc: Linus Walleij <linus.walleij@...aro.org>
> ---
> drivers/leds/leds-gpio.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index b26cf78993d1..60fb3c85cf05 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -77,11 +77,11 @@ static int gpio_blink_set(struct led_classdev *led_cdev,
>
> static int create_gpio_led(const struct gpio_led *template,
> struct gpio_led_data *led_dat, struct device *parent,
> - struct device_node *np, gpio_blink_set_t blink_set)
> + struct fwnode_handle *fwnode, gpio_blink_set_t blink_set)
> {
> + struct led_init_data init_data = {};
> int ret, state;
>
> - led_dat->cdev.name = template->name;
> led_dat->cdev.default_trigger = template->default_trigger;
> led_dat->can_sleep = gpiod_cansleep(led_dat->gpiod);
> if (!led_dat->can_sleep)
> @@ -112,7 +112,13 @@ static int create_gpio_led(const struct gpio_led *template,
> if (ret < 0)
> return ret;
>
> - return devm_led_classdev_register(parent, &led_dat->cdev);
> + if (template->name)
> + led_dat->cdev.name = template->name;
> + else
> + init_data.fwnode = fwnode;
> +
> + return devm_led_classdev_register_ext(parent, &led_dat->cdev,
> + &init_data);
Won't register_ext() overwrite template->name?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists