Skip to contentSkip to conversation

phy: Replace genphy_update_link() call with phy_read_status()

PATCH In review Alexander Sverdlin 2 participants 2 messages Sep 13, 2012 – Sep 17, 2012

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

PATCH 1/1 phy: Replace genphy_update_link() call with phy_read_status()

From: Alexander Sverdlin <[email protected]>

Replace genphy_update_link() call with phy_read_status()

Code in phy.c should not call genphy_*() functions directly, this breaks PHY layer abstraction. Some drivers may re-implement "read_status" callback and it's not being called in one place of PHY state machine, where genphy_update_link() is called instead. So fix it.
For drivers that rely on genphy_* implementation nothing changed, as genphy_read_status() calls genphy_update_link() anyway.

---
 drivers/net/phy/phy.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/phy/phy.c +1 -1
index dfca51d..cfed41c 100644
@@ -839,7 +839,7 @@ void phy_state_machine(struct work_struct *work)
 			}
 			break;
 		case PHY_FORCING:
-			err = genphy_update_link(phydev);
+			err = phy_read_status(phydev);
 
 			if (err)
 				break;
maintainer
#1 lore raw

From: Alexander Sverdlin <[email protected]>
Date: Thu, 13 Sep 2012 09:20:43 +0200

Quoted 11 lines

From: Alexander Sverdlin <[email protected]>

Replace genphy_update_link() call with phy_read_status()

Code in phy.c should not call genphy_*() functions directly, this breaks PHY layer abstraction. Some drivers may re-implement "read_status" callback and it's not being called in one place of PHY state machine, where genphy_update_link() is called instead. So fix it.
For drivers that rely on genphy_* implementation nothing changed, as genphy_read_status() calls genphy_update_link() anyway.

This is a behavioral change, not just a change to make sure the right interfaces are used.

genphy_update_link() does only a small subset of the operations performed by the generic read_status callback.

I'm not applying this patch, because all of those extra operations might be unexpected in some situations and break some configurations.