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: 9927633 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 D03CB60383 for ; Tue, 29 Aug 2017 15:01:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD9B728987 for ; Tue, 29 Aug 2017 15:01:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DB3328A08; Tue, 29 Aug 2017 15:01:21 +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 035CF289AC for ; Tue, 29 Aug 2017 15:01:20 +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=9zDB07IRFr41o1HVBhawr2Pz+eIuEMpwrPBpjzm5fr0=; b=fyQvGH0NwT5amoi6uiIzHegX0O X5RkKIoo4bQjRr9nVdKCVP6wElr3ikHVJ8/hFtsMXOaU3cgmtNHi9ME2yOVWWaTkTFMBb9avokIvr +5rA3tvEhUxclG/LTxCss6zXTe22m7BGnjGJ5lWf0l8hxTp18fWaOjf1NPewp//nUZsCH8FelTSy6 Hfb7IYq1X9zmgfYlJoz+lLg+0S2mrK5o8rlODNIP303OYlKjUWyGdy+hZWWOmA8P3RkYDb/jf1M3h PLMmnKbWcYWiQdlPtE+mnpNwSVXeHeum42lqQYNU0FS/ImQ23zNPdSRx0K/l48dPxnB2XA6XdZxO8 1X2f1KDA==; 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 1dmi0t-0005xO-NF; Tue, 29 Aug 2017 15:01:11 +0000 Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmhxO-000246-UW for linux-arm-kernel@lists.infradead.org; Tue, 29 Aug 2017 14:57:55 +0000 Received: by mail-lf0-x22d.google.com with SMTP id a126so14481609lfa.0 for ; Tue, 29 Aug 2017 07:57:10 -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=nwlIMNqR1KvsX2SdH6MlI9Nsz58kLOdQq9tX88BtTBsxINbXLLI4PT6AR8PghNr8DW xicVbCeoeivxR7RbMmialxzU9UOKB3vc1uTSlmkdCcPD3wyRvgAu43hIEuEb+/JcIQMQ jPwoxh9HNoXJrQLDRg1npGEu29xJ65VKDSdnjziZH506LB1JhHgvJ6UxGvn3kTm8Nh8s JyA2lBa2VOIXgxz1gaMp7nxLN0PdEt4J8deOeotMxnVehvJE5zMIT0OOCzxyYJ769Crt q3ZSDogCI0OqKhUujLldLmCpCyrfuTfdaLbuWOPRgiUCJot0UGxNx0Bg//UWs+LRIRjY uGsQ== X-Gm-Message-State: AHYfb5gBmrVe6kkg9GtmqR7k1CCQvWZN3x4N6SUHA+E4B6SB6yt+20rr TXVdTykhI2KSHMe2 X-Received: by 10.25.31.136 with SMTP id f130mr156330lff.135.1504018628870; Tue, 29 Aug 2017 07:57:08 -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 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170829_075736_157539_D9D95D4F X-CRM114-Status: GOOD ( 14.03 ) 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 , Johannes Stezenbach , Guodong Xu , Kevin Hilman , Ulf Hansson , 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 v3: - 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 */