]> Pileus Git - ~andy/linux/blobdiff - drivers/regulator/core.c
regulator: core: Use the power efficient workqueue for delayed powerdown
[~andy/linux] / drivers / regulator / core.c
index 288c75abc19034c06e62772ea6b6cc62242da473..f49c6615dc3724330604b98d593ac02fc6770abf 100644 (file)
@@ -1890,8 +1890,9 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
        rdev->deferred_disables++;
        mutex_unlock(&rdev->mutex);
 
-       ret = schedule_delayed_work(&rdev->disable_work,
-                                   msecs_to_jiffies(ms));
+       ret = queue_delayed_work(system_power_efficient_wq,
+                                &rdev->disable_work,
+                                msecs_to_jiffies(ms));
        if (ret < 0)
                return ret;
        else
@@ -3740,8 +3741,11 @@ void regulator_unregister(struct regulator_dev *rdev)
        if (rdev == NULL)
                return;
 
-       if (rdev->supply)
+       if (rdev->supply) {
+               while (rdev->use_count--)
+                       regulator_disable(rdev->supply);
                regulator_put(rdev->supply);
+       }
        mutex_lock(&regulator_list_mutex);
        debugfs_remove_recursive(rdev->debugfs);
        flush_work(&rdev->disable_work.work);