net: phy: neaten phy_print_status
Subsystems (3)
v2 cover net: phy: neaten phy_print_status
David, Joe,
This patchset neatens phy_print_status based on earlier feedback from Joe.
Thanks!
Florian Fainelli (4):
net: phy: use network device in phy_print_status
net: phy: update phy_print_status to show pause settings
net: phy: display human readable PHY speed settings
net: phy: remove unneeded parenthesis
drivers/net/phy/phy.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.3.2
PATCH v2 1/4 net: phy: use network device in phy_print_status
phy_print_status() currently uses dev_name(&phydev->dev) which will usually result in printing something along those lines for Device Tree aware drivers:
libphy: f0b60000.etherne:0a - Link is Down
libphy: f0ba0000.etherne:00 - Link is Up - 1000/Full
This is not terribly useful for network administrators or users since we expect a network interface name to be able to correlate link events with interfaces. Update phy_print_status() to use netdev_info() with phydev->attached_dev which is the backing network device for our PHY device. The leading dash is removed since netdev_info() prefixes the messages with "<interface>: " already.
--- drivers/net/phy/phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/phy/phy.c +2 -3
@@ -45,12 +45,11 @@void phy_print_status (struct phy_device *phydev) {if (phydev->link) { -pr_info ("%s - Link is Up - %d/%s\n" , -dev_name (&phydev->dev), +netdev_info (phydev->attached_dev,"Link is Up - %d/%s\n" , phydev->speed,DUPLEX_FULL == phydev->duplex ?"Full" :"Half" ); }else { -pr_info ("%s - Link is Down\n" ,dev_name (&phydev->dev)); +netdev_info (phydev->attached_dev,"Link is Down\n" ); } }EXPORT_SYMBOL (phy_print_status);
Signature · 1 line
1.8.3.2
PATCH v2 2/4 net: phy: update phy_print_status to show pause settings
In reply to Florian FainelliUpdate phy_print_status() to also display the PHY device pause settings (rx/tx or off).
--- drivers/net/phy/phy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/phy/phy.c +4 -2
@@ -45,9 +45,11 @@void phy_print_status (struct phy_device *phydev) {if (phydev->link) { -netdev_info (phydev->attached_dev,"Link is Up - %d/%s\n" , +netdev_info (phydev->attached_dev, +"Link is Up - %d/%s - flow control %s\n" , phydev->speed, -DUPLEX_FULL == phydev->duplex ?"Full" :"Half" ); +DUPLEX_FULL == phydev->duplex ?"Full" :"Half" , + phydev->pause ?"rx/tx" :"off" ); }else {netdev_info (phydev->attached_dev,"Link is Down\n" ); }
Signature · 1 line
1.8.3.2
PATCH v2 3/4 net: phy: display human readable PHY speed settings
In reply to Florian FainelliUse a convenience function: phy_speed_to_str() which will display human readable speeds.
---
Joe,
This is highly inspired from the version you sent to me, although I renamed to phy_speed_to_str() for clarity as well as added the unit suffix to each speed because your version would show:
Unknownmbps for instance.
drivers/net/phy/phy.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/net/phy/phy.c +22 -2
@@ -38,6 +38,26 @@#include <asm/irq.h> +static const char *phy_speed_to_str (int speed) +{ +switch (speed) { +case SPEED_10 : +return "10Mbps" ; +case SPEED_100 : +return "100Mbps" ; +case SPEED_1000 : +return "1Gbps" ; +case SPEED_2500 : +return "2.5Gbps" ; +case SPEED_10000 : +return "10Gbps" ; +case SPEED_UNKNOWN : +return "Unknown" ; +default : +return "Unsupported (update phy.c)" ; + } +} +/** * phy_print_status - Convenience function to print out the current phy status * @phydev: the phy_device struct
@@ -46,8 +66,8 @@ void phy_print_status(struct phy_device *phydev) {if (phydev->link) {netdev_info (phydev->attached_dev, -"Link is Up - %d/%s - flow control %s\n" , - phydev->speed, +"Link is Up - %s/%s - flow control %s\n" , +phy_speed_to_str (phydev->speed),DUPLEX_FULL == phydev->duplex ?"Full" :"Half" , phydev->pause ?"rx/tx" :"off" ); }else {
Signature · 1 line
1.8.3.2
PATCH v2 4/4 net: phy: remove unneeded parenthesis
In reply to Florian FainelliOur if/else statement in phy_print_status() is only comprised of one line for each, remove the parenthesis.
--- drivers/net/phy/phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/phy/phy.c +2 -3
@@ -64,15 +64,14 @@ static const char *phy_speed_to_str(int speed)*/ void phy_print_status (struct phy_device *phydev) { -if (phydev->link) { +if (phydev->link)netdev_info (phydev->attached_dev,"Link is Up - %s/%s - flow control %s\n" ,phy_speed_to_str (phydev->speed),DUPLEX_FULL == phydev->duplex ?"Full" :"Half" , phydev->pause ?"rx/tx" :"off" ); - }else { +else netdev_info (phydev->attached_dev,"Link is Down\n" ); - } }EXPORT_SYMBOL (phy_print_status);
Signature · 1 line
1.8.3.2
Re: [PATCH net-next v2 4/4] net: phy: remove unneeded parenthesis
Hello.
Quoted 2 lines · Florian Fainelli
Our if/else statement in
phy_print_status()is only comprised of one line for each, remove the parenthesis.
I protest, the *if* arm is multi-line, though single statement. :-)
Could we avoid changing that code to and fro during 3.14-rc1?
Quoted 16 lines
Signed-off-by Florian Fainelli <[email protected]>--- drivers/net/phy/phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/net/phy/phy.c +1
-1@@ -64,15 +64,14 @@ static const char *phy_speed_to_str(int speed)*/ void phy_print_status (struct phy_device *phydev) { -if (phydev->link) { +if (phydev->link) netdev_info(phydev->attached_dev,
drivers/net/phy/phy.c static const char *phy_speed_to_str(int speed) · line 76
Quoted 10 lines
drivers/net/phy/phy.c +1
-2"Link is Up - %s/%s - flow control %s\n" ,phy_speed_to_str (phydev->speed),DUPLEX_FULL == phydev->duplex ?"Full" :"Half" , phydev->pause ? "rx/tx" : "off"); - }else { + else netdev_info(phydev->attached_dev, "Link is Down\n"); - } }EXPORT_SYMBOL (phy_print_status);
WBR, Sergei
Re: [PATCH net-next v2 4/4] net: phy: remove unneeded parenthesis
2014/1/23 Sergei Shtylyov <[email protected]>:
Quoted 11 lines
Hello.
Quoted 2 lines · Florian Fainelli
Our if/else statement in
phy_print_status()is only comprised of one line for each, remove the parenthesis.I protest, the *if* arm is multi-line, though single statement. :-)
Could we avoid changing that code to and fro during 3.14-rc1?
Is it that big of a problem? Does that make checkpatch.pl unhappy, does that make you unhappy? Since this is intentionally the last patch in the series, it would be trivial for David to ignore it I suppose.
Quoted 33 lines
Quoted 19 lines
Signed-off-by Florian Fainelli <[email protected]>--- drivers/net/phy/phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/net/phy/phy.c +1
-1@@ -64,15 +64,14 @@ static const char *phy_speed_to_str(int speed)*/ void phy_print_status (struct phy_device *phydev) { -if (phydev->link) { +if (phydev->link) netdev_info(phydev->attached_dev,drivers/net/phy/phy.c static const char *phy_speed_to_str(int speed) · line 76
Quoted 10 lines
drivers/net/phy/phy.c +1
-2"Link is Up - %s/%s - flow control %s\n" ,phy_speed_to_str (phydev->speed),DUPLEX_FULL == phydev->duplex ?"Full" :"Half" , phydev->pause ? "rx/tx" : "off"); - }else { + else netdev_info(phydev->attached_dev, "Link is Down\n"); - } }EXPORT_SYMBOL (phy_print_status);WBR, Sergei
Signature · 1 line
Florian
Re: [PATCH net-next v2 4/4] net: phy: remove unneeded parenthesis
Hello.
Quoted 7 lines · Florian Fainelli
Quoted 5 lines
Quoted 2 lines
Our if/else statement in
phy_print_status()is only comprised of one line for each, remove the parenthesis.I protest, the *if* arm is multi-line, though single statement. :-)
Could we avoid changing that code to and fro during 3.14-rc1?Is it that big of a problem?
You should be clearer in the changelog, at least. :-)
Quoted 1 line
Does that make checkpatch.pl unhappy,
No, it doesn't.
Quoted 1 line
does that make you unhappy?
Kind of, as it was me who added {} in net-next, IIRC.
Quoted 2 lines
Since this is intentionally the last patch
in the series, it would be trivial for David to ignore it I suppose.
Would be fine...
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Signed-off-by Florian Fainelli <[email protected]>--- drivers/net/phy/phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/net/phy/phy.c +1
-1@@ -64,15 +64,14 @@ static const char *phy_speed_to_str(int speed)*/ void phy_print_status (struct phy_device *phydev) { -if (phydev->link) { +if (phydev->link) netdev_info(phydev->attached_dev, "Link is Up - %s/%s - flow control %s\n", phy_speed_to_str(phydev->speed),
Quoted 8 lines
Quoted 8 lines
drivers/net/phy/phy.c static const char *phy_speed_to_str(int speed) · line 76
Quoted 8 lines
drivers/net/phy/phy.c +1
-2DUPLEX_FULL == phydev->duplex ?"Full" :"Half" , phydev->pause ? "rx/tx" : "off"); - }else { + else netdev_info(phydev->attached_dev, "Link is Down\n"); - } }EXPORT_SYMBOL (phy_print_status);
WBR, Sergei
Re: [PATCH net-next v2 4/4] net: phy: remove unneeded parenthesis
In reply to Florian FainelliQuoted 2 lines · Florian Fainelli
Our if/else statement in
phy_print_status()is only comprised of one line for each, remove the parenthesis.
Your patch removes the braces, not the parenthesis ;-)
Regards,
Fabio Estevam