kernel: bump 4.9 to 4.9.63
[openwrt/staging/mkresin.git] / target / linux / generic / pending-4.9 / 703-phy-add-detach-callback-to-struct-phy_driver.patch
1 From: Gabor Juhos <juhosg@openwrt.org>
2 Subject: generic: add detach callback to struct phy_driver
3
4 lede-commit: fe61fc2d7d0b3fb348b502f68f98243b3ddf5867
5
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
7 ---
8 drivers/net/phy/phy_device.c | 3 +++
9 include/linux/phy.h | 6 ++++++
10 2 files changed, 9 insertions(+)
11
12 --- a/drivers/net/phy/phy_device.c
13 +++ b/drivers/net/phy/phy_device.c
14 @@ -1001,6 +1001,9 @@ void phy_detach(struct phy_device *phyde
15 struct mii_bus *bus;
16 int i;
17
18 + if (phydev->drv && phydev->drv->detach)
19 + phydev->drv->detach(phydev);
20 +
21 phydev->attached_dev->phydev = NULL;
22 phydev->attached_dev = NULL;
23 phy_suspend(phydev);
24 --- a/include/linux/phy.h
25 +++ b/include/linux/phy.h
26 @@ -507,6 +507,12 @@ struct phy_driver {
27 */
28 int (*did_interrupt)(struct phy_device *phydev);
29
30 + /*
31 + * Called before an ethernet device is detached
32 + * from the PHY.
33 + */
34 + void (*detach)(struct phy_device *phydev);
35 +
36 /* Clears up any memory if needed */
37 void (*remove)(struct phy_device *phydev);
38