lkml.org 
[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@gmail.com>
> Cc: Linus Walleij <linus.walleij@linaro.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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-04-24 16:05    [W:0.385 / U:1.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site