From patchwork Wed Aug 23 14:42:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 110846 Delivered-To: patches@linaro.org Received: by 10.37.128.210 with SMTP id c18csp7031362ybm; Wed, 23 Aug 2017 07:42:18 -0700 (PDT) X-Received: by 10.25.228.194 with SMTP id x63mr959854lfi.218.1503499338034; Wed, 23 Aug 2017 07:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503499338; cv=none; d=google.com; s=arc-20160816; b=sLTUnYDaPHUu2gEB7Xd+HodNAxXGxCKOHPHvBPF1rTnErZt2esJyYUwogkNZcB+dzE DymympcwctRXAqRGP0cVzGN/VP59UQJx5bd2tEYoZsj0T9QTTX0JJzIYe/hZTvD7Kwey 2lR0L2IuFE0wF3V3JuKqatmU8y0c8do5Fz2dTTLEnxdph8YKOVXQLRZ94xjlcWjiFtvk 3vog6gsffNWBPqOAJ1ncIz0KHaPZHHO+Lvv39wims7xnUl1ALFLoyyLvFD45QAstEl+F CXKA4wkmWOF4Mz8UkeuSH9wU2MlqJH33dPWhQZ2dmilWuw/jkdc7kJndWRHCrCTIqLXE tKHQ== 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=KzVpXfyc4xVzl22eZpEVfjyQDIR09PtoK3oRB7BB5a4=; b=fzOCmrAG4DVDqiP8jdcB5lAiAf+L8WJLT6WubXC+tL0xPy+ELIx9WpyB06TZ3z79fw KT5gi/ZLgvTYW1JZuFB7Uhe/xoY9YVVdnCSsAGII4Yaof+6D5B3UZnhpPmkKReUzbher KrgFayVzZwP3sL51aF/um/ofr8w9SV/AF3RrGB++HEpMjOwBxtW4AQ6JPJWPGTt0UQCH MfpTer/G7jeJyM3rhqog/wqqhP/Zc2b8CzDnA9AfZYf0/01LlFX5GKrOtfiSBGHCVD93 8TQ4KWG1WtC+nftKmODiQiwTJdScEuehfYVT3/AGJJMKHpGrc56t93s151kQTBk6Iuo5 EUew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fMGGCVJr; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::232 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-x232.google.com (mail-lf0-x232.google.com. [2a00:1450:4010:c07::232]) by mx.google.com with ESMTPS id 1si745715ljn.72.2017.08.23.07.42.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Aug 2017 07:42:18 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::232 as permitted sender) client-ip=2a00:1450:4010:c07::232; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fMGGCVJr; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::232 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-x232.google.com with SMTP id g77so1535421lfg.1 for ; Wed, 23 Aug 2017 07:42:17 -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=KzVpXfyc4xVzl22eZpEVfjyQDIR09PtoK3oRB7BB5a4=; b=fMGGCVJrKuhg8VgM11uxUlqHOhu9636wl25qTqyIvIVof5a59Pahso49ocmXMl4LbN ZqOjulhcw27qjtfsvgIPeFja6hUZDLgucl0zrZZpQQ43hIe92IO4D8tZTGaGBG+0Oo84 e+JYrqjbSlSz9JDo28PCMnBzj0bH9bynw8J8k= 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=KzVpXfyc4xVzl22eZpEVfjyQDIR09PtoK3oRB7BB5a4=; b=AsACHUXx0xyRea0I26N1dISlKUM7g0N2+Mf5qaJ2piBpZjcJ+PTubjWqxlTwDrezm5 qTmYFqew0pAaSCJkIhV4JTUOiG6KqOIRiLZ1omL0jRuhRNOxNRLdcUpHyzzx7RHBkOBr g61ckBEWpVRgHLIL3Xz4uRn1pAX7ObQVRqpSSEsuh+g/wiopUpDABV7YC4RRXUgO0eQ8 5ZfmVjTxBz++Y46fYlz50hqQST5aCkdCKo7RuH3ILW2kbP9ICFUTfZbVEzRybARhnl06 y6hxPSezdw1Mu7VQj/H6rPQBPQQBzMgMoem2w8jDi993fOpEzcfywdnrxaOKyf5OnzbK MUPw== X-Gm-Message-State: AHYfb5jmp8I9bcgKOhUqZ4//C4R8vMW8Km/FOA+rKjqHYL0nHAzFZ2Fz 7NyL/dE3hJ7QKaWYYfs= X-Received: by 10.25.84.4 with SMTP id i4mr912192lfb.221.1503499337581; Wed, 23 Aug 2017 07:42:17 -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 c89sm287593lfb.78.2017.08.23.07.42.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Aug 2017 07:42:16 -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 , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 1/9] PM / ACPI: Restore acpi_subsys_complete() Date: Wed, 23 Aug 2017 16:42:01 +0200 Message-Id: <1503499329-28834-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503499329-28834-1-git-send-email-ulf.hansson@linaro.org> References: <1503499329-28834-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 v2: - 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,