From patchwork Tue Oct 3 07:11:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 9981847 X-Patchwork-Delegate: rjw@sisk.pl 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 A744960365 for ; Tue, 3 Oct 2017 07:11:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A9D72870C for ; Tue, 3 Oct 2017 07:11:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F7732887B; Tue, 3 Oct 2017 07:11:29 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 427EC2870C for ; Tue, 3 Oct 2017 07:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750865AbdJCHL1 (ORCPT ); Tue, 3 Oct 2017 03:11:27 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:46976 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143AbdJCHLZ (ORCPT ); Tue, 3 Oct 2017 03:11:25 -0400 Received: by mail-lf0-f53.google.com with SMTP id m199so8569473lfe.3 for ; Tue, 03 Oct 2017 00:11:25 -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=i9LTPr3NQP6LXkf5acmqRvL/6PLCvp3g7LDHFKZztS8=; b=Skkvt44FG9DdSGr4QSidD9nCkqLB1CFZWMCsbOjbxQhOhNpK6udll017Nefps0gAqS VnTBVNgQW5nE4fa54XMSqu+trEIC+TG1iG+fbSBzkKwdESzR5G9iVpqXLAPGWH5+aWbc v8IH7z8ZmqIm3ZpYleOcWon2+UPJFDmmH0OpY= 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=i9LTPr3NQP6LXkf5acmqRvL/6PLCvp3g7LDHFKZztS8=; b=V0A7fa42Ac5h1YYJph2YcLL8QrKz1+Bdm4sTl2zZc3LOqkRSa9IhBVGWmoOsErpfSA FvMA3TcO1txLRedKxQrDXjaalEv1E8pHePQI09dY2Okcf7K2k0Oxr3LevttWdGACfUhp UntNeZtDyQzoK64dTsJTZh8I6V55W147pqWnYmYV34BCZgw3+JOnKzI/yO8nhbGwmCs6 fORpxMOl5rGUsVK+KeXeAhrChti4Ij7ft6D5nrHxIsRZnZpLAHE+ddReJ6OCBIWGHflV 32GlnmC1vKU86nAq5yBe9qjTFSpepL6oxpbRdUJHbjo/logOt3VzEZLJ3gqQVz+H1T+b gjUw== X-Gm-Message-State: AMCzsaU5WbuExdz+mWWWfCFjDc5ythMp71Ix7on5zuy1wGAgr2OrTXx6 XTEGfxM8jcG96W/VuGT8YNJPQw== X-Google-Smtp-Source: AOwi7QB282XjNqqwVFdIF4iAnD1h3qIlNyS4PahGjRRSBLBNOsfPNiddw//BzJutEZZTileTZsqJ6g== X-Received: by 10.25.56.80 with SMTP id d16mr5185690lfj.157.1507014684410; Tue, 03 Oct 2017 00:11:24 -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 x13sm2764497ljb.23.2017.10.03.00.11.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Oct 2017 00:11:23 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org Cc: Len Brown , Pavel Machek , Kevin Hilman , Ulf Hansson Subject: [PATCH 4/4] PM / ACPI: Split acpi_lpss_suspend_late|resume_early() Date: Tue, 3 Oct 2017 09:11:09 +0200 Message-Id: <1507014669-1502-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507014669-1502-1-git-send-email-ulf.hansson@linaro.org> References: <1507014669-1502-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 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 */