diff mbox

[4/4] PM / ACPI: Split acpi_lpss_suspend_late|resume_early()

Message ID 1507014669-1502-5-git-send-email-ulf.hansson@linaro.org (mailing list archive)
State Deferred
Delegated to: Rafael Wysocki
Headers show

Commit Message

Ulf Hansson Oct. 3, 2017, 7:11 a.m. UTC
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 <ulf.hansson@linaro.org>
---
 drivers/acpi/acpi_lpss.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

Comments

Rafael J. Wysocki Oct. 6, 2017, 12:59 p.m. UTC | #1
On Tue, Oct 3, 2017 at 9:11 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> 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.

I'm not sure what changes this is talking about.

I have the device flags patches in the works, but I don't think they
will need this ATM.

Thanks,
Rafael
Ulf Hansson Oct. 7, 2017, 6:46 a.m. UTC | #2
On 6 October 2017 at 14:59, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Tue, Oct 3, 2017 at 9:11 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> 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.
>
> I'm not sure what changes this is talking about.

Right, I forgot to update the changelog.

>
> I have the device flags patches in the works, but I don't think they
> will need this ATM.

Okay, then let's just ignore this one.

Kind regards
Uffe
diff mbox

Patch

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 */