Netdev List
 help / color / mirror / Atom feed
* [RFC 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use
@ 2014-07-21 18:26 Ezequiel Garcia
  2014-07-21 18:26 ` [RFC 1/2] net: phy: Set the driver when registering an MDIO bus device Ezequiel Garcia
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ezequiel Garcia @ 2014-07-21 18:26 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Florian Fainelli, Thomas Petazzoni, Gregory Clement,
	Ezequiel Garcia

Hi all,

This small patchset is a first proposal to fix the current lack of relationship
between an ethernet driver and the MDIO bus behind the PHY device.

In such cases, we would find no visible link between the drivers:

  $ lsmod
  Module                  Size  Used by    Not tainted
  mvmdio                  2941  0 
  mvneta                 22069  0 

Which means nothing prevents the MDIO driver from being removed:

  $ modprobe -r mvmdio

  # Unable to handle kernel NULL pointer dereference at virtual address 00000060
  pgd = c0004000
  [00000060] *pgd=00000000
  Internal error: Oops: 17 [#1] SMP ARM
  Modules linked in: mvneta [last unloaded: mvmdio]
  CPU: 0 PID: 22 Comm: kworker/0:1 Not tainted 3.16.0-rc5-01127-g62c0816-dirty #608
  Workqueue: events_power_efficient phy_state_machine
  task: df5ec840 ti: df67a000 task.ti: df67a000
  PC is at phy_state_machine+0x1c/0x468
  LR is at phy_state_machine+0x18/0x468
  [snip]

This patchset fixes this by calling module_{get,put} in the ethernet driver.
After this patch, the mvmdio driver is no longer removable:

  $ modprobe -r mvmdio
  modprobe: can't unload module mvmdio: Resource temporarily unavailable

Of course, we can expect a few drivers to have the same need and therefore
we could argue about moving this to be part of the phydev connection.

Ezequiel Garcia (2):
  net: phy: Set the driver when registering an MDIO bus device
  net: mvneta: Ensure the MDIO bus module is held

 drivers/net/ethernet/marvell/mvneta.c | 12 ++++++++++++
 drivers/net/phy/mdio_bus.c            |  1 +
 2 files changed, 13 insertions(+)

-- 
2.0.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-22 21:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-21 18:26 [RFC 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use Ezequiel Garcia
2014-07-21 18:26 ` [RFC 1/2] net: phy: Set the driver when registering an MDIO bus device Ezequiel Garcia
2014-07-21 18:26 ` [RFC 2/2] net: mvneta: Ensure the MDIO bus module is held Ezequiel Garcia
2014-07-21 18:42 ` [RFC 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use Florian Fainelli
2014-07-21 18:55   ` Ezequiel Garcia
2014-07-22 21:31     ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox