Re: [PATCH v3 1/2] leds: tlc591xx: simplify driver by using the managed led API

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

 



Hi Jean,

Thank you for the updated set.

We will need one more iteration. Please refer below.

On 9/18/19 5:25 PM, Jean-Jacques Hiblot wrote:
> Use the managed API of the LED class (devm_led_classdev_register()
> instead of led_classdev_register()).
> This allows us to remove the code used to track-and-destroy the LED devices
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@xxxxxx>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@xxxxxx>
> ---
>  drivers/leds/leds-tlc591xx.c | 79 +++++++++---------------------------
>  1 file changed, 20 insertions(+), 59 deletions(-)
> 
> diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
> index 59ff088c7d75..3d5a4b92f016 100644
> --- a/drivers/leds/leds-tlc591xx.c
> +++ b/drivers/leds/leds-tlc591xx.c
> @@ -128,51 +128,6 @@ tlc591xx_brightness_set(struct led_classdev *led_cdev,
>  	return err;
>  }
>  
[...]
> +		led->ldev.max_brightness = LED_FULL;

This is redundant since initially zeroed by kzalloc and LED core sets it
to LED_FULL in this case, so we can remove it by this occasion.

We have also one fix to this driver, preceding this patch, so your set
will need a rebase onto for-5.5 branch [0].


> +		err = devm_led_classdev_register(dev, &led->ldev);
> +		if (err < 0) {
> +			dev_err(dev, "couldn't register LED %s\n",
> +				led->ldev.name);
> +			return err;
> +		}
> +	}
>  	return 0;
>  }
>  
> @@ -268,7 +230,6 @@ static struct i2c_driver tlc591xx_driver = {
>  		.of_match_table = of_match_ptr(of_tlc591xx_leds_match),
>  	},
>  	.probe = tlc591xx_probe,
> -	.remove = tlc591xx_remove,
>  	.id_table = tlc591xx_id,
>  };
>  
> 

[0]
https://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git/log/?h=for-5.5

-- 
Best regards,
Jacek Anaszewski



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux