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: 123154 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9132239qgn; Tue, 2 Jan 2018 08:09:01 -0800 (PST) X-Received: by 10.46.95.206 with SMTP id x75mr28594185lje.111.1514909341768; Tue, 02 Jan 2018 08:09:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514909341; cv=none; d=google.com; s=arc-20160816; b=lnVbGQo42PIwd0ku8xEsTd8VZAzPgfePXyVyhfOWnNVa/S4xRitEhP0Scd8xgSGaXf 25LPLzC7EyPsrzUaYAvtFHnSzQvHrklX7ahesKkxl/vLqNLrYs8jV+Uj83btrfNIdW2x mXMdFfVM5czzw92JoI9FfJOSrvdUWZ4ZP83jNTqPKU3m6Jxesaz/QFskZE5Herr4gVIk isdd0X6K2SM16A++wzM8coTDwNVE5HtIhxHbIX+q1ik8okrfkm8yxFoE7PBUGS+CR6Vn QYsQEBIMH/yUC47euj3o/w4bFZEXGrNw2mEWq2jLr8QhuRX2Pw4zUNGatxXcmtsbW+sz NAHw== 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=JCerMTek20UlHIiT5CohPKjIQW87drp5DugK/MATYGI=; b=G5QrW3jaXSGrIq3v51Ik28NDOk0Y5mCyd4PYqoBUfiK2tAn6M/9ORVkwlWo+lLeZD9 Jpy85/z23Zd8zxonA1gASR/ab6p7L16GbT1krjKKj6689GQsxoOBKUv0XFKNj4hpntiN KVuEw9vVNwT1aB+RleFSdtMjHGtRqTHyAC8u/YRHKHHGqK9F5xcDKufkLcKaRVF1fMbL t3vcPpK/MAGNU4jnbjigFYvS3IpyE3HlZVTcMqfEtihwO4g720O7SlGnt+X3OyTaT/Zt civlZ3zxQDYEU93vGAAmoaEWNDC8OltpOAbK41i3f4NUOzTyq8P6RxnSC4bni76odZoJ 1YGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V1R2on9/; 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 102sor4946756lfw.11.2018.01.02.08.09.01 for (Google Transport Security); Tue, 02 Jan 2018 08:09:01 -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=V1R2on9/; 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=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=DGAkP26XB72NihZutvyoa8z9VayOgeSdsCpo74o+3D1FnuIz/Zoi+04m7zmvL0ZJaN E5c8PQi2rKJ0g2J4XdhQLxfVkGn8tOtcWPMMfox+MM0GmQwI4ZFcqRUe1MX6LK90uvD3 whNLs67jhD6IkPxq8xc5S89LI0LOhnPuU0D91+eKASYxJv4zt8Ksb1RlxDEWx9VxQiXB kfO9fyG0brQExWTWibX97dhAI/G1uEAbFJ/nG3T5q8Z9BmqqL7UjbugxAbbTQtS2+QQZ DJT4LVrtijdLSEoeTUFnVMrUGipwvXFmIPrzTXX56cwh/k2wXjn6DcAZ+OEJTMZj+Jfz 9lHQ== X-Gm-Message-State: AKGB3mJvMbAqLO73naWKBSJmXMG4ncmyB+EzKau5+3IxTUFVIJV/coo7 9GhLPkiuyoJdSNhROrsSIWlttq95 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) 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.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> 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(-) -- 2.7.4 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;