[PATCH 2/6] led-uclass: honour ->label field populated by driver's own .bind

Marek Vasut marex at denx.de
Thu Oct 19 15:54:43 CEST 2023


On 10/19/23 11:58, Rasmus Villemoes wrote:
> If the driver's own .bind method has populated uc_plat->label, don't
> override that. This is necessary for an upcoming driver for ti,lp5562,
> where the DT binding unfortunately says to use "chan-name" and not
> "label".
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
>   drivers/led/led-uclass.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
> index 5a5d07b9a7..0232fa84de 100644
> --- a/drivers/led/led-uclass.c
> +++ b/drivers/led/led-uclass.c
> @@ -71,7 +71,9 @@ static int led_post_bind(struct udevice *dev)
>   	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
>   	const char *default_state;
>   
> -	uc_plat->label = dev_read_string(dev, "label");
> +	if (!uc_plat->label)
> +		uc_plat->label = dev_read_string(dev, "label");
> +

One thing I have to wonder about is, why does this controller have label 
property in the top-level node , what is that used for ?

(see Linux Documentation/devicetree/bindings/leds/leds-lp55xx.yaml)

Reviewed-by: Marek Vasut <marex at denx.de>


More information about the U-Boot mailing list