RE: [EXTERNAL] [PATCH] net: phy: don't issue a module request if a driver is available
From: Suman Ghosh <hidden>
Date: 2025-01-03 07:48:17
quoted
quoted
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 @@structquoted
quoted
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 theif/else check?quoted
Not really, as in case of C45 PHYs we have to check for drivers using (multiple) IDs, which are different from phy_id.
[Suman] Hmm got it. We can isolate the else part but that won't make much difference. Thank you!!