From patchwork Wed Jun 21 19:21:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 9802745 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 9D4D5601C0 for ; Wed, 21 Jun 2017 19:22:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D874285ED for ; Wed, 21 Jun 2017 19:22:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CCDE28662; Wed, 21 Jun 2017 19:22:24 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 57D282869D for ; Wed, 21 Jun 2017 19:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752006AbdFUTV5 (ORCPT ); Wed, 21 Jun 2017 15:21:57 -0400 Received: from mail-lf0-f44.google.com ([209.85.215.44]:36291 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751997AbdFUTVz (ORCPT ); Wed, 21 Jun 2017 15:21:55 -0400 Received: by mail-lf0-f44.google.com with SMTP id h22so23139415lfk.3 for ; Wed, 21 Jun 2017 12:21:54 -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=JaEwCekFsuVLnVwL8IUqLgCL1SsSfKEdsOUQ9nlXA3M=; b=PMLMk2+VMub8w9US46yrAeuN3GiD9ZZINXAT4O6g/cAoUyApaT3WqTH7bmSEstBpvx 9znN2wtGdSEjq54DHcr15CguRdWyroKQIgFin21ddvZQPtsbWlY6EYP7Pa1hf89sd1+H OI7KstOCGFqv05+O+Mx+o7zk6lu4uyaLRlfEw= 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=JaEwCekFsuVLnVwL8IUqLgCL1SsSfKEdsOUQ9nlXA3M=; b=PjjoQZuigkHNnWkxNyeuPSQPQuwZvQLontZ0RGKpJ1X4iY3Z7jW8hpktCF/M9WyoHX lccr0tX7k3Bb5Xq3nKISwmgvyoDJo5jXPrPyt4kVINMah+Gi/zoLj8V6AN5QO7tqqFSr zaevzd6LVzLajQGQvrvGMBa7p9yBwb0JaZx1OtOQzgZpwzZop5zzDuQfVuWTxGdbyker HwSX93B4RTQ/jBR7swB+CdY5y/9cscu4XEGDFjDgkbWt3JM6QbhvZfnb+xFwgPeSclna EjTeqPsYsdemYLLBgVqu08zDS4uP8GR8OlQwp37eszhw0E3Fbb4wz5WCYqUIgo8dDdU7 5AqQ== X-Gm-Message-State: AKS2vOw273ZWdcteCeYTi2YRsusZqnMPPm7dBtmlp40BYJR4v8W/1tTa qvtE12HKzCpdmcx6 X-Received: by 10.46.84.90 with SMTP id y26mr11084220ljd.77.1498072913735; Wed, 21 Jun 2017 12:21:53 -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 t24sm3920047ljd.1.2017.06.21.12.21.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jun 2017 12:21:53 -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 5/9] PM / ACPI: Split acpi_lpss_suspend_late|resume_early() Date: Wed, 21 Jun 2017 21:21:24 +0200 Message-Id: <1498072888-14782-6-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498072888-14782-1-git-send-email-ulf.hansson@linaro.org> References: <1498072888-14782-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 --- 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 d7b6778..12bc5c7 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -702,22 +702,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; @@ -731,6 +737,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 */