Skip to contentSkip to conversation

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

PATCH Superseded Benjamin Gaignard 2 participants 2 messages Sep 13, 2022 Arm i.MX and Layerscape

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
v2:
- keep dev_err_probe only change the return value

 drivers/soc/imx/imx8m-blk-ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/imx/imx8m-blk-ctrl.c +2 -1
index dff7529268e4..253d08de8923 100644
@@ -215,9 +215,10 @@ 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),
+		return dev_err_probe(dev, -EPROBE_DEFER,
 				     "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];
 		struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
Signature · 1 line
2.32.0
#1 lore raw

Hello Benjamin,

Quoted 17 lines · Benjamin Gaignard

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.

---
v2:
- keep dev_err_probe only change the return value

 drivers/soc/imx/imx8m-blk-ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/imx/imx8m-blk-ctrl.c +0 -0
index dff7529268e4..253d08de8923 100644

drivers/soc/imx/imx8m-blk-ctrl.c static int imx8m_blk_ctrl_probe(struct platform_device *pdev) · line 219

Quoted 6 lines
drivers/soc/imx/imx8m-blk-ctrl.c +1 -1
@@ -215,9 +215,10 @@ 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),
+		return dev_err_probe(dev, -EPROBE_DEFER,
 				     "failed to attach power domain \"bus\"\n");

Close, but now any error is treated as an -EPROBE_DEFER, e.g. -ENOMEM. Please check which error code is returned for your corner case and see if either the API should be changed to return -EPROBE_DEFER instead or if you should translate only that error code on the consumer side to -EPROBE_DEFER.

Thanks,
Ahmad

Quoted 5 lines
drivers/soc/imx/imx8m-blk-ctrl.c +1 -0
+
 	for (i = 0; i < bc_data->num_domains; i++) {
 		const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
 		struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |