@@ -320,6 +320,29 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
(phydev->phy_id & phydrv->phy_id_mask));
}
+static int mdio_bus_suspend_unused(struct device *busdev, void *data)
+{
+ struct mii_bus *bus = to_mii_bus(busdev);
+ int i;
+
+ for (i = 0; i < PHY_MAX_ADDR; i++) {
+ if (!bus->phy_map[i])
+ continue;
+
+ if (!bus->phy_map[i]->attached_dev)
+ phy_suspend(bus->phy_map[i]);
+ }
+
+ return 0;
+}
+
+static int mdio_bus_class_suspend_unused(void)
+{
+ return class_for_each_device(&mdio_bus_class, NULL, NULL,
+ mdio_bus_suspend_unused);
+}
+late_initcall_sync(mdio_bus_class_suspend_unused);
+
#ifdef CONFIG_PM
static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)