tree d812a362e9e530f0cfd7a189d79ede3e8d5a7f96
parent 8066eff0a1a0703ad901dbe5646a47dbfc089ef2
author David Shaohua Li <[EMAIL PROTECTED]> Thu, 04 Aug 2005 07:46:33 -0400
committer Len Brown <[EMAIL PROTECTED]> Thu, 04 Aug 2005 07:50:36 -0400

[ACPI] S3 resume: avoid kmalloc() might_sleep oops symptom

ACPI now uses kmalloc(...,GPF_ATOMIC) during suspend/resume.

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

Signed-off-by: David Shaohua Li <[EMAIL PROTECTED]>
Signed-off-by: Len Brown <[EMAIL PROTECTED]>

 drivers/acpi/osl.c      |    6 +++++-
 drivers/acpi/pci_link.c |    7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -145,10 +145,14 @@ acpi_os_vprintf(const char *fmt, va_list
 #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
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -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);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to