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: 9917563 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 91A32608A6 for ; Wed, 23 Aug 2017 14:55:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 836BC28943 for ; Wed, 23 Aug 2017 14:55:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77FC328706; Wed, 23 Aug 2017 14:55:40 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8C23289AB for ; Wed, 23 Aug 2017 14:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=wWooHKAltQAHOl/jk8s4laNA2NktXG1xPJkKfN3iI6k=; b=S63Wq4z5unT2tOZ5m7cCE3UCTx Toae7Uwm4BXm+/UMWtwoyzk18fButYwRyj9XiLJNudeGtsjo8qbeZxzHMY2M7GP6ygNRgy9ZIGn1m CWzF4E4xG9UuSGm/bZCO+1UH72lKvQOK+tcMYUOabEKbfULiQHwavBobOavAYV/2y5TVH36Z0wxxI HGmVo2CTmuvKCecj2ccwOP7e/4RHnhkO3CVlcLBSltcadpStrIH55Zw2dTFQp1Dhm8vIibM0llgfs YsKAEEvD8f0cBjVVYLD0c4Kez4ZMSPlnLsqDwEkWoxGMWZlFUY5h11U0Fs7xd6lWmaRfhmOAowZ0V kR93aeNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dkX3i-0002Ot-Gf; Wed, 23 Aug 2017 14:55:06 +0000 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dkWrh-0001QR-CO for linux-arm-kernel@lists.infradead.org; Wed, 23 Aug 2017 14:42:44 +0000 Received: by mail-lf0-x235.google.com with SMTP id g77so1536433lfg.1 for ; Wed, 23 Aug 2017 07:42:23 -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=SXa5vSB1TxOrnU+2dvyyb6GLcdZjVrr4sSSw503XJIAQ4VhTeNwoc80p5niFSDJm+K DHpFPx8m614sDOaqR7e+jZ1gKYma8ssNfMBEvL8VHUmXvN3WZV/PYyZWzgaPFTvIVt5h K/yPhCIQIDFoSUljFDJgfxnZLveMpOamERi05RG9DCqcw3fC9H9hjmLgAncXMA9MyyeK 4AtQKW3ilP3ZE7FrU+JaNitQaORduDwNPOl4KA4Tkx8lioNiqAMlT78tVK63KOUmjEX0 0bi2BkuqIB4OVPMMVqkOHp3RiN+rii6+TEWdf3aaYGCvkpRDqm2sLcG36OI1wzFCKKax pubg== X-Gm-Message-State: AHYfb5hw1dFu5xntJGsf3nLHAXBCtQ2Ql66fnhtaK9NEC17vpB40l2wF GbQp6sThc2g267yL 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170823_074241_714027_93672741 X-CRM114-Status: GOOD ( 13.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jisheng Zhang , Ulf Hansson , Guodong Xu , Kevin Hilman , Jarkko Nikula , Haojian Zhuang , John Stultz , Andy Shevchenko , Mika Westerberg , Sumit Semwal , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 */