net: phy: Guard against the presence of a netdev
authorIoana Ciornei <ioana.ciornei@nxp.com>
Tue, 28 May 2019 17:38:08 +0000 (20:38 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 May 2019 04:48:53 +0000 (21:48 -0700)
commit2db2d9d1ac37222cd9cd9b59bfd7f9cea3bd2457
treea5148aae012d3af151815a7f7a070af436964fa0
parent53cfca2d6b934b456f89ce2ecfdf0b08593384f1
net: phy: Guard against the presence of a netdev

A prerequisite for PHYLIB to work in the absence of a struct net_device
is to not access pointers to it.

Changes are needed in the following areas:

 - Printing: In some places netdev_err was replaced with phydev_err.

 - Incrementing reference count to the parent MDIO bus driver: If there
   is no net device, then the reference count should definitely be
   incremented since there is no chance that it was an Ethernet driver
   who registered the MDIO bus.

 - Sysfs links are not created in case there is no attached_dev.

 - No netif_carrier_off is done if there is no attached_dev.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c