aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-07-10 01:35:51 -0400
committerLen Brown <len.brown@intel.com>2006-07-10 02:37:22 -0400
commite21c1ca3f98529921c829a792dfdbfc5a5dc393b (patch)
treefdb0a3c00d46db197ae65e6c66fc841b194cb507 /drivers/acpi
parentb3cf257623fabd8f1ee6700a6d328cc1c5da5a1d (diff)
ACPI: acpi_os_allocate() fixes
Replace acpi_in_resume with a more general hack to check irqs_disabled() on any kmalloc() from ACPI. While setting (system_state != SYSTEM_RUNNING) on resume seemed more general, Andrew Morton preferred this approach. http://bugzilla.kernel.org/show_bug.cgi?id=3469 Make acpi_os_allocate() into an inline function to allow /proc/slab_allocators to work. Delete some memset() that could fault on allocation failure. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/osl.c30
-rw-r--r--drivers/acpi/parser/psutils.c2
-rw-r--r--drivers/acpi/pci_link.c7
-rw-r--r--drivers/acpi/utilities/utalloc.c2
4 files changed, 2 insertions, 39 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index eedb05c6dc7b..47dfde95b8f8 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -136,16 +136,6 @@ void acpi_os_vprintf(const char *fmt, va_list args)
136#endif 136#endif
137} 137}
138 138
139
140extern int acpi_in_resume;
141void *acpi_os_allocate(acpi_size size)
142{
143 if (acpi_in_resume)
144 return kmalloc(size, GFP_ATOMIC);
145 else
146 return kmalloc(size, GFP_KERNEL);
147}
148
149acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) 139acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
150{ 140{
151 if (efi_enabled) { 141 if (efi_enabled) {
@@ -1115,26 +1105,6 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1115 return (AE_OK); 1105 return (AE_OK);
1116} 1106}
1117 1107
1118/*******************************************************************************
1119 *
1120 * FUNCTION: acpi_os_acquire_object
1121 *
1122 * PARAMETERS: Cache - Handle to cache object
1123 * ReturnObject - Where the object is returned
1124 *
1125 * RETURN: Status
1126 *
1127 * DESCRIPTION: Return a zero-filled object.
1128 *
1129 ******************************************************************************/
1130
1131void *acpi_os_acquire_object(acpi_cache_t * cache)
1132{
1133 void *object = kmem_cache_zalloc(cache, GFP_KERNEL);
1134 WARN_ON(!object);
1135 return object;
1136}
1137
1138/****************************************************************************** 1108/******************************************************************************
1139 * 1109 *
1140 * FUNCTION: acpi_os_validate_interface 1110 * FUNCTION: acpi_os_validate_interface
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
index 182474ae8ce9..d405387b7414 100644
--- a/drivers/acpi/parser/psutils.c
+++ b/drivers/acpi/parser/psutils.c
@@ -139,12 +139,10 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
139 /* The generic op (default) is by far the most common (16 to 1) */ 139 /* The generic op (default) is by far the most common (16 to 1) */
140 140
141 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); 141 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
142 memset(op, 0, sizeof(struct acpi_parse_obj_common));
143 } else { 142 } else {
144 /* Extended parseop */ 143 /* Extended parseop */
145 144
146 op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache); 145 op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
147 memset(op, 0, sizeof(struct acpi_parse_obj_named));
148 } 146 }
149 147
150 /* Initialize the Op */ 148 /* Initialize the Op */
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 8197c0e40769..7f3e7e77e794 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -780,11 +780,6 @@ static int acpi_pci_link_resume(struct acpi_pci_link *link)
780 return 0; 780 return 0;
781} 781}
782 782
783/*
784 * FIXME: this is a workaround to avoid nasty warning. It will be removed
785 * after every device calls pci_disable_device in .resume.
786 */
787int acpi_in_resume;
788static int irqrouter_resume(struct sys_device *dev) 783static int irqrouter_resume(struct sys_device *dev)
789{ 784{
790 struct list_head *node = NULL; 785 struct list_head *node = NULL;
@@ -794,7 +789,6 @@ static int irqrouter_resume(struct sys_device *dev)
794 /* Make sure SCI is enabled again (Apple firmware bug?) */ 789 /* Make sure SCI is enabled again (Apple firmware bug?) */
795 acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); 790 acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK);
796 791
797 acpi_in_resume = 1;
798 list_for_each(node, &acpi_link.entries) { 792 list_for_each(node, &acpi_link.entries) {
799 link = list_entry(node, struct acpi_pci_link, node); 793 link = list_entry(node, struct acpi_pci_link, node);
800 if (!link) { 794 if (!link) {
@@ -803,7 +797,6 @@ static int irqrouter_resume(struct sys_device *dev)
803 } 797 }
804 acpi_pci_link_resume(link); 798 acpi_pci_link_resume(link);
805 } 799 }
806 acpi_in_resume = 0;
807 return 0; 800 return 0;
808} 801}
809 802
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 5cff17dc78b3..f6cbc0b1bfd0 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -285,6 +285,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
285 return (status); 285 return (status);
286} 286}
287 287
288#ifdef NOT_USED_BY_LINUX
288/******************************************************************************* 289/*******************************************************************************
289 * 290 *
290 * FUNCTION: acpi_ut_allocate 291 * FUNCTION: acpi_ut_allocate
@@ -360,3 +361,4 @@ void *acpi_ut_allocate_zeroed(acpi_size size,
360 361
361 return (allocation); 362 return (allocation);
362} 363}
364#endif