Skip to contentSkip to conversation

mdio_bus: suppress err message for reset gpio EPROBE_DEFER

PATCH In review Grygorii Strashko 5 participants 10 messages Nov 19, 2020 – Nov 21, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mdio_bus: suppress err message for reset gpio EPROBE_DEFER

The mdio_bus may have dependencies from GPIO controller and so got deferred. Now it will print error message every time -EPROBE_DEFER is returned which from:
__mdiobus_register()
|-devm_gpiod_get_optional()
without actually identifying error code.

"mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO"

Hence, suppress error message for devm_gpiod_get_optional() returning -EPROBE_DEFER case by using dev_err_probe().

---
 drivers/net/phy/mdio_bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/phy/mdio_bus.c +3 -3
index 757e950fb745..83cd61c3dd01 100644
@@ -546,10 +546,10 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
 	/* de-assert bus level PHY GPIO reset */
 	gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(gpiod)) {
-		dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
-			bus->id);
+		err = dev_err_probe(&bus->dev, PTR_ERR(gpiod),
+				    "mii_bus %s couldn't get reset GPIO\n", bus->id);
 		device_del(&bus->dev);
-		return PTR_ERR(gpiod);
+		return err;
 	} else	if (gpiod) {
 		bus->reset_gpiod = gpiod;
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Am 19.11.2020 um 21:34 schrieb Grygorii Strashko:

Quoted 22 lines

The mdio_bus may have dependencies from GPIO controller and so got deferred. Now it will print error message every time -EPROBE_DEFER is returned which from:
__mdiobus_register()
|-devm_gpiod_get_optional()
without actually identifying error code.

"mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO"

Hence, suppress error message for devm_gpiod_get_optional() returning -EPROBE_DEFER case by using dev_err_probe().

---
 drivers/net/phy/mdio_bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/phy/mdio_bus.c +0 -0
index 757e950fb745..83cd61c3dd01 100644

drivers/net/phy/mdio_bus.c int __mdiobus_register(struct mii_bus *bus, struct module *owner) · line 550

Quoted 7 lines
drivers/net/phy/mdio_bus.c +2 -2
@@ -546,10 +546,10 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
 	/* de-assert bus level PHY GPIO reset */
 	gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(gpiod)) {
-		dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
-			bus->id);
+		err = dev_err_probe(&bus->dev, PTR_ERR(gpiod),
+				    "mii_bus %s couldn't get reset GPIO\n", bus->id);

Doesn't checkpatch complain about line length > 80 here?

drivers/net/phy/mdio_bus.c int __mdiobus_register(struct mii_bus *bus, struct module *owner) · line 555

Quoted 7 lines
drivers/net/phy/mdio_bus.c +1 -1
 		device_del(&bus->dev);
-		return PTR_ERR(gpiod);
+		return err;
 	} else	if (gpiod) {
 		bus->reset_gpiod = gpiod;
 

Last but not least the net or net-next patch annotation is missing. I'd be fine with treating the change as an improvement (net-next).

Apart from that change looks good to me.

#2 lore raw
Quoted 18 lines · Heiner Kallweit

Am 19.11.2020 um 21:34 schrieb Grygorii Strashko:

Quoted 17 lines

The mdio_bus may have dependencies from GPIO controller and so got deferred. Now it will print error message every time -EPROBE_DEFER is returned which from:
__mdiobus_register()
|-devm_gpiod_get_optional()
without actually identifying error code.

"mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO"

Hence, suppress error message for devm_gpiod_get_optional() returning -EPROBE_DEFER case by using dev_err_probe().

---
  drivers/net/phy/mdio_bus.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/net/phy/mdio_bus.c int __mdiobus_register(struct mii_bus *bus, struct module *owner) · line 550

Quoted 12 lines
drivers/net/phy/mdio_bus.c +2 -2
index 757e950fb745..83cd61c3dd01 100644
@@ -546,10 +546,10 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
  	/* de-assert bus level PHY GPIO reset */
  	gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
  	if (IS_ERR(gpiod)) {
-		dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
-			bus->id);
+		err = dev_err_probe(&bus->dev, PTR_ERR(gpiod),
+				    "mii_bus %s couldn't get reset GPIO\n", bus->id);

Doesn't checkpatch complain about line length > 80 here?

:)

commit bdc48fa11e46f867ea4d75fa59ee87a7f48be144

Author: Joe Perches <[email protected]>
Date:   Fri May 29 16:12:21 2020 -0700

checkpatch/coding-style: deprecate 80-column warning

Quoted 14 lines

drivers/net/phy/mdio_bus.c int __mdiobus_register(struct mii_bus *bus, struct module *owner) · line 555

Quoted 8 lines
drivers/net/phy/mdio_bus.c +1 -1
  		device_del(&bus->dev);
-		return PTR_ERR(gpiod);
+		return err;
  	} else	if (gpiod) {
  		bus->reset_gpiod = gpiod;
 

Last but not least the net or net-next patch annotation is missing. I'd be fine with treating the change as an improvement (net-next).

Apart from that change looks good to me.

Signature · 2 lines
Best regards,
grygorii
maintainer
#3 lore raw

Am 19.11.2020 um 22:17 schrieb Grygorii Strashko:

Quoted 36 lines · Heiner Kallweit
Quoted 18 lines

Am 19.11.2020 um 21:34 schrieb Grygorii Strashko:

Quoted 17 lines

The mdio_bus may have dependencies from GPIO controller and so got deferred. Now it will print error message every time -EPROBE_DEFER is returned which from:
__mdiobus_register()
  |-devm_gpiod_get_optional()
without actually identifying error code.

"mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO"

Hence, suppress error message for devm_gpiod_get_optional() returning -EPROBE_DEFER case by using dev_err_probe().

---
  drivers/net/phy/mdio_bus.c | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/net/phy/mdio_bus.c int __mdiobus_register(struct mii_bus *bus, struct module *owner) · line 550

Quoted 12 lines
drivers/net/phy/mdio_bus.c +2 -2
index 757e950fb745..83cd61c3dd01 100644
@@ -546,10 +546,10 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
       /* de-assert bus level PHY GPIO reset */
       gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
       if (IS_ERR(gpiod)) {
-        dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
-            bus->id);
+        err = dev_err_probe(&bus->dev, PTR_ERR(gpiod),
+                    "mii_bus %s couldn't get reset GPIO\n", bus->id);

Doesn't checkpatch complain about line length > 80 here?

Quoted 8 lines

:)

