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: 10137001 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5CB206037D for ; Fri, 29 Dec 2017 11:37:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4ABCB2DF14 for ; Fri, 29 Dec 2017 11:37:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F9662DF17; Fri, 29 Dec 2017 11:37:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D34CD2DF14 for ; Fri, 29 Dec 2017 11:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755597AbdL2LhV (ORCPT ); Fri, 29 Dec 2017 06:37:21 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35791 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755567AbdL2LhU (ORCPT ); Fri, 29 Dec 2017 06:37:20 -0500 Received: by mail-lf0-f65.google.com with SMTP id h5so4225019lfj.2 for ; Fri, 29 Dec 2017 03:37: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: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=AbkekEXA8h1GatWRtd2tgBEyP0sFGn3Wun1gBQVrO2/tl06c1+Hu+7FU2SALEbvuwW JEYOX/siAaJvswikXwrwD8VvOO2jlJoa0K8i6nbcBfJAU+qJP6etmoU8XL4oFVV08Q/R fDBuc/Q/mhkdCl+Ai4FEmbZAPi5tELtbOvIILQgYG1Csa20MNp2Vszmgdwjl81nF/XrS aaF65cpmK1BHfIgKPpTNxOmvF7gt1wAANAVuQo/VM/2w6Ug/rWfszEllD1BjS7dNE6DA frFeFe+i3jOuBMuc1fvHTtpc6WALeXa77x1Sdo1lnHwoxiVpJTnlTiJEaOd3AYFIJ3HI C7ZA== X-Gm-Message-State: AKGB3mIFLEQ1z6BHt+lFA0vXabvKyDilCHg2dU+ZZsM7qIkQKs6ZgMOL 2Y7ALFQ2I9LUe8xMJ/3uB5U9WQ== 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) 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> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 */