Pull acpi_device_handle_cleanup into release branch

Len Brown b2f71bad ba290ab7

+111 -148
+6 -8
drivers/acpi/ac.c
··· 65 65 }; 66 66 67 67 struct acpi_ac { 68 - acpi_handle handle; 68 + struct acpi_device * device; 69 69 unsigned long state; 70 70 }; 71 71 ··· 88 88 if (!ac) 89 89 return -EINVAL; 90 90 91 - status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); 91 + status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, &ac->state); 92 92 if (ACPI_FAILURE(status)) { 93 93 ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); 94 94 ac->state = ACPI_AC_STATUS_UNKNOWN; ··· 191 191 if (!ac) 192 192 return; 193 193 194 - if (acpi_bus_get_device(ac->handle, &device)) 195 - return; 196 - 194 + device = ac->device; 197 195 switch (event) { 198 196 case ACPI_AC_NOTIFY_STATUS: 199 197 acpi_ac_get_state(ac); ··· 221 223 return -ENOMEM; 222 224 memset(ac, 0, sizeof(struct acpi_ac)); 223 225 224 - ac->handle = device->handle; 226 + ac->device = device; 225 227 strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); 226 228 strcpy(acpi_device_class(device), ACPI_AC_CLASS); 227 229 acpi_driver_data(device) = ac; ··· 234 236 if (result) 235 237 goto end; 236 238 237 - status = acpi_install_notify_handler(ac->handle, 239 + status = acpi_install_notify_handler(device->handle, 238 240 ACPI_DEVICE_NOTIFY, acpi_ac_notify, 239 241 ac); 240 242 if (ACPI_FAILURE(status)) { ··· 266 268 267 269 ac = (struct acpi_ac *)acpi_driver_data(device); 268 270 269 - status = acpi_remove_notify_handler(ac->handle, 271 + status = acpi_remove_notify_handler(device->handle, 270 272 ACPI_DEVICE_NOTIFY, acpi_ac_notify); 271 273 272 274 acpi_ac_remove_fs(device);
+7 -7
drivers/acpi/acpi_memhotplug.c
··· 80 80 }; 81 81 82 82 struct acpi_memory_device { 83 - acpi_handle handle; 83 + struct acpi_device * device; 84 84 unsigned int state; /* State of the memory device */ 85 85 struct list_head res_list; 86 86 }; ··· 129 129 struct acpi_memory_info *info, *n; 130 130 131 131 132 - status = acpi_walk_resources(mem_device->handle, METHOD_NAME__CRS, 132 + status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, 133 133 acpi_memory_get_resource, mem_device); 134 134 if (ACPI_FAILURE(status)) { 135 135 list_for_each_entry_safe(info, n, &mem_device->res_list, list) ··· 192 192 193 193 194 194 /* Get device present/absent information from the _STA */ 195 - if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", 195 + if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle, "_STA", 196 196 NULL, &current_status))) 197 197 return -ENODEV; 198 198 /* ··· 222 222 return result; 223 223 } 224 224 225 - node = acpi_get_node(mem_device->handle); 225 + node = acpi_get_node(mem_device->device->handle); 226 226 /* 227 227 * Tell the VM there is more memory here... 228 228 * Note: Assume that this function returns zero on success ··· 269 269 arg_list.pointer = &arg; 270 270 arg.type = ACPI_TYPE_INTEGER; 271 271 arg.integer.value = 1; 272 - status = acpi_evaluate_object(mem_device->handle, 272 + status = acpi_evaluate_object(mem_device->device->handle, 273 273 "_EJ0", &arg_list, NULL); 274 274 /* Return on _EJ0 failure */ 275 275 if (ACPI_FAILURE(status)) { ··· 278 278 } 279 279 280 280 /* Evalute _STA to check if the device is disabled */ 281 - status = acpi_evaluate_integer(mem_device->handle, "_STA", 281 + status = acpi_evaluate_integer(mem_device->device->handle, "_STA", 282 282 NULL, &current_status); 283 283 if (ACPI_FAILURE(status)) 284 284 return -ENODEV; ··· 398 398 memset(mem_device, 0, sizeof(struct acpi_memory_device)); 399 399 400 400 INIT_LIST_HEAD(&mem_device->res_list); 401 - mem_device->handle = device->handle; 401 + mem_device->device = device; 402 402 sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME); 403 403 sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS); 404 404 acpi_driver_data(device) = mem_device;
+10 -13
drivers/acpi/battery.c
··· 108 108 }; 109 109 110 110 struct acpi_battery { 111 - acpi_handle handle; 111 + struct acpi_device * device; 112 112 struct acpi_battery_flags flags; 113 113 struct acpi_battery_trips trips; 114 114 unsigned long alarm; ··· 138 138 139 139 /* Evalute _BIF */ 140 140 141 - status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); 141 + status = acpi_evaluate_object(battery->device->handle, "_BIF", NULL, &buffer); 142 142 if (ACPI_FAILURE(status)) { 143 143 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); 144 144 return -ENODEV; ··· 198 198 199 199 /* Evalute _BST */ 200 200 201 - status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); 201 + status = acpi_evaluate_object(battery->device->handle, "_BST", NULL, &buffer); 202 202 if (ACPI_FAILURE(status)) { 203 203 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 204 204 return -ENODEV; ··· 255 255 256 256 arg0.integer.value = alarm; 257 257 258 - status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL); 258 + status = acpi_evaluate_object(battery->device->handle, "_BTP", &arg_list, NULL); 259 259 if (ACPI_FAILURE(status)) 260 260 return -ENODEV; 261 261 ··· 278 278 if (!battery) 279 279 return -EINVAL; 280 280 281 - result = acpi_bus_get_device(battery->handle, &device); 282 - if (result) 283 - return result; 281 + device = battery->device; 284 282 285 283 result = acpi_bus_get_status(device); 286 284 if (result) ··· 303 305 304 306 /* See if alarms are supported, and if so, set default */ 305 307 306 - status = acpi_get_handle(battery->handle, "_BTP", &handle); 308 + status = acpi_get_handle(battery->device->handle, "_BTP", &handle); 307 309 if (ACPI_SUCCESS(status)) { 308 310 battery->flags.alarm = 1; 309 311 acpi_battery_set_alarm(battery, battery->trips.warning); ··· 660 662 if (!battery) 661 663 return; 662 664 663 - if (acpi_bus_get_device(handle, &device)) 664 - return; 665 + device = battery->device; 665 666 666 667 switch (event) { 667 668 case ACPI_BATTERY_NOTIFY_STATUS: ··· 692 695 return -ENOMEM; 693 696 memset(battery, 0, sizeof(struct acpi_battery)); 694 697 695 - battery->handle = device->handle; 698 + battery->device = device; 696 699 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 697 700 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 698 701 acpi_driver_data(device) = battery; ··· 705 708 if (result) 706 709 goto end; 707 710 708 - status = acpi_install_notify_handler(battery->handle, 711 + status = acpi_install_notify_handler(device->handle, 709 712 ACPI_DEVICE_NOTIFY, 710 713 acpi_battery_notify, battery); 711 714 if (ACPI_FAILURE(status)) { ··· 737 740 738 741 battery = (struct acpi_battery *)acpi_driver_data(device); 739 742 740 - status = acpi_remove_notify_handler(battery->handle, 743 + status = acpi_remove_notify_handler(device->handle, 741 744 ACPI_DEVICE_NOTIFY, 742 745 acpi_battery_notify); 743 746
+4 -6
drivers/acpi/button.c
··· 82 82 }; 83 83 84 84 struct acpi_button { 85 - acpi_handle handle; 86 85 struct acpi_device *device; /* Fixed button kludge */ 87 86 u8 type; 88 87 unsigned long pushed; ··· 136 137 if (!button || !button->device) 137 138 return 0; 138 139 139 - status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); 140 + status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state); 140 141 if (ACPI_FAILURE(status)) { 141 142 seq_printf(seq, "state: unsupported\n"); 142 143 } else { ··· 281 282 if (!button) 282 283 return AE_BAD_PARAMETER; 283 284 284 - acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); 285 + acpi_button_notify(button->device->handle, ACPI_BUTTON_NOTIFY_STATUS, button); 285 286 286 287 return AE_OK; 287 288 } ··· 302 303 memset(button, 0, sizeof(struct acpi_button)); 303 304 304 305 button->device = device; 305 - button->handle = device->handle; 306 306 acpi_driver_data(device) = button; 307 307 308 308 /* ··· 360 362 button); 361 363 break; 362 364 default: 363 - status = acpi_install_notify_handler(button->handle, 365 + status = acpi_install_notify_handler(device->handle, 364 366 ACPI_DEVICE_NOTIFY, 365 367 acpi_button_notify, 366 368 button); ··· 418 420 acpi_button_notify_fixed); 419 421 break; 420 422 default: 421 - status = acpi_remove_notify_handler(button->handle, 423 + status = acpi_remove_notify_handler(device->handle, 422 424 ACPI_DEVICE_NOTIFY, 423 425 acpi_button_notify); 424 426 break;
+5 -5
drivers/acpi/fan.c
··· 64 64 }; 65 65 66 66 struct acpi_fan { 67 - acpi_handle handle; 67 + struct acpi_device * device; 68 68 }; 69 69 70 70 /* -------------------------------------------------------------------------- ··· 80 80 81 81 82 82 if (fan) { 83 - if (acpi_bus_get_power(fan->handle, &state)) 83 + if (acpi_bus_get_power(fan->device->handle, &state)) 84 84 seq_printf(seq, "status: ERROR\n"); 85 85 else 86 86 seq_printf(seq, "status: %s\n", ··· 112 112 113 113 state_string[count] = '\0'; 114 114 115 - result = acpi_bus_set_power(fan->handle, 115 + result = acpi_bus_set_power(fan->device->handle, 116 116 simple_strtoul(state_string, NULL, 0)); 117 117 if (result) 118 118 return result; ··· 191 191 return -ENOMEM; 192 192 memset(fan, 0, sizeof(struct acpi_fan)); 193 193 194 - fan->handle = device->handle; 194 + fan->device = device; 195 195 strcpy(acpi_device_name(device), "Fan"); 196 196 strcpy(acpi_device_class(device), ACPI_FAN_CLASS); 197 197 acpi_driver_data(device) = fan; 198 198 199 - result = acpi_bus_get_power(fan->handle, &state); 199 + result = acpi_bus_get_power(device->handle, &state); 200 200 if (result) { 201 201 printk(KERN_ERR PREFIX "Reading power state\n"); 202 202 goto end;
+6 -9
drivers/acpi/pci_link.c
··· 83 83 struct acpi_pci_link { 84 84 struct list_head node; 85 85 struct acpi_device *device; 86 - acpi_handle handle; 87 86 struct acpi_pci_link_irq irq; 88 87 int refcnt; 89 88 }; ··· 174 175 if (!link) 175 176 return -EINVAL; 176 177 177 - status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, 178 + status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS, 178 179 acpi_pci_link_check_possible, link); 179 180 if (ACPI_FAILURE(status)) { 180 181 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); ··· 248 249 acpi_status status = AE_OK; 249 250 int irq = 0; 250 251 251 - 252 - if (!link || !link->handle) 252 + if (!link) 253 253 return -EINVAL; 254 254 255 255 link->irq.active = 0; ··· 272 274 * Query and parse _CRS to get the current IRQ assignment. 273 275 */ 274 276 275 - status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, 277 + status = acpi_walk_resources(link->device->handle, METHOD_NAME__CRS, 276 278 acpi_pci_link_check_current, &irq); 277 279 if (ACPI_FAILURE(status)) { 278 280 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); ··· 358 360 resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; 359 361 360 362 /* Attempt to set the resource */ 361 - status = acpi_set_current_resources(link->handle, &buffer); 363 + status = acpi_set_current_resources(link->device->handle, &buffer); 362 364 363 365 /* check for total failure */ 364 366 if (ACPI_FAILURE(status)) { ··· 697 699 acpi_device_bid(link->device))); 698 700 699 701 if (link->refcnt == 0) { 700 - acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); 702 + acpi_ut_evaluate_object(link->device->handle, "_DIS", 0, NULL); 701 703 } 702 704 mutex_unlock(&acpi_link_lock); 703 705 return (link->irq.active); ··· 724 726 memset(link, 0, sizeof(struct acpi_pci_link)); 725 727 726 728 link->device = device; 727 - link->handle = device->handle; 728 729 strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); 729 730 strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); 730 731 acpi_driver_data(device) = link; ··· 762 765 763 766 end: 764 767 /* disable all links -- to be activated on use */ 765 - acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); 768 + acpi_ut_evaluate_object(device->handle, "_DIS", 0, NULL); 766 769 mutex_unlock(&acpi_link_lock); 767 770 768 771 if (result)
+10 -10
drivers/acpi/pci_root.c
··· 58 58 59 59 struct acpi_pci_root { 60 60 struct list_head node; 61 - acpi_handle handle; 61 + struct acpi_device * device; 62 62 struct acpi_pci_id id; 63 63 struct pci_bus *bus; 64 64 }; ··· 83 83 list_for_each(entry, &acpi_pci_roots) { 84 84 struct acpi_pci_root *root; 85 85 root = list_entry(entry, struct acpi_pci_root, node); 86 - driver->add(root->handle); 86 + driver->add(root->device->handle); 87 87 n++; 88 88 } 89 89 ··· 110 110 list_for_each(entry, &acpi_pci_roots) { 111 111 struct acpi_pci_root *root; 112 112 root = list_entry(entry, struct acpi_pci_root, node); 113 - driver->remove(root->handle); 113 + driver->remove(root->device->handle); 114 114 } 115 115 } 116 116 ··· 170 170 memset(root, 0, sizeof(struct acpi_pci_root)); 171 171 INIT_LIST_HEAD(&root->node); 172 172 173 - root->handle = device->handle; 173 + root->device = device; 174 174 strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); 175 175 strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); 176 176 acpi_driver_data(device) = root; ··· 185 185 * ------- 186 186 * Obtained via _SEG, if exists, otherwise assumed to be zero (0). 187 187 */ 188 - status = acpi_evaluate_integer(root->handle, METHOD_NAME__SEG, NULL, 188 + status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL, 189 189 &value); 190 190 switch (status) { 191 191 case AE_OK: ··· 207 207 * --- 208 208 * Obtained via _BBN, if exists, otherwise assumed to be zero (0). 209 209 */ 210 - status = acpi_evaluate_integer(root->handle, METHOD_NAME__BBN, NULL, 210 + status = acpi_evaluate_integer(device->handle, METHOD_NAME__BBN, NULL, 211 211 &value); 212 212 switch (status) { 213 213 case AE_OK: ··· 234 234 "Wrong _BBN value, reboot" 235 235 " and use option 'pci=noacpi'\n"); 236 236 237 - status = try_get_root_bridge_busnr(root->handle, &bus); 237 + status = try_get_root_bridge_busnr(device->handle, &bus); 238 238 if (ACPI_FAILURE(status)) 239 239 break; 240 240 if (bus != root->id.bus) { ··· 294 294 * ----------------- 295 295 * Evaluate and parse _PRT, if exists. 296 296 */ 297 - status = acpi_get_handle(root->handle, METHOD_NAME__PRT, &handle); 297 + status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); 298 298 if (ACPI_SUCCESS(status)) 299 - result = acpi_pci_irq_add_prt(root->handle, root->id.segment, 299 + result = acpi_pci_irq_add_prt(device->handle, root->id.segment, 300 300 root->id.bus); 301 301 302 302 end: ··· 315 315 316 316 317 317 list_for_each_entry(root, &acpi_pci_roots, node) { 318 - if (root->handle == device->handle) { 318 + if (root->device == device) { 319 319 pci_bus_add_devices(root->bus); 320 320 return 0; 321 321 }
+9 -13
drivers/acpi/power.c
··· 70 70 }; 71 71 72 72 struct acpi_power_resource { 73 - acpi_handle handle; 73 + struct acpi_device * device; 74 74 acpi_bus_id name; 75 75 u32 system_level; 76 76 u32 order; ··· 124 124 if (!resource) 125 125 return -EINVAL; 126 126 127 - status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta); 127 + status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta); 128 128 if (ACPI_FAILURE(status)) 129 129 return -ENODEV; 130 130 ··· 192 192 return 0; 193 193 } 194 194 195 - status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL); 195 + status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); 196 196 if (ACPI_FAILURE(status)) 197 197 return -ENODEV; 198 198 ··· 203 203 return -ENOEXEC; 204 204 205 205 /* Update the power resource's _device_ power state */ 206 - result = acpi_bus_get_device(resource->handle, &device); 207 - if (result) 208 - return result; 209 - device->power.state = ACPI_STATE_D0; 206 + device = resource->device; 207 + resource->device->power.state = ACPI_STATE_D0; 210 208 211 209 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", 212 210 resource->name)); ··· 240 242 return 0; 241 243 } 242 244 243 - status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL); 245 + status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL); 244 246 if (ACPI_FAILURE(status)) 245 247 return -ENODEV; 246 248 ··· 251 253 return -ENOEXEC; 252 254 253 255 /* Update the power resource's _device_ power state */ 254 - result = acpi_bus_get_device(resource->handle, &device); 255 - if (result) 256 - return result; 256 + device = resource->device; 257 257 device->power.state = ACPI_STATE_D3; 258 258 259 259 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", ··· 540 544 return -ENOMEM; 541 545 memset(resource, 0, sizeof(struct acpi_power_resource)); 542 546 543 - resource->handle = device->handle; 547 + resource->device = device; 544 548 strcpy(resource->name, device->pnp.bus_id); 545 549 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 546 550 strcpy(acpi_device_class(device), ACPI_POWER_CLASS); 547 551 acpi_driver_data(device) = resource; 548 552 549 553 /* Evalute the object to get the system level and resource order. */ 550 - status = acpi_evaluate_object(resource->handle, NULL, NULL, &buffer); 554 + status = acpi_evaluate_object(device->handle, NULL, NULL, &buffer); 551 555 if (ACPI_FAILURE(status)) { 552 556 result = -ENODEV; 553 557 goto end;
+20 -37
drivers/acpi/thermal.c
··· 162 162 }; 163 163 164 164 struct acpi_thermal { 165 - acpi_handle handle; 165 + struct acpi_device * device; 166 166 acpi_bus_id name; 167 167 unsigned long temperature; 168 168 unsigned long last_temperature; ··· 229 229 tz->last_temperature = tz->temperature; 230 230 231 231 status = 232 - acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); 232 + acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tz->temperature); 233 233 if (ACPI_FAILURE(status)) 234 234 return -ENODEV; 235 235 ··· 248 248 return -EINVAL; 249 249 250 250 status = 251 - acpi_evaluate_integer(tz->handle, "_TZP", NULL, 251 + acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, 252 252 &tz->polling_frequency); 253 253 if (ACPI_FAILURE(status)) 254 254 return -ENODEV; ··· 285 285 if (!tz) 286 286 return -EINVAL; 287 287 288 - status = acpi_get_handle(tz->handle, "_SCP", &handle); 288 + status = acpi_get_handle(tz->device->handle, "_SCP", &handle); 289 289 if (ACPI_FAILURE(status)) { 290 290 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); 291 291 return -ENODEV; ··· 316 316 317 317 /* Critical Shutdown (required) */ 318 318 319 - status = acpi_evaluate_integer(tz->handle, "_CRT", NULL, 319 + status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, 320 320 &tz->trips.critical.temperature); 321 321 if (ACPI_FAILURE(status)) { 322 322 tz->trips.critical.flags.valid = 0; ··· 332 332 /* Critical Sleep (optional) */ 333 333 334 334 status = 335 - acpi_evaluate_integer(tz->handle, "_HOT", NULL, 335 + acpi_evaluate_integer(tz->device->handle, "_HOT", NULL, 336 336 &tz->trips.hot.temperature); 337 337 if (ACPI_FAILURE(status)) { 338 338 tz->trips.hot.flags.valid = 0; ··· 346 346 /* Passive: Processors (optional) */ 347 347 348 348 status = 349 - acpi_evaluate_integer(tz->handle, "_PSV", NULL, 349 + acpi_evaluate_integer(tz->device->handle, "_PSV", NULL, 350 350 &tz->trips.passive.temperature); 351 351 if (ACPI_FAILURE(status)) { 352 352 tz->trips.passive.flags.valid = 0; ··· 355 355 tz->trips.passive.flags.valid = 1; 356 356 357 357 status = 358 - acpi_evaluate_integer(tz->handle, "_TC1", NULL, 358 + acpi_evaluate_integer(tz->device->handle, "_TC1", NULL, 359 359 &tz->trips.passive.tc1); 360 360 if (ACPI_FAILURE(status)) 361 361 tz->trips.passive.flags.valid = 0; 362 362 363 363 status = 364 - acpi_evaluate_integer(tz->handle, "_TC2", NULL, 364 + acpi_evaluate_integer(tz->device->handle, "_TC2", NULL, 365 365 &tz->trips.passive.tc2); 366 366 if (ACPI_FAILURE(status)) 367 367 tz->trips.passive.flags.valid = 0; 368 368 369 369 status = 370 - acpi_evaluate_integer(tz->handle, "_TSP", NULL, 370 + acpi_evaluate_integer(tz->device->handle, "_TSP", NULL, 371 371 &tz->trips.passive.tsp); 372 372 if (ACPI_FAILURE(status)) 373 373 tz->trips.passive.flags.valid = 0; 374 374 375 375 status = 376 - acpi_evaluate_reference(tz->handle, "_PSL", NULL, 376 + acpi_evaluate_reference(tz->device->handle, "_PSL", NULL, 377 377 &tz->trips.passive.devices); 378 378 if (ACPI_FAILURE(status)) 379 379 tz->trips.passive.flags.valid = 0; ··· 393 393 char name[5] = { '_', 'A', 'C', ('0' + i), '\0' }; 394 394 395 395 status = 396 - acpi_evaluate_integer(tz->handle, name, NULL, 396 + acpi_evaluate_integer(tz->device->handle, name, NULL, 397 397 &tz->trips.active[i].temperature); 398 398 if (ACPI_FAILURE(status)) 399 399 break; 400 400 401 401 name[2] = 'L'; 402 402 status = 403 - acpi_evaluate_reference(tz->handle, name, NULL, 403 + acpi_evaluate_reference(tz->device->handle, name, NULL, 404 404 &tz->trips.active[i].devices); 405 405 if (ACPI_SUCCESS(status)) { 406 406 tz->trips.active[i].flags.valid = 1; ··· 424 424 return -EINVAL; 425 425 426 426 status = 427 - acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); 427 + acpi_evaluate_reference(tz->device->handle, "_TZD", NULL, &tz->devices); 428 428 if (ACPI_FAILURE(status)) 429 429 return -ENODEV; 430 430 ··· 453 453 454 454 static int acpi_thermal_critical(struct acpi_thermal *tz) 455 455 { 456 - int result = 0; 457 - struct acpi_device *device = NULL; 458 - 459 - 460 456 if (!tz || !tz->trips.critical.flags.valid) 461 457 return -EINVAL; 462 458 ··· 462 466 } else if (tz->trips.critical.flags.enabled) 463 467 tz->trips.critical.flags.enabled = 0; 464 468 465 - result = acpi_bus_get_device(tz->handle, &device); 466 - if (result) 467 - return result; 468 - 469 469 printk(KERN_EMERG 470 470 "Critical temperature reached (%ld C), shutting down.\n", 471 471 KELVIN_TO_CELSIUS(tz->temperature)); 472 - acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, 472 + acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, 473 473 tz->trips.critical.flags.enabled); 474 474 475 475 acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); ··· 475 483 476 484 static int acpi_thermal_hot(struct acpi_thermal *tz) 477 485 { 478 - int result = 0; 479 - struct acpi_device *device = NULL; 480 - 481 - 482 486 if (!tz || !tz->trips.hot.flags.valid) 483 487 return -EINVAL; 484 488 ··· 484 496 } else if (tz->trips.hot.flags.enabled) 485 497 tz->trips.hot.flags.enabled = 0; 486 498 487 - result = acpi_bus_get_device(tz->handle, &device); 488 - if (result) 489 - return result; 490 - 491 - acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, 499 + acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, 492 500 tz->trips.hot.flags.enabled); 493 501 494 502 /* TBD: Call user-mode "sleep(S4)" function */ ··· 1177 1193 if (!tz) 1178 1194 return; 1179 1195 1180 - if (acpi_bus_get_device(tz->handle, &device)) 1181 - return; 1196 + device = tz->device; 1182 1197 1183 1198 switch (event) { 1184 1199 case ACPI_THERMAL_NOTIFY_TEMPERATURE: ··· 1276 1293 return -ENOMEM; 1277 1294 memset(tz, 0, sizeof(struct acpi_thermal)); 1278 1295 1279 - tz->handle = device->handle; 1296 + tz->device = device; 1280 1297 strcpy(tz->name, device->pnp.bus_id); 1281 1298 strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); 1282 1299 strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); ··· 1294 1311 1295 1312 acpi_thermal_check(tz); 1296 1313 1297 - status = acpi_install_notify_handler(tz->handle, 1314 + status = acpi_install_notify_handler(device->handle, 1298 1315 ACPI_DEVICE_NOTIFY, 1299 1316 acpi_thermal_notify, tz); 1300 1317 if (ACPI_FAILURE(status)) { ··· 1335 1352 /* deferred task may reinsert timer */ 1336 1353 del_timer_sync(&(tz->timer)); 1337 1354 1338 - status = acpi_remove_notify_handler(tz->handle, 1355 + status = acpi_remove_notify_handler(device->handle, 1339 1356 ACPI_DEVICE_NOTIFY, 1340 1357 acpi_thermal_notify); 1341 1358
+34 -40
drivers/acpi/video.c
··· 117 117 }; 118 118 119 119 struct acpi_video_bus { 120 - acpi_handle handle; 120 + struct acpi_device *device; 121 121 u8 dos_setting; 122 122 struct acpi_video_enumerated_device *attached_array; 123 123 u8 attached_count; ··· 155 155 }; 156 156 157 157 struct acpi_video_device { 158 - acpi_handle handle; 159 158 unsigned long device_id; 160 159 struct acpi_video_device_flags flags; 161 160 struct acpi_video_device_cap cap; ··· 271 272 acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) 272 273 { 273 274 int status; 274 - status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); 275 + 276 + status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state); 275 277 276 278 return status; 277 279 } ··· 283 283 { 284 284 int status; 285 285 286 - 287 - status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state); 286 + status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state); 288 287 289 288 return status; 290 289 } ··· 298 299 299 300 300 301 arg0.integer.value = state; 301 - status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret); 302 + status = acpi_evaluate_integer(device->dev->handle, "_DSS", &args, &ret); 302 303 303 304 return status; 304 305 } ··· 314 315 315 316 *levels = NULL; 316 317 317 - status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); 318 + status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer); 318 319 if (!ACPI_SUCCESS(status)) 319 320 return status; 320 321 obj = (union acpi_object *)buffer.pointer; ··· 343 344 344 345 345 346 arg0.integer.value = level; 346 - status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL); 347 + status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL); 347 348 348 349 printk(KERN_DEBUG "set_level status: %x\n", status); 349 350 return status; ··· 355 356 { 356 357 int status; 357 358 358 - status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); 359 + status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); 359 360 360 361 return status; 361 362 } ··· 382 383 else 383 384 return -EINVAL; 384 385 385 - status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer); 386 + status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer); 386 387 if (ACPI_FAILURE(status)) 387 388 return -ENODEV; 388 389 ··· 412 413 413 414 arg0.integer.value = option; 414 415 415 - status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp); 416 + status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp); 416 417 if (ACPI_SUCCESS(status)) 417 418 status = tmp ? (-EINVAL) : (AE_OK); 418 419 ··· 424 425 { 425 426 int status; 426 427 427 - 428 - status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id); 428 + status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); 429 429 430 430 return status; 431 431 } ··· 435 437 { 436 438 int status; 437 439 438 - status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); 440 + status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options); 439 441 *options &= 3; 440 442 441 443 return status; ··· 476 478 } 477 479 arg0.integer.value = (lcd_flag << 2) | bios_flag; 478 480 video->dos_setting = arg0.integer.value; 479 - acpi_evaluate_object(video->handle, "_DOS", &args, NULL); 481 + acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL); 480 482 481 483 Failed: 482 484 return status; ··· 504 506 505 507 memset(&device->cap, 0, 4); 506 508 507 - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) { 509 + if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { 508 510 device->cap._ADR = 1; 509 511 } 510 - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) { 512 + if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) { 511 513 device->cap._BCL = 1; 512 514 } 513 - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) { 515 + if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) { 514 516 device->cap._BCM = 1; 515 517 } 516 - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) { 518 + if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { 517 519 device->cap._DDC = 1; 518 520 } 519 - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) { 521 + if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DCS", &h_dummy1))) { 520 522 device->cap._DCS = 1; 521 523 } 522 - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) { 524 + if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DGS", &h_dummy1))) { 523 525 device->cap._DGS = 1; 524 526 } 525 - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) { 527 + if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DSS", &h_dummy1))) { 526 528 device->cap._DSS = 1; 527 529 } 528 530 ··· 586 588 acpi_handle h_dummy1; 587 589 588 590 memset(&video->cap, 0, 4); 589 - if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) { 591 + if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { 590 592 video->cap._DOS = 1; 591 593 } 592 - if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) { 594 + if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) { 593 595 video->cap._DOD = 1; 594 596 } 595 - if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) { 597 + if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) { 596 598 video->cap._ROM = 1; 597 599 } 598 - if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) { 600 + if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) { 599 601 video->cap._GPD = 1; 600 602 } 601 - if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) { 603 + if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) { 602 604 video->cap._SPD = 1; 603 605 } 604 - if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) { 606 + if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) { 605 607 video->cap._VPO = 1; 606 608 } 607 609 } ··· 1269 1271 1270 1272 memset(data, 0, sizeof(struct acpi_video_device)); 1271 1273 1272 - data->handle = device->handle; 1273 1274 strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); 1274 1275 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); 1275 1276 acpi_driver_data(device) = data; ··· 1295 1298 acpi_video_device_bind(video, data); 1296 1299 acpi_video_device_find_cap(data); 1297 1300 1298 - status = acpi_install_notify_handler(data->handle, 1301 + status = acpi_install_notify_handler(device->handle, 1299 1302 ACPI_DEVICE_NOTIFY, 1300 1303 acpi_video_device_notify, 1301 1304 data); ··· 1397 1400 union acpi_object *dod = NULL; 1398 1401 union acpi_object *obj; 1399 1402 1400 - 1401 - status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); 1403 + status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer); 1402 1404 if (!ACPI_SUCCESS(status)) { 1403 1405 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); 1404 1406 return status; ··· 1565 1569 up(&video->sem); 1566 1570 acpi_video_device_remove_fs(device->dev); 1567 1571 1568 - status = acpi_remove_notify_handler(device->handle, 1572 + status = acpi_remove_notify_handler(device->dev->handle, 1569 1573 ACPI_DEVICE_NOTIFY, 1570 1574 acpi_video_device_notify); 1571 1575 ··· 1620 1624 if (!video) 1621 1625 return; 1622 1626 1623 - if (acpi_bus_get_device(handle, &device)) 1624 - return; 1627 + device = video->device; 1625 1628 1626 1629 switch (event) { 1627 1630 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, ··· 1663 1668 if (!video_device) 1664 1669 return; 1665 1670 1666 - if (acpi_bus_get_device(handle, &device)) 1667 - return; 1671 + device = video_device->dev; 1668 1672 1669 1673 switch (event) { 1670 1674 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ ··· 1701 1707 return -ENOMEM; 1702 1708 memset(video, 0, sizeof(struct acpi_video_bus)); 1703 1709 1704 - video->handle = device->handle; 1710 + video->device = device; 1705 1711 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); 1706 1712 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); 1707 1713 acpi_driver_data(device) = video; ··· 1721 1727 acpi_video_bus_get_devices(video, device); 1722 1728 acpi_video_bus_start_devices(video); 1723 1729 1724 - status = acpi_install_notify_handler(video->handle, 1730 + status = acpi_install_notify_handler(device->handle, 1725 1731 ACPI_DEVICE_NOTIFY, 1726 1732 acpi_video_bus_notify, video); 1727 1733 if (ACPI_FAILURE(status)) { ··· 1761 1767 1762 1768 acpi_video_bus_stop_devices(video); 1763 1769 1764 - status = acpi_remove_notify_handler(video->handle, 1770 + status = acpi_remove_notify_handler(video->device->handle, 1765 1771 ACPI_DEVICE_NOTIFY, 1766 1772 acpi_video_bus_notify); 1767 1773