From patchwork Wed Jun 21 19:21:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 106116 Delivered-To: patches@linaro.org Received: by 10.140.91.2 with SMTP id y2csp2092608qgd; Wed, 21 Jun 2017 12:21:50 -0700 (PDT) X-Received: by 10.25.22.105 with SMTP id m102mr1733244lfi.66.1498072910039; Wed, 21 Jun 2017 12:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498072910; cv=none; d=google.com; s=arc-20160816; b=n/L5LqYablxE1vZ1UuWkJX058NZ2VDkMJnDIKKQmjqx75jwFnIQvM15OmfDY26JzL0 AfKKB8Jrwj7o0NW4LKrfi6piZRykYOsTIEZcykkR+dxWJ1SrjKOPdXCAB6F8JpEEk+Tj Y7yZ8OjKGcq99E3ixPfYuaywVETp7W25LgnG1lQZ0qHV1SLFS8NiaLhGKXKbwHeI7pfB VzmqP0GwlwBycdLTe1ah667lS6gSFaTNIXOpsmih8H/W3AVCM7Lx8DnKf5iF8D7+aDdB M0J3nTIecFhwxf4c1/6tTDmCkaz1Bt0G6Iqe9pUpJJA+RbRN6Vm3GNR4zirPwSHmakvh Vfcg== 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=liNEDxp84FpoKqU17EtPadGxsRlMpLk7RyQaj+68Pn8=; b=ME6ZYwqHc4ff7Iq9B0g8LA1cbnfODpQUnv4PG4FE2Uc3YCZwEJk3OymZFheqgezyTy 9P42PbFK4tWVdc5+CD0vuKp0YWccdtRIDNZ55E/JnfbIQSO8wCZr7Eb98Abco8hbwtPX /JSBjAHVOX3btOnxkuRcLx5FiLfUT8hw/x7H/b2qndjE7EWhqzJNn5iOfZA5k6SqGkqI Y3F6OrwBKIzJm2cHcmpW1b3ot2uyucKPoeobHC4KNRej+cvO3qU7GEW6JL6Harkx5/fW Q1GlEx12q3SEImYgTqHIWc1CqdaL54nhVyJloHsL4bAUABqJhVGvwQ/TD+k/tiYrSJiZ c6RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=QpBhcd9P; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::230 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-x230.google.com (mail-lf0-x230.google.com. [2a00:1450:4010:c07::230]) by mx.google.com with ESMTPS id y130si9029249lfc.86.2017.06.21.12.21.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 12:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::230 as permitted sender) client-ip=2a00:1450:4010:c07::230; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=QpBhcd9P; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::230 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-x230.google.com with SMTP id p189so102983872lfe.2 for ; Wed, 21 Jun 2017 12:21:49 -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=liNEDxp84FpoKqU17EtPadGxsRlMpLk7RyQaj+68Pn8=; b=QpBhcd9P1jje4M9S6CA/cWb3cpYGJJv3n+gwayJJFmtcQIdrx0xXqn521c2JFZ3PMi jumVQF4jG2z3NY4bNqz0BQLvdEwMNJ8I81qkFBNbMHWpBtU60UoFKvVUSTe2dK7M/crp N9iQQ9rVnkCmWiBY7mhXetBkPt2cWtAGJPo5I= 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=liNEDxp84FpoKqU17EtPadGxsRlMpLk7RyQaj+68Pn8=; b=rWdPV+TV7BnfN57C/4fm+CeVYKxxPZ+T5Qn22iaXZV3eyuI9Ltv4Fq8m6AAs9ZNqig J90qhbHOUDIhMlDmo/sPw7kQD3FTy38o1WyV2XH+m3dr1Ga2sVRHdPuUYTwx+ND3zn5W 8bygWvTUcBA4Yj4YLy4FiX1beH3LfKuJZJdb1obzXL9emkdpUPSM0bl1oDC/fqUZGW2r cqSUU5ADvlzIhebc/a6CniqnFvmBQDoLKl46tK7SBCJ5kAKCZUvjVJH8QhhSoU27r7SS Z7AmFy8mlKhMMe1cxvUNo5EOPvLxx1CpBx5aqRMCp52LYRjzu8mXOGR18tDeIJorcd+X 54Sw== X-Gm-Message-State: AKS2vOyuPxdLqjdH//XSBud/L9xbDUEc8At0LlLHJaFgP3/z7WBSDgXQ op5mmO9kfdD1HvwefUU= X-Received: by 10.46.80.84 with SMTP id v20mr7354828ljd.129.1498072909680; Wed, 21 Jun 2017 12:21:49 -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 t24sm3920047ljd.1.2017.06.21.12.21.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jun 2017 12:21:49 -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 2/9] PM / ACPI: Restore acpi_subsys_complete() Date: Wed, 21 Jun 2017 21:21:21 +0200 Message-Id: <1498072888-14782-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498072888-14782-1-git-send-email-ulf.hansson@linaro.org> References: <1498072888-14782-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 --- 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 10347e3..d7b6778 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -879,7 +879,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 ca02102..d38acbc 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -964,6 +964,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. * @@ -1031,7 +1048,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,