commit bdc48fa11e46f867ea4d75fa59ee87a7f48be144
Author: Joe Perches <[email protected]>
Date:   Fri May 29 16:12:21 2020 -0700

    checkpatch/coding-style: deprecate 80-column warning

Ah, again something learnt. Thanks for the reference.

Quoted 14 lines
Quoted 13 lines
Quoted 7 lines
drivers/net/phy/mdio_bus.c +1 -1
           device_del(&bus->dev);
-        return PTR_ERR(gpiod);
+        return err;
       } else    if (gpiod) {
           bus->reset_gpiod = gpiod;

Last but not least the net or net-next patch annotation is missing. I'd be fine with treating the change as an improvement (net-next).

Apart from that change looks good to me.

maintainer
#4 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

Doesn't checkpatch complain about line length > 80 here?

:)

Quoted 8 lines
Quoted 6 lines

commit bdc48fa11e46f867ea4d75fa59ee87a7f48be144
Author: Joe Perches <[email protected]>
Date:   Fri May 29 16:12:21 2020 -0700

    checkpatch/coding-style: deprecate 80-column warning

Ah, again something learnt. Thanks for the reference.

But it then got revoked for netdev. Or at least it was planned to re-impose 80 for netdev. I don't know if checkpatch got patched yet.

Andrew

maintainer
#5 lore raw

Am 19.11.2020 um 22:41 schrieb Andrew Lunn:

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 1 line

Doesn't checkpatch complain about line length > 80 here?

:)

commit bdc48fa11e46f867ea4d75fa59ee87a7f48be144
Author: Joe Perches <[email protected]>
Date:   Fri May 29 16:12:21 2020 -0700

    checkpatch/coding-style: deprecate 80-column warning

Quoted 7 lines
Quoted 1 line

Ah, again something learnt. Thanks for the reference.

But it then got revoked for netdev. Or at least it was planned to re-impose 80 for netdev. I don't know if checkpatch got patched yet.

Andrew

At a first glance it sounds strange that subsystems may define own rules for such basic things. But supposedly there has been a longer emotional disucssion about this already ..

maintainer
#6 lore raw
Quoted 16 lines · On Thu, 19 Nov 2020 23:09:52 +0100 Heiner Kallweit wrote:

Am 19.11.2020 um 22:41 schrieb Andrew Lunn:

Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

Doesn't checkpatch complain about line length > 80 here?

:)

Quoted 8 lines
Quoted 6 lines

commit bdc48fa11e46f867ea4d75fa59ee87a7f48be144
Author: Joe Perches <[email protected]>
Date:   Fri May 29 16:12:21 2020 -0700

    checkpatch/coding-style: deprecate 80-column warning

Ah, again something learnt. Thanks for the reference.

But it then got revoked for netdev. Or at least it was planned to re-impose 80 for netdev. I don't know if checkpatch got patched yet.

FWIW I had a patch for it but before I sent it Dave suggested I ask around and Alexei was opposed.

And I don't have the strength to argue :)

I'll just tell people case by case when they have 4+ indentation levels in their code or use 40+ character variables/defines, in my copious spare time.

Quoted 3 lines

At a first glance it sounds strange that subsystems may define own rules for such basic things. But supposedly there has been a longer emotional disucssion about this already ..

We do have our own comment style rule in networking since the beginning of time, and reverse xmas tree, so it's not completely crazy.

#7 lore raw
Quoted 2 lines · Jakub Kicinski

We do have our own comment style rule in networking since the beginning of time, and reverse xmas tree, so it's not completely crazy.

reverse xmas tree is completely crazy.

But I posted a patch to checkpatch to suggest it for net/ and drivers/net/ once

https://lkml.org/lkml/2016/11/4/54

maintainer
#8 lore raw

Hi Joe

Quoted 10 lines

reverse xmas tree is completely crazy.

But I posted a patch to checkpatch to suggest it for net/ and drivers/net/ once

https://lkml.org/lkml/2016/11/4/54

From Joe Perches <>

...

Quoted 4 lines

and the reverse xmas tree helpfulness of looking up the type of bar is neither obvious nor easy.

My preference would be for a bar that serves coffee and alcohol.

Ah, those were the days.

Anyway, can this patch be brought back to life, with the problem pointed out fixed? It is still something we do in netdev, and a machine can spot these problems better than a human maintainer or developer.

Thanks
Andrew

maintainer
#9 lore raw
In reply to Grygorii Strashko
Quoted 7 lines · On Thu, 19 Nov 2020 22:34:46 +0200 Grygorii Strashko wrote:

The mdio_bus may have dependencies from GPIO controller and so got deferred. Now it will print error message every time -EPROBE_DEFER is returned which from:
__mdiobus_register()
|-devm_gpiod_get_optional()
without actually identifying error code.

Quoted 6 lines

"mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO"

Hence, suppress error message for devm_gpiod_get_optional() returning -EPROBE_DEFER case by using dev_err_probe().

Applied (with the line wrapped), thanks!