usb: musb: Switch to use dev_err_probe() helper
Subsystems (4)
v2 cover usb: musb: Switch to use dev_err_probe() helper
This patchset is trying to replace dev_err() with dev_err_probe() in the probe path.
v1 -> v2:
Remove " with status" from error message in patch #1.
Yang Yingliang (5):
usb: musb: core: Switch to use dev_err_probe() helper
usb: musb: da8xx: Switch to use dev_err_probe() helper
usb: musb: cppi41: Switch to use dev_err_probe() helper
usb: musb: jz4740: Switch to use dev_err_probe() helper
usb: musb: sunxi: Switch to use dev_err_probe() helper
drivers/usb/musb/da8xx.c | 8 +++----- drivers/usb/musb/jz4740.c | 10 +++------- drivers/usb/musb/musb_core.c | 4 +--- drivers/usb/musb/musb_cppi41.c | 6 ++---- drivers/usb/musb/sunxi.c | 29 +++++++++-------------------- 5 files changed, 18 insertions(+), 39 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/5 usb: musb: core: Switch to use dev_err_probe() helper
In the probe path, dev_err() can be replaced with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. It also sets the defer probe reason which can be checked later through debugfs. It's more simple in error path.
--- drivers/usb/musb/musb_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/musb/musb_core.c +1 -3
@@ -2595,9 +2595,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)musb_platform_exit (musb); fail1: -if (status != -EPROBE_DEFER ) -dev_err (musb->controller, -"%s failed with status %d\n" , __func__, status); +dev_err_probe (musb->controller, status,"%s failed\n" , __func__);musb_free (musb);
Signature · 1 line
2.25.1
PATCH v2 2/5 usb: musb: da8xx: Switch to use dev_err_probe() helper
In reply to Yang YingliangIn the probe path, dev_err() can be replaced with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. It also sets the defer probe reason which can be checked later through debugfs. It's more simple in error path.
--- drivers/usb/musb/da8xx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/musb/da8xx.c +3 -5
@@ -523,11 +523,9 @@ static int da8xx_probe(struct platform_device *pdev) } glue->phy =devm_phy_get (&pdev->dev,"usb-phy" ); -if (IS_ERR (glue->phy)) { -if (PTR_ERR (glue->phy) != -EPROBE_DEFER ) -dev_err (&pdev->dev,"failed to get phy\n" ); -return PTR_ERR (glue->phy); - } +if (IS_ERR (glue->phy)) +return dev_err_probe (&pdev->dev,PTR_ERR (glue->phy), +"failed to get phy\n" ); glue->dev = &pdev->dev; glue->clk = clk;
Signature · 1 line
2.25.1
PATCH v2 3/5 usb: musb: cppi41: Switch to use dev_err_probe() helper
In reply to Yang YingliangIn the probe path, dev_err() can be replaced with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. It also sets the defer probe reason which can be checked later through debugfs. It's more simple in error path.
--- drivers/usb/musb/musb_cppi41.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/musb/musb_cppi41.c +2 -4
@@ -718,10 +718,8 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) dc =dma_request_chan (dev->parent, str);if (IS_ERR (dc)) { - ret =PTR_ERR (dc); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to request %s: %d.\n" , - str, ret); + ret =dev_err_probe (dev,PTR_ERR (dc), +"Failed to request %s.\n" , str); goto err; }
Signature · 1 line
2.25.1
PATCH v2 4/5 usb: musb: jz4740: Switch to use dev_err_probe() helper
In reply to Yang YingliangIn the probe path, dev_err() can be replaced with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. It also sets the defer probe reason which can be checked later through debugfs. It's more simple in error path.
--- drivers/usb/musb/jz4740.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/usb/musb/jz4740.c +3 -7
@@ -105,7 +105,6 @@ static int jz4740_musb_init(struct musb *musb) .driver_data = glue, .fwnode = dev_fwnode(dev), }; -int err; glue->musb = musb;
@@ -113,12 +112,9 @@ static int jz4740_musb_init(struct musb *musb) musb->xceiv =devm_usb_get_phy_by_phandle (dev,"phys" ,0 ); else musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); -if (IS_ERR (musb->xceiv)) { - err =PTR_ERR (musb->xceiv); -if (err != -EPROBE_DEFER ) -dev_err (dev,"No transceiver configured: %d\n" , err); -return err; - } +if (IS_ERR (musb->xceiv)) +return dev_err_probe (dev,PTR_ERR (musb->xceiv), +"No transceiver configured\n" ); glue->role_sw =usb_role_switch_register (dev, &role_sw_desc);if (IS_ERR (glue->role_sw)) {
Signature · 1 line
2.25.1
PATCH v2 5/5 usb: musb: sunxi: Switch to use dev_err_probe() helper
In reply to Yang YingliangIn the probe path, dev_err() can be replaced with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. It also sets the defer probe reason which can be checked later through debugfs. It's more simple in error path.
--- drivers/usb/musb/sunxi.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-)
drivers/usb/musb/sunxi.c +9 -20
@@ -743,31 +743,20 @@ static int sunxi_musb_probe(struct platform_device *pdev)if (test_bit (SUNXI_MUSB_FL_HAS_RESET , &glue->flags)) { glue->rst =devm_reset_control_get (&pdev->dev,NULL ); -if (IS_ERR (glue->rst)) { -if (PTR_ERR (glue->rst) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; -dev_err (&pdev->dev,"Error getting reset %ld\n" , -PTR_ERR (glue->rst)); -return PTR_ERR (glue->rst); - } +if (IS_ERR (glue->rst)) +return dev_err_probe (&pdev->dev,PTR_ERR (glue->rst), +"Error getting reset\n" ); } glue->extcon =extcon_get_edev_by_phandle (&pdev->dev,0 ); -if (IS_ERR (glue->extcon)) { -if (PTR_ERR (glue->extcon) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; -dev_err (&pdev->dev,"Invalid or missing extcon\n" ); -return PTR_ERR (glue->extcon); - } +if (IS_ERR (glue->extcon)) +return dev_err_probe (&pdev->dev,PTR_ERR (glue->extcon), +"Invalid or missing extcon\n" ); glue->phy =devm_phy_get (&pdev->dev,"usb" ); -if (IS_ERR (glue->phy)) { -if (PTR_ERR (glue->phy) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; -dev_err (&pdev->dev,"Error getting phy %ld\n" , -PTR_ERR (glue->phy)); -return PTR_ERR (glue->phy); - } +if (IS_ERR (glue->phy)) +return dev_err_probe (&pdev->dev,PTR_ERR (glue->phy), +"Error getting phy\n" ); glue->usb_phy =usb_phy_generic_register ();if (IS_ERR (glue->usb_phy)) {
Signature · 1 line
2.25.1