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: 9917529 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 6B8D460327 for ; Wed, 23 Aug 2017 14:43:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DD37289B4 for ; Wed, 23 Aug 2017 14:43:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 526D8289B5; Wed, 23 Aug 2017 14:43:07 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06760289AF for ; Wed, 23 Aug 2017 14:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3c462OQ0ljU5DE6M4KAJSkYcnsLTWGOixRbISYyLHlg=; b=s9l2R1mpCnbeFMMQI+fSNswnai TayY/k4xFAJk74DixkEXPS7aFeaM4bQAl/SbaR/c2w28ue5mDIuCu+aEe8VMiXbWvU5pq2btz/cuQ 8u0VLraf8FYtYx1S5DAXSpLJ8NS8mOB9sqmW+va0pXnJRDspxcHvsYT9zgU8wihf3faLlVM4cK6B8 kUS6bH06fmhpvJxmfT7YJXLr4EaoqdPGHcPzxrShREIvbUX986NFpMjwuo8d3ham9bPasvwHhXmA2 I49nlY2YACiVKLe/mtr1Fc+OnvXtget/htjb2Q3kW9efBVG/5DSMLMImAKfac/DRG8j+NHiXztaV9 kbBrjClQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dkWs2-000245-KW; Wed, 23 Aug 2017 14:43:02 +0000 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dkWrf-0001In-Qa for linux-arm-kernel@lists.infradead.org; Wed, 23 Aug 2017 14:42:42 +0000 Received: by mail-lf0-x234.google.com with SMTP id f7so1387429lfg.4 for ; Wed, 23 Aug 2017 07:42:19 -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=ZNiYA3+V6Sj7Zd0wb/udnV+zGSKjnXhwKbpG+P4t7G9Z1lA2wlS8m7oP03OC7Oon9M 8rTQ8H/Yd3fZsQwZDElo4Pdnwksp+BmiH3lF7UMTkNlYii+JfXyEAn++E+F6YDC8pP3+ 6uJzn+C/09Cygo6oajKPHoaUwFcMDGFgc+LJNutfpzy9Vwq+n6RntUXkekryyt8dxs9G bWIqxZQTpCqIfNsZ+btX5J/ii+8nowf8xvLkhYoV445KYCqii7AcDEYVdnzaf1kAcmcU KTfUUt6q3jXrMPy5KJ04dQ4W0vQG1ge8Ijb30XfWVaEeN7ZnQk/5SLnl6ylSin/4v4k8 DTfQ== X-Gm-Message-State: AHYfb5hN/JsEsHXv9+ph+5dj2nSC7xRcFFo9k350mFs6y769wyykjpFK N8D81VJxeiJYBbvp X-Received: by 10.25.84.4 with SMTP id i4mr912192lfb.221.1503499337581; Wed, 23 Aug 2017 07:42:17 -0700 (PDT) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170823_074240_137211_F3D02D9E X-CRM114-Status: GOOD ( 14.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jisheng Zhang , Ulf Hansson , Guodong Xu , Kevin Hilman , Jarkko Nikula , Haojian Zhuang , John Stultz , Andy Shevchenko , Mika Westerberg , Sumit Semwal , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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,