Pull acpi_device_handle_cleanup into release branch
authorLen Brown <len.brown@intel.com>
Sat, 1 Jul 2006 15:05:19 +0000 (11:05 -0400)
committerLen Brown <len.brown@intel.com>
Sat, 1 Jul 2006 15:05:19 +0000 (11:05 -0400)
1  2 
drivers/acpi/acpi_memhotplug.c
drivers/acpi/battery.c
drivers/acpi/video.c

index 84a68965c11ad38e475445cf1f318cc09ab05f15,97863143d21d2c030fc77b6d71c8911d71feb14f..81e970adeab3b3cc6d5e47d32e69381693240943
@@@ -80,7 -80,7 +80,7 @@@ struct acpi_memory_info 
  };
  
  struct acpi_memory_device {
-       acpi_handle handle;
+       struct acpi_device * device;
        unsigned int state;     /* State of the memory device */
        struct list_head res_list;
  };
@@@ -129,7 -129,7 +129,7 @@@ acpi_memory_get_device_resources(struc
        struct acpi_memory_info *info, *n;
  
  
-       status = acpi_walk_resources(mem_device->handle, METHOD_NAME__CRS,
+       status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS,
                                     acpi_memory_get_resource, mem_device);
        if (ACPI_FAILURE(status)) {
                list_for_each_entry_safe(info, n, &mem_device->res_list, list)
@@@ -192,7 -192,7 +192,7 @@@ static int acpi_memory_check_device(str
  
  
        /* Get device present/absent information from the _STA */
-       if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
+       if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle, "_STA",
                                               NULL, &current_status)))
                return -ENODEV;
        /*
@@@ -222,7 -222,7 +222,7 @@@ static int acpi_memory_enable_device(st
                return result;
        }
  
-       node = acpi_get_node(mem_device->handle);
+       node = acpi_get_node(mem_device->device->handle);
        /*
         * Tell the VM there is more memory here...
         * Note: Assume that this function returns zero on success
                num_enabled++;
        }
        if (!num_enabled) {
 -              ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
 +              printk(KERN_ERR PREFIX "add_memory failed\n");
                mem_device->state = MEMORY_INVALID_STATE;
                return -EINVAL;
        }
@@@ -269,7 -269,7 +269,7 @@@ static int acpi_memory_powerdown_device
        arg_list.pointer = &arg;
        arg.type = ACPI_TYPE_INTEGER;
        arg.integer.value = 1;
-       status = acpi_evaluate_object(mem_device->handle,
+       status = acpi_evaluate_object(mem_device->device->handle,
                                      "_EJ0", &arg_list, NULL);
        /* Return on _EJ0 failure */
        if (ACPI_FAILURE(status)) {
        }
  
        /* Evalute _STA to check if the device is disabled */
