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>
This commit is contained in:
parent
0d9c76aedb
commit
afdb32f2e4
@ -1259,7 +1259,7 @@ static int menelaus_probe(struct i2c_client *client,
|
|||||||
return 0;
|
return 0;
|
||||||
fail2:
|
fail2:
|
||||||
free_irq(client->irq, menelaus);
|
free_irq(client->irq, menelaus);
|
||||||
flush_scheduled_work();
|
flush_work_sync(&menelaus->work);
|
||||||
fail1:
|
fail1:
|
||||||
kfree(menelaus);
|
kfree(menelaus);
|
||||||
return err;
|
return err;
|
||||||
@ -1270,6 +1270,7 @@ static int __exit menelaus_remove(struct i2c_client *client)
|
|||||||
struct menelaus_chip *menelaus = i2c_get_clientdata(client);
|
struct menelaus_chip *menelaus = i2c_get_clientdata(client);
|
||||||
|
|
||||||
free_irq(client->irq, menelaus);
|
free_irq(client->irq, menelaus);
|
||||||
|
flush_work_sync(&menelaus->work);
|
||||||
kfree(menelaus);
|
kfree(menelaus);
|
||||||
the_menelaus = NULL;
|
the_menelaus = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -242,7 +242,7 @@ static int dbg_show(struct seq_file *s, void *_)
|
|||||||
seq_printf(s, "mask2 %s\n", buf);
|
seq_printf(s, "mask2 %s\n", buf);
|
||||||
/* ignore ackint2 */
|
/* ignore ackint2 */
|
||||||
|
|
||||||
(void) schedule_delayed_work(&tps->work, POWER_POLL_DELAY);
|
schedule_delayed_work(&tps->work, POWER_POLL_DELAY);
|
||||||
|
|
||||||
|
|
||||||
/* VMAIN voltage, enable lowpower, etc */
|
/* VMAIN voltage, enable lowpower, etc */
|
||||||
@ -400,7 +400,7 @@ static void tps65010_interrupt(struct tps65010 *tps)
|
|||||||
&& (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC)))
|
&& (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC)))
|
||||||
poll = 1;
|
poll = 1;
|
||||||
if (poll)
|
if (poll)
|
||||||
(void) schedule_delayed_work(&tps->work, POWER_POLL_DELAY);
|
schedule_delayed_work(&tps->work, POWER_POLL_DELAY);
|
||||||
|
|
||||||
/* also potentially gpio-in rise or fall */
|
/* also potentially gpio-in rise or fall */
|
||||||
}
|
}
|
||||||
@ -410,7 +410,7 @@ static void tps65010_work(struct work_struct *work)
|
|||||||
{
|
{
|
||||||
struct tps65010 *tps;
|
struct tps65010 *tps;
|
||||||
|
|
||||||
tps = container_of(work, struct tps65010, work.work);
|
tps = container_of(to_delayed_work(work), struct tps65010, work);
|
||||||
mutex_lock(&tps->lock);
|
mutex_lock(&tps->lock);
|
||||||
|
|
||||||
tps65010_interrupt(tps);
|
tps65010_interrupt(tps);
|
||||||
@ -448,7 +448,7 @@ static irqreturn_t tps65010_irq(int irq, void *_tps)
|
|||||||
|
|
||||||
disable_irq_nosync(irq);
|
disable_irq_nosync(irq);
|
||||||
set_bit(FLAG_IRQ_ENABLE, &tps->flags);
|
set_bit(FLAG_IRQ_ENABLE, &tps->flags);
|
||||||
(void) schedule_work(&tps->work.work);
|
schedule_delayed_work(&tps->work, 0);
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,8 +527,7 @@ static int __exit tps65010_remove(struct i2c_client *client)
|
|||||||
}
|
}
|
||||||
if (client->irq > 0)
|
if (client->irq > 0)
|
||||||
free_irq(client->irq, tps);
|
free_irq(client->irq, tps);
|
||||||
cancel_delayed_work(&tps->work);
|
cancel_delayed_work_sync(&tps->work);
|
||||||
flush_scheduled_work();
|
|
||||||
debugfs_remove(tps->file);
|
debugfs_remove(tps->file);
|
||||||
kfree(tps);
|
kfree(tps);
|
||||||
the_tps = NULL;
|
the_tps = NULL;
|
||||||
@ -720,7 +719,7 @@ int tps65010_set_vbus_draw(unsigned mA)
|
|||||||
&& test_and_set_bit(
|
&& test_and_set_bit(
|
||||||
FLAG_VBUS_CHANGED, &the_tps->flags)) {
|
FLAG_VBUS_CHANGED, &the_tps->flags)) {
|
||||||
/* gadget drivers call this in_irq() */
|
/* gadget drivers call this in_irq() */
|
||||||
(void) schedule_work(&the_tps->work.work);
|
schedule_delayed_work(&the_tps->work, 0);
|
||||||
}
|
}
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user