]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branches 'release', 'bugzilla-11880', 'bugzilla-12037' and 'bugzilla-12257...
authorLen Brown <len.brown@intel.com>
Fri, 9 Jan 2009 08:37:11 +0000 (03:37 -0500)
committerLen Brown <len.brown@intel.com>
Fri, 9 Jan 2009 08:37:11 +0000 (03:37 -0500)
1  2  3  4 
drivers/acpi/ec.c

diff --combined drivers/acpi/ec.c
index 3105e0410e9b22988011c979a58f32cd3a40ed96,6276e5c0fefdeec0d7f4cf8fe708cb08dce1ed97,30f3ef236ecb1b354548c5bb2570866eaa8ec6be,30f3ef236ecb1b354548c5bb2570866eaa8ec6be..2e8317bf723e960824a7ec9d8856d369ec10c385
    #include <asm/io.h>
    #include <acpi/acpi_bus.h>
    #include <acpi/acpi_drivers.h>
 ---#include <acpi/actypes.h>
    
    #define ACPI_EC_CLASS                       "embedded_controller"
    #define ACPI_EC_DEVICE_NAME         "Embedded Controller"
@@@@@ -218,8 -219,7 -219,8 -219,8 +218,8 @@@@@ static void gpe_transaction(struct acpi
        goto unlock;
    err:
        /* false interrupt, state didn't change */
 -      ++ec->curr->irq_count;
 +      if (in_interrupt())
 +              ++ec->curr->irq_count;
    unlock:
        spin_unlock_irqrestore(&ec->curr_lock, flags);
    }
@@@@@ -755,15 -755,10 -756,10 -756,10 +755,15 @@@@@ static acpi_statu
    acpi_ec_register_query_methods(acpi_handle handle, u32 level,
                               void *context, void **return_value)
    {
 ---    struct acpi_namespace_node *node = handle;
 +++    char node_name[5];
 +++    struct acpi_buffer buffer = { sizeof(node_name), node_name };
        struct acpi_ec *ec = context;
        int value = 0;
 ---    if (sscanf(node->name.ascii, "_Q%x", &value) == 1) {
 +++    acpi_status status;
 +++
 +++    status = acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
 +++
 +++    if (ACPI_SUCCESS(status) && sscanf(node_name, "_Q%x", &value) == 1) {
                acpi_ec_add_query_handler(ec, value, handle, NULL, NULL);
        }
        return AE_OK;
@@@@@ -982,9 -977,9 -978,9 -978,9 +982,9 @@@@@ static const struct acpi_device_id ec_d
    
    int __init acpi_ec_ecdt_probe(void)
    {
- --    int ret;
        acpi_status status;
        struct acpi_table_ecdt *ecdt_ptr;
+ ++    acpi_handle dummy;
    
        boot_ec = make_acpi_ec();
        if (!boot_ec)
                boot_ec->gpe = ecdt_ptr->gpe;
                boot_ec->handle = ACPI_ROOT_OBJECT;
                acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
- --    } else {
- --            /* This workaround is needed only on some broken machines,
- --             * which require early EC, but fail to provide ECDT */
- --            acpi_handle x;
- --            printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
- --            status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
- --                                            boot_ec, NULL);
- --            /* Check that acpi_get_devices actually find something */
- --            if (ACPI_FAILURE(status) || !boot_ec->handle)
- --                    goto error;
- --            /* We really need to limit this workaround, the only ASUS,
- --             * which needs it, has fake EC._INI method, so use it as flag.
- --             * Keep boot_ec struct as it will be needed soon.
- --             */
- --            if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
- --                    return -ENODEV;
+ ++            /* Add some basic check against completely broken table */
+ ++            if (boot_ec->data_addr != boot_ec->command_addr)
+ ++                    goto install;
+ ++    /* fall through */
        }
- --
- --    ret = ec_install_handlers(boot_ec);
- --    if (!ret) {
+ ++    /* This workaround is needed only on some broken machines,
+ ++     * which require early EC, but fail to provide ECDT */
+ ++    printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
+ ++    status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
+ ++                                    boot_ec, NULL);
+ ++    /* Check that acpi_get_devices actually find something */
+ ++    if (ACPI_FAILURE(status) || !boot_ec->handle)
+ ++            goto error;
+ ++    /* We really need to limit this workaround, the only ASUS,
+ ++     * which needs it, has fake EC._INI method, so use it as flag.
+ ++     * Keep boot_ec struct as it will be needed soon.
+ ++     */
+ ++    if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy)))
+ ++            return -ENODEV;
+ ++install:
+ ++    if (!ec_install_handlers(boot_ec)) {
                first_ec = boot_ec;
                return 0;
        }
- --      error:
+ ++error:
        kfree(boot_ec);
        boot_ec = NULL;
        return -ENODEV;