Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc51e7ff authored by Tejun Heo's avatar Tejun Heo Committed by Anton Vorontsov
Browse files

power_supply: Don't use flush_scheduled_work()



flush_scheduled_work() is deprecated and scheduled to be removed.

In battery drivers, the work can be canceled on probe failure and
removal and should be flushed on suspend.  Replace
flush_scheduled_work() usages with direct cancels and flushes.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
parent 3a2dbd61
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ static struct {
static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state)
{
	/* flush all pending status updates */
	flush_scheduled_work();
	flush_work_sync(&bat_work);
	return 0;
}

@@ -362,7 +362,7 @@ static int __devinit collie_bat_probe(struct ucb1x00_dev *dev)
err_psy_reg_main:

	/* see comment in collie_bat_remove */
	flush_scheduled_work();
	cancel_work_sync(&bat_work);

	i--;
err_gpio:
@@ -382,12 +382,11 @@ static void __devexit collie_bat_remove(struct ucb1x00_dev *dev)
	power_supply_unregister(&collie_bat_main.psy);

	/*
	 * now flush all pending work.
	 * we won't get any more schedules, since all
	 * sources (isr and external_power_changed)
	 * are unregistered now.
	 * Now cancel the bat_work.  We won't get any more schedules,
	 * since all sources (isr and external_power_changed) are
	 * unregistered now.
	 */
	flush_scheduled_work();
	cancel_work_sync(&bat_work);

	for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
		gpio_free(gpios[i].gpio);
+1 −1
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ static int __devexit platform_pmic_battery_remove(struct platform_device *pdev)
	power_supply_unregister(&pbi->usb);
	power_supply_unregister(&pbi->batt);

	flush_scheduled_work();
	cancel_work_sync(&pbi->handler);
	kfree(pbi);
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ EXPORT_SYMBOL_GPL(power_supply_register);

void power_supply_unregister(struct power_supply *psy)
{
	flush_scheduled_work();
	cancel_work_sync(&psy->changed_work);
	power_supply_remove_triggers(psy);
	device_unregister(psy->dev);
}
+6 −7
Original line number Diff line number Diff line
@@ -332,7 +332,7 @@ static struct {
static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state)
{
	/* flush all pending status updates */
	flush_scheduled_work();
	flush_work_sync(&bat_work);
	return 0;
}

@@ -422,7 +422,7 @@ static int __devinit tosa_bat_probe(struct platform_device *dev)
err_psy_reg_main:

	/* see comment in tosa_bat_remove */
	flush_scheduled_work();
	cancel_work_sync(&bat_work);

	i--;
err_gpio:
@@ -445,12 +445,11 @@ static int __devexit tosa_bat_remove(struct platform_device *dev)
	power_supply_unregister(&tosa_bat_main.psy);

	/*
	 * now flush all pending work.
	 * we won't get any more schedules, since all
	 * sources (isr and external_power_changed)
	 * are unregistered now.
	 * Now cancel the bat_work.  We won't get any more schedules,
	 * since all sources (isr and external_power_changed) are
	 * unregistered now.
	 */
	flush_scheduled_work();
	cancel_work_sync(&bat_work);

	for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
		gpio_free(gpios[i].gpio);
+2 −2
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ static irqreturn_t wm97xx_chrg_irq(int irq, void *data)
#ifdef CONFIG_PM
static int wm97xx_bat_suspend(struct device *dev)
{
	flush_scheduled_work();
	flush_work_sync(&bat_work);
	return 0;
}

@@ -273,7 +273,7 @@ static int __devexit wm97xx_bat_remove(struct platform_device *dev)
		free_irq(gpio_to_irq(pdata->charge_gpio), dev);
		gpio_free(pdata->charge_gpio);
	}
	flush_scheduled_work();
	cancel_work_sync(&bat_work);
	power_supply_unregister(&bat_ps);
	kfree(prop);
	return 0;
Loading