From patchwork Tue Jan 9 09:03:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10151209 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 908D4602B3 for ; Tue, 9 Jan 2018 09:03:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 891D0288C6 for ; Tue, 9 Jan 2018 09:03:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E002288CF; Tue, 9 Jan 2018 09:03:57 +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=unavailable 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 39ABA288C6 for ; Tue, 9 Jan 2018 09:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341AbeAIJD4 (ORCPT ); Tue, 9 Jan 2018 04:03:56 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:46007 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751379AbeAIJDu (ORCPT ); Tue, 9 Jan 2018 04:03:50 -0500 Received: by mail-lf0-f67.google.com with SMTP id y71so15046935lfd.12 for ; Tue, 09 Jan 2018 01:03:49 -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=tqdOjDJU2C1f2D9ygV/K9t84nXOxcCUjXW4linf6Gik=; b=cRLyNc3vCgqSjl59dsfJbPw2JrR0IE4obbGyMPLNKwyDSNQ6Ug8ZsEcfaadMvO/2eD l0Qusg6lwNsr2Dqx5uDMSg6w8OwT8Ny34e8MT/xaBerNBWoejCkNNwU5gsBzT9xAcVfx DtUQuhmodZyjIz/jO1QboX8uv22+CH+/ih5Og= 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=tqdOjDJU2C1f2D9ygV/K9t84nXOxcCUjXW4linf6Gik=; b=CN5R8ABE0v3xTRwIX/io8CmUDfgTyQl403BiS1yJv2GgjJN/BGIz0S6CWP1mLLfdDm 1Zz59hkkZw6grVQPqwmelC9egQ+LBi3r4snYrGKN75EiXJgEt9uiNHWRBW3FOraH4sZY NmiQ3QXFieTeekHCtjdar7JJMmFVO4l1e8C6GPEMiNmd58CIlmWJYjvWTkqK2c0Efz26 RIrPFursEt79mqvVR5xnIl650tkkMQbkbCiM/dAHlOpTP7wraIP4WMjQYovx+gs6QXCp XHhK3XqRsri22sTa5W15OiLAFfMQ1vWmGFc/0tIWTnmK/f4MBIwsDJ3BqICFVV/tqsNL VbjQ== X-Gm-Message-State: AKGB3mKu/6j/1e1pLgj7vU60Hx/eDJ6SpDpW4Chm2uarSaq9GtM0ZnZT B7AjBc9OCbozs0yvZGr1wbqkIw== X-Google-Smtp-Source: ACJfBovpAjvAAdXffBG+L+HsuSsx+kav+sGg+VLLAWWDe5FQ23Q4wwW4UbWI7horLKuYq5ph7Uq9qQ== X-Received: by 10.46.59.12 with SMTP id i12mr8227440lja.88.1515488628278; Tue, 09 Jan 2018 01:03:48 -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 f78sm2745355lje.20.2018.01.09.01.03.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 01:03:47 -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 v4 2/2] PM / core: Propagate wakeup_path status flag in __device_suspend_late() Date: Tue, 9 Jan 2018 10:03:40 +0100 Message-Id: <1515488620-10575-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515488620-10575-1-git-send-email-ulf.hansson@linaro.org> References: <1515488620-10575-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 Currently the wakeup_path status flag becomes propagated from a child device to its parent device at __device_suspend(). This allows a driver dealing with a parent device to act on the flag from its ->suspend() callback. However, in situations when the wakeup_path status flag needs to be set from a ->suspend_late() callback, its value doesn't get propagated to the parent by the PM core. Let's address this limitation, by also propagating the flag at __device_suspend_late(). Signed-off-by: Ulf Hansson --- drivers/base/power/main.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 720e36e..02a497e 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1447,6 +1447,21 @@ int dpm_suspend_noirq(pm_message_t state) return ret; } +static void dpm_propagate_wakeup_to_parent(struct device *dev) +{ + struct device *parent = dev->parent; + + if (!parent) + return; + + spin_lock_irq(&parent->power.lock); + + if (dev->power.wakeup_path && !parent->power.ignore_children) + parent->power.wakeup_path = true; + + spin_unlock_irq(&parent->power.lock); +} + static pm_callback_t dpm_subsys_suspend_late_cb(struct device *dev, pm_message_t state, const char **info_p) @@ -1527,6 +1542,7 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as async_error = error; goto Complete; } + dpm_propagate_wakeup_to_parent(dev); Skip: dev->power.is_late_suspended = true; @@ -1660,21 +1676,6 @@ static int legacy_suspend(struct device *dev, pm_message_t state, return error; } -static void dpm_propagate_wakeup_to_parent(struct device *dev) -{ - struct device *parent = dev->parent; - - if (!parent) - return; - - spin_lock_irq(&parent->power.lock); - - if (dev->power.wakeup_path && !parent->power.ignore_children) - parent->power.wakeup_path = true; - - spin_unlock_irq(&parent->power.lock); -} - static void dpm_clear_superiors_direct_complete(struct device *dev) { struct device_link *link;