From patchwork Fri Dec 15 15:56:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122115 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp648069qgn; Fri, 15 Dec 2017 07:56:45 -0800 (PST) X-Received: by 10.25.78.214 with SMTP id u83mr5700232lfk.74.1513353405260; Fri, 15 Dec 2017 07:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513353405; cv=none; d=google.com; s=arc-20160816; b=NDcfAISJt5stMxvlOetRm55wEJ90xhRKxE1fZ1W5dGbCbrWF819wWkzZJkFu4Ntzet tZrDe57INJf6pV+Alq8z0PyBmMy7gwaTTU/qV3l+lJoo9eO1EA94eB+oIccZ4RAQtdR3 oaISuZjWCpUuyB9czhc0CnjSV4ooCKXKSvXohzQl8h541fjaLQU/YEqTbtaprqgcoCA9 hVuePCwMizUfCYcVB52b/oDHCx240f5Bl6lc6RJjZ0ftLlAOcGkNu9plCGdM919fOgs5 3jFBNgDPtv0pJ/Ww6ZNcOJqRxni5NdSoOPSLuOJbfqPpr7o24tDDENJmBG/n4tcndN6Y c9qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Zc71+Bu5PUWIa8bITeKtvmFDBRUtUqPswjTAf1jpAL0=; b=cQ8nQ15+uOcFFsFQJvWuUuflNdlFZJQQkTmsDzMnwBtTQr8d5sCVcW/1hVpYDmZ9NH 8o0CKqPvEC+Qzet9yFGzNz7GhR9FBFWZdNp5rYlTuzR1IHDeJ+KsMdGNfqhmhhYCO+QR eqAOM2ebGtFOcJjaLVGvcsA2ludCsM7iafTuXi+ahdeUcK+NVwW7lpLLh3LEfRZ5POP6 yFW93SiZwhiKrNpca7viZ0cCPawqpm3AJ/uGp28FwXUs9juE9h/RsHnIcMIzaXHBgY16 +vQMlModnbJHqhfdrNHCDGbst4NzOXZ3lGgVe4HKepMZ+5UOZCTu23ArwY2lSMCmqVsL VB/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LP/ZXvOe; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b195sor1257518lfe.63.2017.12.15.07.56.45 for (Google Transport Security); Fri, 15 Dec 2017 07:56:45 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LP/ZXvOe; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Zc71+Bu5PUWIa8bITeKtvmFDBRUtUqPswjTAf1jpAL0=; b=LP/ZXvOeENL3omL2X3P1ybCk8yhhMWM4WWkR9ntv6d/MA9+RycdP2J7/6VbOPIOg2g /qC0RrRxZMU4RLts4UOieopPeLmuYdr9vnz4p2rpWElEEZ/xEL0y2ZlZf76NGAjH+bm6 vKNaNa2UO5IJ5hpvB+9pituBPmN4adirF2Pro= 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:in-reply-to :references; bh=Zc71+Bu5PUWIa8bITeKtvmFDBRUtUqPswjTAf1jpAL0=; b=mBNn0nrhg9meULvmAqjoeeqR9tA2jFruseGAnKqZNWIBp7ruBOfLVz3bUt7sbU/q9s 8zfOjzP32ybRZuF2TGVfPJDDJnyBglMNNibai31U/IUfUsKanbAfTyz06NBowsUalUA+ ESrD719CQz196001AVBU0dmc+vtMKWqr/yz+CDDRCsLlbrmYdjXAq90ZAKUSOXlV7wkH Gjl2HvLjWUa9dCkSPt5Pc0WzkmrQBnCk4lrjcrNZMdK+08qdvN9qYuNmzDrUYIJDEpho GiMJMvkj6grUSGEg28wH49L8Si7gXNdJYMe1EGwgQHOOmKaY8nWMaWR4eid2udNinC++ AiBA== X-Gm-Message-State: AKGB3mJdcybaAOKCsF8iM5kk9W3LWMuF1sod/LRffGNprSD12t1zKv0h 0wstTbLZlQ73lxhU5n68iwu/B7x4 X-Google-Smtp-Source: ACJfBotgZYBQ35xJIBJfYHHUr6hieJKnNqkDh/aOolFa9kS+KxAtIPnsqsgF4729QYPZXdh0E7sSfg== X-Received: by 10.25.143.77 with SMTP id r74mr6634902lfd.86.1513353404776; Fri, 15 Dec 2017 07:56:44 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id y15sm1294216lje.10.2017.12.15.07.56.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 07:56:44 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Kevin Hilman , Viresh Kumar , Geert Uytterhoeven , Simon Horman , Niklas Soderlund , Vincent Guittot , linux-renesas-soc@vger.kernel.org, Ulf Hansson Subject: [PATCH 1/3] PM / core: Assign the wakeup_path status flag in __device_prepare() Date: Fri, 15 Dec 2017 16:56:29 +0100 Message-Id: <1513353391-30806-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513353391-30806-1-git-send-email-ulf.hansson@linaro.org> References: <1513353391-30806-1-git-send-email-ulf.hansson@linaro.org> The PM core in the device_prepare() phase, resets the wakeup_path status flag to the value of device_may_wakeup(). This means if a ->prepare() or a ->suspend() callback for the device would update the device's wakeup setting, this doesn't become reflected in the wakeup_path status flag. In general this isn't a problem, because wakeup settings isn't supposed to be changed during those system suspend phases. Nevertheless, there are a cases not conforming to that behaviour, as device_set_wakeup_enable() is indeed called from ->suspend() callbacks. To address this, let's move the assignment of the wakeup_path status flag to the __device_suspend() phase and more precisely, after the ->suspend() callback has been invoked. Signed-off-by: Ulf Hansson --- drivers/base/power/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 6e8cc5d..810e5fb 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1620,6 +1620,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) End: if (!error) { dev->power.is_suspended = true; + if (device_may_wakeup(dev)) + dev->power.wakeup_path = true; dpm_propagate_to_parent(dev); dpm_clear_suppliers_direct_complete(dev); } @@ -1744,7 +1746,7 @@ static int device_prepare(struct device *dev, pm_message_t state) device_lock(dev); - dev->power.wakeup_path = device_may_wakeup(dev); + dev->power.wakeup_path = false; if (dev->power.no_pm_callbacks) { ret = 1; /* Let device go direct_complete */