From patchwork Sat Dec 22 01:57:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 1905231 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D78E6DFAC4 for ; Sat, 22 Dec 2012 02:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752678Ab2LVCCs (ORCPT ); Fri, 21 Dec 2012 21:02:48 -0500 Received: from mail-ie0-f178.google.com ([209.85.223.178]:44420 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265Ab2LVB6T (ORCPT ); Fri, 21 Dec 2012 20:58:19 -0500 Received: by mail-ie0-f178.google.com with SMTP id c12so7220395ieb.9 for ; Fri, 21 Dec 2012 17:58:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=ubeuH15Q6jNlBuW824OTsKFIPzvAKb7zrnlc9LUEOKk=; b=EZgkWcrywZJmqGLYPW9V/z/zC/NS3r/o7mlUVezPHvQxtuuST2YrLgXc/WVoqo6JpN ttTGoxJ/mIBgyxQSTkvHFK+g9CQVErAYT8lH61isriqX/dYWekwcZjeNlbxNQH9ZP+B7 w2qwJqLigQPkOXXzffV/edBVRcr+rTIoucLg7dmj68s8hZO4cPD+HYF0eobFe2fMDhq7 56euce7m78I+5lYitDIXjYABtRIZpIUwjMvysM4nZ01Sis4hpmNQqNFMoj7TY64DPfUa 739SdPZmAp/8vVErCDCK7D1ld4CR0xtJrnv2Nn3JCpi7EpaVyOTLXqc1p8/ScA/SjIPk sbZA== X-Received: by 10.50.57.200 with SMTP id k8mr15514940igq.29.1356141498584; Fri, 21 Dec 2012 17:58:18 -0800 (PST) Received: from htj.dyndns.org.com (c-69-181-251-227.hsd1.ca.comcast.net. [69.181.251.227]) by mx.google.com with ESMTPS id v12sm10975374igv.3.2012.12.21.17.58.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Dec 2012 17:58:17 -0800 (PST) From: Tejun Heo To: linux-kernel@vger.kernel.org Cc: Tejun Heo , "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: [PATCH 11/25] pm: don't use [delayed_]work_pending() Date: Fri, 21 Dec 2012 17:57:01 -0800 Message-Id: <1356141435-17340-12-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1356141435-17340-1-git-send-email-tj@kernel.org> References: <1356141435-17340-1-git-send-email-tj@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There's no need to test whether a (delayed) work item in pending before queueing, flushing or cancelling it. Most uses are unnecessary and quite a few of them are buggy. Remove unnecessary pending tests from pm autosleep and qos. Only compile tested. Signed-off-by: Tejun Heo Cc: "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org --- Please let me know how this patch should be routed. I can take it through the workqueue tree if necessary. Thanks. kernel/power/autosleep.c | 2 +- kernel/power/qos.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/kernel/power/autosleep.c b/kernel/power/autosleep.c index ca304046..c6422ff 100644 --- a/kernel/power/autosleep.c +++ b/kernel/power/autosleep.c @@ -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); } diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 9322ff7..587ddde 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -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( @@ -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( @@ -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,