Re: [PATCH v4 24/26] leds: gpio: Use generic support for composing LED names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
> ---
>  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

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux