Merge tag 'pm+acpi-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[cascardo/linux.git] / drivers / spi / spi.c
index e19512f..ebcb33d 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/spi/spi.h>
 #include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
+#include <linux/pm_domain.h>
 #include <linux/export.h>
 #include <linux/sched/rt.h>
 #include <linux/delay.h>
@@ -264,10 +265,12 @@ static int spi_drv_probe(struct device *dev)
        if (ret)
                return ret;
 
-       acpi_dev_pm_attach(dev, true);
-       ret = sdrv->probe(to_spi_device(dev));
-       if (ret)
-               acpi_dev_pm_detach(dev, true);
+       ret = dev_pm_domain_attach(dev, true);
+       if (ret != -EPROBE_DEFER) {
+               ret = sdrv->probe(to_spi_device(dev));
+               if (ret)
+                       dev_pm_domain_detach(dev, true);
+       }
 
        return ret;
 }
@@ -278,7 +281,7 @@ static int spi_drv_remove(struct device *dev)
        int ret;
 
        ret = sdrv->remove(to_spi_device(dev));
-       acpi_dev_pm_detach(dev, true);
+       dev_pm_domain_detach(dev, true);
 
        return ret;
 }