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: 807141 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gUg8qNZd"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xhWvV447Sz9sR9 for ; Wed, 30 Aug 2017 00:57:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754678AbdH2O5M (ORCPT ); Tue, 29 Aug 2017 10:57:12 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:35501 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754611AbdH2O5K (ORCPT ); Tue, 29 Aug 2017 10:57:10 -0400 Received: by mail-lf0-f42.google.com with SMTP id k186so14377668lfe.2 for ; Tue, 29 Aug 2017 07:57:09 -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=eeNBSwg80rxI92Q0h3hI1ADVMLC4XhVKOCR4JBvKX+UKm+fIJ7YG5UO2VM6LZQpAt5 saUrNPgezS5oRoecwJBDyvfspINB5g6yZzP+eAxZlv5/WGTRybstffyiWbPptVmROR1S lGM2slId7D2kLgrXzu7lusGR18mGNTUxtTkRWIOdnapvrRjJkfI2PJ8IKRFfSkISNlAI /E2CMc07xIDisX4Ad4Ugv/3t45S/RdqKjMhkdyTCzJmruVFaI7p6LiIY8X/dzMxMRx9K pK6qg0+1bdx8RcVfFcVgliIjD+UCYtOY1j+mvTVE1aRXYXIhhtItXbNWvsokwhX2cl+7 RsjA== X-Gm-Message-State: AHYfb5gJQE/LocDnIM36+hPFjvJYZSWVlrlDRYvTX7C6W1LkdBuHXquL n7ehbbgnIiHC6LTN 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 Cc: Kevin Hilman , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jisheng Zhang , John Stultz , Guodong Xu , Sumit Semwal , Haojian Zhuang , Johannes Stezenbach , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, Ulf Hansson 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> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.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 --- 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 */