netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use
@ 2014-07-23 19:47 Ezequiel Garcia
  2014-07-23 19:47 ` [PATCH v2 1/2] net: phy: Set the driver when registering an MDIO bus device Ezequiel Garcia
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2014-07-23 19:47 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Florian Fainelli, Thomas Petazzoni, Gregory Clement,
	Ezequiel Garcia

Changes from v1:
  * Dropped the unneeded module_put() on phy_attach_direct().

The motivation of this small series is 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 problem by adding a pair of module_{get,put},
so the module reference count is increased when the PHY device is attached
and is decreased when the PHY is detached.

Tested with mvneta and mv643xx_eth drivers, which depend on the mvmdio
driver to handle MDIO. This series applies on both net and net-next branches.

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

 drivers/net/phy/mdio_bus.c   |  1 +
 drivers/net/phy/phy_device.c | 13 +++++++++++++
 2 files changed, 14 insertions(+)

-- 
2.0.1

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

end of thread, other threads:[~2014-08-05 11:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-23 19:47 [PATCH v2 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use Ezequiel Garcia
2014-07-23 19:47 ` [PATCH v2 1/2] net: phy: Set the driver when registering an MDIO bus device Ezequiel Garcia
2014-08-05  2:55   ` Fabio Estevam
2014-08-05  3:22     ` Shawn Guo
2014-08-05  4:01       ` Florian Fainelli
2014-08-05  4:41         ` Shawn Guo
2014-08-05 10:43           ` Ezequiel Garcia
2014-08-05 11:02             ` Fabio Estevam
2014-07-23 19:47 ` [PATCH v2 2/2] net: phy: Ensure the MDIO bus module is held Ezequiel Garcia
2014-07-23 21:46   ` Florian Fainelli
2014-07-25  1:10 ` [PATCH v2 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).