[ACPI] S3 resume: avoid kmalloc() might_sleep oops symptom
authorDavid Shaohua Li <shaohua.li@intel.com>
Thu, 4 Aug 2005 03:46:33 +0000 (23:46 -0400)
committerLen Brown <len.brown@intel.com>
Thu, 4 Aug 2005 03:50:36 +0000 (23:50 -0400)
ACPI now uses kmalloc(...,GPF_ATOMIC) during suspend/resume.

http://bugzilla.kernel.org/show_bug.cgi?id=3469

Signed-off-by: David Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/osl.c
drivers/acpi/pci_link.c

index bdd9f37f8101e67a0392349696ec2f632a0b4747..7289da3c4db6a28778628337f26e79015de7139d 100644 (file)
@@ -145,10 +145,14 @@ acpi_os_vprintf(const char *fmt, va_list args)
 #endif
 }
 
+extern int acpi_in_resume;
 void *
 acpi_os_allocate(acpi_size size)
 {
-       return kmalloc(size, GFP_KERNEL);
+       if (acpi_in_resume)
+               return kmalloc(size, GFP_ATOMIC);
+       else
+               return kmalloc(size, GFP_KERNEL);
 }
 
 void
index 65cea07abbc3876bc3a3258ed9e2f64a81805125..834c2ceff1aa4ba1864e2dfff84667384a33a72a 100644 (file)
@@ -798,6 +798,11 @@ acpi_pci_link_resume(
                return_VALUE(0);
 }
 
+/*
+ * FIXME: this is a workaround to avoid nasty warning.  It will be removed
+ * after every device calls pci_disable_device in .resume.
+ */
+int acpi_in_resume;
 static int
 irqrouter_resume(
        struct sys_device *dev)
@@ -807,6 +812,7 @@ irqrouter_resume(
 
        ACPI_FUNCTION_TRACE("irqrouter_resume");
 
+       acpi_in_resume = 1;
        list_for_each(node, &acpi_link.entries) {
                link = list_entry(node, struct acpi_pci_link, node);
                if (!link) {
@@ -816,6 +822,7 @@ irqrouter_resume(
                }
                acpi_pci_link_resume(link);
        }
+       acpi_in_resume = 0;
        return_VALUE(0);
 }