Commit 856d3624 authored by Amelie Delaunay's avatar Amelie Delaunay Committed by Greg Kroah-Hartman

usb: dwc2: platform: adopt dev_err_probe() to silent probe defer

In case of probe defer, a message is logged for resets and clocks. Use
dev_err_probe to log the message only when error code is not -517.
Simplify phy, regulators and drd probe defer handling with dev_err_probe().
Then, take benefit of devices_deferred debugfs in case of probe deferral.
Acked-by: default avatarMinas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Signed-off-by: default avatarAmelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20211207120829.266837-1-amelie.delaunay@foss.st.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cdf8e2de
...@@ -222,20 +222,16 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) ...@@ -222,20 +222,16 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
int i, ret; int i, ret;
hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2"); hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2");
if (IS_ERR(hsotg->reset)) { if (IS_ERR(hsotg->reset))
ret = PTR_ERR(hsotg->reset); return dev_err_probe(hsotg->dev, PTR_ERR(hsotg->reset),
dev_err(hsotg->dev, "error getting reset control %d\n", ret); "error getting reset control\n");
return ret;
}
reset_control_deassert(hsotg->reset); reset_control_deassert(hsotg->reset);
hsotg->reset_ecc = devm_reset_control_get_optional(hsotg->dev, "dwc2-ecc"); hsotg->reset_ecc = devm_reset_control_get_optional(hsotg->dev, "dwc2-ecc");
if (IS_ERR(hsotg->reset_ecc)) { if (IS_ERR(hsotg->reset_ecc))
ret = PTR_ERR(hsotg->reset_ecc); return dev_err_probe(hsotg->dev, PTR_ERR(hsotg->reset_ecc),
dev_err(hsotg->dev, "error getting reset control for ecc %d\n", ret); "error getting reset control for ecc\n");
return ret;
}
reset_control_deassert(hsotg->reset_ecc); reset_control_deassert(hsotg->reset_ecc);
...@@ -251,11 +247,8 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) ...@@ -251,11 +247,8 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
case -ENOSYS: case -ENOSYS:
hsotg->phy = NULL; hsotg->phy = NULL;
break; break;
case -EPROBE_DEFER:
return ret;
default: default:
dev_err(hsotg->dev, "error getting phy %d\n", ret); return dev_err_probe(hsotg->dev, ret, "error getting phy\n");
return ret;
} }
} }
...@@ -268,12 +261,8 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) ...@@ -268,12 +261,8 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
case -ENXIO: case -ENXIO:
hsotg->uphy = NULL; hsotg->uphy = NULL;
break; break;
case -EPROBE_DEFER:
return ret;
default: default:
dev_err(hsotg->dev, "error getting usb phy %d\n", return dev_err_probe(hsotg->dev, ret, "error getting usb phy\n");
ret);
return ret;
} }
} }
} }
...@@ -282,10 +271,8 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) ...@@ -282,10 +271,8 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
/* Clock */ /* Clock */
hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg"); hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
if (IS_ERR(hsotg->clk)) { if (IS_ERR(hsotg->clk))
dev_err(hsotg->dev, "cannot get otg clock\n"); return dev_err_probe(hsotg->dev, PTR_ERR(hsotg->clk), "cannot get otg clock\n");
return PTR_ERR(hsotg->clk);
}
/* Regulators */ /* Regulators */
for (i = 0; i < ARRAY_SIZE(hsotg->supplies); i++) for (i = 0; i < ARRAY_SIZE(hsotg->supplies); i++)
...@@ -293,12 +280,9 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) ...@@ -293,12 +280,9 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
ret = devm_regulator_bulk_get(hsotg->dev, ARRAY_SIZE(hsotg->supplies), ret = devm_regulator_bulk_get(hsotg->dev, ARRAY_SIZE(hsotg->supplies),
hsotg->supplies); hsotg->supplies);
if (ret) { if (ret)
if (ret != -EPROBE_DEFER) return dev_err_probe(hsotg->dev, ret, "failed to request supplies\n");
dev_err(hsotg->dev, "failed to request supplies: %d\n",
ret);
return ret;
}
return 0; return 0;
} }
...@@ -558,16 +542,12 @@ static int dwc2_driver_probe(struct platform_device *dev) ...@@ -558,16 +542,12 @@ static int dwc2_driver_probe(struct platform_device *dev)
hsotg->usb33d = devm_regulator_get(hsotg->dev, "usb33d"); hsotg->usb33d = devm_regulator_get(hsotg->dev, "usb33d");
if (IS_ERR(hsotg->usb33d)) { if (IS_ERR(hsotg->usb33d)) {
retval = PTR_ERR(hsotg->usb33d); retval = PTR_ERR(hsotg->usb33d);
if (retval != -EPROBE_DEFER) dev_err_probe(hsotg->dev, retval, "failed to request usb33d supply\n");
dev_err(hsotg->dev,
"failed to request usb33d supply: %d\n",
retval);
goto error; goto error;
} }
retval = regulator_enable(hsotg->usb33d); retval = regulator_enable(hsotg->usb33d);
if (retval) { if (retval) {
dev_err(hsotg->dev, dev_err_probe(hsotg->dev, retval, "failed to enable usb33d supply\n");
"failed to enable usb33d supply: %d\n", retval);
goto error; goto error;
} }
...@@ -579,8 +559,7 @@ static int dwc2_driver_probe(struct platform_device *dev) ...@@ -579,8 +559,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
retval = dwc2_drd_init(hsotg); retval = dwc2_drd_init(hsotg);
if (retval) { if (retval) {
if (retval != -EPROBE_DEFER) dev_err_probe(hsotg->dev, retval, "failed to initialize dual-role\n");
dev_err(hsotg->dev, "failed to initialize dual-role\n");
goto error_init; goto error_init;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment