Skip to content

Commit

Permalink
net: phylib: add link_change_notify callback to phy device
Browse files Browse the repository at this point in the history
Add a notify callback to inform phy drivers when the core is about to
do its link adjustment. No change for drivers that do not implement
this callback.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Mack authored and David S. Miller committed Jun 21, 2014
1 parent 916c168 commit 2b8f2a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@ void phy_state_machine(struct work_struct *work)

mutex_lock(&phydev->lock);

if (phydev->drv->link_change_notify)
phydev->drv->link_change_notify(phydev);

switch (phydev->state) {
case PHY_DOWN:
case PHY_STARTING:
Expand Down
9 changes: 9 additions & 0 deletions include/linux/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,15 @@ struct phy_driver {
/* See set_wol, but for checking whether Wake on LAN is enabled. */
void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);

/*
* Called to inform a PHY device driver when the core is about to
* change the link state. This callback is supposed to be used as
* fixup hook for drivers that need to take action when the link
* state changes. Drivers are by no means allowed to mess with the
* PHY device structure in their implementations.
*/
void (*link_change_notify)(struct phy_device *dev);

struct device_driver driver;
};
#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
Expand Down

0 comments on commit 2b8f2a2

Please sign in to comment.