Hi Jiaxun,

On 2024-05-13 20:13, Jiaxun Yang wrote:
> When bootph-all is enabled for a syscon driver, the device
> may leave unprobed when syscon_get_regmap is called by another
> driver.
> 
> Perform device_probe in syscon_get_regmap, there is no side
> affect as device_probe will return 0 quickly for an activated
> device.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.y...@flygoat.com>
> ---
>  drivers/core/syscon-uclass.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c
> index f0e69d7216b3..b09f7013194d 100644
> --- a/drivers/core/syscon-uclass.c
> +++ b/drivers/core/syscon-uclass.c
> @@ -32,10 +32,14 @@
>   */
>  struct regmap *syscon_get_regmap(struct udevice *dev)
>  {
> +     int ret;
>       struct syscon_uc_info *priv;
>  
>       if (device_get_uclass_id(dev) != UCLASS_SYSCON)
>               return ERR_PTR(-ENOEXEC);
> +     ret = device_probe(dev);
> +     if (ret)
> +             return ERR_PTR(ret);

Please explain in more details what the issue this is trying to solve.

Typically syscon_get_regmap() is called on a udevice returned from a
uclass_get_device call, and that should trigger a probe for the device
and its parents.

Adding device_probe() here possible just hides an issue that exists
somewhere else. In what instance are you ending up with a call to
this function with a udevice that has not been probed?

Also, please add a new test to test/dm/regmap.c if this solves a real
issue.

Regards,
Jonas

>       priv = dev_get_uclass_priv(dev);
>       return priv->regmap;
>  }
> 

Reply via email to