]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/base/dd.c
drivercore: Bind/unbind power domain on probe/remove
[karo-tx-linux.git] / drivers / base / dd.c
index 8a8d611f202128e02aadb921870efdc6701873b9..4e812a0c445d6f13f2c16c8447496bd6a2609dac 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/kthread.h>
 #include <linux/wait.h>
 #include <linux/async.h>
+#include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
 #include <linux/pinctrl/devinfo.h>
 
@@ -287,6 +288,11 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 
        dev->driver = drv;
 
+       /* If using genpd, bind power domain now before probing */
+       ret = genpd_bind_domain(dev);
+       if (ret)
+               goto probe_failed;
+
        /* If using pinctrl, bind pins now before probing */
        ret = pinctrl_bind_pins(dev);
        if (ret)
@@ -317,6 +323,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 probe_failed:
        devres_release_all(dev);
        driver_sysfs_remove(dev);
+       genpd_unbind_domain(dev);
        dev->driver = NULL;
        dev_set_drvdata(dev, NULL);
 
@@ -530,7 +537,7 @@ static void __device_release_driver(struct device *dev)
                        blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
                                                     BUS_NOTIFY_UNBOUND_DRIVER,
                                                     dev);
-
+               genpd_unbind_domain(dev);
        }
 }