Commit bc51e7ff521f28a7f14dc2f25307ad9101d1305a
Committed by
Anton Vorontsov
1 parent
3a2dbd611b
Exists in
master
and in
4 other branches
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>
Showing 6 changed files with 20 additions and 20 deletions Side-by-side Diff
drivers/power/collie_battery.c
... | ... | @@ -295,7 +295,7 @@ |
295 | 295 | static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state) |
296 | 296 | { |
297 | 297 | /* flush all pending status updates */ |
298 | - flush_scheduled_work(); | |
298 | + flush_work_sync(&bat_work); | |
299 | 299 | return 0; |
300 | 300 | } |
301 | 301 | |
... | ... | @@ -362,7 +362,7 @@ |
362 | 362 | err_psy_reg_main: |
363 | 363 | |
364 | 364 | /* see comment in collie_bat_remove */ |
365 | - flush_scheduled_work(); | |
365 | + cancel_work_sync(&bat_work); | |
366 | 366 | |
367 | 367 | i--; |
368 | 368 | err_gpio: |
369 | 369 | |
... | ... | @@ -382,12 +382,11 @@ |
382 | 382 | power_supply_unregister(&collie_bat_main.psy); |
383 | 383 | |
384 | 384 | /* |
385 | - * now flush all pending work. | |
386 | - * we won't get any more schedules, since all | |
387 | - * sources (isr and external_power_changed) | |
388 | - * are unregistered now. | |
385 | + * Now cancel the bat_work. We won't get any more schedules, | |
386 | + * since all sources (isr and external_power_changed) are | |
387 | + * unregistered now. | |
389 | 388 | */ |
390 | - flush_scheduled_work(); | |
389 | + cancel_work_sync(&bat_work); | |
391 | 390 | |
392 | 391 | for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) |
393 | 392 | gpio_free(gpios[i].gpio); |
drivers/power/intel_mid_battery.c
drivers/power/power_supply_core.c
drivers/power/tosa_battery.c
... | ... | @@ -332,7 +332,7 @@ |
332 | 332 | static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state) |
333 | 333 | { |
334 | 334 | /* flush all pending status updates */ |
335 | - flush_scheduled_work(); | |
335 | + flush_work_sync(&bat_work); | |
336 | 336 | return 0; |
337 | 337 | } |
338 | 338 | |
... | ... | @@ -422,7 +422,7 @@ |
422 | 422 | err_psy_reg_main: |
423 | 423 | |
424 | 424 | /* see comment in tosa_bat_remove */ |
425 | - flush_scheduled_work(); | |
425 | + cancel_work_sync(&bat_work); | |
426 | 426 | |
427 | 427 | i--; |
428 | 428 | err_gpio: |
429 | 429 | |
... | ... | @@ -445,12 +445,11 @@ |
445 | 445 | power_supply_unregister(&tosa_bat_main.psy); |
446 | 446 | |
447 | 447 | /* |
448 | - * now flush all pending work. | |
449 | - * we won't get any more schedules, since all | |
450 | - * sources (isr and external_power_changed) | |
451 | - * are unregistered now. | |
448 | + * Now cancel the bat_work. We won't get any more schedules, | |
449 | + * since all sources (isr and external_power_changed) are | |
450 | + * unregistered now. | |
452 | 451 | */ |
453 | - flush_scheduled_work(); | |
452 | + cancel_work_sync(&bat_work); | |
454 | 453 | |
455 | 454 | for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) |
456 | 455 | gpio_free(gpios[i].gpio); |
drivers/power/wm97xx_battery.c
... | ... | @@ -147,7 +147,7 @@ |
147 | 147 | #ifdef CONFIG_PM |
148 | 148 | static int wm97xx_bat_suspend(struct device *dev) |
149 | 149 | { |
150 | - flush_scheduled_work(); | |
150 | + flush_work_sync(&bat_work); | |
151 | 151 | return 0; |
152 | 152 | } |
153 | 153 | |
... | ... | @@ -273,7 +273,7 @@ |
273 | 273 | free_irq(gpio_to_irq(pdata->charge_gpio), dev); |
274 | 274 | gpio_free(pdata->charge_gpio); |
275 | 275 | } |
276 | - flush_scheduled_work(); | |
276 | + cancel_work_sync(&bat_work); | |
277 | 277 | power_supply_unregister(&bat_ps); |
278 | 278 | kfree(prop); |
279 | 279 | return 0; |
drivers/power/z2_battery.c
... | ... | @@ -254,7 +254,7 @@ |
254 | 254 | struct z2_charger *charger = i2c_get_clientdata(client); |
255 | 255 | struct z2_battery_info *info = charger->info; |
256 | 256 | |
257 | - flush_scheduled_work(); | |
257 | + cancel_work_sync(&charger->bat_work); | |
258 | 258 | power_supply_unregister(&charger->batt_ps); |
259 | 259 | |
260 | 260 | kfree(charger->batt_ps.properties); |
... | ... | @@ -271,7 +271,9 @@ |
271 | 271 | #ifdef CONFIG_PM |
272 | 272 | static 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 | 277 | return 0; |
276 | 278 | } |
277 | 279 |