diff mbox

Subject: [ACPI] Add constraints on usage of ACPI Sleep function

Message ID 20100506173034.16768.15614.stgit@thinkpad (mailing list archive)
State New, archived
Headers show

Commit Message

Alexey Starikovskiy May 6, 2010, 5:30 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 7594f65..7a58dc5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -438,7 +438,14 @@  acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
 
 void acpi_os_sleep(u64 ms)
 {
-	schedule_timeout_interruptible(msecs_to_jiffies(ms));
+	if (ms > 1000) {
+		printk(KERN_WARNING "ACPI: Limit long sleep to 1 second\n");
+		ms = 1000;
+	}
+	if (system_state == SYSTEM_RUNNING)
+		schedule_timeout_interruptible(msecs_to_jiffies(ms));
+	else
+		acpi_os_stall(ms * 1000);
 }
 
 void acpi_os_stall(u32 us)