These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / mmc / core / sdio_bus.c
index bee02e6..7e327a6 100644 (file)
@@ -137,6 +137,10 @@ static int sdio_bus_probe(struct device *dev)
        if (!id)
                return -ENODEV;
 
+       ret = dev_pm_domain_attach(dev, false);
+       if (ret == -EPROBE_DEFER)
+               return ret;
+
        /* Unbound SDIO functions are always suspended.
         * During probe, the function is set active and the usage count
         * is incremented.  If the driver supports runtime PM,
@@ -166,6 +170,7 @@ static int sdio_bus_probe(struct device *dev)
 disable_runtimepm:
        if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
                pm_runtime_put_noidle(dev);
+       dev_pm_domain_detach(dev, false);
        return ret;
 }
 
@@ -197,6 +202,8 @@ static int sdio_bus_remove(struct device *dev)
        if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
                pm_runtime_put_sync(dev);
 
+       dev_pm_domain_detach(dev, false);
+
        return ret;
 }
 
@@ -316,10 +323,8 @@ int sdio_add_func(struct sdio_func *func)
        sdio_set_of_node(func);
        sdio_acpi_set_handle(func);
        ret = device_add(&func->dev);
-       if (ret == 0) {
+       if (ret == 0)
                sdio_func_set_present(func);
-               dev_pm_domain_attach(&func->dev, false);
-       }
 
        return ret;
 }
@@ -335,7 +340,6 @@ void sdio_remove_func(struct sdio_func *func)
        if (!sdio_func_present(func))
                return;
 
-       dev_pm_domain_detach(&func->dev, false);
        device_del(&func->dev);
        of_node_put(func->dev.of_node);
        put_device(&func->dev);