Pull acpi_device_handle_cleanup into release branch
[pandora-kernel.git] / drivers / acpi / video.c
index 1f3ffb3..56666a9 100644 (file)
@@ -117,7 +117,7 @@ struct acpi_video_enumerated_device {
 };
 
 struct acpi_video_bus {
-       acpi_handle handle;
+       struct acpi_device *device;
        u8 dos_setting;
        struct acpi_video_enumerated_device *attached_array;
        u8 attached_count;
@@ -155,7 +155,6 @@ struct acpi_video_device_brightness {
 };
 
 struct acpi_video_device {
-       acpi_handle handle;
        unsigned long device_id;
        struct acpi_video_device_flags flags;
        struct acpi_video_device_cap cap;
@@ -272,7 +271,8 @@ static int
 acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
 {
        int status;
-       status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
+
+       status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state);
 
        return status;
 }
@@ -283,8 +283,7 @@ acpi_video_device_get_state(struct acpi_video_device *device,
 {
        int status;
 
-
-       status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state);
+       status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state);
 
        return status;
 }
@@ -299,7 +298,7 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state)
 
 
        arg0.integer.value = state;
-       status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret);
+       status = acpi_evaluate_integer(device->dev->handle, "_DSS", &args, &ret);
 
        return status;
 }
@@ -315,7 +314,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
 
        *levels = NULL;
 
-       status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
+       status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer);
        if (!ACPI_SUCCESS(status))
                return status;
        obj = (union acpi_object *)buffer.pointer;
@@ -344,7 +343,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
 
 
        arg0.integer.value = level;
-       status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL);
+       status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
 
        printk(KERN_DEBUG "set_level status: %x\n", status);
        return status;
@@ -356,7 +355,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
 {
        int status;
 
-       status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level);
+       status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level);
 
        return status;
 }
@@ -383,7 +382,7 @@ acpi_video_device_EDID(struct acpi_video_device *device,
        else
                return -EINVAL;
 
-       status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer);
+       status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
@@ -413,7 +412,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
 
        arg0.integer.value = option;
 
-       status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp);
+       status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp);
        if (ACPI_SUCCESS(status))
                status = tmp ? (-EINVAL) : (AE_OK);
 
@@ -425,8 +424,7 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
 {
        int status;
 
-
-       status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id);
+       status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
 
        return status;
 }
@@ -437,7 +435,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
 {
        int status;
 
-       status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options);
+       status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options);
        *options &= 3;
 
        return status;
@@ -478,7 +476,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
        }
        arg0.integer.value = (lcd_flag << 2) | bios_flag;
        video->dos_setting = arg0.integer.value;
-       acpi_evaluate_object(video->handle, "_DOS", &args, NULL);
+       acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL);
 
       Failed:
        return status;
@@ -506,25 +504,25 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
 
        memset(&device->cap, 0, 4);
 
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) {
                device->cap._ADR = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) {
                device->cap._BCL = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) {
                device->cap._BCM = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) {
                device->cap._DDC = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DCS", &h_dummy1))) {
                device->cap._DCS = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DGS", &h_dummy1))) {
                device->cap._DGS = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DSS", &h_dummy1))) {
                device->cap._DSS = 1;
        }
 
@@ -588,22 +586,22 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
        acpi_handle h_dummy1;
 
        memset(&video->cap, 0, 4);
-       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) {
                video->cap._DOS = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) {
                video->cap._DOD = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) {
                video->cap._ROM = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) {
                video->cap._GPD = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) {
                video->cap._SPD = 1;
        }
-       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) {
                video->cap._VPO = 1;
        }
 }
@@ -1271,7 +1269,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
 
                memset(data, 0, sizeof(struct acpi_video_device));
 
-               data->handle = device->handle;
                strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
                strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
                acpi_driver_data(device) = data;
@@ -1298,7 +1295,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
                acpi_video_device_bind(video, data);
                acpi_video_device_find_cap(data);
 
-               status = acpi_install_notify_handler(data->handle,
+               status = acpi_install_notify_handler(device->handle,
                                                     ACPI_DEVICE_NOTIFY,
                                                     acpi_video_device_notify,
                                                     data);
@@ -1400,8 +1397,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
        union acpi_object *dod = NULL;
        union acpi_object *obj;
 
-
-       status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer);
+       status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
        if (!ACPI_SUCCESS(status)) {
                ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
                return status;
@@ -1569,7 +1565,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
        up(&video->sem);
        acpi_video_device_remove_fs(device->dev);
 
-       status = acpi_remove_notify_handler(device->handle,
+       status = acpi_remove_notify_handler(device->dev->handle,
                                            ACPI_DEVICE_NOTIFY,
                                            acpi_video_device_notify);
 
@@ -1624,8 +1620,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
        if (!video)
                return;
 
-       if (acpi_bus_get_device(handle, &device))
-               return;
+       device = video->device;
 
        switch (event) {
        case ACPI_VIDEO_NOTIFY_SWITCH:  /* User request that a switch occur,
@@ -1668,8 +1663,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
        if (!video_device)
                return;
 
-       if (acpi_bus_get_device(handle, &device))
-               return;
+       device = video_device->dev;
 
        switch (event) {
        case ACPI_VIDEO_NOTIFY_SWITCH:  /* change in status (cycle output device) */
@@ -1707,7 +1701,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
                return -ENOMEM;
        memset(video, 0, sizeof(struct acpi_video_bus));
 
-       video->handle = device->handle;
+       video->device = device;
        strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
        strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
        acpi_driver_data(device) = video;
@@ -1727,7 +1721,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
        acpi_video_bus_get_devices(video, device);
        acpi_video_bus_start_devices(video);
 
-       status = acpi_install_notify_handler(video->handle,
+       status = acpi_install_notify_handler(device->handle,
                                             ACPI_DEVICE_NOTIFY,
                                             acpi_video_bus_notify, video);
        if (ACPI_FAILURE(status)) {
@@ -1767,7 +1761,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
 
        acpi_video_bus_stop_devices(video);
 
-       status = acpi_remove_notify_handler(video->handle,
+       status = acpi_remove_notify_handler(video->device->handle,
                                            ACPI_DEVICE_NOTIFY,
                                            acpi_video_bus_notify);