[PATCH 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND

Patrice CHOTARD patrice.chotard at foss.st.com
Fri Apr 22 15:44:40 CEST 2022


Hi Marek

On 4/22/22 15:15, Marek Vasut wrote:
> Calling device_probe() from uclass .post_bind() callback has all kinds
> of odd side-effects, e.g. device instances not being available just yet.
> Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances
> which need to be probe()d in order to configure the LED default state
> with this flag and let the DM core do the device_probe() at the right
> time instead.
> 
> Fixes: 72675b063b6 ("led: Configure LED default-state on boot")
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Patrice Chotard <patrice.chotard at foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
> Cc: Sean Anderson <seanga2 at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Steven Lawrance <steven.lawrance at softathome.com>
> ---
>  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 5d7bf40896b..2ce72933b6c 100644
> --- a/drivers/led/led-uclass.c
> +++ b/drivers/led/led-uclass.c
> @@ -98,7 +98,9 @@ static int led_post_bind(struct udevice *dev)
>  	 * In case the LED has default-state DT property, trigger
>  	 * probe() to configure its default state during startup.
>  	 */
> -	return device_probe(dev);
> +	dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
> +
> +	return 0;
>  }
>  
>  static int led_post_probe(struct udevice *dev)

Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard at foss.st.com>

Tested on stm32mp157c-dk2 board
Thanks
Patrice


More information about the U-Boot mailing list