Skip to content

Commit cf95799

Browse files
vladimirolteandavem330
authored andcommitted
net: mdio: introduce a shutdown method to mdio device drivers
MDIO-attached devices might have interrupts and other things that might need quiesced when we kexec into a new kernel. Things are even more creepy when those interrupt lines are shared, and in that case it is absolutely mandatory to disable all interrupt sources. Moreover, MDIO devices might be DSA switches, and DSA needs its own shutdown method to unlink from the DSA master, which is a new requirement that appeared after commit 2f1e8ea ("net: dsa: link interfaces with the DSA master to get rid of lockdep warnings"). So introduce a ->shutdown method in the MDIO device driver structure. Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 02319bf commit cf95799

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/net/phy/mdio_device.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev)
179179
return 0;
180180
}
181181

182+
static void mdio_shutdown(struct device *dev)
183+
{
184+
struct mdio_device *mdiodev = to_mdio_device(dev);
185+
struct device_driver *drv = mdiodev->dev.driver;
186+
struct mdio_driver *mdiodrv = to_mdio_driver(drv);
187+
188+
if (mdiodrv->shutdown)
189+
mdiodrv->shutdown(mdiodev);
190+
}
191+
182192
/**
183193
* mdio_driver_register - register an mdio_driver with the MDIO layer
184194
* @drv: new mdio_driver to register
@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv)
193203
mdiodrv->driver.bus = &mdio_bus_type;
194204
mdiodrv->driver.probe = mdio_probe;
195205
mdiodrv->driver.remove = mdio_remove;
206+
mdiodrv->driver.shutdown = mdio_shutdown;
196207

197208
retval = driver_register(&mdiodrv->driver);
198209
if (retval) {

include/linux/mdio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ struct mdio_driver {
8080

8181
/* Clears up any memory if needed */
8282
void (*remove)(struct mdio_device *mdiodev);
83+
84+
/* Quiesces the device on system shutdown, turns off interrupts etc */
85+
void (*shutdown)(struct mdio_device *mdiodev);
8386
};
8487

8588
static inline struct mdio_driver *

0 commit comments

Comments
 (0)