* [PATCH -next v2 0/5] usb: musb: Switch to use dev_err_probe() helper
@ 2022-09-27 7:26 Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 1/5] usb: musb: core: " Yang Yingliang
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-09-27 7:26 UTC (permalink / raw)
To: linux-usb; +Cc: gregkh, b-liu, sergei.shtylyov, yangyingliang
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(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH -next v2 1/5] usb: musb: core: Switch to use dev_err_probe() helper
2022-09-27 7:26 [PATCH -next v2 0/5] usb: musb: Switch to use dev_err_probe() helper Yang Yingliang
@ 2022-09-27 7:26 ` Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 2/5] usb: musb: da8xx: " Yang Yingliang
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-09-27 7:26 UTC (permalink / raw)
To: linux-usb; +Cc: gregkh, b-liu, sergei.shtylyov, yangyingliang
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.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/usb/musb/musb_core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index bbbcfd49fb35..03027c6fa3ab 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -next v2 2/5] usb: musb: da8xx: Switch to use dev_err_probe() helper
2022-09-27 7:26 [PATCH -next v2 0/5] usb: musb: Switch to use dev_err_probe() helper Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 1/5] usb: musb: core: " Yang Yingliang
@ 2022-09-27 7:26 ` Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 3/5] usb: musb: cppi41: " Yang Yingliang
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-09-27 7:26 UTC (permalink / raw)
To: linux-usb; +Cc: gregkh, b-liu, sergei.shtylyov, yangyingliang
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.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/usb/musb/da8xx.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index fd4ae2dd24e5..a4e55b0c52cf 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -next v2 3/5] usb: musb: cppi41: Switch to use dev_err_probe() helper
2022-09-27 7:26 [PATCH -next v2 0/5] usb: musb: Switch to use dev_err_probe() helper Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 1/5] usb: musb: core: " Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 2/5] usb: musb: da8xx: " Yang Yingliang
@ 2022-09-27 7:26 ` Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 4/5] usb: musb: jz4740: " Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 5/5] usb: musb: sunxi: " Yang Yingliang
4 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-09-27 7:26 UTC (permalink / raw)
To: linux-usb; +Cc: gregkh, b-liu, sergei.shtylyov, yangyingliang
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.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/usb/musb/musb_cppi41.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index c963cb8565f2..9589243e8951 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -next v2 4/5] usb: musb: jz4740: Switch to use dev_err_probe() helper
2022-09-27 7:26 [PATCH -next v2 0/5] usb: musb: Switch to use dev_err_probe() helper Yang Yingliang
` (2 preceding siblings ...)
2022-09-27 7:26 ` [PATCH -next v2 3/5] usb: musb: cppi41: " Yang Yingliang
@ 2022-09-27 7:26 ` Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 5/5] usb: musb: sunxi: " Yang Yingliang
4 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-09-27 7:26 UTC (permalink / raw)
To: linux-usb; +Cc: gregkh, b-liu, sergei.shtylyov, yangyingliang
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.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/usb/musb/jz4740.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 417c30bff9ca..d1e4e0deb753 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -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)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -next v2 5/5] usb: musb: sunxi: Switch to use dev_err_probe() helper
2022-09-27 7:26 [PATCH -next v2 0/5] usb: musb: Switch to use dev_err_probe() helper Yang Yingliang
` (3 preceding siblings ...)
2022-09-27 7:26 ` [PATCH -next v2 4/5] usb: musb: jz4740: " Yang Yingliang
@ 2022-09-27 7:26 ` Yang Yingliang
4 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-09-27 7:26 UTC (permalink / raw)
To: linux-usb; +Cc: gregkh, b-liu, sergei.shtylyov, yangyingliang
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.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/usb/musb/sunxi.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index 961c858fb349..7f9a999cd5ff 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -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)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-27 7:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 7:26 [PATCH -next v2 0/5] usb: musb: Switch to use dev_err_probe() helper Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 1/5] usb: musb: core: " Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 2/5] usb: musb: da8xx: " Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 3/5] usb: musb: cppi41: " Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 4/5] usb: musb: jz4740: " Yang Yingliang
2022-09-27 7:26 ` [PATCH -next v2 5/5] usb: musb: sunxi: " Yang Yingliang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.