From patchwork Wed Aug 23 14:42:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 9917515 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 E7D5260327 for ; Wed, 23 Aug 2017 14:42:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA5CF285C2 for ; Wed, 23 Aug 2017 14:42:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF06A28927; Wed, 23 Aug 2017 14:42:41 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E297285C2 for ; Wed, 23 Aug 2017 14:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932134AbdHWOm1 (ORCPT ); Wed, 23 Aug 2017 10:42:27 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:36198 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754151AbdHWOmX (ORCPT ); Wed, 23 Aug 2017 10:42:23 -0400 Received: by mail-lf0-f52.google.com with SMTP id l137so1427329lfg.3 for ; Wed, 23 Aug 2017 07:42:22 -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=VxCQHodaKHhG0+hTeLvSHBW3NEuDXnKN4by+eq4cwcM=; b=dcmFdWaJvixzT7Pue/FcXmWuNsI9f6cG8QJ9/+QVxpqRf8/7KPYdTXktvrE6ZEEO3h zLdFCHVxM+LffQaVchX0tjKI+l9HDEEQIV8t+bWpTlFqMvA/5lEBNH3asHpnZmN82edW nPDyxwvdt75Hg8J+JF/38ATlHJhJ7ViAwNngo= 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=VxCQHodaKHhG0+hTeLvSHBW3NEuDXnKN4by+eq4cwcM=; b=pxsDJ6rs0L5V70g7RD7pCRwdFiOzJL0yZXTjgvoSIt13BNzij11s+7QuscjNu8DahC xn5fAMDhWlLz906gcGtrx9q+hPaCG5hLC3QXFM4/tDNV3cvz5wtN4QveqkjzUFfmmKo4 pGOtZPnqDRe0Vo+7R1jmb57umzxlW+lduleuQayecYzXZanjthukC0V5OvHQ/RIEfLms c266iubtVoZvhtzIzkR/vK9fznCzdsD0i1wZTBHHuUrYdq4oilccDUjGYhabhuV9D9/t 3/c/QoaVkGHtqXwx4zU3zgdIVm10W6HyJ/AfB5w6B7PFcJraICq5RPNO7xVJ+dyesBn4 GFYQ== X-Gm-Message-State: AHYfb5gwX5wme31/l+Vjp6PgqRi2muGMr/jgzUhWdCKt/2O7M/iPzFlX UyrX34ohWLMSeGaR X-Received: by 10.46.84.83 with SMTP id y19mr1129581ljd.167.1503499342117; Wed, 23 Aug 2017 07:42:22 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Aug 2017 07:42:21 -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 v2 4/9] PM / ACPI: Split acpi_lpss_suspend_late|resume_early() Date: Wed, 23 Aug 2017 16:42:04 +0200 Message-Id: <1503499329-28834-5-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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 v2: - None. --- drivers/acpi/acpi_lpss.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) 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 */