-       status = acpi_evaluate_integer(mem_device->handle, "_STA",
+       status = acpi_evaluate_integer(mem_device->device->handle, "_STA",
                                       NULL, &current_status);
        if (ACPI_FAILURE(status))
                return -ENODEV;
@@@ -398,7 -398,7 +398,7 @@@ static int acpi_memory_device_add(struc
        memset(mem_device, 0, sizeof(struct acpi_memory_device));
  
        INIT_LIST_HEAD(&mem_device->res_list);
-       mem_device->handle = device->handle;
+       mem_device->device = device;
        sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME);
        sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
        acpi_driver_data(device) = mem_device;
@@@ -466,7 -466,7 +466,7 @@@ static acpi_status is_memory_device(acp
  
        info = buffer.pointer;
        if (!(info->valid & ACPI_VALID_HID)) {
 -              acpi_os_free(buffer.pointer);
 +              kfree(buffer.pointer);
                return AE_ERROR;
        }
  
            (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
                status = AE_ERROR;
  
 -      acpi_os_free(buffer.pointer);
 +      kfree(buffer.pointer);
        return status;
  }
  
diff --combined drivers/acpi/battery.c
index 7d92f73b265f6e98d0d4c0d9e705dbbc9040f15a,6ce93306dd378dd6c8f541a0d1456e2494c1ed1d..2b8aab560b5855ae51bb56dbe379ff85d87c83eb
@@@ -108,7 -108,7 +108,7 @@@ struct acpi_battery_trips 
  };
  
  struct acpi_battery {
-       acpi_handle handle;
+       struct acpi_device * device;
        struct acpi_battery_flags flags;
        struct acpi_battery_trips trips;
        unsigned long alarm;
@@@ -138,7 -138,7 +138,7 @@@ acpi_battery_get_info(struct acpi_batte
  
        /* Evalute _BIF */
  
-       status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
+       status = acpi_evaluate_object(battery->device->handle, "_BIF", NULL, &buffer);
        if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
                return -ENODEV;
        }
  
        end:
 -      acpi_os_free(buffer.pointer);
 +      kfree(buffer.pointer);
  
        if (!result)
                (*bif) = (struct acpi_battery_info *)data.pointer;
@@@ -198,7 -198,7 +198,7 @@@ acpi_battery_get_status(struct acpi_bat
  
        /* Evalute _BST */
  
-       status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
+       status = acpi_evaluate_object(battery->device->handle, "_BST", NULL, &buffer);
        if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
                return -ENODEV;
        }
  
        end:
 -      acpi_os_free(buffer.pointer);
 +      kfree(buffer.pointer);
  
        if (!result)
                (*bst) = (struct acpi_battery_status *)data.pointer;
@@@ -255,7 -255,7 +255,7 @@@ acpi_battery_set_alarm(struct acpi_batt
  
        arg0.integer.value = alarm;
  
-       status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL);
+       status = acpi_evaluate_object(battery->device->handle, "_BTP", &arg_list, NULL);
        if (ACPI_FAILURE(status))
                return -ENODEV;
  
@@@ -278,9 -278,7 +278,7 @@@ static int acpi_battery_check(struct ac
        if (!battery)
                return -EINVAL;
  
-       result = acpi_bus_get_device(battery->handle, &device);
-       if (result)
-               return result;
+       device = battery->device;
  
        result = acpi_bus_get_status(device);
        if (result)
  
                /* See if alarms are supported, and if so, set default */
  
-               status = acpi_get_handle(battery->handle, "_BTP", &handle);
+               status = acpi_get_handle(battery->device->handle, "_BTP", &handle);
                if (ACPI_SUCCESS(status)) {
                        battery->flags.alarm = 1;
                        acpi_battery_set_alarm(battery, battery->trips.warning);
@@@ -662,8 -660,7 +660,7 @@@ static void acpi_battery_notify(acpi_ha
        if (!battery)
                return;
  
-       if (acpi_bus_get_device(handle, &device))
-               return;
+       device = battery->device;
  
        switch (event) {
        case ACPI_BATTERY_NOTIFY_STATUS:
@@@ -695,7 -692,7 +692,7 @@@ static int acpi_battery_add(struct acpi
                return -ENOMEM;
        memset(battery, 0, sizeof(struct acpi_battery));
  
-       battery->handle = device->handle;
+       battery->device = device;
        strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
        acpi_driver_data(device) = battery;
        if (result)
                goto end;
  
-       status = acpi_install_notify_handler(battery->handle,
+       status = acpi_install_notify_handler(device->handle,
                                             ACPI_DEVICE_NOTIFY,
                                             acpi_battery_notify, battery);
        if (ACPI_FAILURE(status)) {
@@@ -740,7 -737,7 +737,7 @@@ static int acpi_battery_remove(struct a
  
        battery = (struct acpi_battery *)acpi_driver_data(device);
  
-       status = acpi_remove_notify_handler(battery->handle,
+       status = acpi_remove_notify_handler(device->handle,
                                            ACPI_DEVICE_NOTIFY,
                                            acpi_battery_notify);
  
diff --combined drivers/acpi/video.c
index 1f3ffb353299422848367fa028c69087c777c1a3,7459ca52c1a829cae548828fb083636a573e179f..56666a9824760bc0fbf569aba85518a38ce995cb
@@@ -117,7 -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 +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 +271,8 @@@ static in
  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 +283,7 @@@ acpi_video_device_get_state(struct acpi
  {
        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 +298,7 @@@ acpi_video_device_set_state(struct acpi
  
  
        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 +314,7 @@@ acpi_video_device_lcd_query_levels(stru
  
        *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 +343,7 @@@ acpi_video_device_lcd_set_level(struct 
  
  
        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 +355,7 @@@ acpi_video_device_lcd_get_level_current
  {
        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 +382,7 @@@ acpi_video_device_EDID(struct acpi_vide
        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 +412,7 @@@ acpi_video_bus_set_POST(struct acpi_vid
  
        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 +424,7 @@@ acpi_video_bus_get_POST(struct acpi_vid
  {
        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 +435,7 @@@ acpi_video_bus_POST_options(struct acpi
  {
        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 +476,7 @@@ acpi_video_bus_DOS(struct acpi_video_bu
        }
        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 +504,25 @@@ static void acpi_video_device_find_cap(
  
        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 +586,22 @@@ static void acpi_video_bus_find_cap(str
        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 +1269,6 @@@ acpi_video_bus_get_one_device(struct ac
  
                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;
                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 +1397,7 @@@ static int acpi_video_device_enumerate(
        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;
        video->attached_array = active_device_list;
        video->attached_count = count;
        out:
 -      acpi_os_free(buffer.pointer);
 +      kfree(buffer.pointer);
        return status;
  }
  
@@@ -1569,7 -1565,7 +1565,7 @@@ static int acpi_video_bus_put_one_devic
        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 +1620,7 @@@ static void acpi_video_bus_notify(acpi_
        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 +1663,7 @@@ static void acpi_video_device_notify(ac
        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 +1701,7 @@@ static int acpi_video_bus_add(struct ac
                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;
        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 +1761,7 @@@ static int acpi_video_bus_remove(struc
  
        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);