Skip to content

Commit

Permalink
net: phy: Uniform PHY driver access
Browse files Browse the repository at this point in the history
struct phy_device contains a pointer to the PHY driver and nearly
everywhere this pointer is used to access the PHY driver. Only
mdio_bus_phy_may_suspend() is still using to_phy_driver() instead of the
PHY driver pointer. Uniform PHY driver access by eliminating
to_phy_driver() use in mdio_bus_phy_may_suspend().

Only phy_bus_match() and phy_probe() are still using to_phy_driver(),
because PHY driver pointer is not available there.

Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gerhard Engleder authored and David S. Miller committed Aug 20, 2021
1 parent 4ed311b commit 3ac8eed
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,9 @@ static DEFINE_MUTEX(phy_fixup_lock);

static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
{
struct device_driver *drv = phydev->mdio.dev.driver;
struct phy_driver *phydrv = to_phy_driver(drv);
struct net_device *netdev = phydev->attached_dev;

if (!drv || !phydrv->suspend)
if (!phydev->drv->suspend)
return false;

/* PHY not attached? May suspend if the PHY has not already been
Expand Down

0 comments on commit 3ac8eed

Please sign in to comment.