From patchwork Fri Mar 8 09:53:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 159962 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp8502057jad; Fri, 8 Mar 2019 01:53:21 -0800 (PST) X-Google-Smtp-Source: APXvYqz8M/mpWuXscoVbZqRhxxa0tFPHVeMkZhdiumc4QvwXaRqsq708tsykMuhec2ES5oBI3Xj/ X-Received: by 2002:a63:fc62:: with SMTP id r34mr15941226pgk.154.1552038801330; Fri, 08 Mar 2019 01:53:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552038801; cv=none; d=google.com; s=arc-20160816; b=eZB7K1B2KpKDqvWrIVq3ZXqObZOjTkmdOe2W+mvQqlJP2jZA7DU+rM462yO+aD/dM1 YHjHt7DnJ1gjMzCqNQ87JKej2E27v2YIw8RuVRyo8ocM63FACQ0Du6BQuJ82EWAyc/ne F0BrBjTQTJkhKUW3o+p7195WYm3QlGDK0gO8DJFg4CwWnRsTC5L82H480HRWIFbQMgPm zxJqys3sc8ulQ7yKRmc3Afqv10+C5EvMUPh25+mb53NRDjKgIrKeqtRv8G1yD7KY2dJ5 V8WoqoeY8eoFl/La3g3gZd9KMThrpK4CzC3cqxPw8jTabCH+X2DGLE4X3/VaMhU4Xp5K J+Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Vy96qw906KzwVqq5CS1pkHwqm+ScdE79tDQaBnxqd9k=; b=fgt2RGby/lL6xJb+SkxrwVEt0BxofqxoCK6t+YMhY4yo5HstYnfQXAW1z1mvCehUtv qIDBRxDJa3H/5WjsyBu2NOfDVCUrOrW7MNBW6auQKtKIP1fC210zjK3G3ZoAhrE5R2Zc jqrN3YAJNsgExaUc14d+GpnhRRBTSzWp0jyXG+Yt9WLrgbwICXMVeQnL8L/j6EyhcxcK kD7boGkirFv0aBdBZTS50FSajBIPEUxZOFu7YuwPAGJhfV+ipx8qPUbWmLtf+Ewuuiyt faZUm6rZnSrzGRTl/7ZQSUVn6BSkBhPfCaTLwHSUPHylrtFk6shNkWOXOmYrkOeU8apW bf7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q5Vh35zy; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si6244362pgh.258.2019.03.08.01.53.20; Fri, 08 Mar 2019 01:53:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q5Vh35zy; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726283AbfCHJxU (ORCPT + 11 others); Fri, 8 Mar 2019 04:53:20 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33525 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbfCHJxU (ORCPT ); Fri, 8 Mar 2019 04:53:20 -0500 Received: by mail-pg1-f196.google.com with SMTP id h11so13760947pgl.0 for ; Fri, 08 Mar 2019 01:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Vy96qw906KzwVqq5CS1pkHwqm+ScdE79tDQaBnxqd9k=; b=Q5Vh35zyMEg5duJM56TOzPRSRktxy+TEJWCSg66P8bscAIm16R+fSBCvI2NQ3xvop6 R8oOYP2HXv222mXwSzh1vMurQlGCeq+KF7+zTCq0xSYdtN68wFtJWRFGD8pMLlpEyYfB vrhLyltx9pBAooyRB/jAivP/J/eRYr0FTR+BlmGgQUssZc4ilXQiZT8irMhi3UUwTEx8 EFBANw32TUK/Wm/eSmoRuo8/pQiu4woy5QPewpEXSIkVG/IFSjrxiAsOQmA/00BoEeeJ 0yhdN4SvyJOwh14di9LG6theNbEMnn28tHea2nR0x86awBNsQQfNhsobPXZAvagxgp81 9o+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Vy96qw906KzwVqq5CS1pkHwqm+ScdE79tDQaBnxqd9k=; b=beIVjUB5V8whCLHTFea3wLWcMQf/r/1OC5h31LQpYyuD2vHgG/Fpmk6xWYtzrQA1Xq SyZ64leBrniclGH4Zz1xa+2R2c/BUaDGuiHmfL6qAzB2adgsR4pTSwAxExNHQxZSXx5x pgbBT8Z+uX6foqutYA9cEIznHyRIvtRnXSHHUFGKX5XVGQzZnMDI5qPwmeBAbr0D1Dkh RazezqBj7MYjOI6TPJWyBuBX22+YvajI11GLHJ30VykUdTc6RpKLJZJ6T1YpO3J4wIHP oS1PYnz3XEn/5YxJ71Li4eOI6lSavwhJzkGD6mmW+mlIjeOY1rqIGFCTKR87nT3jIOds thvg== X-Gm-Message-State: APjAAAX0IVaF6MfVJBrHzXsCin7LlINRX0zoDh0W6SKlx+7GUFuSqPPC bRIF9Kesl5LmIhEAKDPU+esTTA== X-Received: by 2002:aa7:8c8c:: with SMTP id p12mr18132197pfd.0.1552038799185; Fri, 08 Mar 2019 01:53:19 -0800 (PST) Received: from localhost ([122.171.71.18]) by smtp.gmail.com with ESMTPSA id m13sm20232219pff.175.2019.03.08.01.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 01:53:18 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Pavel Machek , Len Brown Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , sunzhaosheng@hisilicon.com, jean.xupeng@hisilicon.com, yuwei3@hisilicon.com, gengyanping@hisilicon.com, peter.panshilin@hisilicon.com, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] PM / wakeup: Remove timer from wakeup_source_remove() Date: Fri, 8 Mar 2019 15:23:11 +0530 Message-Id: <621452804d6d22f72438614b6687f37282d883f5.1552038717.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org wakeup_source_remove() is the counterpart of wakeup_source_add() helper and must undo the initializations done by wakeup_source_add(). Currently the timer is initialized by wakeup_source_add() but removed from wakeup_source_drop(), which doesn't look logically correct. Also it should be okay to call wakeup_source_add() right after calling wakeup_source_remove(), and in that case we may end up calling timer_setup() for a potentially scheduled timer which is surely incorrect. Move the timer removal part to wakeup_source_remove() instead. Signed-off-by: Viresh Kumar --- drivers/base/power/wakeup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index f1fee72ed970..18333962e3da 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -118,7 +118,6 @@ void wakeup_source_drop(struct wakeup_source *ws) if (!ws) return; - del_timer_sync(&ws->timer); __pm_relax(ws); } EXPORT_SYMBOL_GPL(wakeup_source_drop); @@ -205,6 +204,8 @@ void wakeup_source_remove(struct wakeup_source *ws) list_del_rcu(&ws->entry); raw_spin_unlock_irqrestore(&events_lock, flags); synchronize_srcu(&wakeup_srcu); + + del_timer_sync(&ws->timer); } EXPORT_SYMBOL_GPL(wakeup_source_remove);