aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-12-11 11:51:45 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2010-12-21 18:39:56 -0500
commitbc51e7ff521f28a7f14dc2f25307ad9101d1305a (patch)
tree011477cb2e90d2038261170a4e688f795d6720f9 /drivers/power
parent3a2dbd611b38cf9a026c0099a85701ad183d1949 (diff)
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: Tejun Heo <tj@kernel.org> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/collie_battery.c13
-rw-r--r--drivers/power/intel_mid_battery.c2
-rw-r--r--drivers/power/power_supply_core.c2
-rw-r--r--drivers/power/tosa_battery.c13
-rw-r--r--drivers/power/wm97xx_battery.c4
-rw-r--r--drivers/power/z2_battery.c6
6 files changed, 20 insertions, 20 deletions
diff --git a/drivers/power/collie_battery.c b/drivers/power/collie_battery.c
index 039f41ae217d..548d263b1ad0 100644
--- a/drivers/power/collie_battery.c
+++ b/drivers/power/collie_battery.c
@@ -295,7 +295,7 @@ static struct {
295static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state) 295static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state)
296{ 296{
297 /* flush all pending status updates */ 297 /* flush all pending status updates */
298 flush_scheduled_work(); 298 flush_work_sync(&bat_work);
299 return 0; 299 return 0;
300} 300}
301 301
@@ -362,7 +362,7 @@ err_psy_reg_bu:
362err_psy_reg_main: 362err_psy_reg_main:
363 363
364 /* see comment in collie_bat_remove */ 364 /* see comment in collie_bat_remove */
365 flush_scheduled_work(); 365 cancel_work_sync(&bat_work);
366 366
367 i--; 367 i--;
368err_gpio: 368err_gpio:
@@ -382,12 +382,11 @@ static void __devexit collie_bat_remove(struct ucb1x00_dev *dev)
382 power_supply_unregister(&collie_bat_main.psy); 382 power_supply_unregister(&collie_bat_main.psy);
383 383
384 /* 384 /*
385 * now flush all pending work. 385 * Now cancel the bat_work. We won't get any more schedules,
386 * we won't get any more schedules, since all 386 * since all sources (isr and external_power_changed) are
387 * sources (isr and external_power_changed) 387 * unregistered now.
388 * are unregistered now.
389 */ 388 */
390 flush_scheduled_work(); 389 cancel_work_sync(&bat_work);
391 390
392 for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) 391 for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
393 gpio_free(gpios[i].gpio); 392 gpio_free(gpios[i].gpio);
diff --git a/drivers/power/intel_mid_battery.c b/drivers/power/intel_mid_battery.c
index 2a10cd361181..236147c3a5c6 100644
--- a/drivers/power/intel_mid_battery.c
+++ b/drivers/power/intel_mid_battery.c
@@ -767,7 +767,7 @@ static int __devexit platform_pmic_battery_remove(struct platform_device *pdev)
767 power_supply_unregister(&pbi->usb); 767 power_supply_unregister(&pbi->usb);
768 power_supply_unregister(&pbi->batt); 768 power_supply_unregister(&pbi->batt);
769 769
770 flush_scheduled_work(); 770 cancel_work_sync(&pbi->handler);
771 kfree(pbi); 771 kfree(pbi);
772 return 0; 772 return 0;
773} 773}
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index f06bad047d76..970f7335d3a7 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -201,7 +201,7 @@ EXPORT_SYMBOL_GPL(power_supply_register);
201 201
202void power_supply_unregister(struct power_supply *psy) 202void power_supply_unregister(struct power_supply *psy)
203{ 203{
204 flush_scheduled_work(); 204 cancel_work_sync(&psy->changed_work);
205 power_supply_remove_triggers(psy); 205 power_supply_remove_triggers(psy);
206 device_unregister(psy->dev); 206 device_unregister(psy->dev);
207} 207}
diff --git a/drivers/power/tosa_battery.c b/drivers/power/tosa_battery.c
index ee04936b2db5..53f0d3524fcd 100644
--- a/drivers/power/tosa_battery.c
+++ b/drivers/power/tosa_battery.c
@@ -332,7 +332,7 @@ static struct {
332static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state) 332static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state)
333{ 333{
334 /* flush all pending status updates */ 334 /* flush all pending status updates */
335 flush_scheduled_work(); 335 flush_work_sync(&bat_work);
336 return 0; 336 return 0;
337} 337}
338 338
@@ -422,7 +422,7 @@ err_psy_reg_jacket:
422err_psy_reg_main: 422err_psy_reg_main:
423 423
424 /* see comment in tosa_bat_remove */ 424 /* see comment in tosa_bat_remove */
425 flush_scheduled_work(); 425 cancel_work_sync(&bat_work);
426 426
427 i--; 427 i--;
428err_gpio: 428err_gpio:
@@ -445,12 +445,11 @@ static int __devexit tosa_bat_remove(struct platform_device *dev)
445 power_supply_unregister(&tosa_bat_main.psy); 445 power_supply_unregister(&tosa_bat_main.psy);
446 446
447 /* 447 /*
448 * now flush all pending work. 448 * Now cancel the bat_work. We won't get any more schedules,
449 * we won't get any more schedules, since all 449 * since all sources (isr and external_power_changed) are
450 * sources (isr and external_power_changed) 450 * unregistered now.
451 * are unregistered now.
452 */ 451 */
453 flush_scheduled_work(); 452 cancel_work_sync(&bat_work);
454 453
455 for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) 454 for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
456 gpio_free(gpios[i].gpio); 455 gpio_free(gpios[i].gpio);
diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c
index 5071d85ec12d..156559e56fa5 100644
--- a/drivers/power/wm97xx_battery.c
+++ b/drivers/power/wm97xx_battery.c
@@ -147,7 +147,7 @@ static irqreturn_t wm97xx_chrg_irq(int irq, void *data)
147#ifdef CONFIG_PM 147#ifdef CONFIG_PM
148static int wm97xx_bat_suspend(struct device *dev) 148static int wm97xx_bat_suspend(struct device *dev)
149{ 149{
150 flush_scheduled_work(); 150 flush_work_sync(&bat_work);
151 return 0; 151 return 0;
152} 152}
153 153
@@ -273,7 +273,7 @@ static int __devexit wm97xx_bat_remove(struct platform_device *dev)
273 free_irq(gpio_to_irq(pdata->charge_gpio), dev); 273 free_irq(gpio_to_irq(pdata->charge_gpio), dev);
274 gpio_free(pdata->charge_gpio); 274 gpio_free(pdata->charge_gpio);
275 } 275 }
276 flush_scheduled_work(); 276 cancel_work_sync(&bat_work);
277 power_supply_unregister(&bat_ps); 277 power_supply_unregister(&bat_ps);
278 kfree(prop); 278 kfree(prop);
279 return 0; 279 return 0;
diff --git a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c
index 85064a9f649e..e5ed52d71937 100644
--- a/drivers/power/z2_battery.c
+++ b/drivers/power/z2_battery.c
@@ -254,7 +254,7 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
254 struct z2_charger *charger = i2c_get_clientdata(client); 254 struct z2_charger *charger = i2c_get_clientdata(client);
255 struct z2_battery_info *info = charger->info; 255 struct z2_battery_info *info = charger->info;
256 256
257 flush_scheduled_work(); 257 cancel_work_sync(&charger->bat_work);
258 power_supply_unregister(&charger->batt_ps); 258 power_supply_unregister(&charger->batt_ps);
259 259
260 kfree(charger->batt_ps.properties); 260 kfree(charger->batt_ps.properties);
@@ -271,7 +271,9 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
271#ifdef CONFIG_PM 271#ifdef CONFIG_PM
272static int z2_batt_suspend(struct i2c_client *client, pm_message_t state) 272static int z2_batt_suspend(struct i2c_client *client, pm_message_t state)
273{ 273{
274 flush_scheduled_work(); 274 struct z2_charger *charger = i2c_get_clientdata(client);
275
276 flush_work_sync(&charger->bat_work);
275 return 0; 277 return 0;
276} 278}
277 279