From patchwork Fri Feb 15 12:45:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14884 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DEBDD23E2E for ; Fri, 15 Feb 2013 12:47:25 +0000 (UTC) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) by fiordland.canonical.com (Postfix) with ESMTP id AAF2FA197C4 for ; Fri, 15 Feb 2013 12:47:25 +0000 (UTC) Received: by mail-vb0-f43.google.com with SMTP id fs19so2126337vbb.2 for ; Fri, 15 Feb 2013 04:47:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=YH7GKCc/Qs06x0SJi5qunitfVBSpo7dV3jDTZCNs7Ew=; b=XVwHiZZRaq46YQiN7weR6fSsQLmKHPZgnCMy5PFsL+2rtyD6Wzw8PmARROidNXib4P XZxo7GEsqc+AeZMaajR3Q5mYrkju0171sb1yUg6ZDNRpxI/u7eHya+AfZr0DkcgEDxRO krSmYbO3pt0IQVHZPTrS5HKSXayEeIdS/91nlUKZLmkMPQ1UfQkaFL2jyYn2q6kErnS5 6umvuiE+QlrnoanHN3W0zPgZdKMHv676xkJbOSeLqnXBEFNKGO0SvAXOvWlqwoJIth3B XXn9cUgAjIM8aTHw4SZtGW7/6516PY6V5DLEi4IcRbi4+MEB/Esds380OEYcSdLwpb/L yDhQ== X-Received: by 10.58.40.9 with SMTP id t9mr3075144vek.10.1360932445201; Fri, 15 Feb 2013 04:47:25 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp10934vcb; Fri, 15 Feb 2013 04:47:24 -0800 (PST) X-Received: by 10.194.83.105 with SMTP id p9mr3860719wjy.56.1360932430101; Fri, 15 Feb 2013 04:47:10 -0800 (PST) Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]) by mx.google.com with ESMTPS id fo3si1032842wib.99.2013.02.15.04.47.09 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:47:10 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22f is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22f; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::22f is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f175.google.com with SMTP id x8so2851245wey.6 for ; Fri, 15 Feb 2013 04:47:09 -0800 (PST) X-Received: by 10.194.235.196 with SMTP id uo4mr3955832wjc.30.1360932429106; Fri, 15 Feb 2013 04:47:09 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id bs6sm5133904wib.4.2013.02.15.04.47.07 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:47:08 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, cbouatmailru@gmail.com, sameo@linux.intel.com, Lee Jones Subject: [PATCH 40/40] ab8500-charger: Do not use [delayed_]work_pending() Date: Fri, 15 Feb 2013 12:45:10 +0000 Message-Id: <1360932310-30065-41-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360932310-30065-1-git-send-email-lee.jones@linaro.org> References: <1360932310-30065-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkEB5ZGjEAgfi1SawpPciQWBPZ2e3hltH0WHLWSfMHlERr0FrJ4B/qpv4cRVQbZmJYcRQYT 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: Lee Jones --- drivers/power/ab8500_charger.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 81c9615..a558318 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -1661,8 +1661,7 @@ static int ab8500_charger_usb_en(struct ux500_charger *charger, dev_dbg(di->dev, "%s Disabled USB charging\n", __func__); /* 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); @@ -3335,11 +3334,8 @@ static int ab8500_charger_resume(struct platform_device *pdev) dev_err(di->dev, "Failed to kick WD!\n"); /* If not already pending start a new timer */ - if (!delayed_work_pending( - &di->kick_wd_work)) { - queue_delayed_work(di->charger_wq, &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 */ @@ -3359,12 +3355,9 @@ static int ab8500_charger_suspend(struct platform_device *pdev, { struct ab8500_charger *di = platform_get_drvdata(pdev); - /* Cancel any pending HW failure check */ - if (delayed_work_pending(&di->check_hw_failure_work)) - cancel_delayed_work(&di->check_hw_failure_work); - - if (delayed_work_pending(&di->vbus_drop_end_work)) - cancel_delayed_work(&di->vbus_drop_end_work); + /* Cancel any pending jobs */ + cancel_delayed_work(&di->check_hw_failure_work); + cancel_delayed_work(&di->vbus_drop_end_work); flush_delayed_work(&di->attach_work); flush_delayed_work(&di->usb_charger_attached_work);