From patchwork Tue Jan 2 16:08:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 123153 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9132219qgn; Tue, 2 Jan 2018 08:09:00 -0800 (PST) X-Received: by 10.46.95.28 with SMTP id t28mr25064745ljb.110.1514909340498; Tue, 02 Jan 2018 08:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514909340; cv=none; d=google.com; s=arc-20160816; b=BqYgabxMa6l57knqJU2QEHal4hhVTVyWvS81JpeEZvlXPN1CUql/Bk60ocZgQwhyeE nTZ9s2jwZ/4OSng1BlQsomS3MqvyWWpxbiTCFLzMF+Yb3/VpgEZtB3NvP1lZcBhtItpu q6MNj1LUi5GN92+0qttHMFGDsT7QPmHxbd0RWbQZkTDZnNIcoXrOL41ROlyqLAsc7WVR m6p3jisLdsawSt0tmCTjsvm/6MQJMRSkw9tr3uDeTo02MMbQK2ZcpYff9xPAG0yOdBu9 yeO9HsDlN/g0Iw7/fofuWQQ9oHPfCncNM4k10SSIO0XAXBKhpSRZqZ3FubL0L91hg7kQ H9MQ== 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=2TkJwObSBzzfwZ33Q+ifKvh0/A+ZHvasaCfRCMgstgI=; b=zVcSI81dOaoz34sCIU9Ic4+7g5kHa3tgWST5FEoU1QmG4+Wg0ya/hVROzj9uYdMaXo Gpd5RW63pDtOyzIV2AlIuzugI9ZEsM6unnf85CCQddOTeMcM5zGsABV/UuWU95R4ozyM hikJvFmY6mJjdU5WjwW+2sQuU8Hhu31eamp+4nduXFWEtxq7tCXVDLpsT1JAr8yZn+On Pz9PUyDXaAFtgqAdT+yS/ctKfyxNSCZlDAYRKXLXnqW3lE5lPhparZFuBXH/ykerAcUG Djh0J7Lvwqzsd/MHBW013dSbZD1iz2t6LILKK6p8TeUv/g8K2g6BqLS8HwpSMeucqcpX jdFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D1HuTXIe; 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 u72sor4812691lfi.86.2018.01.02.08.09.00 for (Google Transport Security); Tue, 02 Jan 2018 08:09:00 -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=D1HuTXIe; 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=2TkJwObSBzzfwZ33Q+ifKvh0/A+ZHvasaCfRCMgstgI=; b=D1HuTXIeI1elawHYSa1o09S06AUZHZY3lWSLwcIvcqNv3HpEdrKBMuLLRo3ZPjFpRF CRGOiOq443Fym8O28L5ICrRQui9ROYQY+WP++u4hbpjtiCauNDAejE5EDRY2rpUQWURS uTYfJcAVZhr8WQz3DETqOsyTxR29FUDM4yjhg= 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=2TkJwObSBzzfwZ33Q+ifKvh0/A+ZHvasaCfRCMgstgI=; b=CxUmZjn5oTxUJcGPGzXnKp8iz9fx2PVi+5q/hrQm3kEHJU9wur8ZrNOz6XCOu4tjQp W0eAberuxcZIr9/S+D+YedAwIggtp5hrvQnCkzNN1DVCGzdMFAvcRb2c/hGwNN7SLgHG 7uUejO2RMMf0gvuvfVbr47PwIQEETyu7gx0NjE75q+uYaVKqgrv1NzUOmG7evKuGntf2 A5dEipKbBY5UdhZ9K8ctxI7ciktp/YUL3gy+6/UYCt+RnhAlFeFMsKbOYn5p43JNyjMo w5uQmw6ffHKIF+L59Z0fnDpMeIF4jRwditLocZOjpOKFkYLIwdXOnbM99bYvltWF4hyN fopA== X-Gm-Message-State: AKGB3mLoY8mEWMx8I67k1eMqjO4UFnennO/a/UcYNk8AwzD9tLQraN7b VfA2HA6uJLRUYB1s+7tIrgRtXGjKmAbqyg== X-Google-Smtp-Source: ACJfBouYDUz0IS3colNOO+fknCZg/6Hf51TMsINg4FQVagwWJAgGO0i9F1xu22WhMV58k9bK0jQauQ== X-Received: by 10.25.150.8 with SMTP id y8mr2074435lfd.49.1514909340125; Tue, 02 Jan 2018 08:09:00 -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 f4sm1619422lfl.17.2018.01.02.08.08.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:08:59 -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 v3 1/4] PM / core: Assign the wakeup_path status flag in __device_prepare() Date: Tue, 2 Jan 2018 17:08:50 +0100 Message-Id: <1514909333-4450-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514909333-4450-1-git-send-email-ulf.hansson@linaro.org> References: <1514909333-4450-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 70398e7..7aeb91d 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1788,6 +1788,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); } @@ -1912,7 +1914,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 */