dm: core: Add a flag for power domain control on device removal
[oweals/u-boot.git] / drivers / core / device-remove.c
index 444e34b4921b047c329866e93d872ddb83b9e8d7..ff5b28cb6a7633753c6060cf9a4e71401a19690d 100644 (file)
@@ -194,8 +194,9 @@ int device_remove(struct udevice *dev, uint flags)
                }
        }
 
-       if (!(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF) &&
-           (dev != gd->cur_serial_dev))
+       if (!(drv->flags &
+             (DM_FLAG_DEFAULT_PD_CTRL_OFF | DM_FLAG_REMOVE_WITH_PD_ON)) &&
+           dev != gd->cur_serial_dev)
                dev_power_domain_off(dev);
 
        if (flags_remove(flags, drv->flags)) {