diff mbox

[v2] net: phy: Log only PHY state transitions

Message ID 7a34bf57-4fde-529f-36cf-ad8022185df9@sigmadesigns.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Marc Gonzalez July 28, 2017, 11:18 a.m. UTC
In the current code, old and new PHY states are always logged.
From now on, log only PHY state transitions.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
---
Fix indentation. I was trying to minimize the diff.
I also considered using a goto to jump over the phydev_dbg() call,
but that didn't feel right.
---
 drivers/net/phy/phy.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

David Miller July 31, 2017, 11:21 p.m. UTC | #1
From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Date: Fri, 28 Jul 2017 13:18:30 +0200

> In the current code, old and new PHY states are always logged.
> From now on, log only PHY state transitions.
> 
> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>

Applied to net-next, thanks.
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d0626bf5c540..3ff79c3d90f0 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1226,9 +1226,10 @@  void phy_state_machine(struct work_struct *work)
 	if (err < 0)
 		phy_error(phydev);
 
-	phydev_dbg(phydev, "PHY state change %s -> %s\n",
-		   phy_state_to_str(old_state),
-		   phy_state_to_str(phydev->state));
+	if (old_state != phydev->state)
+		phydev_dbg(phydev, "PHY state change %s -> %s\n",
+			   phy_state_to_str(old_state),
+			   phy_state_to_str(phydev->state));
 
 	/* Only re-schedule a PHY state machine change if we are polling the
 	 * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving