core: device: use dev_power_domain_on
authorPeng Fan <peng.fan@nxp.com>
Tue, 17 Sep 2019 09:29:22 +0000 (09:29 +0000)
committerSimon Glass <sjg@chromium.org>
Tue, 15 Oct 2019 14:40:02 +0000 (08:40 -0600)
When multiple power domains attached to a device, need power on
them all, so use dev_power_domain_on to do that.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/core/device.c

index 24b940eac289bb43aa711c108798c121f40a3c2f..28363ff00bab2c950b6a6cc8b0598211054a02c3 100644 (file)
@@ -312,7 +312,6 @@ static void *alloc_priv(int size, uint flags)
 
 int device_probe(struct udevice *dev)
 {
-       struct power_domain pd;
        const struct driver *drv;
        int size = 0;
        int ret;
@@ -395,8 +394,9 @@ int device_probe(struct udevice *dev)
 
        if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
            device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
-               if (!power_domain_get(dev, &pd))
-                       power_domain_on(&pd);
+               ret = dev_power_domain_on(dev);
+               if (ret)
+                       goto fail;
        }
 
        ret = uclass_pre_probe_device(dev);