diff mbox series

soc: imx: imx8m-blk-ctrl: Defer probe if 'bus' genpd is not yet ready

Message ID 20220913090655.39778-1-benjamin.gaignard@collabora.com (mailing list archive)
State New, archived
Headers show
Series soc: imx: imx8m-blk-ctrl: Defer probe if 'bus' genpd is not yet ready | expand

Commit Message

Benjamin Gaignard Sept. 13, 2022, 9:06 a.m. UTC
Depending of the boot sequence 'bus' genpd could be probed after imx8m-blk-ctrl
which led driver probe to fail. Change the returned error to allow
to defer the probe in this case.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
 drivers/soc/imx/imx8m-blk-ctrl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ahmad Fatoum Sept. 13, 2022, 9:19 a.m. UTC | #1
Hello Benjamin,

On 13.09.22 11:06, Benjamin Gaignard wrote:
> Depending of the boot sequence 'bus' genpd could be probed after imx8m-blk-ctrl
> which led driver probe to fail. Change the returned error to allow
> to defer the probe in this case.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> ---
>  drivers/soc/imx/imx8m-blk-ctrl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c
> index dff7529268e4..99f5226a465b 100644
> --- a/drivers/soc/imx/imx8m-blk-ctrl.c
> +++ b/drivers/soc/imx/imx8m-blk-ctrl.c
> @@ -215,8 +215,7 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
>  
>  	bc->bus_power_dev = genpd_dev_pm_attach_by_name(dev, "bus");
>  	if (IS_ERR(bc->bus_power_dev))
> -		return dev_err_probe(dev, PTR_ERR(bc->bus_power_dev),
> -				     "failed to attach power domain \"bus\"\n");
> +		return -EPROBE_DEFER;

If probe is deferred indefinitely, you lose the very helpful probe error message.
Please translate error code instead and keep the dev_err_probe call.

Cheers,
Ahmad

>  
>  	for (i = 0; i < bc_data->num_domains; i++) {
>  		const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
diff mbox series

Patch

diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c
index dff7529268e4..99f5226a465b 100644
--- a/drivers/soc/imx/imx8m-blk-ctrl.c
+++ b/drivers/soc/imx/imx8m-blk-ctrl.c
@@ -215,8 +215,7 @@  static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 
 	bc->bus_power_dev = genpd_dev_pm_attach_by_name(dev, "bus");
 	if (IS_ERR(bc->bus_power_dev))
-		return dev_err_probe(dev, PTR_ERR(bc->bus_power_dev),
-				     "failed to attach power domain \"bus\"\n");
+		return -EPROBE_DEFER;
 
 	for (i = 0; i < bc_data->num_domains; i++) {
 		const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];