[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200708171530.29592.rjw@sisk.pl>
Date: Fri, 17 Aug 2007 15:30:28 +0200
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Andrew Morton <akpm@...ux-foundation.org>,
Jaroslav Kysela <perex@...e.cz>
Cc: ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Len Brown <len.brown@...el.com>,
LKML <linux-kernel@...r.kernel.org>, Pavel Machek <pavel@....cz>,
pm list <linux-pm@...ts.linux-foundation.org>
Subject: [PATCH -mm] PNP: Make pnpacpi_suspend handle errors
From: Rafael J. Wysocki <rjw@...k.pl>
pnpacpi_suspend() doesn't check the result returned by
acpi_pm_device_sleep_state() before passing it to acpi_bus_set_power(), which
may not be desirable. Make it select the target power state of the device
using its second argument if acpi_pm_device_sleep_state() fails.
Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>
Looks-ok-to: Pavel Machek <pavel@....cz>
---
drivers/pnp/pnpacpi/core.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
Index: linux-2.6.23-rc3/drivers/pnp/pnpacpi/core.c
===================================================================
--- linux-2.6.23-rc3.orig/drivers/pnp/pnpacpi/core.c 2007-08-15 14:56:58.000000000 +0200
+++ linux-2.6.23-rc3/drivers/pnp/pnpacpi/core.c 2007-08-15 15:08:36.000000000 +0200
@@ -130,11 +130,16 @@ static int pnpacpi_disable_resources(str
#ifdef CONFIG_ACPI_SLEEP
static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
{
- return acpi_bus_set_power((acpi_handle) dev->data,
- acpi_pm_device_sleep_state(&dev->dev,
- device_may_wakeup
- (&dev->dev),
- NULL));
+ int power_state;
+
+ power_state = acpi_pm_device_sleep_state(&dev->dev,
+ device_may_wakeup(&dev->dev),
+ NULL);
+ if (power_state < 0)
+ power_state = (state.event == PM_EVENT_ON) ?
+ ACPI_STATE_D0 : ACPI_STATE_D3;
+
+ return acpi_bus_set_power((acpi_handle) dev->data, power_state);
}
static int pnpacpi_resume(struct pnp_dev *dev)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists