• Vladimir Oltean's avatar
    Revert "net: phy: Uniform PHY driver access" · 301de697
    Vladimir Oltean authored
    This reverts commit 3ac8eed6, which did
    more than it said on the box, and not only it replaced to_phy_driver
    with phydev->drv, but it also removed the "!drv" check, without actually
    explaining why that is fine.
    
    That patch in fact breaks suspend/resume on any system which has PHY
    devices with no drivers bound.
    
    The stack trace is:
    
    Unable to handle kernel NULL pointer dereference at virtual address 00000000000000e8
    pc : mdio_bus_phy_suspend+0xd8/0xec
    lr : dpm_run_callback+0x38/0x90
    Call trace:
     mdio_bus_phy_suspend+0xd8/0xec
     dpm_run_callback+0x38/0x90
     __device_suspend+0x108/0x3cc
     dpm_suspend+0x140/0x210
     dpm_suspend_start+0x7c/0xa0
     suspend_devices_and_enter+0x13c/0x540
     pm_suspend+0x2a4/0x330
    
    Examples why that assumption is not fine:
    
    - There is an MDIO bus with a PHY device that doesn't have a specific
      PHY driver loaded, because mdiobus_register() automatically creates a
      PHY device for it but there is no specific PHY dr...
    301de697
phy_device.c 85.3 KB