From patchwork Fri Dec 29 11:37:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122926 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4574567qgn; Fri, 29 Dec 2017 03:37:19 -0800 (PST) X-Received: by 10.25.233.25 with SMTP id g25mr19123020lfh.101.1514547439246; Fri, 29 Dec 2017 03:37:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514547439; cv=none; d=google.com; s=arc-20160816; b=UtwVvTWc+nEWScPlOfu4bPNm/2eDJLFZZleizaSggGAeanO4ThYUkIm8Gj2iaUeb3Z UGWmk7RRFTDriegtTo4a8KtyeoQuKFfSWBFgl5kPScmHwzmDYQO1iVLBnOk0ZF8w9s7k tglscWACWE1lmpCaObCNrp6gCz2+o8j0n1bo1TrHhbhQGv7erxk7Xim5uxAVRhoG/YBB NW8ukCTBjIU76zNwEwdugUXRMvpnrzLbivWeNd81pXmVBswyWh/NIn5ukKZR5v+3pomy hu6y2uSOPvSflZB9X3g+dYObKAyl12xh+z+J3TdjVZ/THv/PWbuUKWwV10n5OitSZlxB j6XQ== 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=oW3rET3KLR2qx3Z+Qyo47ErWsC0L9XLCU7bkqm0PBv0=; b=OubaaRuvMjUKIWRrEy3sP85PFF1BDdia2Cyk6EU/8bOA8OSviXlyFBzmg/jFDhEFT8 rgHGV44MxkrjI5hYKp6kkZ4X6ulF2vXpnheVEavq3bKRwqiJvSMzK4zO/+aKrWj1HH3B OT296ZxXL0r6H+tQyjd324q/ti+Jc6Or5NBzDEfc1nq40zlZNBsKi+rxIJP7c3NJPEYF PamWo6YFnc5qgIBto2Ku3iLa87J34miSl8JijrvAf1ZalA3wuTMYaQu02SYEsIMDNQ0i 2CtiKqeWQQluFjtCf5DgAgArgFvrolmuj0p475HXoP/75tcSaN4Nul4B1wKz2+A+v3l7 P3qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EBJk72+i; 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 r24sor6273441ljr.59.2017.12.29.03.37.19 for (Google Transport Security); Fri, 29 Dec 2017 03:37:19 -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=EBJk72+i; 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=oW3rET3KLR2qx3Z+Qyo47ErWsC0L9XLCU7bkqm0PBv0=; b=EBJk72+ipL/Z/EOn/tiROsKxaFJwmuojXo+hQ+vtLcftA6T9CAplI3IzrwPfvToRt9 uB2MFbgei73ZPlC6uuhMdmHgM8QE0gsCk8Cj6NP2zCRkvomc+wfHo45LfaEPpkdJQM8I 7QW6bzSolV/1gphQWAuIw07G2calo8q3FnoLY= 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=oW3rET3KLR2qx3Z+Qyo47ErWsC0L9XLCU7bkqm0PBv0=; b=swoyQKc2bZrPXRxcK9092Ad3oQP0AqYcRXEbGDCuHjyYxO2Ha57SuUgjUYbjb1ewry MF79dDdxFhMsiH2lJEOXwANzrMm7Sk276ILwcD060yMngECYpamyqrbgJSYlbZeRFyhV CrdeR+MXNLSewTVu7RiecVKF8gPvI89XwFIE9pCjpLRevgecvI2fivyVVklqoZ4kyTyL n7hkuoBNmQy24OK1cWkTl/43Pe8IESIjuVKjvEeoeLvA5l9G2JIYDgTy3QojemUP2Ry2 +eJBTVXXiPUk4oc6tFEqmUk/W9oQHp5+Am4Unppe9TORJxPbv1+gvNaQLhujzjyergA5 8Q2g== X-Gm-Message-State: AKGB3mIon38wSma4T6douvpdC7GlbegN6gUWkKrtzRsd/klPRojvn93u mKSaBEfYSrsfSyAaHHvcHrZzCgty X-Google-Smtp-Source: ACJfBos8XqndgB6w6r0c3xPQ+z0z52+qRe4uRK50XcM5HaeCuolDo2YjEX4DYZP8rfHFZQCoBlRUJQ== X-Received: by 10.46.21.87 with SMTP id 23mr19867373ljv.107.1514547438860; Fri, 29 Dec 2017 03:37:18 -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 r74sm7280469ljb.28.2017.12.29.03.37.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 03:37:18 -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 v2 1/4] PM / core: Assign the wakeup_path status flag in __device_prepare() Date: Fri, 29 Dec 2017 12:37:00 +0100 Message-Id: <1514547423-18965-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514547423-18965-1-git-send-email-ulf.hansson@linaro.org> References: <1514547423-18965-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 are not supposed to be changed (via for example calling device_set_wakeup_enable()) during any system wide suspend/resume phase. Nevertheless there are some users, which can be considered as legacy, that don't conform to this behaviour. These legacy cases should be corrected, however until that is done, let's address the issue from the PM core, by moving the assignment of the wakeup_path status flag to the __device_suspend() phase and 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 */