RE: [EXTERNAL] [PATCH] net: phy: don't issue a module request if a driver is available
From: Suman Ghosh <hidden>
Date: 2025-01-02 09:36:11
mutex_init(&dev->lock);
INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine);
- /* Request the appropriate module unconditionally; don't
- * bother trying to do so only if it isn't already loaded,
- * because that gets complicated. A hotplug event would have
- * done an unconditional modprobe anyway.
- * We don't do normal hotplug because it won't work for MDIO
+ /* We don't do normal hotplug because it won't work for MDIO
* -- because it relies on the device staying around for long
* enough for the driver to get loaded. With MDIO, the NIC
* driver will get bored and give up as soon as it finds that @@ -
724,7 +745,8 @@ struct phy_device *phy_device_create(struct mii_bus
*bus, int addr, u32 phy_id,
int i;
for (i = 1; i < num_ids; i++) {
- if (c45_ids->device_ids[i] == 0xffffffff)
+ if (c45_ids->device_ids[i] == 0xffffffff ||
+ phy_driver_exists(c45_ids->device_ids[i]))
continue;
ret = phy_request_driver_module(dev, @@ -732,7 +754,7 @@
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32
phy_id,
if (ret)
break;
}
- } else {
+ } else if (!phy_driver_exists(phy_id)) {[Suman] Can we add this phy_driver_exists() API call before the if/else check?
ret = phy_request_driver_module(dev, phy_id); }