From patchwork Tue Aug 29 14:56:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 111223 Delivered-To: patches@linaro.org Received: by 10.140.95.112 with SMTP id h103csp1457567qge; Tue, 29 Aug 2017 07:57:09 -0700 (PDT) X-Received: by 10.46.77.84 with SMTP id a81mr267325ljb.134.1504018629294; Tue, 29 Aug 2017 07:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504018629; cv=none; d=google.com; s=arc-20160816; b=oczARWjlJVdrKxYzYfRqZIfcz0iJjf9isXzSRmXY2Njt2NWPWuBXVAOEBnM2s9AfYL HEUTnXxVnWS778MdYhGsD4GLyGz1XJ4ykHAZb+qhk4hMhWGttH6+R/IcmOmqhPfmUxlQ Tlo+sI96HSvrkNzud5NFUEL/OCi7I4fJiZ/6hilHpiQTau5TLjwbznt2w5T3NHvsS6r3 bLYbpHKtGtKt0VviFPS6XdXFrZwSUdDnoKYhri5xL1+8GliQkMxyJoyIveGyKITTDb/i /8ylLbzqhJ0nVjhu6JXMV40MWxU6gsfqdhQ8y7mXTAsvbKcBdtI9lTY810nx1yT/77Pt bW0w== 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=f36S30elag1XUSQJ2xs8/bYVZoa7ATy6lX0aBxlSVbM=; b=AKq4nX75ktgI+1ry7dMH561if40DW3Pf60b9aBqXWskva7IIvkRhPuYFnkNBpB+1tx CRATXWRb3I04UZkkfaij63stNXPaa2zB6LV6DSwhvXcdG2+AVe29Ts7Y6bUZVMMF5ljs n8+Cby1xMh2WSYR7zbK55AEP64XgS2Lb+tDFa8Dvyp3koTWbikUGdYllyp5/ZT+76T7P zwDaa1AvjRSuwD/2trWFrvwD2v2LIOxai/0KoHmSLZpM6AHlv2gqggRIYPavYJYIRlWy BiEfK3FbvMa1r01apk4K9wBMuRMke8H5KpNynQhGn8zt3KoqI5WM02toM/SK1AxBhdiL nfUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gUg8qNZd; 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 n1si1412468lje.479.2017.08.29.07.57.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 07:57:09 -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.s=google header.b=gUg8qNZd; 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 z12so14370508lfd.3 for ; Tue, 29 Aug 2017 07:57:09 -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=f36S30elag1XUSQJ2xs8/bYVZoa7ATy6lX0aBxlSVbM=; b=gUg8qNZdgTFXYBikNQpTwlNrIoJ1Rqbkn8/MrtmNa4CdqTegSsIx0mLvBr3RLROVvD Kc/plvnQ2oDlQuxWCyDykDw35gFxLyjzHikJvFDopc65ihv9EvDxYrJDAynZlAiw7KAG 6He1UHzicDQavqHgg7qPfGNiGZjF//vGPM7Kc= 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=f36S30elag1XUSQJ2xs8/bYVZoa7ATy6lX0aBxlSVbM=; b=jQJ85Gv05E5IaV0voQcAW1NGWM/4YbgPGuq7r4DShKosw5JE5diXfZS/Vw67L5plVL nGUb456FfioddGYShUJ/t7Y9CsnQOh2J/kiswe9m1j+9/TgCcDBJvs5Txj1GUg9YTG/f PSujgqGv1ROyd68/p9miwLCCXYDIeUzWI3+TW6Vk4NlohzbmftZXyhbLVCpwR1U9wOSF zeqbJueKLtWCVaCk5qABoX8KMeZUySMwgIe+X9LPBOtjcUqvcH+c6AdWve5+STj2IQ9z A6nBYMByeOPtIKnDqq1fSjXHQr+qybYxQuk5wURbwxTqRRGo6GSepXsgsrhUFQT069Af zHfQ== X-Gm-Message-State: AHYfb5icqTyWmiidOgCh3Smt0CI4r8OEWEYAFjRqVM4wI9+LVXPDfmXP zkRo05SgK1D0YNXS2rY= X-Received: by 10.25.31.136 with SMTP id f130mr156330lff.135.1504018628870; Tue, 29 Aug 2017 07:57:08 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 07:57:08 -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 5/8] PM / ACPI: Split acpi_lpss_suspend_late|resume_early() Date: Tue, 29 Aug 2017 16:56:47 +0200 Message-Id: <1504018610-10822-6-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> Move the code which is special to ACPI LPSS into separate functions. This may clarify the code a bit, but the main purpose of this change, is instead to prepare for additional changes on top. Ideally the following changes should then become easier to review. Signed-off-by: Ulf Hansson --- Changes in v3: - None. --- drivers/acpi/acpi_lpss.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 0c84d15..e726173 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -717,22 +717,28 @@ static void acpi_lpss_dismiss(struct device *dev) } #ifdef CONFIG_PM_SLEEP -static int acpi_lpss_suspend_late(struct device *dev) +static int lpss_suspend_late(struct device *dev) { struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); + + if (pdata->dev_desc->flags & LPSS_SAVE_CTX) + acpi_lpss_save_ctx(dev, pdata); + + return acpi_dev_suspend_late(dev); +} + +static int acpi_lpss_suspend_late(struct device *dev) +{ int ret; ret = pm_generic_suspend_late(dev); if (ret) return ret; - if (pdata->dev_desc->flags & LPSS_SAVE_CTX) - acpi_lpss_save_ctx(dev, pdata); - - return acpi_dev_suspend_late(dev); + return lpss_suspend_late(dev); } -static int acpi_lpss_resume_early(struct device *dev) +static int lpss_resume_early(struct device *dev) { struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); int ret; @@ -746,6 +752,17 @@ static int acpi_lpss_resume_early(struct device *dev) if (pdata->dev_desc->flags & LPSS_SAVE_CTX) acpi_lpss_restore_ctx(dev, pdata); + return 0; +} + +static int acpi_lpss_resume_early(struct device *dev) +{ + int ret; + + ret = lpss_resume_early(dev); + if (ret) + return ret; + return pm_generic_resume_early(dev); } #endif /* CONFIG_PM_SLEEP */