From patchwork Tue Aug 29 14:56:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 111220 Delivered-To: patches@linaro.org Received: by 10.140.95.112 with SMTP id h103csp1457434qge; Tue, 29 Aug 2017 07:57:03 -0700 (PDT) X-Received: by 10.25.87.7 with SMTP id l7mr192268lfb.128.1504018623888; Tue, 29 Aug 2017 07:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504018623; cv=none; d=google.com; s=arc-20160816; b=sd1bZPXJQHMuXmk+6OvpWb7t5/Somv8HhYpRItcyWRDwchG0FDW/AvIObLhHEpajFi xIY2d9W5LmrhYdT7vgDZmEZIcIcXi7TtR7QdpDAbTVmOcl/evW0zIf2VQ3L5NWYU9W9x DWSWO8E4wTGpUCd0J9eKixoyluP6HRpluH0TjpZ3ywo6Eq7jsInnPfO1EgW/1W3DcdSj 0PdIPSRMxAHKcx1iLMNc/GmOwFxrY0L49sqCGtJljJqOndjwp5jAFkjPNU80jbTtjbHJ mNgq18wz5yi3P18u7fIN9LeqLyrNKRnC60/dC/ojIUgcqRxk68dt4keVedS7rhnFIZSZ lTLg== 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=t/0EnNFHSFSy+bWjKQA9j4SLg6VF07in38lNTG8qPK0=; b=gVFxZSbPPR2WtQyi6cTJA7qJKcQkK2Yaz9Z0zQAf17W3caw7dBUut6zCBlmt0JoGae kwg7qzK4yrnb7iUpLtF/GBIZpHjHMZybQFnwnonGVqBVm/yBvwRgfxdxOTz+N7TwEqkW RKu8PAr4YsN/sWOVIwjZyZsWp32fHRwEfvvTswhF43ZETxdahfznsZCFuJ1189wxTVy2 U1PUGPcwFp2pjrcYNRS7K/blsnYCEWs1EGJeYyTgF2B5LxJqDr0P0v/TENF2TQ+s6yeV udiQCwACNv5wHfpLL6Yrte6jOP05gw4ty5J0X1/HdjqRWOaHLGiHMdoz9HL0cKZlZ+JR DL4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ctbr+X1o; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 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-lf0-x235.google.com (mail-lf0-x235.google.com. [2a00:1450:4010:c07::235]) by mx.google.com with ESMTPS id i200si1251061lfg.451.2017.08.29.07.57.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 07:57:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 as permitted sender) client-ip=2a00:1450:4010:c07::235; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ctbr+X1o; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x235.google.com with SMTP id d17so14395520lfe.1 for ; Tue, 29 Aug 2017 07:57:03 -0700 (PDT) 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=t/0EnNFHSFSy+bWjKQA9j4SLg6VF07in38lNTG8qPK0=; b=ctbr+X1oWC+TdTvFCeKHnk0j901D9J4dyc5jODfHaAmx8gbH0u3xs34PzB7J9IaUE+ QkSCJeH5EwAUaXn0u+gaET6QLa328XmEmayBeapeuuA4SCn0CNogituvdqEAbO+1bZQ+ mcBOSq1oMOmQ6odQWoA/QWi1lIVQ5zLtX1hC0= 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=t/0EnNFHSFSy+bWjKQA9j4SLg6VF07in38lNTG8qPK0=; b=RFsAkHuu0ezoXRWD+o8ieCyQOnVF6ABAhO+lAzPfYqwtN2RryxpBTs1L4O3b3J6McC CSW9kQXl4pC4DpFN4Pc/1/rCHpuhfKSA6j3JqzQVNnTRrC1tRPx+6UD5n7UGEZMMaBhg lttjmJCeqaUDoJ2aRAZkSPg3VLYI6BNKJ1ixlcPgl2YJ1TKwiKX6OrOhf/uNg7P2Zrd9 BY7H6JEksgwWSAgYMqZjWFQ4GKzk11BuH5jV4y8ePF19bbvqikE/MQHRWCnNPTVUqViS 0UJ0TItEiA6BQnsNGFLdUqavhjuYnoaifjBrbt0Bha6kvY/9r18gNurb1YDqZhwuz/W+ CJUw== X-Gm-Message-State: AHYfb5giKUAuKVgaZhwIXGSlqqK7AZ8NsiyjVwkHZSK89SqOxw7D8I78 vVgf/6yaLuAArIob5IQ= X-Received: by 10.46.88.90 with SMTP id x26mr256631ljd.53.1504018623456; Tue, 29 Aug 2017 07:57:03 -0700 (PDT) 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 y23sm652454ljd.19.2017.08.29.07.57.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 07:57:02 -0700 (PDT) From: Ulf Hansson To: Wolfram Sang , "Rafael J . Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org Cc: Kevin Hilman , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jisheng Zhang , John Stultz , Guodong Xu , Sumit Semwal , Haojian Zhuang , Johannes Stezenbach , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 2/8] PM / ACPI: Restore acpi_subsys_complete() Date: Tue, 29 Aug 2017 16:56:44 +0200 Message-Id: <1504018610-10822-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504018610-10822-1-git-send-email-ulf.hansson@linaro.org> References: <1504018610-10822-1-git-send-email-ulf.hansson@linaro.org> The commit 58a1fbbb2ee8 ("PM / PCI / ACPI: Kick devices that might have been reset by firmware"), made PCI's and ACPI's ->complete() callbacks to be assigned to a new API called pm_complete_with_resume_check(), which was introduced in the same change. Later it turned out that using pm_complete_with_resume_check() isn't good enough for PCI, as it needs additional PCI specific checks, before deciding whether runtime resuming the device is needed when running the ->complete() callback. This leaves ACPI being the only user of pm_complete_with_resume_check(). Therefore let's restore ACPI's acpi_subsys_complete(), which was dropped in commit 58a1fbbb2ee8 ("PM / PCI / ACPI: Kick devices that might have been reset by firmware"). This enables us to remove the pm_complete_with_resume_check() API in a following change, but it also enables ACPI to add more ACPI specific checks in acpi_subsys_complete() if it turns out that is needed. Signed-off-by: Ulf Hansson --- Changes in v3: - None. --- drivers/acpi/acpi_lpss.c | 2 +- drivers/acpi/device_pm.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 032ae44..0c84d15 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -894,7 +894,7 @@ static struct dev_pm_domain acpi_lpss_pm_domain = { #ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP .prepare = acpi_subsys_prepare, - .complete = pm_complete_with_resume_check, + .complete = acpi_subsys_complete, .suspend = acpi_subsys_suspend, .suspend_late = acpi_lpss_suspend_late, .resume_early = acpi_lpss_resume_early, diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index fbcc73f..632f214 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -1020,6 +1020,23 @@ int acpi_subsys_prepare(struct device *dev) EXPORT_SYMBOL_GPL(acpi_subsys_prepare); /** + * acpi_subsys_complete - Finalize device's resume during system resume. + * @dev: Device to handle. + */ +void acpi_subsys_complete(struct device *dev) +{ + pm_generic_complete(dev); + /* + * If the device had been runtime-suspended before the system went into + * the sleep state it is going out of and it has never been resumed till + * now, resume it in case the firmware powered it up. + */ + if (dev->power.direct_complete && pm_resume_via_firmware()) + pm_request_resume(dev); +} +EXPORT_SYMBOL_GPL(acpi_subsys_complete); + +/** * acpi_subsys_suspend - Run the device driver's suspend callback. * @dev: Device to handle. * @@ -1087,7 +1104,7 @@ static struct dev_pm_domain acpi_general_pm_domain = { .runtime_resume = acpi_subsys_runtime_resume, #ifdef CONFIG_PM_SLEEP .prepare = acpi_subsys_prepare, - .complete = pm_complete_with_resume_check, + .complete = acpi_subsys_complete, .suspend = acpi_subsys_suspend, .suspend_late = acpi_subsys_suspend_late, .resume_early = acpi_subsys_resume_early,