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: 9981849 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 015AE6038E for ; Tue, 3 Oct 2017 07:11:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E93FB2870C for ; Tue, 3 Oct 2017 07:11:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE1E528878; 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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 6625B2872A for ; Tue, 3 Oct 2017 07:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751072AbdJCHL1 (ORCPT ); Tue, 3 Oct 2017 03:11:27 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:43141 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751146AbdJCHLZ (ORCPT ); Tue, 3 Oct 2017 03:11:25 -0400 Received: by mail-lf0-f51.google.com with SMTP id o125so3964999lfe.0 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=jvnNhAvZc8I6Jc0as2gSZyKUjKQP/b1KSsVwAjR5uYaA1Az7l5srm5awEdhuw08sDT aaQlbghBXU8n/9zMdShjUez9uWI4knjSWSMoe5YZElLoFNcH3h8IsD/H89OwHnTfkue+ SWm+43ZLRa3F7wAAj3jclcniZCuvySQN7MjupTDc+NP8SZzXLYbBwHbWvsJqjSh1tULc ZyVC5qqC5uH2Y9ig7Vz9VnsvMLFgrd2UP6VuBw83/z65kCB8HjHe5Y88qqbVkgtqbvd/ Xt9avTJ/x80g6R5fxBVzSe0OUtFBSBoJCiZqF1aJ18gxUh9LnTWEegQg3js+KmbBPrXv gTaA== X-Gm-Message-State: AMCzsaX5bMytfEI9fe0hoGxEYXrc3RozklJTBdtH5RgOZnz4rRyt4Z6i Gd+J+OK/BKc15Sxe6kWwt/VFuQ== 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-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 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 */