Commit b09f86db authored by Lee Jones's avatar Lee Jones

ab8500-charger: Do not use [delayed_]work_pending()

There's no need to test whether a (delayed) work item is pending
before queueing, flushing or cancelling it.  Most uses are unnecessary
and quite a few of them are buggy.
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 0577610e
...@@ -1661,8 +1661,7 @@ static int ab8500_charger_usb_en(struct ux500_charger *charger, ...@@ -1661,8 +1661,7 @@ static int ab8500_charger_usb_en(struct ux500_charger *charger,
dev_dbg(di->dev, "%s Disabled USB charging\n", __func__); dev_dbg(di->dev, "%s Disabled USB charging\n", __func__);
/* Cancel any pending Vbat check work */ /* Cancel any pending Vbat check work */
if (delayed_work_pending(&di->check_vbat_work)) cancel_delayed_work(&di->check_vbat_work);
cancel_delayed_work(&di->check_vbat_work);
} }
ab8500_power_supply_changed(di, &di->usb_chg.psy); ab8500_power_supply_changed(di, &di->usb_chg.psy);
...@@ -3335,11 +3334,8 @@ static int ab8500_charger_resume(struct platform_device *pdev) ...@@ -3335,11 +3334,8 @@ static int ab8500_charger_resume(struct platform_device *pdev)
dev_err(di->dev, "Failed to kick WD!\n"); dev_err(di->dev, "Failed to kick WD!\n");
/* If not already pending start a new timer */ /* If not already pending start a new timer */
if (!delayed_work_pending( queue_delayed_work(di->charger_wq, &di->kick_wd_work,
&di->kick_wd_work)) { round_jiffies(WD_KICK_INTERVAL));
queue_delayed_work(di->charger_wq, &di->kick_wd_work,
round_jiffies(WD_KICK_INTERVAL));
}
} }
/* If we still have a HW failure, schedule a new check */ /* If we still have a HW failure, schedule a new check */
...@@ -3359,12 +3355,9 @@ static int ab8500_charger_suspend(struct platform_device *pdev, ...@@ -3359,12 +3355,9 @@ static int ab8500_charger_suspend(struct platform_device *pdev,
{ {
struct ab8500_charger *di = platform_get_drvdata(pdev); struct ab8500_charger *di = platform_get_drvdata(pdev);
/* Cancel any pending HW failure check */ /* Cancel any pending jobs */
if (delayed_work_pending(&di->check_hw_failure_work)) cancel_delayed_work(&di->check_hw_failure_work);
cancel_delayed_work(&di->check_hw_failure_work); cancel_delayed_work(&di->vbus_drop_end_work);
if (delayed_work_pending(&di->vbus_drop_end_work))
cancel_delayed_work(&di->vbus_drop_end_work);
flush_delayed_work(&di->attach_work); flush_delayed_work(&di->attach_work);
flush_delayed_work(&di->usb_charger_attached_work); flush_delayed_work(&di->usb_charger_attached_work);
......
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