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: 123815 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3776267qgn; Tue, 9 Jan 2018 01:03:48 -0800 (PST) X-Received: by 10.25.44.206 with SMTP id s197mr6542941lfs.15.1515488628599; Tue, 09 Jan 2018 01:03:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515488628; cv=none; d=google.com; s=arc-20160816; b=x4/rt+54+FoTj2vpevE+Rkj8HxjbmEs1xn5HF/YMYSRnVFFwq2H526azk+0uZ1ekwf 3Nv2zIlWcM1SrxsiMDG5WZHv5dSOrv3CR0aIpFgUuxy3tQYbfLpYiBmFFWEPpHd2dKN1 Vf3XajXpgqRcZ7oAKojE+DX5w25xZ0DR7Dbx2k1s5B3Q2pi56BTQ34WylNaySEyZY+m1 4OKYA8oPotlJR0m3xiD6Xdxac4yCNJfAHzi5BEDpYtv8ZhpZdTCwAYt4h0AQ486jYsKj tjNMBJa7mcHpgEPEh9KjM1sKfuibBxEtYb/gpOvw5tX1cS0rgc5XMvv3S8QkGoMXGp3b 9M1g== 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=tqdOjDJU2C1f2D9ygV/K9t84nXOxcCUjXW4linf6Gik=; b=zJ8okBDui+igxHcCZdQ/33canvfjUiW5rt1o/y/SNoafvzu6FIggl5EZwbMd4gJ/Ly TR2KWLeSHEjfKIde8u0dE+0TxOFHZRJxSAoWVVFBcRAHOMSUG+3ki96MZOnDbk+PbDBE pLwo5WuFUw8jRA36iecFig2ILjDuNMLH+lFcQbwV1o5b6QaDO+F+BeTbOEg+2eiOisng Ttfyh88oRKEaKwkYC/KGVufPKOt9plPHjTrAzIQd4r4f0vyp7MG/NwaTFV30QJwcJq9Y sqTETgU+PtBtdiZI69drswo1jyIuNhFetV4H0GJ3HMrnAyjQJ6t9nRwV9H0Ug0gdCPtu P4kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRLyNc3v; 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 n71sor2311147lja.74.2018.01.09.01.03.48 for (Google Transport Security); Tue, 09 Jan 2018 01:03:48 -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=cRLyNc3v; 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=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=YR7xIoD/RJwvrr2dIqtPAy1c9DTvQbUk125iSTQ1OebjnFnxqhtVSagXBzeJABx8bC wXEgX2nVLyq0+/f1Yz8Lv0h/J152KgpB19u20QGisLLQOVRJcCq95L2GEYgiBzvHgqAq Gdj5jybSKAScm1J52R/HRQtM7iW628TjPRIBwf5M1hbz/L1f9krBnbNjhXPSOag7Awsr 2gmyuLvn2uLZa1kQvDzYbnA+smD9tvMx0DQFoOY7qWwmzJO8yC+BA3hcWPj4Tee5jW86 64aZLabSpiR96BZZL6hU3RHftTKdiEymOyeRflQ22SOdSjLVtjqraIv/mISMAyQ6d5ub jkeQ== X-Gm-Message-State: AKGB3mIMqbWTuGGC02pB2D4Rs1RAPfxSOzq+tNBT8t2Wt0DHtn6V2Bco TrQGQy/SK91En4TsaEwSIBp9NxFB 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) 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 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> 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(-) -- 2.7.4 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;