Commit 05b35e7eb9a1 ("smsc95xx: add phylib support") amended smsc95xx_resume() to call phy_init_hw(). That function waits for the device to runtime resume even though it is placed in the runtime resume path, causing a deadlock. The problem is that phy_init_hw() calls down to smsc95xx_mdiobus_read(), which never uses the _nopm variant of usbnet_read_cmd(). Amend it to autosense that it's called from the runtime resume/suspend path and use the _nopm variant if so. Stacktrace for posterity: INFO: task kworker/2:1:49 blocked for more than 122 seconds. Workqueue: usb_hub_wq hub_event schedule rpm_resume __pm_runtime_resume usb_autopm_get_interface usbnet_read_cmd __smsc95xx_read_reg __smsc95xx_phy_wait_not_busy __smsc95xx_mdio_read smsc95xx_mdiobus_read __mdiobus_read mdiobus_read smsc_phy_reset phy_init_hw smsc95xx_resume usb_resume_interface usb_resume_both usb_runtime_resume __rpm_callback rpm_callback rpm_resume __pm_runtime_resume usb_autoresume_device hub_event process_one_work Fixes: 05b35e7eb9a1 ("smsc95xx: add phylib support") Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx # v5.10+ Cc: Andre Edich <andre.edich@xxxxxxxxxxxxx> --- drivers/net/usb/smsc95xx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 4ef61f6b85df..82b8feaa5162 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -285,11 +285,21 @@ static void smsc95xx_mdio_write_nopm(struct usbnet *dev, int idx, int regval) __smsc95xx_mdio_write(dev, pdata->phydev->mdio.addr, idx, regval, 1); } +static bool smsc95xx_in_pm(struct usbnet *dev) +{ +#ifdef CONFIG_PM + return dev->udev->dev.power.runtime_status == RPM_RESUMING || + dev->udev->dev.power.runtime_status == RPM_SUSPENDING; +#else + return false; +#endif +} + static int smsc95xx_mdiobus_read(struct mii_bus *bus, int phy_id, int idx) { struct usbnet *dev = bus->priv; - return __smsc95xx_mdio_read(dev, phy_id, idx, 0); + return __smsc95xx_mdio_read(dev, phy_id, idx, smsc95xx_in_pm(dev)); } static int smsc95xx_mdiobus_write(struct mii_bus *bus, int phy_id, int idx, @@ -297,7 +307,7 @@ static int smsc95xx_mdiobus_write(struct mii_bus *bus, int phy_id, int idx, { struct usbnet *dev = bus->priv; - __smsc95xx_mdio_write(dev, phy_id, idx, regval, 0); + __smsc95xx_mdio_write(dev, phy_id, idx, regval, smsc95xx_in_pm(dev)); return 0; } -- 2.35.2