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_gonza...@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(-)

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
-- 
2.11.0

Reply via email to