提交 fcffad7a 编写于 作者: V Vladimir Oltean 提交者: Zheng Zengkai

net: mdio: introduce a shutdown method to mdio device drivers

stable inclusion
from stable-5.10.72
commit a41938d07201d0e7793f5aade5574a49f32ae82f
bugzilla: 182982 https://gitee.com/openeuler/kernel/issues/I4I3L1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a41938d07201d0e7793f5aade5574a49f32ae82f

--------------------------------

[ Upstream commit cf957997 ]

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 2f1e8ea7 ("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: NVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 09fa6f6e
...@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev) ...@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev)
return 0; return 0;
} }
static void mdio_shutdown(struct device *dev)
{
struct mdio_device *mdiodev = to_mdio_device(dev);
struct device_driver *drv = mdiodev->dev.driver;
struct mdio_driver *mdiodrv = to_mdio_driver(drv);
if (mdiodrv->shutdown)
mdiodrv->shutdown(mdiodev);
}
/** /**
* mdio_driver_register - register an mdio_driver with the MDIO layer * mdio_driver_register - register an mdio_driver with the MDIO layer
* @drv: new mdio_driver to register * @drv: new mdio_driver to register
...@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv) ...@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv)
mdiodrv->driver.bus = &mdio_bus_type; mdiodrv->driver.bus = &mdio_bus_type;
mdiodrv->driver.probe = mdio_probe; mdiodrv->driver.probe = mdio_probe;
mdiodrv->driver.remove = mdio_remove; mdiodrv->driver.remove = mdio_remove;
mdiodrv->driver.shutdown = mdio_shutdown;
retval = driver_register(&mdiodrv->driver); retval = driver_register(&mdiodrv->driver);
if (retval) { if (retval) {
......
...@@ -72,6 +72,9 @@ struct mdio_driver { ...@@ -72,6 +72,9 @@ struct mdio_driver {
/* Clears up any memory if needed */ /* Clears up any memory if needed */
void (*remove)(struct mdio_device *mdiodev); void (*remove)(struct mdio_device *mdiodev);
/* Quiesces the device on system shutdown, turns off interrupts etc */
void (*shutdown)(struct mdio_device *mdiodev);
}; };
#define to_mdio_driver(d) \ #define to_mdio_driver(d) \
container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv) container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册