diff mbox

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

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

Commit Message

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

Patch

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 7594f65..b3451a0 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -438,7 +438,15 @@  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 FW_BUG
+			"ACPI: Limit %lld sleep to 1 second\n", ms);
+		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)