diff options
author | Pavel Machek <pavel@suse.cz> | 2008-11-25 06:05:08 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-11-26 17:39:06 -0500 |
commit | 40599072dca3ec7d4c9ff8271978be169f974638 (patch) | |
tree | c7a4f34e547aadb47644f57bb1c96a8ad9c24689 /drivers/acpi/utils.c | |
parent | 558073dd56707864f09d563b64e7c37c021e89d2 (diff) |
ACPI: scheduling in atomic via acpi_evaluate_integer ()
Now I know why I had strange "scheduling in atomic" problems:
acpi_evaluate_integer() does malloc(..., irqs_disabled() ? GFP_ATOMIC
: GFP_KERNEL)... which is (of course) broken.
There's no way to reliably tell if we need GFP_ATOMIC or not from
code, this one for example fails to detect spinlocks held.
Fortunately, allocation seems small enough to be done on stack.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Acked-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r-- | drivers/acpi/utils.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index e827be36ee8d..f844941089bb 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -259,34 +259,26 @@ acpi_evaluate_integer(acpi_handle handle, | |||
259 | struct acpi_object_list *arguments, unsigned long long *data) | 259 | struct acpi_object_list *arguments, unsigned long long *data) |
260 | { | 260 | { |
261 | acpi_status status = AE_OK; | 261 | acpi_status status = AE_OK; |
262 | union acpi_object *element; | 262 | union acpi_object element; |
263 | struct acpi_buffer buffer = { 0, NULL }; | 263 | struct acpi_buffer buffer = { 0, NULL }; |
264 | 264 | ||
265 | |||
266 | if (!data) | 265 | if (!data) |
267 | return AE_BAD_PARAMETER; | 266 | return AE_BAD_PARAMETER; |
268 | 267 | ||
269 | element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); | ||
270 | if (!element) | ||
271 | return AE_NO_MEMORY; | ||
272 | |||
273 | buffer.length = sizeof(union acpi_object); | 268 | buffer.length = sizeof(union acpi_object); |
274 | buffer.pointer = element; | 269 | buffer.pointer = &element; |
275 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); | 270 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); |
276 | if (ACPI_FAILURE(status)) { | 271 | if (ACPI_FAILURE(status)) { |
277 | acpi_util_eval_error(handle, pathname, status); | 272 | acpi_util_eval_error(handle, pathname, status); |
278 | kfree(element); | ||
279 | return status; | 273 | return status; |
280 | } | 274 | } |
281 | 275 | ||
282 | if (element->type != ACPI_TYPE_INTEGER) { | 276 | if (element.type != ACPI_TYPE_INTEGER) { |
283 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); | 277 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); |
284 | kfree(element); | ||
285 | return AE_BAD_DATA; | 278 | return AE_BAD_DATA; |
286 | } | 279 | } |
287 | 280 | ||
288 | *data = element->integer.value; | 281 | *data = element.integer.value; |
289 | kfree(element); | ||
290 | 282 | ||
291 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data)); | 283 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data)); |
292 | 284 | ||