Commit afdb32f2e463a195c104555ac9a8cdd39a2b6561
1 parent
0d9c76aedb
Exists in
master
and in
4 other branches
mfd: update workqueue usages
flush_scheduled_work() is deprecated and scheduled to be removed. * In menelaus, flush menelaus->work directly on probe failure. Also, make sure the work isn't running on removal. * In tps65010, cancel_delayed_work() + flush_scheduled_work() -> cancel_delayed_work_sync(). While at it, remove unnecessary (void) casts on return value, and use schedule_delayed_work() and to_delayed_work() instead of using delayed_work's internal work field. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Samuel Ortiz <sameo@linux.intel.com>
Showing 2 changed files with 8 additions and 8 deletions Side-by-side Diff
drivers/mfd/menelaus.c
... | ... | @@ -1259,7 +1259,7 @@ |
1259 | 1259 | return 0; |
1260 | 1260 | fail2: |
1261 | 1261 | free_irq(client->irq, menelaus); |
1262 | - flush_scheduled_work(); | |
1262 | + flush_work_sync(&menelaus->work); | |
1263 | 1263 | fail1: |
1264 | 1264 | kfree(menelaus); |
1265 | 1265 | return err; |
... | ... | @@ -1270,6 +1270,7 @@ |
1270 | 1270 | struct menelaus_chip *menelaus = i2c_get_clientdata(client); |
1271 | 1271 | |
1272 | 1272 | free_irq(client->irq, menelaus); |
1273 | + flush_work_sync(&menelaus->work); | |
1273 | 1274 | kfree(menelaus); |
1274 | 1275 | the_menelaus = NULL; |
1275 | 1276 | return 0; |
drivers/mfd/tps65010.c
... | ... | @@ -242,7 +242,7 @@ |
242 | 242 | seq_printf(s, "mask2 %s\n", buf); |
243 | 243 | /* ignore ackint2 */ |
244 | 244 | |
245 | - (void) schedule_delayed_work(&tps->work, POWER_POLL_DELAY); | |
245 | + schedule_delayed_work(&tps->work, POWER_POLL_DELAY); | |
246 | 246 | |
247 | 247 | |
248 | 248 | /* VMAIN voltage, enable lowpower, etc */ |
... | ... | @@ -400,7 +400,7 @@ |
400 | 400 | && (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC))) |
401 | 401 | poll = 1; |
402 | 402 | if (poll) |
403 | - (void) schedule_delayed_work(&tps->work, POWER_POLL_DELAY); | |
403 | + schedule_delayed_work(&tps->work, POWER_POLL_DELAY); | |
404 | 404 | |
405 | 405 | /* also potentially gpio-in rise or fall */ |
406 | 406 | } |
... | ... | @@ -410,7 +410,7 @@ |
410 | 410 | { |
411 | 411 | struct tps65010 *tps; |
412 | 412 | |
413 | - tps = container_of(work, struct tps65010, work.work); | |
413 | + tps = container_of(to_delayed_work(work), struct tps65010, work); | |
414 | 414 | mutex_lock(&tps->lock); |
415 | 415 | |
416 | 416 | tps65010_interrupt(tps); |
... | ... | @@ -448,7 +448,7 @@ |
448 | 448 | |
449 | 449 | disable_irq_nosync(irq); |
450 | 450 | set_bit(FLAG_IRQ_ENABLE, &tps->flags); |
451 | - (void) schedule_work(&tps->work.work); | |
451 | + schedule_delayed_work(&tps->work, 0); | |
452 | 452 | return IRQ_HANDLED; |
453 | 453 | } |
454 | 454 | |
... | ... | @@ -527,8 +527,7 @@ |
527 | 527 | } |
528 | 528 | if (client->irq > 0) |
529 | 529 | free_irq(client->irq, tps); |
530 | - cancel_delayed_work(&tps->work); | |
531 | - flush_scheduled_work(); | |
530 | + cancel_delayed_work_sync(&tps->work); | |
532 | 531 | debugfs_remove(tps->file); |
533 | 532 | kfree(tps); |
534 | 533 | the_tps = NULL; |
... | ... | @@ -720,7 +719,7 @@ |
720 | 719 | && test_and_set_bit( |
721 | 720 | FLAG_VBUS_CHANGED, &the_tps->flags)) { |
722 | 721 | /* gadget drivers call this in_irq() */ |
723 | - (void) schedule_work(&the_tps->work.work); | |
722 | + schedule_delayed_work(&the_tps->work, 0); | |
724 | 723 | } |
725 | 724 | local_irq_restore(flags); |
726 | 725 |