Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: Change ACPI to use dev_archdata instead of firmware_data

Change ACPI to use dev_archdata instead of firmware_data

This patch changes ACPI to use the new dev_archdata on i386, x86_64
and ia64 (is there any other arch using ACPI ?) to store it's
acpi_handle.

It also removes the firmware_data field from struct device as this
was the only user.

Only build-tested on x86

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Benjamin Herrenschmidt and committed by
Greg Kroah-Hartman
465ae641 c6dbaef2

+39 -15
+11 -9
drivers/acpi/glue.c
··· 267 267 { 268 268 acpi_status status; 269 269 270 - if (dev->firmware_data) { 270 + if (dev->archdata.acpi_handle) { 271 271 printk(KERN_WARNING PREFIX 272 - "Drivers changed 'firmware_data' for %s\n", dev->bus_id); 272 + "Drivers changed 'acpi_handle' for %s\n", dev->bus_id); 273 273 return -EINVAL; 274 274 } 275 275 get_device(dev); ··· 278 278 put_device(dev); 279 279 return -EINVAL; 280 280 } 281 - dev->firmware_data = handle; 281 + dev->archdata.acpi_handle = handle; 282 282 283 283 return 0; 284 284 } 285 285 286 286 static int acpi_unbind_one(struct device *dev) 287 287 { 288 - if (!dev->firmware_data) 288 + if (!dev->archdata.acpi_handle) 289 289 return 0; 290 - if (dev == acpi_get_physical_device(dev->firmware_data)) { 290 + if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { 291 291 /* acpi_get_physical_device increase refcnt by one */ 292 292 put_device(dev); 293 - acpi_detach_data(dev->firmware_data, acpi_glue_data_handler); 294 - dev->firmware_data = NULL; 293 + acpi_detach_data(dev->archdata.acpi_handle, 294 + acpi_glue_data_handler); 295 + dev->archdata.acpi_handle = NULL; 295 296 /* acpi_bind_one increase refcnt by one */ 296 297 put_device(dev); 297 298 } else { 298 299 printk(KERN_ERR PREFIX 299 - "Oops, 'firmware_data' corrupt for %s\n", dev->bus_id); 300 + "Oops, 'acpi_handle' corrupt for %s\n", dev->bus_id); 300 301 } 301 302 return 0; 302 303 } ··· 329 328 if (!ret) { 330 329 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 331 330 332 - acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer); 331 + acpi_get_name(dev->archdata.acpi_handle, 332 + ACPI_FULL_PATHNAME, &buffer); 333 333 DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); 334 334 kfree(buffer.pointer); 335 335 } else
+1 -1
include/acpi/acpi_bus.h
··· 357 357 /* helper */ 358 358 acpi_handle acpi_get_child(acpi_handle, acpi_integer); 359 359 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 360 - #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) 360 + #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) 361 361 362 362 #endif /* CONFIG_ACPI */ 363 363
+9 -1
include/asm-i386/device.h
··· 3 3 * 4 4 * This file is released under the GPLv2 5 5 */ 6 - #include <asm-generic/device.h> 6 + #ifndef _ASM_I386_DEVICE_H 7 + #define _ASM_I386_DEVICE_H 7 8 9 + struct dev_archdata { 10 + #ifdef CONFIG_ACPI 11 + void *acpi_handle; 12 + #endif 13 + }; 14 + 15 + #endif /* _ASM_I386_DEVICE_H */
+9 -1
include/asm-ia64/device.h
··· 3 3 * 4 4 * This file is released under the GPLv2 5 5 */ 6 - #include <asm-generic/device.h> 6 + #ifndef _ASM_IA64_DEVICE_H 7 + #define _ASM_IA64_DEVICE_H 7 8 9 + struct dev_archdata { 10 + #ifdef CONFIG_ACPI 11 + void *acpi_handle; 12 + #endif 13 + }; 14 + 15 + #endif /* _ASM_IA64_DEVICE_H */
+9 -1
include/asm-x86_64/device.h
··· 3 3 * 4 4 * This file is released under the GPLv2 5 5 */ 6 - #include <asm-generic/device.h> 6 + #ifndef _ASM_X86_64_DEVICE_H 7 + #define _ASM_X86_64_DEVICE_H 7 8 9 + struct dev_archdata { 10 + #ifdef CONFIG_ACPI 11 + void *acpi_handle; 12 + #endif 13 + }; 14 + 15 + #endif /* _ASM_X86_64_DEVICE_H */
-2
include/linux/device.h
··· 369 369 void *driver_data; /* data private to the driver */ 370 370 void *platform_data; /* Platform specific data, device 371 371 core doesn't touch it */ 372 - void *firmware_data; /* Firmware specific data (e.g. ACPI, 373 - BIOS data),reserved for device core*/ 374 372 struct dev_pm_info power; 375 373 376 374 u64 *dma_mask; /* dma mask (if dma'able device) */