From patchwork Tue Jan 2 16:08:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10140971 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 DF8E460594 for ; Tue, 2 Jan 2018 16:09:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBB0C28433 for ; Tue, 2 Jan 2018 16:09:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C060228B7B; Tue, 2 Jan 2018 16:09:04 +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 6C70228B67 for ; Tue, 2 Jan 2018 16:09:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751101AbeABQJE (ORCPT ); Tue, 2 Jan 2018 11:09:04 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:44466 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751007AbeABQJC (ORCPT ); Tue, 2 Jan 2018 11:09:02 -0500 Received: by mail-lf0-f65.google.com with SMTP id g63so34083971lfl.11 for ; Tue, 02 Jan 2018 08:09:02 -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=JCerMTek20UlHIiT5CohPKjIQW87drp5DugK/MATYGI=; b=V1R2on9/TplKDFSANCTTPZXp+zC95735TOKKi/OfG4ZjNrUmcLaaadGCUmhG9lCnOS +OydSB3xzIvBXd3TOSwV2IVSzzzggqhcXHescvp10hRGrH38lJjM/36ycxiclcyfu8B+ XMEGsWqz4L8BZlfOapjGpuPHbaWAK2ddOjRPU= 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=JCerMTek20UlHIiT5CohPKjIQW87drp5DugK/MATYGI=; b=B9/btHh5WI0SsL1N0Dw+EC+sgONHzMF4iwYbMxJfI34JRByDafkQ64OY8LsUnKh+B9 co1mR9HE0u37KOU3v4/0ZyG769awAXt725zMixrsDl3GzfHrhH+/ll+SSW4knIW6pgXw q6mqQ7uz64XsUSJzTwVkG4GxZlDGcJtZhyaLWfB0LawsZV7AX4/yv5o6fyxpYk4X0V1p qOTlItJgGoGxoQnCKQZW5pAveGS1J2dpY0zzThcLlhcryXvhy9/leJrki+nejiH8HYMr yxR5CO0YsdHgosrfkyhl1PSmu5C1zrthLs3bcv2GK+DHxlpeB4XmKauxWKDKwhYQUWw2 cn8A== X-Gm-Message-State: AKGB3mJLmfyvhecwWS88emdA/x3HJ5xgZ2IkwUSdorSv4LzLu5NwRmGG DilBn+uy7SPZViNq0HJAHoFDGg== X-Google-Smtp-Source: ACJfBovMQvMoKxtukzbJz9tD0mabMvAaNX6UKnuscxzP3OAIES7JOQkvcWYL3f/QDzy4E3Ovze2/0w== X-Received: by 10.25.196.212 with SMTP id u203mr22200658lff.126.1514909341401; Tue, 02 Jan 2018 08:09:01 -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 f4sm1619422lfl.17.2018.01.02.08.09.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:09:00 -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 2/4] PM / core: Propagate wakeup_path status flag in __device_suspend_late() Date: Tue, 2 Jan 2018 17:08:51 +0100 Message-Id: <1514909333-4450-3-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> 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 | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 7aeb91d..612bf1b 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1476,6 +1476,22 @@ static pm_callback_t dpm_subsys_suspend_late_cb(struct device *dev, return callback; } +static void dpm_propagate_to_parent(struct device *dev) +{ + struct device *parent = dev->parent; + + if (!parent) + return; + + spin_lock_irq(&parent->power.lock); + + parent->power.direct_complete = false; + if (dev->power.wakeup_path && !parent->power.ignore_children) + parent->power.wakeup_path = true; + + spin_unlock_irq(&parent->power.lock); +} + /** * __device_suspend_late - Execute a "late suspend" callback for given device. * @dev: Device to handle. @@ -1528,6 +1544,7 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as goto Complete; } + dpm_propagate_to_parent(dev); Skip: dev->power.is_late_suspended = true; @@ -1660,22 +1677,6 @@ static int legacy_suspend(struct device *dev, pm_message_t state, return error; } -static void dpm_propagate_to_parent(struct device *dev) -{ - struct device *parent = dev->parent; - - if (!parent) - return; - - spin_lock_irq(&parent->power.lock); - - parent->power.direct_complete = false; - if (dev->power.wakeup_path && !parent->power.ignore_children) - parent->power.wakeup_path = true; - - spin_unlock_irq(&parent->power.lock); -} - static void dpm_clear_suppliers_direct_complete(struct device *dev) { struct device_link *link;