Skip to contentSkip to conversation

Parent device of MDIO bus

DISCUSSION Krzysztof Hałasa 2 participants 3 messages Aug 13, 2014 – Aug 14, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I noticed a recent change a71e3c37960ce5f9c6a519bc1215e3ba9fa83e75:
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.

Does this mean an MDIO driver must now be separate from its Ethernet driver in order for the latter to be rmmod-able? Otherwise, the Ethernet .probe (*_init_one()) calls mdiobus_register() and immediately bumps refcount (for both drivers in a common module) forever.

The other option seems to be moving mdio_register() from Ethernet's .probe() to dev->open(). This will make the driver un-rmmod-able when the Ethernet device is open (not a big problem and we had it this way some time ago). It will be rmmod-able again when all Ethernets are closed.

Or am I missing something?
What do you think?

Signature · 4 lines
Krzysztof Halasa

Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland
#1 lore raw
Quoted 17 lines · Krzysztof Hałasa

Hi,

I noticed a recent change a71e3c37960ce5f9c6a519bc1215e3ba9fa83e75:
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.

Does this mean an MDIO driver must now be separate from its Ethernet driver in order for the latter to be rmmod-able? Otherwise, the Ethernet .probe (*_init_one()) calls mdiobus_register() and immediately bumps refcount (for both drivers in a common module) forever.

Quoted 8 lines

The other option seems to be moving mdio_register() from Ethernet's .probe() to dev->open(). This will make the driver un-rmmod-able when the Ethernet device is open (not a big problem and we had it this way some time ago). It will be rmmod-able again when all Ethernets are closed.

Or am I missing something?
What do you think?

This patch has been reverted in mainline.

#2 lore raw
Quoted 9 lines
Quoted 9 lines

I noticed a recent change a71e3c37960ce5f9c6a519bc1215e3ba9fa83e75:
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.

Quoted 1 line · Fabio Estevam

This patch has been reverted in mainline.

Short and simple... Thanks.

Signature · 4 lines
Krzysztof Halasa

Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland