From patchwork Tue Oct 3 07:11:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 114667 Delivered-To: patches@linaro.org Received: by 10.140.22.163 with SMTP id 32csp1552804qgn; Tue, 3 Oct 2017 00:11:21 -0700 (PDT) X-Received: by 10.46.31.17 with SMTP id f17mr2502517ljf.102.1507014680973; Tue, 03 Oct 2017 00:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507014680; cv=none; d=google.com; s=arc-20160816; b=qjIy0KjaOO/ODPctP50dpsLBcxYyGwBYzGvwiKjXi6YNNjr6dKgPtIH5KnDUtBijDH NW90tt2lDF/A8eQmo3+SYWfLtLRPzoXGOcTYoIu1yhzuzLDIRVcu2RXQLofF7RYPsBBo FUsqnllR0dZTGqxa9G4RTQXwwSVI+5yB5Fu3yfWT75GynIA1Z8iPFHQRNAThhvpXcp18 IzeeyVea+kPrwWUJGJDmgMieITv1D5WD6EivS1hZxI7Ep/0FEC54PGGFc+DqDYVdPS42 u4c0n0raf1vLoDNPWqX18+cxEbN6eTu0KjbD7Do3KDL9/dqQhwgKIeBxwrRCQyUwDMuN s2rQ== 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=7/Ou5jvJLbGAZcm2TFdgdYXlrcHEFB/3t5Dk+B/DuAc=; b=YmRDZ7kSXhdn0MJQD148EugE5bIawiCaxuPB6pmfDx+xFL5cAaUJXHINYf+jKLwLK4 /+Imtr2rNPTJxsjG6Wez4ntqNamwcfgov3ZSZDF9y51Pz9VByjiaeiE1dX9DWfLdAFQk NCu8iS1fNBjYrfJ/CC8hDeO17CIWrJcZ+Ffpb37ysfYZdDI4rQ31rt7jxvVl12BYWrup SNLxJRJ8AyXr6WUT5iWVzx+8xSihdXsZD0xmqd5VEzi/RPTROJ4WMCRwyZU4a3NflW9g Ibx6Myhp+z2p3cTCOvF+i55lG7WCUjs1KlEVIRIbwYKr36HtgnOSU8C8+tCvi5KRuqO1 nY6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d3kHgv5N; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 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-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id q7sor1816798lfq.42.2017.10.03.00.11.20 for (Google Transport Security); Tue, 03 Oct 2017 00:11:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d3kHgv5N; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 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=7/Ou5jvJLbGAZcm2TFdgdYXlrcHEFB/3t5Dk+B/DuAc=; b=d3kHgv5Nn0gCQI65sPpJFFohR9oy4v0O4CypDbsPHubwDI8041upNfYW0Qn5zRNpgL EY+WczKkJIKtnJX5izkVQwhdZLMiu/fNk5RftVR4DjpgSYdE45Bzo7KB+FINVPmKHLnj Pg+KorSEll4ZNUJYY/E3C5ZpP0Y4fO05loFD8= 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=7/Ou5jvJLbGAZcm2TFdgdYXlrcHEFB/3t5Dk+B/DuAc=; b=s1oKij+F+PBsDudSGT2lPqWy0uWvbrmabvcYaNNGGug8QNUqid2tZGdOSPnkWV+gC1 iqZCPE2LpTY9m8MY8o8xiCK0VKRRGrqXWe3aeAgyd8di2TpbqoN4AUkzmaTqC66LOhhV gZDnZ10LiT0fTgZElA3P1ILmFPv6ea3WZJ/FbkQ2FQjvVjyh2lz2ZjoLaYHLVD2UIwPn B+vAsohkwEveJXkzyRgaItu8hp/GbpKlMjUKKfSgvNEDwaLqKfTb6roXi07hVCeJ9pj5 Qq6rZ5U09pyncczXkiEIUJZ6MjfsKTte9gRRGbyoisb5FMBadOHGkskxXCk1ilDQvS2v WY0A== X-Gm-Message-State: AMCzsaV0uVSl0NHUn0TtyC7cT92dsZEj4dU4Df8a+4ClJAFhwe/gCQKY XuOkEiUQaUZBnfGDfiz2NHw+RL2l X-Google-Smtp-Source: AOwi7QD6+6Nzy+1jGeKnLNABNPuueThpP63emMynTXAFWgBOp8VY5UmPdsF5gnOmIcTDyWp4OMzNfQ== X-Received: by 10.25.104.22 with SMTP id d22mr5295464lfc.41.1507014680609; Tue, 03 Oct 2017 00:11:20 -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 x13sm2764497ljb.23.2017.10.03.00.11.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Oct 2017 00:11:19 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org Cc: Len Brown , Pavel Machek , Kevin Hilman , Ulf Hansson Subject: [PATCH 1/4] PM / ACPI: Restore acpi_subsys_complete() Date: Tue, 3 Oct 2017 09:11:06 +0200 Message-Id: <1507014669-1502-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507014669-1502-1-git-send-email-ulf.hansson@linaro.org> References: <1507014669-1502-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 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,