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

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
...@@ -295,7 +295,7 @@ static struct { ...@@ -295,7 +295,7 @@ static struct {
static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state) static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state)
{ {
/* flush all pending status updates */ /* flush all pending status updates */
flush_scheduled_work(); flush_work_sync(&bat_work);
return 0; return 0;
} }
...@@ -362,7 +362,7 @@ static int __devinit collie_bat_probe(struct ucb1x00_dev *dev) ...@@ -362,7 +362,7 @@ static int __devinit collie_bat_probe(struct ucb1x00_dev *dev)
err_psy_reg_main: err_psy_reg_main:
/* see comment in collie_bat_remove */ /* see comment in collie_bat_remove */
flush_scheduled_work(); cancel_work_sync(&bat_work);
i--; i--;
err_gpio: err_gpio:
...@@ -382,12 +382,11 @@ static void __devexit collie_bat_remove(struct ucb1x00_dev *dev) ...@@ -382,12 +382,11 @@ static void __devexit collie_bat_remove(struct ucb1x00_dev *dev)
power_supply_unregister(&collie_bat_main.psy); power_supply_unregister(&collie_bat_main.psy);
/* /*
* now flush all pending work. * Now cancel the bat_work. We won't get any more schedules,
* we won't get any more schedules, since all * since all sources (isr and external_power_changed) are
* sources (isr and external_power_changed) * unregistered now.
* are unregistered now.
*/ */
flush_scheduled_work(); cancel_work_sync(&bat_work);
for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
gpio_free(gpios[i].gpio); gpio_free(gpios[i].gpio);
......
...@@ -767,7 +767,7 @@ static int __devexit platform_pmic_battery_remove(struct platform_device *pdev) ...@@ -767,7 +767,7 @@ static int __devexit platform_pmic_battery_remove(struct platform_device *pdev)
power_supply_unregister(&pbi->usb); power_supply_unregister(&pbi->usb);
power_supply_unregister(&pbi->batt); power_supply_unregister(&pbi->batt);
flush_scheduled_work(); cancel_work_sync(&pbi->handler);
kfree(pbi); kfree(pbi);
return 0; return 0;
} }
......
...@@ -201,7 +201,7 @@ EXPORT_SYMBOL_GPL(power_supply_register); ...@@ -201,7 +201,7 @@ EXPORT_SYMBOL_GPL(power_supply_register);
void power_supply_unregister(struct power_supply *psy) void power_supply_unregister(struct power_supply *psy)
{ {
flush_scheduled_work(); cancel_work_sync(&psy->changed_work);
power_supply_remove_triggers(psy); power_supply_remove_triggers(psy);
device_unregister(psy->dev); device_unregister(psy->dev);
} }
......
...@@ -332,7 +332,7 @@ static struct { ...@@ -332,7 +332,7 @@ static struct {
static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state) static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state)
{ {
/* flush all pending status updates */ /* flush all pending status updates */
flush_scheduled_work(); flush_work_sync(&bat_work);
return 0; return 0;
} }
...@@ -422,7 +422,7 @@ static int __devinit tosa_bat_probe(struct platform_device *dev) ...@@ -422,7 +422,7 @@ static int __devinit tosa_bat_probe(struct platform_device *dev)
err_psy_reg_main: err_psy_reg_main:
/* see comment in tosa_bat_remove */ /* see comment in tosa_bat_remove */
flush_scheduled_work(); cancel_work_sync(&bat_work);
i--; i--;
err_gpio: err_gpio:
...@@ -445,12 +445,11 @@ static int __devexit tosa_bat_remove(struct platform_device *dev) ...@@ -445,12 +445,11 @@ static int __devexit tosa_bat_remove(struct platform_device *dev)
power_supply_unregister(&tosa_bat_main.psy); power_supply_unregister(&tosa_bat_main.psy);
/* /*
* now flush all pending work. * Now cancel the bat_work. We won't get any more schedules,
* we won't get any more schedules, since all * since all sources (isr and external_power_changed) are
* sources (isr and external_power_changed) * unregistered now.
* are unregistered now.
*/ */
flush_scheduled_work(); cancel_work_sync(&bat_work);
for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
gpio_free(gpios[i].gpio); gpio_free(gpios[i].gpio);
......
...@@ -147,7 +147,7 @@ static irqreturn_t wm97xx_chrg_irq(int irq, void *data) ...@@ -147,7 +147,7 @@ static irqreturn_t wm97xx_chrg_irq(int irq, void *data)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int wm97xx_bat_suspend(struct device *dev) static int wm97xx_bat_suspend(struct device *dev)
{ {
flush_scheduled_work(); flush_work_sync(&bat_work);
return 0; return 0;
} }
...@@ -273,7 +273,7 @@ static int __devexit wm97xx_bat_remove(struct platform_device *dev) ...@@ -273,7 +273,7 @@ static int __devexit wm97xx_bat_remove(struct platform_device *dev)
free_irq(gpio_to_irq(pdata->charge_gpio), dev); free_irq(gpio_to_irq(pdata->charge_gpio), dev);
gpio_free(pdata->charge_gpio); gpio_free(pdata->charge_gpio);
} }
flush_scheduled_work(); cancel_work_sync(&bat_work);
power_supply_unregister(&bat_ps); power_supply_unregister(&bat_ps);
kfree(prop); kfree(prop);
return 0; return 0;
......
...@@ -254,7 +254,7 @@ static int __devexit z2_batt_remove(struct i2c_client *client) ...@@ -254,7 +254,7 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
struct z2_charger *charger = i2c_get_clientdata(client); struct z2_charger *charger = i2c_get_clientdata(client);
struct z2_battery_info *info = charger->info; struct z2_battery_info *info = charger->info;
flush_scheduled_work(); cancel_work_sync(&charger->bat_work);
power_supply_unregister(&charger->batt_ps); power_supply_unregister(&charger->batt_ps);
kfree(charger->batt_ps.properties); kfree(charger->batt_ps.properties);
...@@ -271,7 +271,9 @@ static int __devexit z2_batt_remove(struct i2c_client *client) ...@@ -271,7 +271,9 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int z2_batt_suspend(struct i2c_client *client, pm_message_t state) static int z2_batt_suspend(struct i2c_client *client, pm_message_t state)
{ {
flush_scheduled_work(); struct z2_charger *charger = i2c_get_clientdata(client);
flush_work_sync(&charger->bat_work);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment