Skip to contentSkip to conversation

RFC: Revert "net: phy: check return code when requesting PHY driver module"

PATCH In review Guido Günther 2 participants 3 messages Jan 21, 2019

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

PATCH 1/1 RFC: Revert "net: phy: check return code when requesting PHY driver module"

This unbreaks ethernet on e.g. the NXP imx8mq-evk using the fec driver. Otherwise it fails like:

[    3.702671] device: '30be0000.ethernet-1': device_add
[    3.707783] PM: Adding info for No Bus:30be0000.ethernet-1
[    3.713329] libphy: fec_enet_mii_bus: probed
[    3.717815] mdio_bus 30be0000.ethernet-1:01: error -2 loading PHY driver module for ID 0x004dd074
[    3.726747] PM: Removing info for No Bus:30be0000.ethernet-1
[    3.732460] device: 'pps0': device_unregister
[    3.736911] PM: Removing info for No Bus:pps0
[    3.741317] device: 'ptp0': device_unregister
[    3.745761] PM: Removing info for No Bus:ptp0
[    3.750160] device: 'ptp0': device_create_release
[    3.755024] fec 30be0000.ethernet: Dropping the link to regulator.2
[    3.761359] fec: probe of 30be0000.ethernet failed with error -2

This reverts commit 13d0ab6750b20957ac1466da4e44dc0af746ff28.
---
On linux-next as somewhen starting at 2018-01-18 fec initialization broke due to 13d0ab6750b20957ac1466da4e44dc0af746ff28. It welcome any feedback how to fix this properly without eliminating the purpose of the initial patch.

 drivers/net/phy/phy_device.c | 35 +++++------------------------------
 1 file changed, 5 insertions(+), 30 deletions(-)
drivers/net/phy/phy_device.c +5 -30
index b61db0a5ba3a..636303e50173 100644
@@ -558,31 +558,12 @@ static const struct device_type mdio_bus_phy_type = {
 	.pm = MDIO_BUS_PHY_PM_OPS,
 };
 
-static int phy_request_driver_module(struct phy_device *dev, int phy_id)
-{
-	int ret;
-
-	ret = request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
-			     MDIO_ID_ARGS(phy_id));
-	/* we only check for failures in executing the usermode binary,
-	 * not whether a PHY driver module exists for the PHY ID
-	 */
-	if (IS_ENABLED(CONFIG_MODULES) && ret < 0) {
-		phydev_err(dev, "error %d loading PHY driver module for ID 0x%08x\n",
-			   ret, phy_id);
-		return ret;
-	}
-
-	return 0;
-}
-
 struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 				     bool is_c45,
 				     struct phy_c45_device_ids *c45_ids)
 {
 	struct phy_device *dev;
 	struct mdio_device *mdiodev;
-	int ret = 0;
 
 	/* We allocate the device, and initialize the default values */
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -639,21 +620,15 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 			if (!(c45_ids->devices_in_package & (1 << i)))
 				continue;
 
-			ret = phy_request_driver_module(dev,
-						c45_ids->device_ids[i]);
-			if (ret)
-				break;
+			request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+				       MDIO_ID_ARGS(c45_ids->device_ids[i]));
 		}
 	} else {
-		ret = phy_request_driver_module(dev, phy_id);
+		request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+			       MDIO_ID_ARGS(phy_id));
 	}
 
-	if (!ret) {
-		device_initialize(&mdiodev->dev);
-	} else {
-		kfree(dev);
-		dev = ERR_PTR(ret);
-	}
+	device_initialize(&mdiodev->dev);
 
 	return dev;
 }
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 16 lines · Guido Günther

This unbreaks ethernet on e.g. the NXP imx8mq-evk using the fec driver. Otherwise it fails like:

[    3.702671] device: '30be0000.ethernet-1': device_add
[    3.707783] PM: Adding info for No Bus:30be0000.ethernet-1
[    3.713329] libphy: fec_enet_mii_bus: probed
[    3.717815] mdio_bus 30be0000.ethernet-1:01: error -2 loading PHY driver module for ID 0x004dd074
[    3.726747] PM: Removing info for No Bus:30be0000.ethernet-1
[    3.732460] device: 'pps0': device_unregister
[    3.736911] PM: Removing info for No Bus:pps0
[    3.741317] device: 'ptp0': device_unregister
[    3.745761] PM: Removing info for No Bus:ptp0
[    3.750160] device: 'ptp0': device_create_release
[    3.755024] fec 30be0000.ethernet: Dropping the link to regulator.2
[    3.761359] fec: probe of 30be0000.ethernet failed with error -2
Quoted 1 line

This reverts commit 13d0ab6750b20957ac1466da4e44dc0af746ff28.

Hi Guido

Please could you test:

https://www.spinics.net/lists/netdev/msg545573.html

Thanks
Andrew

author Tested-by
#2 lore raw

Hi,

Quoted 17 lines · Andrew Lunn
Quoted 16 lines · Guido Günther

This unbreaks ethernet on e.g. the NXP imx8mq-evk using the fec driver. Otherwise it fails like:

[    3.702671] device: '30be0000.ethernet-1': device_add
[    3.707783] PM: Adding info for No Bus:30be0000.ethernet-1
[    3.713329] libphy: fec_enet_mii_bus: probed
[    3.717815] mdio_bus 30be0000.ethernet-1:01: error -2 loading PHY driver module for ID 0x004dd074
[    3.726747] PM: Removing info for No Bus:30be0000.ethernet-1
[    3.732460] device: 'pps0': device_unregister
[    3.736911] PM: Removing info for No Bus:pps0
[    3.741317] device: 'ptp0': device_unregister
[    3.745761] PM: Removing info for No Bus:ptp0
[    3.750160] device: 'ptp0': device_create_release
[    3.755024] fec 30be0000.ethernet: Dropping the link to regulator.2
[    3.761359] fec: probe of 30be0000.ethernet failed with error -2
Quoted 7 lines
Quoted 1 line

This reverts commit 13d0ab6750b20957ac1466da4e44dc0af746ff28.

Hi Guido

Please could you test:

https://www.spinics.net/lists/netdev/msg545573.html

Yes, that works. There's indeed no initramfs in this case and the module is built into the kernel. Feel free to add a

Cheers,
-- Guido