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 <[email protected]>
---
v3:
- only return -EPROBE_DEFER if 'bus' device hasn't be found.
v2:
- keep dev_err_probe only change the return value.
drivers/soc/imx/imx8m-blk-ctrl.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c
index dff7529268e4..1c195e9e8895 100644
--- a/drivers/soc/imx/imx8m-blk-ctrl.c
+++ b/drivers/soc/imx/imx8m-blk-ctrl.c
@@ -214,9 +214,14 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
return -ENOMEM;
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");
+ if (IS_ERR(bc->bus_power_dev)) {
+ if (PTR_ERR(bc->bus_power_dev) == -ENODEV)
+ return dev_err_probe(dev, -EPROBE_DEFER,
+ "failed to attach power domain \"bus\"\n");
+ else
+ return dev_err_probe(dev, PTR_ERR(bc->bus_power_dev),
+ "failed to attach power domain \"bus\"\n");
+ }
for (i = 0; i < bc_data->num_domains; i++) {
const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
--
2.32.0
Le 19/09/2022 à 14:13, Benjamin Gaignard a écrit :
> 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.
Gentle reminder about this patch.
Thanks,
Benjamin
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> v3:
> - only return -EPROBE_DEFER if 'bus' device hasn't be found.
>
> v2:
> - keep dev_err_probe only change the return value.
>
> drivers/soc/imx/imx8m-blk-ctrl.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c
> index dff7529268e4..1c195e9e8895 100644
> --- a/drivers/soc/imx/imx8m-blk-ctrl.c
> +++ b/drivers/soc/imx/imx8m-blk-ctrl.c
> @@ -214,9 +214,14 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> 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");
> + if (IS_ERR(bc->bus_power_dev)) {
> + if (PTR_ERR(bc->bus_power_dev) == -ENODEV)
> + return dev_err_probe(dev, -EPROBE_DEFER,
> + "failed to attach power domain \"bus\"\n");
> + else
> + return dev_err_probe(dev, PTR_ERR(bc->bus_power_dev),
> + "failed to attach power domain \"bus\"\n");
> + }
>
> for (i = 0; i < bc_data->num_domains; i++) {
> const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
On 9/19/2022 8:13 PM, 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 <[email protected]>
> ---
> v3:
> - only return -EPROBE_DEFER if 'bus' device hasn't be found.
>
> v2:
> - keep dev_err_probe only change the return value.
>
> drivers/soc/imx/imx8m-blk-ctrl.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c
> index dff7529268e4..1c195e9e8895 100644
> --- a/drivers/soc/imx/imx8m-blk-ctrl.c
> +++ b/drivers/soc/imx/imx8m-blk-ctrl.c
> @@ -214,9 +214,14 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> 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");
> + if (IS_ERR(bc->bus_power_dev)) {
> + if (PTR_ERR(bc->bus_power_dev) == -ENODEV)
> + return dev_err_probe(dev, -EPROBE_DEFER,
> + "failed to attach power domain \"bus\"\n");
> + else
> + return dev_err_probe(dev, PTR_ERR(bc->bus_power_dev),
> + "failed to attach power domain \"bus\"\n");
> + }
>
> for (i = 0; i < bc_data->num_domains; i++) {
> const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
Reviewed-by: Peng Fan <[email protected]>
On Mon, Sep 19, 2022 at 02:13:02PM +0200, 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 <[email protected]>
Applied, thanks!