~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/acpi/acpica/nseval.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 ******************************************************************************/
6
6
 
7
7
/*
8
 
 * Copyright (C) 2000 - 2008, Intel Corp.
 
8
 * Copyright (C) 2000 - 2011, Intel Corp.
9
9
 * All rights reserved.
10
10
 *
11
11
 * Redistribution and use in source and binary forms, with or without
366
366
acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
367
367
                         struct acpi_evaluate_info *info)
368
368
{
369
 
        union acpi_operand_object *root_obj;
 
369
        union acpi_operand_object *parent_obj;
 
370
        struct acpi_namespace_node *parent_node;
 
371
        acpi_object_type type;
370
372
        acpi_status status;
371
373
 
372
374
        ACPI_FUNCTION_TRACE(ns_exec_module_code);
373
375
 
 
376
        /*
 
377
         * Get the parent node. We cheat by using the next_object field
 
378
         * of the method object descriptor.
 
379
         */
 
380
        parent_node = ACPI_CAST_PTR(struct acpi_namespace_node,
 
381
                                    method_obj->method.next_object);
 
382
        type = acpi_ns_get_type(parent_node);
 
383
 
 
384
        /*
 
385
         * Get the region handler and save it in the method object. We may need
 
386
         * this if an operation region declaration causes a _REG method to be run.
 
387
         *
 
388
         * We can't do this in acpi_ps_link_module_code because
 
389
         * acpi_gbl_root_node->Object is NULL at PASS1.
 
390
         */
 
391
        if ((type == ACPI_TYPE_DEVICE) && parent_node->object) {
 
392
                method_obj->method.dispatch.handler =
 
393
                    parent_node->object->device.handler;
 
394
        }
 
395
 
 
396
        /* Must clear next_object (acpi_ns_attach_object needs the field) */
 
397
 
 
398
        method_obj->method.next_object = NULL;
 
399
 
374
400
        /* Initialize the evaluation information block */
375
401
 
376
402
        ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
377
 
        info->prefix_node = acpi_gbl_root_node;
 
403
        info->prefix_node = parent_node;
378
404
 
379
405
        /*
380
 
         * Get the currently attached root object. Add a reference, because the
 
406
         * Get the currently attached parent object. Add a reference, because the
381
407
         * ref count will be decreased when the method object is installed to
382
 
         * the root node.
 
408
         * the parent node.
383
409
         */
384
 
        root_obj = acpi_ns_get_attached_object(acpi_gbl_root_node);
385
 
        acpi_ut_add_reference(root_obj);
386
 
 
387
 
        /* Install the method (module-level code) in the root node */
388
 
 
389
 
        status = acpi_ns_attach_object(acpi_gbl_root_node, method_obj,
 
410
        parent_obj = acpi_ns_get_attached_object(parent_node);
 
411
        if (parent_obj) {
 
412
                acpi_ut_add_reference(parent_obj);
 
413
        }
 
414
 
 
415
        /* Install the method (module-level code) in the parent node */
 
416
 
 
417
        status = acpi_ns_attach_object(parent_node, method_obj,
390
418
                                       ACPI_TYPE_METHOD);
391
419
        if (ACPI_FAILURE(status)) {
392
420
                goto exit;
393
421
        }
394
422
 
395
 
        /* Execute the root node as a control method */
 
423
        /* Execute the parent node as a control method */
396
424
 
397
425
        status = acpi_ns_evaluate(info);
398
426
 
399
427
        ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Executed module-level code at %p\n",
400
428
                          method_obj->method.aml_start));
401
429
 
 
430
        /* Delete a possible implicit return value (in slack mode) */
 
431
 
 
432
        if (info->return_object) {
 
433
                acpi_ut_remove_reference(info->return_object);
 
434
        }
 
435
 
402
436
        /* Detach the temporary method object */
403
437
 
404
 
        acpi_ns_detach_object(acpi_gbl_root_node);
405
 
 
406
 
        /* Restore the original root object */
407
 
 
408
 
        status =
409
 
            acpi_ns_attach_object(acpi_gbl_root_node, root_obj,
410
 
                                  ACPI_TYPE_DEVICE);
 
438
        acpi_ns_detach_object(parent_node);
 
439
 
 
440
        /* Restore the original parent object */
 
441
 
 
442
        if (parent_obj) {
 
443
                status = acpi_ns_attach_object(parent_node, parent_obj, type);
 
444
        } else {
 
445
                parent_node->type = (u8)type;
 
446
        }
411
447
 
412
448
      exit:
413
 
        acpi_ut_remove_reference(root_obj);
 
449
        if (parent_obj) {
 
450
                acpi_ut_remove_reference(parent_obj);
 
451
        }
414
452
        return_VOID;
415
453
}