From patchwork Tue Oct 3 07:11:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 114670 Delivered-To: patches@linaro.org Received: by 10.140.22.163 with SMTP id 32csp1552854qgn; Tue, 3 Oct 2017 00:11:24 -0700 (PDT) X-Received: by 10.25.115.137 with SMTP id h9mr456403lfk.230.1507014684753; Tue, 03 Oct 2017 00:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507014684; cv=none; d=google.com; s=arc-20160816; b=tt5BMqjiy6+JWNzNvCIAaIPU4vioIhEcI41hiMniGe4IgSre2aOiBGO9RsPDfzPj+5 cT+oj9lkc9AQDzfLmXMfT8ym+5+egdJNuGwxUqH0EJqj8SDuU+l1ecfaSTnekS1tdZZt MIYRu9lJVj/mmBy/or6dDam9cQQ4LTqYFAsDON/OoyUPmefpIU0XE5ZcV6GKsjITpXzV ZTdV4E/MXSEW8py459N+ek22UFhEHR7y2iTv8BBY+so42OoT4z5ecBBtIgpiOiIHykXJ 5bqvZSBDq3VTLRcstgxvvW0saCVu7ffOhy9WIKUFJ+0L85aiSrmLO8EOeBURuEJNwT8r w43A== 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=i9LTPr3NQP6LXkf5acmqRvL/6PLCvp3g7LDHFKZztS8=; b=C4LMrekX5phJ7PuzlnAepVo8B0R2J8m54UqvrV/oal9ioNfzWJ3QhmIxP2yaXpNWVS J9/3CvJwXeqpCWcPwxdr1Y0GsHSfWxdlZRDefhRbz5QzUB7kZEY2SFvXh8LH3vn8zq9O XBvFuwoR6pCopFjdCUa5aHhsf/PDF+7ubohc//7cidAkcnw1pxm+qaR99Adhul8868tA X2dN8LhVB6WdZk37xSl0flUzo4sYZgWeZC93H3dYpxoEvk9mKf9eOrUkU6bxC8nZgDSv R7CVrwwQ9iKJVggKevnjrnXsIwm496M1KJW8wQ0Qlp9FoLuzXW7xh2aGzQIUff7Oqei+ 8Gew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Skkvt44F; 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 63sor1847445lfr.66.2017.10.03.00.11.24 for (Google Transport Security); Tue, 03 Oct 2017 00:11:24 -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=Skkvt44F; 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=i9LTPr3NQP6LXkf5acmqRvL/6PLCvp3g7LDHFKZztS8=; b=Skkvt44FG9DdSGr4QSidD9nCkqLB1CFZWMCsbOjbxQhOhNpK6udll017Nefps0gAqS VnTBVNgQW5nE4fa54XMSqu+trEIC+TG1iG+fbSBzkKwdESzR5G9iVpqXLAPGWH5+aWbc v8IH7z8ZmqIm3ZpYleOcWon2+UPJFDmmH0OpY= 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=i9LTPr3NQP6LXkf5acmqRvL/6PLCvp3g7LDHFKZztS8=; b=W5UK12bYtcEaNt2f6dZoS2NJZMbKCcWqF1gnPWkdR/sipbFlIvsYqksLVLC1EYfbYP 454XOMm4ggNB2Ev6FVkXbxdfVsrquHkwyXTxwDOCY3N1LCsy/OGnDSeq9sEMkPlRlM8p EOg6g/rWpfFXIwXYNK8o0giba7E1DzCsvPbpaVVwKvO0ESmyc9wLvKRFe4sHuHmIf79c tEQ+Sxon+hhHHKYqgUlEEk7flm/M+Ne8UsllK5WHPbUTqjk89Qkt7OIc+IqU2/O9/1ET F3gUVqrzowkpGB5wzG8xappe1d8yEQLq9qV/zTUOEdV3UHy32e5uXsyPcjAuQOWOTOUA 5o2g== X-Gm-Message-State: AMCzsaUdi/k7qbz/8fTViyEsIektS3NvlAy5oQwtqOozx/cXArZ9Uw7S r4IeCD/8V66T1B00FhUvHxC0UFWd X-Google-Smtp-Source: AOwi7QB282XjNqqwVFdIF4iAnD1h3qIlNyS4PahGjRRSBLBNOsfPNiddw//BzJutEZZTileTZsqJ6g== X-Received: by 10.25.56.80 with SMTP id d16mr5185690lfj.157.1507014684410; Tue, 03 Oct 2017 00:11:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Oct 2017 00:11:23 -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 4/4] PM / ACPI: Split acpi_lpss_suspend_late|resume_early() Date: Tue, 3 Oct 2017 09:11:09 +0200 Message-Id: <1507014669-1502-5-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> 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 --- 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 */