Skip to content

Commit

Permalink
PM: don't use [delayed_]work_pending()
Browse files Browse the repository at this point in the history
There's no need to test whether a (delayed) work item is pending
before queueing, flushing or cancelling it, so remove work_pending()
tests used in those cases.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
htejun authored and rafaeljw committed Jan 25, 2013
1 parent a4ca26a commit ed1ac6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kernel/power/autosleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static DECLARE_WORK(suspend_work, try_to_suspend);

void queue_up_suspend_work(void)
{
if (!work_pending(&suspend_work) && autosleep_state > PM_SUSPEND_ON)
if (autosleep_state > PM_SUSPEND_ON)
queue_work(autosleep_wq, &suspend_work);
}

Expand Down
9 changes: 3 additions & 6 deletions kernel/power/qos.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,7 @@ void pm_qos_update_request(struct pm_qos_request *req,
return;
}

if (delayed_work_pending(&req->work))
cancel_delayed_work_sync(&req->work);
cancel_delayed_work_sync(&req->work);

if (new_value != req->node.prio)
pm_qos_update_target(
Expand All @@ -386,8 +385,7 @@ void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value,
"%s called for unknown object.", __func__))
return;

if (delayed_work_pending(&req->work))
cancel_delayed_work_sync(&req->work);
cancel_delayed_work_sync(&req->work);

if (new_value != req->node.prio)
pm_qos_update_target(
Expand Down Expand Up @@ -416,8 +414,7 @@ void pm_qos_remove_request(struct pm_qos_request *req)
return;
}

if (delayed_work_pending(&req->work))
cancel_delayed_work_sync(&req->work);
cancel_delayed_work_sync(&req->work);

pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints,
&req->node, PM_QOS_REMOVE_REQ,
Expand Down

0 comments on commit ed1ac6e

Please sign in to comment.