netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
@ 2022-06-01 14:22 Rasmus Villemoes
  2022-06-02  1:03 ` Jakub Kicinski
  2022-06-02  7:48 ` [PATCH v2] " Rasmus Villemoes
  0 siblings, 2 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2022-06-01 14:22 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue
  Cc: Jakub Kicinski, netdev, linux-kernel, David S. Miller,
	Rasmus Villemoes

I have a board where these two lines are always printed during boot:

   imx-dwmac 30bf0000.ethernet: Cannot register the MDIO bus
   imx-dwmac 30bf0000.ethernet: stmmac_dvr_probe: MDIO bus (id: 1) registration failed

It's perfectly fine, and the device is succesfully (and silently, as far
as the console goes) probed later.

Use dev_err_probe() instead, which will demote these messages to debug
level (thus removing the alarming messages from the console) when the
error is -EPROBE_DEFER, and also has the advantage of including the
error code if/when it happens to be something other than -EPROBE_DEFER.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3b81d4e9dc83..8a739746c951 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7129,7 +7129,7 @@ int stmmac_dvr_probe(struct device *device,
 		/* MDIO bus Registration */
 		ret = stmmac_mdio_register(ndev);
 		if (ret < 0) {
-			dev_err(priv->device,
+			dev_err_probe(priv->device, ret,
 				"%s: MDIO bus (id: %d) registration failed",
 				__func__, priv->plat->bus_id);
 			goto error_mdio_register;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 9bc625fccca0..03d3d1f7aa4b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -482,7 +482,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 
 	err = of_mdiobus_register(new_bus, mdio_node);
 	if (err != 0) {
-		dev_err(dev, "Cannot register the MDIO bus\n");
+		dev_err_probe(dev, err, "Cannot register the MDIO bus\n");
 		goto bus_register_fail;
 	}
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
  2022-06-01 14:22 [PATCH] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure Rasmus Villemoes
@ 2022-06-02  1:03 ` Jakub Kicinski
  2022-06-02  7:48 ` [PATCH v2] " Rasmus Villemoes
  1 sibling, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2022-06-02  1:03 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Giuseppe Cavallaro, Alexandre Torgue, netdev, linux-kernel,
	David S. Miller

On Wed,  1 Jun 2022 16:22:26 +0200 Rasmus Villemoes wrote:
>  		if (ret < 0) {
> -			dev_err(priv->device,
> +			dev_err_probe(priv->device, ret,
>  				"%s: MDIO bus (id: %d) registration failed",
>  				__func__, priv->plat->bus_id);

Please adjust the indent of the continuation lines.

And fix the spelling checkpatch also points out.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
  2022-06-01 14:22 [PATCH] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure Rasmus Villemoes
  2022-06-02  1:03 ` Jakub Kicinski
@ 2022-06-02  7:48 ` Rasmus Villemoes
  2022-06-02 18:20   ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Rasmus Villemoes @ 2022-06-02  7:48 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue
  Cc: Jakub Kicinski, netdev, linux-kernel, David S. Miller,
	Rasmus Villemoes

I have a board where these two lines are always printed during boot:

   imx-dwmac 30bf0000.ethernet: Cannot register the MDIO bus
   imx-dwmac 30bf0000.ethernet: stmmac_dvr_probe: MDIO bus (id: 1) registration failed

It's perfectly fine, and the device is successfully (and silently, as
far as the console goes) probed later.

Use dev_err_probe() instead, which will demote these messages to debug
level (thus removing the alarming messages from the console) when the
error is -EPROBE_DEFER, and also has the advantage of including the
error code if/when it happens to be something other than -EPROBE_DEFER.

While here, add the missing \n to one of the format strings.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
v2: Reindent following lines, fix spello in commit message, also add \n.

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3b81d4e9dc83..d1a7cf4567bc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7129,9 +7129,9 @@ int stmmac_dvr_probe(struct device *device,
 		/* MDIO bus Registration */
 		ret = stmmac_mdio_register(ndev);
 		if (ret < 0) {
-			dev_err(priv->device,
-				"%s: MDIO bus (id: %d) registration failed",
-				__func__, priv->plat->bus_id);
+			dev_err_probe(priv->device, ret,
+				      "%s: MDIO bus (id: %d) registration failed\n",
+				      __func__, priv->plat->bus_id);
 			goto error_mdio_register;
 		}
 	}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 9bc625fccca0..03d3d1f7aa4b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -482,7 +482,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 
 	err = of_mdiobus_register(new_bus, mdio_node);
 	if (err != 0) {
-		dev_err(dev, "Cannot register the MDIO bus\n");
+		dev_err_probe(dev, err, "Cannot register the MDIO bus\n");
 		goto bus_register_fail;
 	}
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
  2022-06-02  7:48 ` [PATCH v2] " Rasmus Villemoes
@ 2022-06-02 18:20   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-06-02 18:20 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: peppe.cavallaro, alexandre.torgue, kuba, netdev, linux-kernel,
	davem

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  2 Jun 2022 09:48:40 +0200 you wrote:
> I have a board where these two lines are always printed during boot:
> 
>    imx-dwmac 30bf0000.ethernet: Cannot register the MDIO bus
>    imx-dwmac 30bf0000.ethernet: stmmac_dvr_probe: MDIO bus (id: 1) registration failed
> 
> It's perfectly fine, and the device is successfully (and silently, as
> far as the console goes) probed later.
> 
> [...]

Here is the summary with links:
  - [v2] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
    https://git.kernel.org/netdev/net/c/839612d23ffd

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-02 18:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-01 14:22 [PATCH] net: stmmac: use dev_err_probe() for reporting mdio bus registration failure Rasmus Villemoes
2022-06-02  1:03 ` Jakub Kicinski
2022-06-02  7:48 ` [PATCH v2] " Rasmus Villemoes
2022-06-02 18:20   ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).