diff mbox

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

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

Commit Message

Alexey Starikovskiy April 27, 2010, 9:10 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)