]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/scan.c
ACPI: catch calls of acpi_driver_data on pointer of wrong type
[linux-2.6-omap-h63xx.git] / drivers / acpi / scan.c
index 5b049cd795530a683393d1bca044ba6aa20498e4..b88536ab040a035d8571a263197d0af435985d9b 100644 (file)
@@ -384,7 +384,7 @@ static int acpi_device_remove(struct device * dev)
                        acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type);
        }
        acpi_dev->driver = NULL;
-       acpi_driver_data(dev) = NULL;
+       acpi_dev->driver_data = NULL;
 
        put_device(dev);
        return 0;
@@ -471,7 +471,7 @@ static int acpi_device_register(struct acpi_device *device,
        device->dev.release = &acpi_device_release;
        result = device_add(&device->dev);
        if(result) {
-               printk(KERN_ERR PREFIX "Error adding device %s", device->dev.bus_id);
+               dev_err(&device->dev, "Error adding device\n");
                goto end;
        }
 
@@ -537,7 +537,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
        result = driver->ops.add(device);
        if (result) {
                device->driver = NULL;
-               acpi_driver_data(device) = NULL;
+               device->driver_data = NULL;
                return result;
        }
 
@@ -703,9 +703,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
        acpi_status status = 0;
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        union acpi_object *package = NULL;
-       union acpi_object in_arg[3];
-       struct acpi_object_list arg_list = { 3, in_arg };
-       acpi_status psw_status = AE_OK;
+       int psw_error;
 
        struct acpi_device_id button_device_ids[] = {
                {"PNP0C0D", 0},
@@ -737,39 +735,11 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
         * So it is necessary to call _DSW object first. Only when it is not
         * present will the _PSW object used.
         */
-       /*
-        * Three agruments are needed for the _DSW object.
-        * Argument 0: enable/disable the wake capabilities
-        * When _DSW object is called to disable the wake capabilities, maybe
-        * the first argument is filled. The value of the other two agruments
-        * is meaningless.
-        */
-       in_arg[0].type = ACPI_TYPE_INTEGER;
-       in_arg[0].integer.value = 0;
-       in_arg[1].type = ACPI_TYPE_INTEGER;
-       in_arg[1].integer.value = 0;
-       in_arg[2].type = ACPI_TYPE_INTEGER;
-       in_arg[2].integer.value = 0;
-       psw_status = acpi_evaluate_object(device->handle, "_DSW",
-                                               &arg_list, NULL);
-       if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND))
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n"));
-       /*
-        * When the _DSW object is not present, OSPM will call _PSW object.
-        */
-       if (psw_status == AE_NOT_FOUND) {
-               /*
-                * Only one agruments is required for the _PSW object.
-                * agrument 0: enable/disable the wake capabilities
-                */
-               arg_list.count = 1;
-               in_arg[0].integer.value = 0;
-               psw_status = acpi_evaluate_object(device->handle, "_PSW",
-                                               &arg_list, NULL);
-               if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND))
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in "
-                                               "evaluate _PSW\n"));
-       }
+       psw_error = acpi_device_sleep_wake(device, 0, 0, 0);
+       if (psw_error)
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                               "error in _DSW or _PSW evaluation\n"));
+
        /* Power button, Lid switch always enable wakeup */
        if (!acpi_match_device_ids(device, button_device_ids))
                device->wakeup.flags.run_wake = 1;