diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/axp20x-regulator.c | 6 | ||||
-rw-r--r-- | drivers/regulator/core.c | 12 | ||||
-rw-r--r-- | drivers/regulator/of_regulator.c | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index e2608fe770b9..f18b36dd57dd 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -691,6 +691,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev) (regulators == axp809_regulators && i == AXP809_DC1SW)) { new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), GFP_KERNEL); + if (!new_desc) + return -ENOMEM; + *new_desc = regulators[i]; new_desc->supply_name = dcdc1_name; desc = new_desc; @@ -700,6 +703,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev) (regulators == axp809_regulators && i == AXP809_DC5LDO)) { new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), GFP_KERNEL); + if (!new_desc) + return -ENOMEM; + *new_desc = regulators[i]; new_desc->supply_name = dcdc5_name; desc = new_desc; diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e567fa54980b..9f4d484eb25d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2396,6 +2396,14 @@ static void regulator_disable_work(struct work_struct *work) count = rdev->deferred_disables; rdev->deferred_disables = 0; + /* + * Workqueue functions queue the new work instance while the previous + * work instance is being processed. Cancel the queued work instance + * as the work instance under processing does the job of the queued + * work instance. + */ + cancel_delayed_work(&rdev->disable_work); + for (i = 0; i < count; i++) { ret = _regulator_disable(rdev); if (ret != 0) @@ -2439,10 +2447,10 @@ int regulator_disable_deferred(struct regulator *regulator, int ms) mutex_lock(&rdev->mutex); rdev->deferred_disables++; + mod_delayed_work(system_power_efficient_wq, &rdev->disable_work, + msecs_to_jiffies(ms)); mutex_unlock(&rdev->mutex); - queue_delayed_work(system_power_efficient_wq, &rdev->disable_work, - msecs_to_jiffies(ms)); return 0; } EXPORT_SYMBOL_GPL(regulator_disable_deferred); diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 96bf75458da5..9dd44dd4cdf6 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -333,7 +333,7 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, search = of_get_child_by_name(dev->of_node, desc->regulators_node); else - search = dev->of_node; + search = of_node_get(dev->of_node); if (!search) { dev_dbg(dev, "Failed to find regulator container node '%s'\n", |