Skip to content

Commit a71e3c3

Browse files
ezequielgarciadavem330
authored andcommitted
net: phy: Set the driver when registering an MDIO bus device
mdiobus_register() registers a device which is already bound to a driver. Hence, the driver pointer should be set properly in order to track down the driver associated to the MDIO bus. This will be used to allow ethernet driver to pin down a MDIO bus driver, preventing it from being unloaded while the PHY device is running. Reviewed-by: Florian Fainelli <[email protected]> Tested-by: Florian Fainelli <[email protected]> Signed-off-by: Ezequiel Garcia <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 042d765 commit a71e3c3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ int mdiobus_register(struct mii_bus *bus)
255255

256256
bus->dev.parent = bus->parent;
257257
bus->dev.class = &mdio_bus_class;
258+
bus->dev.driver = bus->parent->driver;
258259
bus->dev.groups = NULL;
259260
dev_set_name(&bus->dev, "%s", bus->id);
260261

0 commit comments

Comments
 (0)