Pārlūkot izejas kodu

[ACPI] Lindent all ACPI files

Signed-off-by: Len Brown <len.brown@intel.com>
Len Brown 20 gadi atpakaļ
vecāks
revīzija
4be44fcd3b
100 mainītis faili ar 13277 papildinājumiem un 14728 dzēšanām
  1. 257 263
      arch/i386/kernel/acpi/boot.c
  2. 20 20
      arch/i386/kernel/acpi/earlyquirk.c
  3. 18 17
      arch/i386/kernel/acpi/sleep.c
  4. 21 16
      arch/ia64/kernel/acpi-ext.c
  5. 167 157
      arch/ia64/kernel/acpi.c
  6. 10 7
      arch/x86_64/kernel/acpi/sleep.c
  7. 56 82
      drivers/acpi/ac.c
  8. 80 96
      drivers/acpi/acpi_memhotplug.c
  9. 312 315
      drivers/acpi/asus_acpi.c
  10. 183 217
      drivers/acpi/battery.c
  11. 66 56
      drivers/acpi/blacklist.c
  12. 151 159
      drivers/acpi/bus.c
  13. 123 151
      drivers/acpi/button.c
  14. 56 72
      drivers/acpi/container.c
  15. 55 60
      drivers/acpi/debug.c
  16. 161 185
      drivers/acpi/dispatcher/dsfield.c
  17. 55 68
      drivers/acpi/dispatcher/dsinit.c
  18. 171 183
      drivers/acpi/dispatcher/dsmethod.c
  19. 194 219
      drivers/acpi/dispatcher/dsmthdat.c
  20. 157 172
      drivers/acpi/dispatcher/dsobject.c
  21. 262 296
      drivers/acpi/dispatcher/dsopcode.c
  22. 203 218
      drivers/acpi/dispatcher/dsutils.c
  23. 269 250
      drivers/acpi/dispatcher/dswexec.c
  24. 242 246
      drivers/acpi/dispatcher/dswload.c
  25. 61 78
      drivers/acpi/dispatcher/dswscope.c
  26. 271 304
      drivers/acpi/dispatcher/dswstate.c
  27. 260 333
      drivers/acpi/ec.c
  28. 31 31
      drivers/acpi/event.c
  29. 66 102
      drivers/acpi/events/evevent.c
  30. 196 232
      drivers/acpi/events/evgpe.c
  31. 290 327
      drivers/acpi/events/evgpeblk.c
  32. 126 168
      drivers/acpi/events/evmisc.c
  33. 268 286
      drivers/acpi/events/evregion.c
  34. 151 160
      drivers/acpi/events/evrgnini.c
  35. 26 51
      drivers/acpi/events/evsci.c
  36. 202 244
      drivers/acpi/events/evxface.c
  37. 199 264
      drivers/acpi/events/evxfevnt.c
  38. 55 59
      drivers/acpi/events/evxfregn.c
  39. 155 164
      drivers/acpi/executer/exconfig.c
  40. 141 170
      drivers/acpi/executer/exconvrt.c
  41. 153 189
      drivers/acpi/executer/excreate.c
  42. 327 370
      drivers/acpi/executer/exdump.c
  43. 126 126
      drivers/acpi/executer/exfield.c
  44. 322 322
      drivers/acpi/executer/exfldio.c
  45. 158 200
      drivers/acpi/executer/exmisc.c
  46. 63 97
      drivers/acpi/executer/exmutex.c
  47. 106 129
      drivers/acpi/executer/exnames.c
  48. 237 261
      drivers/acpi/executer/exoparg1.c
  49. 140 177
      drivers/acpi/executer/exoparg2.c
  50. 48 68
      drivers/acpi/executer/exoparg3.c
  51. 58 69
      drivers/acpi/executer/exoparg6.c
  52. 185 196
      drivers/acpi/executer/exprep.c
  53. 125 155
      drivers/acpi/executer/exregion.c
  54. 84 88
      drivers/acpi/executer/exresnte.c
  55. 136 148
      drivers/acpi/executer/exresolv.c
  56. 197 193
      drivers/acpi/executer/exresop.c
  57. 208 207
      drivers/acpi/executer/exstore.c
  58. 61 60
      drivers/acpi/executer/exstoren.c
  59. 36 50
      drivers/acpi/executer/exstorob.c
  60. 72 111
      drivers/acpi/executer/exsystem.c
  61. 62 109
      drivers/acpi/executer/exutils.c
  62. 54 71
      drivers/acpi/fan.c
  63. 4 2
      drivers/acpi/glue.c
  64. 51 65
      drivers/acpi/hardware/hwacpi.c
  65. 82 115
      drivers/acpi/hardware/hwgpe.c
  66. 290 310
      drivers/acpi/hardware/hwregs.c
  67. 208 207
      drivers/acpi/hardware/hwsleep.c
  68. 30 47
      drivers/acpi/hardware/hwtimer.c
  69. 122 111
      drivers/acpi/hotkey.c
  70. 156 166
      drivers/acpi/ibm_acpi.c
  71. 56 52
      drivers/acpi/motherboard.c
  72. 172 170
      drivers/acpi/namespace/nsaccess.c
  73. 94 138
      drivers/acpi/namespace/nsalloc.c
  74. 207 222
      drivers/acpi/namespace/nsdump.c
  75. 29 45
      drivers/acpi/namespace/nsdumpdv.c
  76. 122 148
      drivers/acpi/namespace/nseval.c
  77. 118 139
      drivers/acpi/namespace/nsinit.c
  78. 98 130
      drivers/acpi/namespace/nsload.c
  79. 46 72
      drivers/acpi/namespace/nsnames.c
  80. 90 119
      drivers/acpi/namespace/nsobject.c
  81. 37 49
      drivers/acpi/namespace/nsparse.c
  82. 98 107
      drivers/acpi/namespace/nssearch.c
  83. 205 297
      drivers/acpi/namespace/nsutils.c
  84. 50 55
      drivers/acpi/namespace/nswalk.c
  85. 196 234
      drivers/acpi/namespace/nsxfeval.c
  86. 80 93
      drivers/acpi/namespace/nsxfname.c
  87. 37 54
      drivers/acpi/namespace/nsxfobj.c
  88. 61 64
      drivers/acpi/numa.c
  89. 218 253
      drivers/acpi/osl.c
  90. 167 209
      drivers/acpi/parser/psargs.c
  91. 302 209
      drivers/acpi/parser/psloop.c
  92. 509 210
      drivers/acpi/parser/psopcode.c
  93. 185 177
      drivers/acpi/parser/psparse.c
  94. 50 80
      drivers/acpi/parser/psscope.c
  95. 30 62
      drivers/acpi/parser/pstree.c
  96. 34 71
      drivers/acpi/parser/psutils.c
  97. 9 17
      drivers/acpi/parser/pswalk.c
  98. 61 81
      drivers/acpi/parser/psxface.c
  99. 103 116
      drivers/acpi/pci_bind.c
  100. 125 138
      drivers/acpi/pci_irq.c

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 257 - 263
arch/i386/kernel/acpi/boot.c


+ 20 - 20
arch/i386/kernel/acpi/earlyquirk.c

@@ -8,44 +8,44 @@
 #include <asm/pci-direct.h>
 #include <asm/acpi.h>
 
-static int __init check_bridge(int vendor, int device) 
+static int __init check_bridge(int vendor, int device)
 {
 	/* According to Nvidia all timer overrides are bogus. Just ignore
 	   them all. */
-	if (vendor == PCI_VENDOR_ID_NVIDIA) { 
-		acpi_skip_timer_override = 1; 		
+	if (vendor == PCI_VENDOR_ID_NVIDIA) {
+		acpi_skip_timer_override = 1;
 	}
 	return 0;
 }
-   
-void __init check_acpi_pci(void) 
-{ 
-	int num,slot,func; 
+
+void __init check_acpi_pci(void)
+{
+	int num, slot, func;
 
 	/* Assume the machine supports type 1. If not it will 
 	   always read ffffffff and should not have any side effect. */
 
 	/* Poor man's PCI discovery */
-	for (num = 0; num < 32; num++) { 
-		for (slot = 0; slot < 32; slot++) { 
-			for (func = 0; func < 8; func++) { 
+	for (num = 0; num < 32; num++) {
+		for (slot = 0; slot < 32; slot++) {
+			for (func = 0; func < 8; func++) {
 				u32 class;
 				u32 vendor;
-				class = read_pci_config(num,slot,func,
+				class = read_pci_config(num, slot, func,
 							PCI_CLASS_REVISION);
 				if (class == 0xffffffff)
-					break; 
+					break;
 
 				if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
-					continue; 
-				
-				vendor = read_pci_config(num, slot, func, 
+					continue;
+
+				vendor = read_pci_config(num, slot, func,
 							 PCI_VENDOR_ID);
-				
-				if (check_bridge(vendor&0xffff, vendor >> 16))
-					return; 
-			} 
-			
+
+				if (check_bridge(vendor & 0xffff, vendor >> 16))
+					return;
+			}
+
 		}
 	}
 }

+ 18 - 17
arch/i386/kernel/acpi/sleep.c

@@ -20,12 +20,13 @@ extern void zap_low_mappings(void);
 
 extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
 
-static void init_low_mapping(pgd_t *pgd, int pgd_limit)
+static void init_low_mapping(pgd_t * pgd, int pgd_limit)
 {
 	int pgd_ofs = 0;
 
-	while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
-		set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD));
+	while ((pgd_ofs < pgd_limit)
+	       && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
+		set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
 		pgd_ofs++, pgd++;
 	}
 	flush_tlb_all();
@@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
  * Create an identity mapped page table and copy the wakeup routine to
  * low memory.
  */
-int acpi_save_state_mem (void)
+int acpi_save_state_mem(void)
 {
 	if (!acpi_wakeup_address)
 		return 1;
 	init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
-	memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
+	memcpy((void *)acpi_wakeup_address, &wakeup_start,
+	       &wakeup_end - &wakeup_start);
 	acpi_copy_wakeup_routine(acpi_wakeup_address);
 
 	return 0;
@@ -51,7 +53,7 @@ int acpi_save_state_mem (void)
 /*
  * acpi_restore_state - undo effects of acpi_save_state_mem
  */
-void acpi_restore_state_mem (void)
+void acpi_restore_state_mem(void)
 {
 	zap_low_mappings();
 }
@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
 void __init acpi_reserve_bootmem(void)
 {
 	if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
-		printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n");
+		printk(KERN_ERR
+		       "ACPI: Wakeup code way too big, S3 disabled.\n");
 		return;
 	}
 
@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
 	return 1;
 }
 
-
 __setup("acpi_sleep=", acpi_sleep_setup);
 
-
 static __init int reset_videomode_after_s3(struct dmi_system_id *d)
 {
 	acpi_video_flags |= 2;
@@ -101,14 +102,14 @@ static __init int reset_videomode_after_s3(struct dmi_system_id *d)
 }
 
 static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
-	{	/* Reset video mode after returning from ACPI S3 sleep */
-		.callback = reset_videomode_after_s3,
-		.ident = "Toshiba Satellite 4030cdt",
-		.matches = {
-			DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
-		},
-	},
-	{ }
+	{			/* Reset video mode after returning from ACPI S3 sleep */
+	 .callback = reset_videomode_after_s3,
+	 .ident = "Toshiba Satellite 4030cdt",
+	 .matches = {
+		     DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
+		     },
+	 },
+	{}
 };
 
 static int __init acpisleep_dmi_init(void)

+ 21 - 16
arch/ia64/kernel/acpi-ext.c

@@ -17,20 +17,20 @@
 #include <asm/acpi-ext.h>
 
 struct acpi_vendor_descriptor {
-	u8				guid_id;
-	efi_guid_t			guid;
+	u8 guid_id;
+	efi_guid_t guid;
 };
 
 struct acpi_vendor_info {
-	struct acpi_vendor_descriptor	*descriptor;
-	u8				*data;
-	u32				length;
+	struct acpi_vendor_descriptor *descriptor;
+	u8 *data;
+	u32 length;
 };
 
 acpi_status
 acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
 {
-	struct acpi_vendor_info *info = (struct acpi_vendor_info *) context;
+	struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
 	struct acpi_resource_vendor *vendor;
 	struct acpi_vendor_descriptor *descriptor;
 	u32 length;
@@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
 	if (resource->id != ACPI_RSTYPE_VENDOR)
 		return AE_OK;
 
-	vendor = (struct acpi_resource_vendor *) &resource->data;
-	descriptor = (struct acpi_vendor_descriptor *) vendor->reserved;
+	vendor = (struct acpi_resource_vendor *)&resource->data;
+	descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
 	if (vendor->length <= sizeof(*info->descriptor) ||
 	    descriptor->guid_id != info->descriptor->guid_id ||
 	    efi_guidcmp(descriptor->guid, info->descriptor->guid))
@@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
 	if (!info->data)
 		return AE_NO_MEMORY;
 
-	memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length);
+	memcpy(info->data,
+	       vendor->reserved + sizeof(struct acpi_vendor_descriptor),
+	       length);
 	info->length = length;
 	return AE_CTRL_TERMINATE;
 }
 
 acpi_status
-acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
-		u8 **data, u32 *length)
+acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
+			  u8 ** data, u32 * length)
 {
 	struct acpi_vendor_info info;
 
 	info.descriptor = id;
 	info.data = NULL;
 
-	acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info);
+	acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match,
+			    &info);
 	if (!info.data)
 		return AE_NOT_FOUND;
 
@@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
 
 struct acpi_vendor_descriptor hp_ccsr_descriptor = {
 	.guid_id = 2,
-	.guid    = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad)
+	.guid =
+	    EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
+		     0x37, 0x0e, 0xad)
 };
 
-acpi_status
-hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
+acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
 {
 	acpi_status status;
 	u8 *data;
 	u32 length;
 
-	status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
+	status =
+	    acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
 
 	if (ACPI_FAILURE(status) || length != 16)
 		return AE_NOT_FOUND;

+ 167 - 157
arch/ia64/kernel/acpi.c

@@ -74,12 +74,11 @@ unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
 #define MAX_SAPICS 256
-u16 ia64_acpiid_to_sapicid[MAX_SAPICS] =
-	{ [0 ... MAX_SAPICS - 1] = -1 };
+u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0...MAX_SAPICS - 1] = -1 };
+
 EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
 
-const char *
-acpi_get_sysname (void)
+const char *acpi_get_sysname(void)
 {
 #ifdef CONFIG_IA64_GENERIC
 	unsigned long rsdp_phys;
@@ -89,27 +88,29 @@ acpi_get_sysname (void)
 
 	rsdp_phys = acpi_find_rsdp();
 	if (!rsdp_phys) {
-		printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n");
+		printk(KERN_ERR
+		       "ACPI 2.0 RSDP not found, default to \"dig\"\n");
 		return "dig";
 	}
 
-	rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys);
+	rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys);
 	if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
-		printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
+		printk(KERN_ERR
+		       "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
 		return "dig";
 	}
 
-	xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address);
+	xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
 	hdr = &xsdt->header;
 	if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
-		printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
+		printk(KERN_ERR
+		       "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
 		return "dig";
 	}
 
 	if (!strcmp(hdr->oem_id, "HP")) {
 		return "hpzx1";
-	}
-	else if (!strcmp(hdr->oem_id, "SGI")) {
+	} else if (!strcmp(hdr->oem_id, "SGI")) {
 		return "sn2";
 	}
 
@@ -137,7 +138,7 @@ acpi_get_sysname (void)
 
 /* Array to record platform interrupt vectors for generic interrupt routing. */
 int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
-	[0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
+	[0...ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
 };
 
 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
@@ -146,8 +147,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
  * Interrupt routing API for device drivers.  Provides interrupt vector for
  * a generic platform event.  Currently only CPEI is implemented.
  */
-int
-acpi_request_vector (u32 int_type)
+int acpi_request_vector(u32 int_type)
 {
 	int vector = -1;
 
@@ -155,12 +155,12 @@ acpi_request_vector (u32 int_type)
 		/* corrected platform error interrupt */
 		vector = platform_intr_list[int_type];
 	} else
-		printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
+		printk(KERN_ERR
+		       "acpi_request_vector(): invalid interrupt type\n");
 	return vector;
 }
 
-char *
-__acpi_map_table (unsigned long phys_addr, unsigned long size)
+char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
 {
 	return __va(phys_addr);
 }
@@ -169,19 +169,18 @@ __acpi_map_table (unsigned long phys_addr, unsigned long size)
                             Boot-time Table Parsing
    -------------------------------------------------------------------------- */
 
-static int			total_cpus __initdata;
-static int			available_cpus __initdata;
-struct acpi_table_madt *	acpi_madt __initdata;
-static u8			has_8259;
-
+static int total_cpus __initdata;
+static int available_cpus __initdata;
+struct acpi_table_madt *acpi_madt __initdata;
+static u8 has_8259;
 
 static int __init
-acpi_parse_lapic_addr_ovr (
-	acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
+			  const unsigned long end)
 {
 	struct acpi_table_lapic_addr_ovr *lapic;
 
-	lapic = (struct acpi_table_lapic_addr_ovr *) header;
+	lapic = (struct acpi_table_lapic_addr_ovr *)header;
 
 	if (BAD_MADT_ENTRY(lapic, end))
 		return -EINVAL;
@@ -193,22 +192,23 @@ acpi_parse_lapic_addr_ovr (
 	return 0;
 }
 
-
 static int __init
-acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
 {
 	struct acpi_table_lsapic *lsapic;
 
-	lsapic = (struct acpi_table_lsapic *) header;
+	lsapic = (struct acpi_table_lsapic *)header;
 
 	if (BAD_MADT_ENTRY(lsapic, end))
 		return -EINVAL;
 
 	if (lsapic->flags.enabled) {
 #ifdef CONFIG_SMP
-		smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
+		smp_boot_data.cpu_phys_id[available_cpus] =
+		    (lsapic->id << 8) | lsapic->eid;
 #endif
-		ia64_acpiid_to_sapicid[lsapic->acpi_id] = (lsapic->id << 8) | lsapic->eid;
+		ia64_acpiid_to_sapicid[lsapic->acpi_id] =
+		    (lsapic->id << 8) | lsapic->eid;
 		++available_cpus;
 	}
 
@@ -216,13 +216,12 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
 	return 0;
 }
 
-
 static int __init
-acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
 {
 	struct acpi_table_lapic_nmi *lacpi_nmi;
 
-	lacpi_nmi = (struct acpi_table_lapic_nmi*) header;
+	lacpi_nmi = (struct acpi_table_lapic_nmi *)header;
 
 	if (BAD_MADT_ENTRY(lacpi_nmi, end))
 		return -EINVAL;
@@ -231,13 +230,12 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
 	return 0;
 }
 
-
 static int __init
-acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
 {
 	struct acpi_table_iosapic *iosapic;
 
-	iosapic = (struct acpi_table_iosapic *) header;
+	iosapic = (struct acpi_table_iosapic *)header;
 
 	if (BAD_MADT_ENTRY(iosapic, end))
 		return -EINVAL;
@@ -245,15 +243,14 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
 	return iosapic_init(iosapic->address, iosapic->global_irq_base);
 }
 
-
 static int __init
-acpi_parse_plat_int_src (
-	acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_plat_int_src(acpi_table_entry_header * header,
+			const unsigned long end)
 {
 	struct acpi_table_plat_int_src *plintsrc;
 	int vector;
 
-	plintsrc = (struct acpi_table_plat_int_src *) header;
+	plintsrc = (struct acpi_table_plat_int_src *)header;
 
 	if (BAD_MADT_ENTRY(plintsrc, end))
 		return -EINVAL;
@@ -267,8 +264,12 @@ acpi_parse_plat_int_src (
 						plintsrc->iosapic_vector,
 						plintsrc->eid,
 						plintsrc->id,
-						(plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-						(plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+						(plintsrc->flags.polarity ==
+						 1) ? IOSAPIC_POL_HIGH :
+						IOSAPIC_POL_LOW,
+						(plintsrc->flags.trigger ==
+						 1) ? IOSAPIC_EDGE :
+						IOSAPIC_LEVEL);
 
 	platform_intr_list[plintsrc->type] = vector;
 	if (acpi_madt_rev > 1) {
@@ -283,7 +284,6 @@ acpi_parse_plat_int_src (
 	return 0;
 }
 
-
 unsigned int can_cpei_retarget(void)
 {
 	extern int cpe_vector;
@@ -322,29 +322,30 @@ unsigned int get_cpei_target_cpu(void)
 }
 
 static int __init
-acpi_parse_int_src_ovr (
-	acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_int_src_ovr(acpi_table_entry_header * header,
+		       const unsigned long end)
 {
 	struct acpi_table_int_src_ovr *p;
 
-	p = (struct acpi_table_int_src_ovr *) header;
+	p = (struct acpi_table_int_src_ovr *)header;
 
 	if (BAD_MADT_ENTRY(p, end))
 		return -EINVAL;
 
 	iosapic_override_isa_irq(p->bus_irq, p->global_irq,
-				 (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-				 (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+				 (p->flags.polarity ==
+				  1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
+				 (p->flags.trigger ==
+				  1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
 	return 0;
 }
 
-
 static int __init
-acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
 {
 	struct acpi_table_nmi_src *nmi_src;
 
-	nmi_src = (struct acpi_table_nmi_src*) header;
+	nmi_src = (struct acpi_table_nmi_src *)header;
 
 	if (BAD_MADT_ENTRY(nmi_src, end))
 		return -EINVAL;
@@ -353,11 +354,9 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
 	return 0;
 }
 
-static void __init
-acpi_madt_oem_check (char *oem_id, char *oem_table_id)
+static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
-	if (!strncmp(oem_id, "IBM", 3) &&
-	    (!strncmp(oem_table_id, "SERMOW", 6))) {
+	if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
 
 		/*
 		 * Unfortunately ITC_DRIFT is not yet part of the
@@ -370,19 +369,18 @@ acpi_madt_oem_check (char *oem_id, char *oem_table_id)
 	}
 }
 
-static int __init
-acpi_parse_madt (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
 {
 	if (!phys_addr || !size)
 		return -EINVAL;
 
-	acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
+	acpi_madt = (struct acpi_table_madt *)__va(phys_addr);
 
 	acpi_madt_rev = acpi_madt->header.revision;
 
 	/* remember the value for reference after free_initmem() */
 #ifdef CONFIG_ITANIUM
-	has_8259 = 1; /* Firmware on old Itanium systems is broken */
+	has_8259 = 1;		/* Firmware on old Itanium systems is broken */
 #else
 	has_8259 = acpi_madt->flags.pcat_compat;
 #endif
@@ -396,19 +394,18 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
 	printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
 
 	acpi_madt_oem_check(acpi_madt->header.oem_id,
-		acpi_madt->header.oem_table_id);
+			    acpi_madt->header.oem_table_id);
 
 	return 0;
 }
 
-
 #ifdef CONFIG_ACPI_NUMA
 
 #undef SLIT_DEBUG
 
 #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
 
-static int __initdata srat_num_cpus;			/* number of cpus */
+static int __initdata srat_num_cpus;	/* number of cpus */
 static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
 #define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))
 #define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))
@@ -421,15 +418,15 @@ static struct acpi_table_slit __initdata *slit_table;
  * ACPI 2.0 SLIT (System Locality Information Table)
  * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
  */
-void __init
-acpi_numa_slit_init (struct acpi_table_slit *slit)
+void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
 {
 	u32 len;
 
 	len = sizeof(struct acpi_table_header) + 8
-		+ slit->localities * slit->localities;
+	    + slit->localities * slit->localities;
 	if (slit->header.length != len) {
-		printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
+		printk(KERN_ERR
+		       "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
 		       len, slit->header.length);
 		memset(numa_slit, 10, sizeof(numa_slit));
 		return;
@@ -438,19 +435,20 @@ acpi_numa_slit_init (struct acpi_table_slit *slit)
 }
 
 void __init
-acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa)
+acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
 {
 	/* record this node in proximity bitmap */
 	pxm_bit_set(pa->proximity_domain);
 
-	node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid);
+	node_cpuid[srat_num_cpus].phys_id =
+	    (pa->apic_id << 8) | (pa->lsapic_eid);
 	/* nid should be overridden as logical node id later */
 	node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
 	srat_num_cpus++;
 }
 
 void __init
-acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
+acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
 {
 	unsigned long paddr, size;
 	u8 pxm;
@@ -487,8 +485,7 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
 	num_node_memblks++;
 }
 
-void __init
-acpi_numa_arch_fixup (void)
+void __init acpi_numa_arch_fixup(void)
 {
 	int i, j, node_from, node_to;
 
@@ -534,21 +531,24 @@ acpi_numa_arch_fixup (void)
 	for (i = 0; i < srat_num_cpus; i++)
 		node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
 
-	printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes());
-	printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
+	printk(KERN_INFO "Number of logical nodes in system = %d\n",
+	       num_online_nodes());
+	printk(KERN_INFO "Number of memory chunks in system = %d\n",
+	       num_node_memblks);
 
-	if (!slit_table) return;
+	if (!slit_table)
+		return;
 	memset(numa_slit, -1, sizeof(numa_slit));
-	for (i=0; i<slit_table->localities; i++) {
+	for (i = 0; i < slit_table->localities; i++) {
 		if (!pxm_bit_test(i))
 			continue;
 		node_from = pxm_to_nid_map[i];
-		for (j=0; j<slit_table->localities; j++) {
+		for (j = 0; j < slit_table->localities; j++) {
 			if (!pxm_bit_test(j))
 				continue;
 			node_to = pxm_to_nid_map[j];
 			node_distance(node_from, node_to) =
-				slit_table->entry[i*slit_table->localities + j];
+			    slit_table->entry[i * slit_table->localities + j];
 		}
 	}
 
@@ -556,40 +556,43 @@ acpi_numa_arch_fixup (void)
 	printk("ACPI 2.0 SLIT locality table:\n");
 	for_each_online_node(i) {
 		for_each_online_node(j)
-			printk("%03d ", node_distance(i,j));
+		    printk("%03d ", node_distance(i, j));
 		printk("\n");
 	}
 #endif
 }
-#endif /* CONFIG_ACPI_NUMA */
+#endif				/* CONFIG_ACPI_NUMA */
 
 /*
  * success: return IRQ number (>=0)
  * failure: return < 0
  */
-int
-acpi_register_gsi (u32 gsi, int edge_level, int active_high_low)
+int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
 {
 	if (has_8259 && gsi < 16)
 		return isa_irq_to_vector(gsi);
 
 	return iosapic_register_intr(gsi,
-			(active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-			(edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+				     (active_high_low ==
+				      ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
+				     IOSAPIC_POL_LOW,
+				     (edge_level ==
+				      ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
+				     IOSAPIC_LEVEL);
 }
+
 EXPORT_SYMBOL(acpi_register_gsi);
 
 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
-void
-acpi_unregister_gsi (u32 gsi)
+void acpi_unregister_gsi(u32 gsi)
 {
 	iosapic_unregister_intr(gsi);
 }
+
 EXPORT_SYMBOL(acpi_unregister_gsi);
-#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
+#endif				/* CONFIG_ACPI_DEALLOCATE_IRQ */
 
-static int __init
-acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size)
 {
 	struct acpi_table_header *fadt_header;
 	struct fadt_descriptor_rev2 *fadt;
@@ -597,11 +600,11 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
 	if (!phys_addr || !size)
 		return -EINVAL;
 
-	fadt_header = (struct acpi_table_header *) __va(phys_addr);
+	fadt_header = (struct acpi_table_header *)__va(phys_addr);
 	if (fadt_header->revision != 3)
-		return -ENODEV;		/* Only deal with ACPI 2.0 FADT */
+		return -ENODEV;	/* Only deal with ACPI 2.0 FADT */
 
-	fadt = (struct fadt_descriptor_rev2 *) fadt_header;
+	fadt = (struct fadt_descriptor_rev2 *)fadt_header;
 
 	if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
 		acpi_kbd_controller_present = 0;
@@ -613,22 +616,19 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
 	return 0;
 }
 
-
-unsigned long __init
-acpi_find_rsdp (void)
+unsigned long __init acpi_find_rsdp(void)
 {
 	unsigned long rsdp_phys = 0;
 
 	if (efi.acpi20)
 		rsdp_phys = __pa(efi.acpi20);
 	else if (efi.acpi)
-		printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n");
+		printk(KERN_WARNING PREFIX
+		       "v1.0/r0.71 tables no longer supported\n");
 	return rsdp_phys;
 }
 
-
-int __init
-acpi_boot_init (void)
+int __init acpi_boot_init(void)
 {
 
 	/*
@@ -646,31 +646,43 @@ acpi_boot_init (void)
 
 	/* Local APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
-		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
+	if (acpi_table_parse_madt
+	    (ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
+		printk(KERN_ERR PREFIX
+		       "Error parsing LAPIC address override entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
-		printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
+	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS)
+	    < 1)
+		printk(KERN_ERR PREFIX
+		       "Error parsing MADT - no LAPIC entries\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0)
+	    < 0)
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 
 	/* I/O APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
-		printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
+	if (acpi_table_parse_madt
+	    (ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
+		printk(KERN_ERR PREFIX
+		       "Error parsing MADT - no IOSAPIC entries\n");
 
 	/* System-Level Interrupt Routing */
 
-	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
-		printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
+	if (acpi_table_parse_madt
+	    (ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src,
+	     ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
+		printk(KERN_ERR PREFIX
+		       "Error parsing platform interrupt source entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
-		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
+	if (acpi_table_parse_madt
+	    (ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
+		printk(KERN_ERR PREFIX
+		       "Error parsing interrupt source overrides entry\n");
 
 	if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
-  skip_madt:
+      skip_madt:
 
 	/*
 	 * FADT says whether a legacy keyboard controller is present.
@@ -685,8 +697,9 @@ acpi_boot_init (void)
 	if (available_cpus == 0) {
 		printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
 		printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
-		smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id();
-		available_cpus = 1; /* We've got at least one of these, no? */
+		smp_boot_data.cpu_phys_id[available_cpus] =
+		    hard_smp_processor_id();
+		available_cpus = 1;	/* We've got at least one of these, no? */
 	}
 	smp_boot_data.cpu_count = available_cpus;
 
@@ -695,8 +708,10 @@ acpi_boot_init (void)
 	if (srat_num_cpus == 0) {
 		int cpu, i = 1;
 		for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
-			if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
-				node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu];
+			if (smp_boot_data.cpu_phys_id[cpu] !=
+			    hard_smp_processor_id())
+				node_cpuid[i++].phys_id =
+				    smp_boot_data.cpu_phys_id[cpu];
 	}
 # endif
 #endif
@@ -704,12 +719,12 @@ acpi_boot_init (void)
 	build_cpu_to_node_map();
 #endif
 	/* Make boot-up look pretty */
-	printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
+	printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
+	       total_cpus);
 	return 0;
 }
 
-int
-acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
+int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
 {
 	int vector;
 
@@ -730,11 +745,10 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
  */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 static
-int
-acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
+int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
 {
 #ifdef CONFIG_ACPI_NUMA
-	int 			pxm_id;
+	int pxm_id;
 
 	pxm_id = acpi_get_pxm(handle);
 
@@ -742,31 +756,28 @@ acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
 	 * Assuming that the container driver would have set the proximity
 	 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
 	 */
-	node_cpuid[cpu].nid = (pxm_id < 0) ? 0:
-			pxm_to_nid_map[pxm_id];
+	node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
 
-	node_cpuid[cpu].phys_id =  physid;
+	node_cpuid[cpu].phys_id = physid;
 #endif
-	return(0);
+	return (0);
 }
 
-
-int
-acpi_map_lsapic(acpi_handle handle, int *pcpu)
+int acpi_map_lsapic(acpi_handle handle, int *pcpu)
 {
-	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *obj;
 	struct acpi_table_lsapic *lsapic;
 	cpumask_t tmp_map;
 	long physid;
 	int cpu;
- 
+
 	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
 		return -EINVAL;
 
-	if (!buffer.length ||  !buffer.pointer)
+	if (!buffer.length || !buffer.pointer)
 		return -EINVAL;
- 
+
 	obj = buffer.pointer;
 	if (obj->type != ACPI_TYPE_BUFFER ||
 	    obj->buffer.length < sizeof(*lsapic)) {
@@ -782,7 +793,7 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
 		return -EINVAL;
 	}
 
-	physid = ((lsapic->id <<8) | (lsapic->eid));
+	physid = ((lsapic->id << 8) | (lsapic->eid));
 
 	acpi_os_free(buffer.pointer);
 	buffer.length = ACPI_ALLOCATE_BUFFER;
@@ -790,50 +801,49 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
 
 	cpus_complement(tmp_map, cpu_present_map);
 	cpu = first_cpu(tmp_map);
-	if(cpu >= NR_CPUS)
+	if (cpu >= NR_CPUS)
 		return -EINVAL;
 
 	acpi_map_cpu2node(handle, cpu, physid);
 
- 	cpu_set(cpu, cpu_present_map);
+	cpu_set(cpu, cpu_present_map);
 	ia64_cpu_to_sapicid[cpu] = physid;
 	ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
 
 	*pcpu = cpu;
-	return(0);
+	return (0);
 }
-EXPORT_SYMBOL(acpi_map_lsapic);
 
+EXPORT_SYMBOL(acpi_map_lsapic);
 
-int
-acpi_unmap_lsapic(int cpu)
+int acpi_unmap_lsapic(int cpu)
 {
 	int i;
 
-	for (i=0; i<MAX_SAPICS; i++) {
- 		if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
- 			ia64_acpiid_to_sapicid[i] = -1;
- 			break;
- 		}
- 	}
+	for (i = 0; i < MAX_SAPICS; i++) {
+		if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
+			ia64_acpiid_to_sapicid[i] = -1;
+			break;
+		}
+	}
 	ia64_cpu_to_sapicid[cpu] = -1;
-	cpu_clear(cpu,cpu_present_map);
+	cpu_clear(cpu, cpu_present_map);
 
 #ifdef CONFIG_ACPI_NUMA
 	/* NUMA specific cleanup's */
 #endif
 
-	return(0);
+	return (0);
 }
+
 EXPORT_SYMBOL(acpi_unmap_lsapic);
-#endif /* CONFIG_ACPI_HOTPLUG_CPU */
- 
+#endif				/* CONFIG_ACPI_HOTPLUG_CPU */
 
 #ifdef CONFIG_ACPI_NUMA
 acpi_status __devinit
-acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
+acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
 {
-	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *obj;
 	struct acpi_table_iosapic *iosapic;
 	unsigned int gsi_base;
@@ -882,10 +892,9 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
 	map_iosapic_to_node(gsi_base, node);
 	return AE_OK;
 }
-#endif /* CONFIG_NUMA */
+#endif				/* CONFIG_NUMA */
 
-int
-acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
+int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
 {
 	int err;
 
@@ -894,17 +903,18 @@ acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
 
 #if CONFIG_ACPI_NUMA
 	acpi_map_iosapic(handle, 0, NULL, NULL);
-#endif /* CONFIG_ACPI_NUMA */
+#endif				/* CONFIG_ACPI_NUMA */
 
 	return 0;
 }
+
 EXPORT_SYMBOL(acpi_register_ioapic);
 
-int
-acpi_unregister_ioapic (acpi_handle handle, u32 gsi_base)
+int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
 {
 	return iosapic_remove(gsi_base);
 }
+
 EXPORT_SYMBOL(acpi_unregister_ioapic);
 
-#endif /* CONFIG_ACPI_BOOT */
+#endif				/* CONFIG_ACPI_BOOT */

+ 10 - 7
arch/x86_64/kernel/acpi/sleep.c

@@ -47,7 +47,6 @@
 #include <asm/proto.h>
 #include <asm/tlbflush.h>
 
-
 /* --------------------------------------------------------------------------
                               Low-Level Sleep Support
    -------------------------------------------------------------------------- */
@@ -77,11 +76,12 @@ static void init_low_mapping(void)
  * Create an identity mapped page table and copy the wakeup routine to
  * low memory.
  */
-int acpi_save_state_mem (void)
+int acpi_save_state_mem(void)
 {
 	init_low_mapping();
 
-	memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
+	memcpy((void *)acpi_wakeup_address, &wakeup_start,
+	       &wakeup_end - &wakeup_start);
 	acpi_copy_wakeup_routine(acpi_wakeup_address);
 
 	return 0;
@@ -90,7 +90,7 @@ int acpi_save_state_mem (void)
 /*
  * acpi_restore_state
  */
-void acpi_restore_state_mem (void)
+void acpi_restore_state_mem(void)
 {
 	set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
 	flush_tlb_all();
@@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void)
 {
 	acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
 	if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
-		printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
+		printk(KERN_CRIT
+		       "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
 }
 
 static int __init acpi_sleep_setup(char *str)
@@ -127,6 +128,8 @@ static int __init acpi_sleep_setup(char *str)
 
 __setup("acpi_sleep=", acpi_sleep_setup);
 
-#endif /*CONFIG_ACPI_SLEEP*/
+#endif				/*CONFIG_ACPI_SLEEP */
 
-void acpi_pci_link_exit(void) {}
+void acpi_pci_link_exit(void)
+{
+}

+ 56 - 82
drivers/acpi/ac.c

@@ -32,7 +32,6 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_AC_COMPONENT		0x00020000
 #define ACPI_AC_CLASS			"ac_adapter"
 #define ACPI_AC_HID 			"ACPI0003"
@@ -45,47 +44,45 @@
 #define ACPI_AC_STATUS_UNKNOWN		0xFF
 
 #define _COMPONENT		ACPI_AC_COMPONENT
-ACPI_MODULE_NAME		("acpi_ac")
+ACPI_MODULE_NAME("acpi_ac")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_ac_add (struct acpi_device *device);
-static int acpi_ac_remove (struct acpi_device *device, int type);
+static int acpi_ac_add(struct acpi_device *device);
+static int acpi_ac_remove(struct acpi_device *device, int type);
 static int acpi_ac_open_fs(struct inode *inode, struct file *file);
 
 static struct acpi_driver acpi_ac_driver = {
-	.name =		ACPI_AC_DRIVER_NAME,
-	.class =	ACPI_AC_CLASS,
-	.ids =		ACPI_AC_HID,
-	.ops =		{
-				.add =		acpi_ac_add,
-				.remove =	acpi_ac_remove,
-			},
+	.name = ACPI_AC_DRIVER_NAME,
+	.class = ACPI_AC_CLASS,
+	.ids = ACPI_AC_HID,
+	.ops = {
+		.add = acpi_ac_add,
+		.remove = acpi_ac_remove,
+		},
 };
 
 struct acpi_ac {
-	acpi_handle		handle;
-	unsigned long		state;
+	acpi_handle handle;
+	unsigned long state;
 };
 
 static struct file_operations acpi_ac_fops = {
-	.open		= acpi_ac_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_ac_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
 /* --------------------------------------------------------------------------
                                AC Adapter Management
    -------------------------------------------------------------------------- */
 
-static int
-acpi_ac_get_state (
-	struct acpi_ac		*ac)
+static int acpi_ac_get_state(struct acpi_ac *ac)
 {
-	acpi_status		status = AE_OK;
+	acpi_status status = AE_OK;
 
 	ACPI_FUNCTION_TRACE("acpi_ac_get_state");
 
@@ -95,24 +92,23 @@ acpi_ac_get_state (
 	status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error reading AC Adapter state\n"));
+				  "Error reading AC Adapter state\n"));
 		ac->state = ACPI_AC_STATUS_UNKNOWN;
 		return_VALUE(-ENODEV);
 	}
-	
+
 	return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry	*acpi_ac_dir;
+static struct proc_dir_entry *acpi_ac_dir;
 
 static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_ac		*ac = (struct acpi_ac *) seq->private;
+	struct acpi_ac *ac = (struct acpi_ac *)seq->private;
 
 	ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
 
@@ -139,23 +135,21 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
 
 	return_VALUE(0);
 }
-	
+
 static int acpi_ac_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
 }
 
-static int
-acpi_ac_add_fs (
-	struct acpi_device	*device)
+static int acpi_ac_add_fs(struct acpi_device *device)
 {
-	struct proc_dir_entry	*entry = NULL;
+	struct proc_dir_entry *entry = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
 
 	if (!acpi_device_dir(device)) {
 		acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-			acpi_ac_dir);
+						     acpi_ac_dir);
 		if (!acpi_device_dir(device))
 			return_VALUE(-ENODEV);
 		acpi_device_dir(device)->owner = THIS_MODULE;
@@ -163,11 +157,11 @@ acpi_ac_add_fs (
 
 	/* 'state' [R] */
 	entry = create_proc_entry(ACPI_AC_FILE_STATE,
-		S_IRUGO, acpi_device_dir(device));
+				  S_IRUGO, acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create '%s' fs entry\n",
-			ACPI_AC_FILE_STATE));
+				  "Unable to create '%s' fs entry\n",
+				  ACPI_AC_FILE_STATE));
 	else {
 		entry->proc_fops = &acpi_ac_fops;
 		entry->data = acpi_driver_data(device);
@@ -177,16 +171,12 @@ acpi_ac_add_fs (
 	return_VALUE(0);
 }
 
-
-static int
-acpi_ac_remove_fs (
-	struct acpi_device	*device)
+static int acpi_ac_remove_fs(struct acpi_device *device)
 {
 	ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
 
 	if (acpi_device_dir(device)) {
-		remove_proc_entry(ACPI_AC_FILE_STATE,
-				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
 
 		remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
 		acpi_device_dir(device) = NULL;
@@ -195,19 +185,14 @@ acpi_ac_remove_fs (
 	return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                    Driver Model
    -------------------------------------------------------------------------- */
 
-static void
-acpi_ac_notify (
-	acpi_handle		handle,
-	u32			event,
-	void			*data)
+static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct acpi_ac		*ac = (struct acpi_ac *) data;
-	struct acpi_device	*device = NULL;
+	struct acpi_ac *ac = (struct acpi_ac *)data;
+	struct acpi_device *device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_ac_notify");
 
@@ -224,21 +209,18 @@ acpi_ac_notify (
 		break;
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"Unsupported event [0x%x]\n", event));
+				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 
 	return_VOID;
 }
 
-
-static int
-acpi_ac_add (
-	struct acpi_device	*device)
+static int acpi_ac_add(struct acpi_device *device)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	struct acpi_ac		*ac = NULL;
+	int result = 0;
+	acpi_status status = AE_OK;
+	struct acpi_ac *ac = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_ac_add");
 
@@ -264,19 +246,20 @@ acpi_ac_add (
 		goto end;
 
 	status = acpi_install_notify_handler(ac->handle,
-		ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac);
+					     ACPI_DEVICE_NOTIFY, acpi_ac_notify,
+					     ac);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error installing notify handler\n"));
+				  "Error installing notify handler\n"));
 		result = -ENODEV;
 		goto end;
 	}
 
-	printk(KERN_INFO PREFIX "%s [%s] (%s)\n", 
-		acpi_device_name(device), acpi_device_bid(device), 
-		ac->state?"on-line":"off-line");
+	printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
+	       acpi_device_name(device), acpi_device_bid(device),
+	       ac->state ? "on-line" : "off-line");
 
-end:
+      end:
 	if (result) {
 		acpi_ac_remove_fs(device);
 		kfree(ac);
@@ -285,27 +268,23 @@ end:
 	return_VALUE(result);
 }
 
-
-static int
-acpi_ac_remove (
-	struct acpi_device	*device,
-	int			type)
+static int acpi_ac_remove(struct acpi_device *device, int type)
 {
-	acpi_status		status = AE_OK;
-	struct acpi_ac		*ac = NULL;
+	acpi_status status = AE_OK;
+	struct acpi_ac *ac = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_ac_remove");
 
 	if (!device || !acpi_driver_data(device))
 		return_VALUE(-EINVAL);
 
-	ac = (struct acpi_ac *) acpi_driver_data(device);
+	ac = (struct acpi_ac *)acpi_driver_data(device);
 
 	status = acpi_remove_notify_handler(ac->handle,
-		ACPI_DEVICE_NOTIFY, acpi_ac_notify);
+					    ACPI_DEVICE_NOTIFY, acpi_ac_notify);
 	if (ACPI_FAILURE(status))
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error removing notify handler\n"));
+				  "Error removing notify handler\n"));
 
 	acpi_ac_remove_fs(device);
 
@@ -314,11 +293,9 @@ acpi_ac_remove (
 	return_VALUE(0);
 }
 
-
-static int __init
-acpi_ac_init (void)
+static int __init acpi_ac_init(void)
 {
-	int			result = 0;
+	int result = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_ac_init");
 
@@ -336,9 +313,7 @@ acpi_ac_init (void)
 	return_VALUE(0);
 }
 
-
-static void __exit
-acpi_ac_exit (void)
+static void __exit acpi_ac_exit(void)
 {
 	ACPI_FUNCTION_TRACE("acpi_ac_exit");
 
@@ -349,6 +324,5 @@ acpi_ac_exit (void)
 	return_VOID;
 }
 
-
 module_init(acpi_ac_init);
 module_exit(acpi_ac_exit);

+ 80 - 96
drivers/acpi/acpi_memhotplug.c

@@ -32,7 +32,6 @@
 #include <linux/memory_hotplug.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_MEMORY_DEVICE_COMPONENT		0x08000000UL
 #define ACPI_MEMORY_DEVICE_CLASS		"memory"
 #define ACPI_MEMORY_DEVICE_HID			"PNP0C80"
@@ -41,8 +40,8 @@
 
 #define _COMPONENT		ACPI_MEMORY_DEVICE_COMPONENT
 
-ACPI_MODULE_NAME		("acpi_memory")
-MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
+ACPI_MODULE_NAME("acpi_memory")
+    MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
 MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
@@ -56,34 +55,33 @@ MODULE_LICENSE("GPL");
 #define MEMORY_POWER_ON_STATE	1
 #define MEMORY_POWER_OFF_STATE	2
 
-static int acpi_memory_device_add (struct acpi_device *device);
-static int acpi_memory_device_remove (struct acpi_device *device, int type);
+static int acpi_memory_device_add(struct acpi_device *device);
+static int acpi_memory_device_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_memory_device_driver = {
-	.name =		ACPI_MEMORY_DEVICE_DRIVER_NAME,
-	.class =	ACPI_MEMORY_DEVICE_CLASS,
-	.ids =		ACPI_MEMORY_DEVICE_HID,
-	.ops =		{
-				.add =		acpi_memory_device_add,
-				.remove =	acpi_memory_device_remove,
-			},
+	.name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
+	.class = ACPI_MEMORY_DEVICE_CLASS,
+	.ids = ACPI_MEMORY_DEVICE_HID,
+	.ops = {
+		.add = acpi_memory_device_add,
+		.remove = acpi_memory_device_remove,
+		},
 };
 
 struct acpi_memory_device {
 	acpi_handle handle;
-	unsigned int state;		/* State of the memory device */
+	unsigned int state;	/* State of the memory device */
 	unsigned short cache_attribute;	/* memory cache attribute */
-	unsigned short read_write_attribute;/* memory read/write attribute */
-	u64 start_addr;	/* Memory Range start physical addr */
-	u64 end_addr;	/* Memory Range end physical addr */
+	unsigned short read_write_attribute;	/* memory read/write attribute */
+	u64 start_addr;		/* Memory Range start physical addr */
+	u64 end_addr;		/* Memory Range end physical addr */
 };
 
-
 static int
 acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
 {
 	acpi_status status;
-	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	struct acpi_resource *resource = NULL;
 	struct acpi_resource_address64 address64;
 
@@ -94,15 +92,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
 	if (ACPI_FAILURE(status))
 		return_VALUE(-EINVAL);
 
-	resource = (struct acpi_resource *) buffer.pointer;
+	resource = (struct acpi_resource *)buffer.pointer;
 	status = acpi_resource_to_address64(resource, &address64);
 	if (ACPI_SUCCESS(status)) {
 		if (address64.resource_type == ACPI_MEMORY_RANGE) {
 			/* Populate the structure */
 			mem_device->cache_attribute =
-				address64.attribute.memory.cache_attribute;
+			    address64.attribute.memory.cache_attribute;
 			mem_device->read_write_attribute =
-			address64.attribute.memory.read_write_attribute;
+			    address64.attribute.memory.read_write_attribute;
 			mem_device->start_addr = address64.min_address_range;
 			mem_device->end_addr = address64.max_address_range;
 		}
@@ -114,7 +112,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
 
 static int
 acpi_memory_get_device(acpi_handle handle,
-	struct acpi_memory_device **mem_device)
+		       struct acpi_memory_device **mem_device)
 {
 	acpi_status status;
 	acpi_handle phandle;
@@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle,
 
 	status = acpi_get_parent(handle, &phandle);
 	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error in acpi_get_parent\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
 		return_VALUE(-EINVAL);
 	}
 
@@ -137,7 +134,7 @@ acpi_memory_get_device(acpi_handle handle,
 	status = acpi_bus_get_device(phandle, &pdevice);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error in acpi_bus_get_device\n"));
+				  "Error in acpi_bus_get_device\n"));
 		return_VALUE(-EINVAL);
 	}
 
@@ -147,23 +144,21 @@ acpi_memory_get_device(acpi_handle handle,
 	 */
 	status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
 	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error in acpi_bus_add\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
 		return_VALUE(-EINVAL);
 	}
 
-end:
+      end:
 	*mem_device = acpi_driver_data(device);
 	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found" );
+		printk(KERN_ERR "\n driver data not found");
 		return_VALUE(-ENODEV);
 	}
 
 	return_VALUE(0);
 }
 
-static int
-acpi_memory_check_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
 {
 	unsigned long current_status;
 
@@ -171,22 +166,21 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
 
 	/* Get device present/absent information from the _STA */
 	if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
-		NULL, &current_status)))
+					       NULL, &current_status)))
 		return_VALUE(-ENODEV);
 	/*
 	 * Check for device status. Device should be
 	 * present/enabled/functioning.
 	 */
 	if (!((current_status & ACPI_MEMORY_STA_PRESENT)
-		&& (current_status & ACPI_MEMORY_STA_ENABLED)
-		&& (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
+	      && (current_status & ACPI_MEMORY_STA_ENABLED)
+	      && (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
 		return_VALUE(-ENODEV);
 
 	return_VALUE(0);
 }
 
-static int
-acpi_memory_enable_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 {
 	int result;
 
@@ -196,7 +190,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 	result = acpi_memory_get_device_resources(mem_device);
 	if (result) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"\nget_device_resources failed\n"));
+				  "\nget_device_resources failed\n"));
 		mem_device->state = MEMORY_INVALID_STATE;
 		return result;
 	}
@@ -206,11 +200,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 	 * Note: Assume that this function returns zero on success
 	 */
 	result = add_memory(mem_device->start_addr,
-			(mem_device->end_addr - mem_device->start_addr) + 1,
-			mem_device->read_write_attribute);
+			    (mem_device->end_addr - mem_device->start_addr) + 1,
+			    mem_device->read_write_attribute);
 	if (result) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"\nadd_memory failed\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
 		mem_device->state = MEMORY_INVALID_STATE;
 		return result;
 	}
@@ -218,11 +211,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 	return result;
 }
 
-static int
-acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
 {
 	acpi_status status;
-	struct acpi_object_list	arg_list;
+	struct acpi_object_list arg_list;
 	union acpi_object arg;
 	unsigned long current_status;
 
@@ -234,16 +226,16 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
 	arg.type = ACPI_TYPE_INTEGER;
 	arg.integer.value = 1;
 	status = acpi_evaluate_object(mem_device->handle,
-			"_EJ0", &arg_list, NULL);
+				      "_EJ0", &arg_list, NULL);
 	/* Return on _EJ0 failure */
 	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"_EJ0 failed.\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n"));
 		return_VALUE(-ENODEV);
 	}
 
 	/* Evalute _STA to check if the device is disabled */
 	status = acpi_evaluate_integer(mem_device->handle, "_STA",
-		NULL, &current_status);
+				       NULL, &current_status);
 	if (ACPI_FAILURE(status))
 		return_VALUE(-ENODEV);
 
@@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
 	return_VALUE(0);
 }
 
-static int
-acpi_memory_disable_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 {
 	int result;
 	u64 start = mem_device->start_addr;
@@ -278,7 +269,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 	result = acpi_memory_powerdown_device(mem_device);
 	if (result) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-					"Device Power Down failed.\n"));
+				  "Device Power Down failed.\n"));
 		/* Set the status of the device to invalid */
 		mem_device->state = MEMORY_INVALID_STATE;
 		return result;
@@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 	return result;
 }
 
-static void
-acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
+static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 {
 	struct acpi_memory_device *mem_device;
 	struct acpi_device *device;
@@ -299,37 +289,37 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 	switch (event) {
 	case ACPI_NOTIFY_BUS_CHECK:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"\nReceived BUS CHECK notification for device\n"));
+				  "\nReceived BUS CHECK notification for device\n"));
 		/* Fall Through */
 	case ACPI_NOTIFY_DEVICE_CHECK:
 		if (event == ACPI_NOTIFY_DEVICE_CHECK)
 			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"\nReceived DEVICE CHECK notification for device\n"));
+					  "\nReceived DEVICE CHECK notification for device\n"));
 		if (acpi_memory_get_device(handle, &mem_device)) {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				"Error in finding driver data\n"));
+					  "Error in finding driver data\n"));
 			return_VOID;
 		}
 
 		if (!acpi_memory_check_device(mem_device)) {
 			if (acpi_memory_enable_device(mem_device))
 				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				"Error in acpi_memory_enable_device\n"));
+						  "Error in acpi_memory_enable_device\n"));
 		}
 		break;
 	case ACPI_NOTIFY_EJECT_REQUEST:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"\nReceived EJECT REQUEST notification for device\n"));
+				  "\nReceived EJECT REQUEST notification for device\n"));
 
 		if (acpi_bus_get_device(handle, &device)) {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-					"Device doesn't exist\n"));
+					  "Device doesn't exist\n"));
 			break;
 		}
 		mem_device = acpi_driver_data(device);
 		if (!mem_device) {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-					"Driver Data is NULL\n"));
+					  "Driver Data is NULL\n"));
 			break;
 		}
 
@@ -337,26 +327,25 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 		 * Currently disabling memory device from kernel mode
 		 * TBD: Can also be disabled from user mode scripts
 		 * TBD: Can also be disabled by Callback registration
-		 * 	with generic sysfs driver
+		 *      with generic sysfs driver
 		 */
 		if (acpi_memory_disable_device(mem_device))
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				"Error in acpi_memory_disable_device\n"));
+					  "Error in acpi_memory_disable_device\n"));
 		/*
 		 * TBD: Invoke acpi_bus_remove to cleanup data structures
 		 */
 		break;
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"Unsupported event [0x%x]\n", event));
+				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 
 	return_VOID;
 }
 
-static int
-acpi_memory_device_add(struct acpi_device *device)
+static int acpi_memory_device_add(struct acpi_device *device)
 {
 	int result;
 	struct acpi_memory_device *mem_device = NULL;
@@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device)
 	return_VALUE(result);
 }
 
-static int
-acpi_memory_device_remove (struct acpi_device *device, int type)
+static int acpi_memory_device_remove(struct acpi_device *device, int type)
 {
 	struct acpi_memory_device *mem_device = NULL;
 
@@ -401,7 +389,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
 	if (!device || !acpi_driver_data(device))
 		return_VALUE(-EINVAL);
 
-	mem_device = (struct acpi_memory_device *) acpi_driver_data(device);
+	mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
 	kfree(mem_device);
 
 	return_VALUE(0);
@@ -410,12 +398,11 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
 /*
  * Helper function to check for memory device
  */
-static acpi_status
-is_memory_device(acpi_handle handle)
+static acpi_status is_memory_device(acpi_handle handle)
 {
 	char *hardware_id;
 	acpi_status status;
-	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	struct acpi_device_info *info;
 
 	ACPI_FUNCTION_TRACE("is_memory_device");
@@ -432,7 +419,7 @@ is_memory_device(acpi_handle handle)
 
 	hardware_id = info->hardware_id.value;
 	if ((hardware_id == NULL) ||
-		(strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
+	    (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
 		status = AE_ERROR;
 
 	acpi_os_free(buffer.pointer);
@@ -440,8 +427,8 @@ is_memory_device(acpi_handle handle)
 }
 
 static acpi_status
-acpi_memory_register_notify_handler (acpi_handle handle,
-	u32 level, void *ctxt, void **retv)
+acpi_memory_register_notify_handler(acpi_handle handle,
+				    u32 level, void *ctxt, void **retv)
 {
 	acpi_status status;
 
@@ -452,10 +439,10 @@ acpi_memory_register_notify_handler (acpi_handle handle,
 		return_ACPI_STATUS(AE_OK);	/* continue */
 
 	status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
-			acpi_memory_device_notify, NULL);
+					     acpi_memory_device_notify, NULL);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error installing notify handler\n"));
+				  "Error installing notify handler\n"));
 		return_ACPI_STATUS(AE_OK);	/* continue */
 	}
 
@@ -463,8 +450,8 @@ acpi_memory_register_notify_handler (acpi_handle handle,
 }
 
 static acpi_status
-acpi_memory_deregister_notify_handler (acpi_handle handle,
-			       u32 level, void *ctxt, void **retv)
+acpi_memory_deregister_notify_handler(acpi_handle handle,
+				      u32 level, void *ctxt, void **retv)
 {
 	acpi_status status;
 
@@ -475,18 +462,18 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
 		return_ACPI_STATUS(AE_OK);	/* continue */
 
 	status = acpi_remove_notify_handler(handle,
-			ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify);
+					    ACPI_SYSTEM_NOTIFY,
+					    acpi_memory_device_notify);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				"Error removing notify handler\n"));
+				  "Error removing notify handler\n"));
 		return_ACPI_STATUS(AE_OK);	/* continue */
 	}
 
 	return_ACPI_STATUS(status);
 }
 
-static int __init
-acpi_memory_device_init (void)
+static int __init acpi_memory_device_init(void)
 {
 	int result;
 	acpi_status status;
@@ -499,21 +486,20 @@ acpi_memory_device_init (void)
 		return_VALUE(-ENODEV);
 
 	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-				ACPI_UINT32_MAX,
-				acpi_memory_register_notify_handler,
-				NULL, NULL);
+				     ACPI_UINT32_MAX,
+				     acpi_memory_register_notify_handler,
+				     NULL, NULL);
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
 		acpi_bus_unregister_driver(&acpi_memory_device_driver);
 		return_VALUE(-ENODEV);
-        }
+	}
 
 	return_VALUE(0);
 }
 
-static void __exit
-acpi_memory_device_exit (void)
+static void __exit acpi_memory_device_exit(void)
 {
 	acpi_status status;
 
@@ -524,12 +510,12 @@ acpi_memory_device_exit (void)
 	 * handles.
 	 */
 	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-			ACPI_UINT32_MAX,
-			acpi_memory_deregister_notify_handler,
-			NULL, NULL);
+				     ACPI_UINT32_MAX,
+				     acpi_memory_deregister_notify_handler,
+				     NULL, NULL);
 
-	if (ACPI_FAILURE (status))
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
+	if (ACPI_FAILURE(status))
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
 
 	acpi_bus_unregister_driver(&acpi_memory_device_driver);
 
@@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
 
 module_init(acpi_memory_device_init);
 module_exit(acpi_memory_device_exit);
-
-

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 312 - 315
drivers/acpi/asus_acpi.c


+ 183 - 217
drivers/acpi/battery.c

@@ -34,7 +34,6 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
 
 #define ACPI_BATTERY_FORMAT_BIF	"NNNNNNNNNSSSS"
@@ -53,87 +52,85 @@
 #define ACPI_BATTERY_UNITS_WATTS	"mW"
 #define ACPI_BATTERY_UNITS_AMPS		"mA"
 
-
 #define _COMPONENT		ACPI_BATTERY_COMPONENT
-ACPI_MODULE_NAME		("acpi_battery")
+ACPI_MODULE_NAME("acpi_battery")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_battery_add (struct acpi_device *device);
-static int acpi_battery_remove (struct acpi_device *device, int type);
+static int acpi_battery_add(struct acpi_device *device);
+static int acpi_battery_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_battery_driver = {
-	.name =		ACPI_BATTERY_DRIVER_NAME,
-	.class =	ACPI_BATTERY_CLASS,
-	.ids =		ACPI_BATTERY_HID,
-	.ops =		{
-				.add =		acpi_battery_add,
-				.remove =	acpi_battery_remove,
-			},
+	.name = ACPI_BATTERY_DRIVER_NAME,
+	.class = ACPI_BATTERY_CLASS,
+	.ids = ACPI_BATTERY_HID,
+	.ops = {
+		.add = acpi_battery_add,
+		.remove = acpi_battery_remove,
+		},
 };
 
 struct acpi_battery_status {
-	acpi_integer		state;
-	acpi_integer		present_rate;
-	acpi_integer		remaining_capacity;
-	acpi_integer		present_voltage;
+	acpi_integer state;
+	acpi_integer present_rate;
+	acpi_integer remaining_capacity;
+	acpi_integer present_voltage;
 };
 
 struct acpi_battery_info {
-	acpi_integer		power_unit;
-	acpi_integer		design_capacity;
-	acpi_integer		last_full_capacity;
-	acpi_integer		battery_technology;
-	acpi_integer		design_voltage;
-	acpi_integer		design_capacity_warning;
-	acpi_integer		design_capacity_low;
-	acpi_integer		battery_capacity_granularity_1;
-	acpi_integer		battery_capacity_granularity_2;
-	acpi_string		model_number;
-	acpi_string		serial_number;
-	acpi_string		battery_type;
-	acpi_string		oem_info;
+	acpi_integer power_unit;
+	acpi_integer design_capacity;
+	acpi_integer last_full_capacity;
+	acpi_integer battery_technology;
+	acpi_integer design_voltage;
+	acpi_integer design_capacity_warning;
+	acpi_integer design_capacity_low;
+	acpi_integer battery_capacity_granularity_1;
+	acpi_integer battery_capacity_granularity_2;
+	acpi_string model_number;
+	acpi_string serial_number;
+	acpi_string battery_type;
+	acpi_string oem_info;
 };
 
 struct acpi_battery_flags {
-	u8			present:1;	/* Bay occupied? */
-	u8			power_unit:1;	/* 0=watts, 1=apms */
-	u8			alarm:1;	/* _BTP present? */
-	u8			reserved:5;
+	u8 present:1;		/* Bay occupied? */
+	u8 power_unit:1;	/* 0=watts, 1=apms */
+	u8 alarm:1;		/* _BTP present? */
+	u8 reserved:5;
 };
 
 struct acpi_battery_trips {
-	unsigned long		warning;
-	unsigned long		low;
+	unsigned long warning;
+	unsigned long low;
 };
 
 struct acpi_battery {
-	acpi_handle		handle;
+	acpi_handle handle;
 	struct acpi_battery_flags flags;
 	struct acpi_battery_trips trips;
-	unsigned long		alarm;
+	unsigned long alarm;
 	struct acpi_battery_info *info;
 };
 
-
 /* --------------------------------------------------------------------------
                                Battery Management
    -------------------------------------------------------------------------- */
 
 static int
-acpi_battery_get_info (
-	struct acpi_battery	*battery,
-	struct acpi_battery_info **bif)
+acpi_battery_get_info(struct acpi_battery *battery,
+		      struct acpi_battery_info **bif)
 {
-	int			result = 0;
-	acpi_status 		status = 0;
-	struct acpi_buffer	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-	struct acpi_buffer	format = {sizeof(ACPI_BATTERY_FORMAT_BIF),
-						ACPI_BATTERY_FORMAT_BIF};
-	struct acpi_buffer	data = {0, NULL};
-	union acpi_object	*package = NULL;
+	int result = 0;
+	acpi_status status = 0;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF),
+		ACPI_BATTERY_FORMAT_BIF
+	};
+	struct acpi_buffer data = { 0, NULL };
+	union acpi_object *package = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_get_info");
 
@@ -148,7 +145,7 @@ acpi_battery_get_info (
 		return_VALUE(-ENODEV);
 	}
 
-	package = (union acpi_object *) buffer.pointer;
+	package = (union acpi_object *)buffer.pointer;
 
 	/* Extract Package Data */
 
@@ -174,27 +171,27 @@ acpi_battery_get_info (
 		goto end;
 	}
 
-end:
+      end:
 	acpi_os_free(buffer.pointer);
 
 	if (!result)
-		(*bif) = (struct acpi_battery_info *) data.pointer;
+		(*bif) = (struct acpi_battery_info *)data.pointer;
 
 	return_VALUE(result);
 }
 
 static int
-acpi_battery_get_status (
-	struct acpi_battery	*battery,
-	struct acpi_battery_status **bst)
+acpi_battery_get_status(struct acpi_battery *battery,
+			struct acpi_battery_status **bst)
 {
-	int			result = 0;
-	acpi_status 		status = 0;
-	struct acpi_buffer	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-	struct acpi_buffer	format = {sizeof(ACPI_BATTERY_FORMAT_BST),
-						ACPI_BATTERY_FORMAT_BST};
-	struct acpi_buffer	data = {0, NULL};
-	union acpi_object	*package = NULL;
+	int result = 0;
+	acpi_status status = 0;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST),
+		ACPI_BATTERY_FORMAT_BST
+	};
+	struct acpi_buffer data = { 0, NULL };
+	union acpi_object *package = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_get_status");
 
@@ -209,7 +206,7 @@ acpi_battery_get_status (
 		return_VALUE(-ENODEV);
 	}
 
-	package = (union acpi_object *) buffer.pointer;
+	package = (union acpi_object *)buffer.pointer;
 
 	/* Extract Package Data */
 
@@ -235,24 +232,21 @@ acpi_battery_get_status (
 		goto end;
 	}
 
-end:
+      end:
 	acpi_os_free(buffer.pointer);
 
 	if (!result)
-		(*bst) = (struct acpi_battery_status *) data.pointer;
+		(*bst) = (struct acpi_battery_status *)data.pointer;
 
 	return_VALUE(result);
 }
 
-
 static int
-acpi_battery_set_alarm (
-	struct acpi_battery	*battery,
-	unsigned long		alarm)
+acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
 {
-	acpi_status		status = 0;
-	union acpi_object	arg0 = {ACPI_TYPE_INTEGER};
-	struct acpi_object_list	arg_list = {1, &arg0};
+	acpi_status status = 0;
+	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list arg_list = { 1, &arg0 };
 
 	ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
 
@@ -275,19 +269,16 @@ acpi_battery_set_alarm (
 	return_VALUE(0);
 }
 
-
-static int
-acpi_battery_check (
-	struct acpi_battery	*battery)
+static int acpi_battery_check(struct acpi_battery *battery)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	acpi_handle		handle = NULL;
-	struct acpi_device	*device = NULL;
+	int result = 0;
+	acpi_status status = AE_OK;
+	acpi_handle handle = NULL;
+	struct acpi_device *device = NULL;
 	struct acpi_battery_info *bif = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_check");
-	
+
 	if (!battery)
 		return_VALUE(-EINVAL);
 
@@ -336,18 +327,17 @@ acpi_battery_check (
 	return_VALUE(result);
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry	*acpi_battery_dir;
+static struct proc_dir_entry *acpi_battery_dir;
 static int acpi_battery_read_info(struct seq_file *seq, void *offset)
 {
-	int			result = 0;
-	struct acpi_battery	*battery = (struct acpi_battery *) seq->private;
+	int result = 0;
+	struct acpi_battery *battery = (struct acpi_battery *)seq->private;
 	struct acpi_battery_info *bif = NULL;
-	char			*units = "?";
+	char *units = "?";
 
 	ACPI_FUNCTION_TRACE("acpi_battery_read_info");
 
@@ -369,19 +359,21 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
 		goto end;
 	}
 
-	units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
-					
+	units =
+	    bif->
+	    power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
+
 	if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
 		seq_printf(seq, "design capacity:         unknown\n");
 	else
 		seq_printf(seq, "design capacity:         %d %sh\n",
-			(u32) bif->design_capacity, units);
+			   (u32) bif->design_capacity, units);
 
 	if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
 		seq_printf(seq, "last full capacity:      unknown\n");
 	else
 		seq_printf(seq, "last full capacity:      %d %sh\n",
-			(u32) bif->last_full_capacity, units);
+			   (u32) bif->last_full_capacity, units);
 
 	switch ((u32) bif->battery_technology) {
 	case 0:
@@ -399,26 +391,22 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
 		seq_printf(seq, "design voltage:          unknown\n");
 	else
 		seq_printf(seq, "design voltage:          %d mV\n",
-			(u32) bif->design_voltage);
-	
+			   (u32) bif->design_voltage);
+
 	seq_printf(seq, "design capacity warning: %d %sh\n",
-		(u32) bif->design_capacity_warning, units);
+		   (u32) bif->design_capacity_warning, units);
 	seq_printf(seq, "design capacity low:     %d %sh\n",
-		(u32) bif->design_capacity_low, units);
+		   (u32) bif->design_capacity_low, units);
 	seq_printf(seq, "capacity granularity 1:  %d %sh\n",
-		(u32) bif->battery_capacity_granularity_1, units);
+		   (u32) bif->battery_capacity_granularity_1, units);
 	seq_printf(seq, "capacity granularity 2:  %d %sh\n",
-		(u32) bif->battery_capacity_granularity_2, units);
-	seq_printf(seq, "model number:            %s\n",
-		bif->model_number);
-	seq_printf(seq, "serial number:           %s\n",
-		bif->serial_number);
-	seq_printf(seq, "battery type:            %s\n",
-		bif->battery_type);
-	seq_printf(seq, "OEM info:                %s\n",
-		bif->oem_info);
-
-end:
+		   (u32) bif->battery_capacity_granularity_2, units);
+	seq_printf(seq, "model number:            %s\n", bif->model_number);
+	seq_printf(seq, "serial number:           %s\n", bif->serial_number);
+	seq_printf(seq, "battery type:            %s\n", bif->battery_type);
+	seq_printf(seq, "OEM info:                %s\n", bif->oem_info);
+
+      end:
 	kfree(bif);
 
 	return_VALUE(0);
@@ -429,14 +417,12 @@ static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
 	return single_open(file, acpi_battery_read_info, PDE(inode)->data);
 }
 
-
-static int
-acpi_battery_read_state (struct seq_file *seq, void *offset)
+static int acpi_battery_read_state(struct seq_file *seq, void *offset)
 {
-	int			result = 0;
-	struct acpi_battery	*battery = (struct acpi_battery *) seq->private;
+	int result = 0;
+	struct acpi_battery *battery = (struct acpi_battery *)seq->private;
 	struct acpi_battery_status *bst = NULL;
-	char			*units = "?";
+	char *units = "?";
 
 	ACPI_FUNCTION_TRACE("acpi_battery_read_state");
 
@@ -452,7 +438,9 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
 
 	/* Battery Units */
 
-	units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
+	units =
+	    battery->flags.
+	    power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
 
 	/* Battery Status (_BST) */
 
@@ -467,12 +455,12 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
 	else
 		seq_printf(seq, "capacity state:          critical\n");
 
-	if ((bst->state & 0x01) && (bst->state & 0x02)){
-		seq_printf(seq, "charging state:          charging/discharging\n");
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Battery Charging and Discharging?\n"));
-	}
-	else if (bst->state & 0x01)
+	if ((bst->state & 0x01) && (bst->state & 0x02)) {
+		seq_printf(seq,
+			   "charging state:          charging/discharging\n");
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Battery Charging and Discharging?\n"));
+	} else if (bst->state & 0x01)
 		seq_printf(seq, "charging state:          discharging\n");
 	else if (bst->state & 0x02)
 		seq_printf(seq, "charging state:          charging\n");
@@ -484,21 +472,21 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
 		seq_printf(seq, "present rate:            unknown\n");
 	else
 		seq_printf(seq, "present rate:            %d %s\n",
-			(u32) bst->present_rate, units);
+			   (u32) bst->present_rate, units);
 
 	if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
 		seq_printf(seq, "remaining capacity:      unknown\n");
 	else
 		seq_printf(seq, "remaining capacity:      %d %sh\n",
-			(u32) bst->remaining_capacity, units);
+			   (u32) bst->remaining_capacity, units);
 
 	if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
 		seq_printf(seq, "present voltage:         unknown\n");
 	else
 		seq_printf(seq, "present voltage:         %d mV\n",
-			(u32) bst->present_voltage);
+			   (u32) bst->present_voltage);
 
-end:
+      end:
 	kfree(bst);
 
 	return_VALUE(0);
@@ -509,12 +497,10 @@ static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
 	return single_open(file, acpi_battery_read_state, PDE(inode)->data);
 }
 
-
-static int
-acpi_battery_read_alarm (struct seq_file *seq, void *offset)
+static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
 {
-	struct acpi_battery	*battery = (struct acpi_battery *) seq->private;
-	char			*units = "?";
+	struct acpi_battery *battery = (struct acpi_battery *)seq->private;
+	char *units = "?";
 
 	ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
 
@@ -527,8 +513,10 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
 	}
 
 	/* Battery Units */
-	
-	units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
+
+	units =
+	    battery->flags.
+	    power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
 
 	/* Battery Alarm */
 
@@ -538,22 +526,19 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
 	else
 		seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
 
-end:
+      end:
 	return_VALUE(0);
 }
 
-
 static ssize_t
-acpi_battery_write_alarm (
-	struct file	*file,
-	const char	__user *buffer,
-	size_t		count,
-	loff_t		*ppos)
+acpi_battery_write_alarm(struct file *file,
+			 const char __user * buffer,
+			 size_t count, loff_t * ppos)
 {
-	int			result = 0;
-	char			alarm_string[12] = {'\0'};
-	struct seq_file		*m = (struct seq_file *)file->private_data;
-	struct acpi_battery	*battery = (struct acpi_battery *)m->private;
+	int result = 0;
+	char alarm_string[12] = { '\0' };
+	struct seq_file *m = (struct seq_file *)file->private_data;
+	struct acpi_battery *battery = (struct acpi_battery *)m->private;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
 
@@ -565,11 +550,11 @@ acpi_battery_write_alarm (
 
 	if (copy_from_user(alarm_string, buffer, count))
 		return_VALUE(-EFAULT);
-	
+
 	alarm_string[count] = '\0';
 
-	result = acpi_battery_set_alarm(battery, 
-		simple_strtoul(alarm_string, NULL, 0));
+	result = acpi_battery_set_alarm(battery,
+					simple_strtoul(alarm_string, NULL, 0));
 	if (result)
 		return_VALUE(result);
 
@@ -582,41 +567,39 @@ static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
 }
 
 static struct file_operations acpi_battery_info_ops = {
-	.open		= acpi_battery_info_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_battery_info_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 	.owner = THIS_MODULE,
 };
 
 static struct file_operations acpi_battery_state_ops = {
-	.open		= acpi_battery_state_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_battery_state_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 	.owner = THIS_MODULE,
 };
 
 static struct file_operations acpi_battery_alarm_ops = {
-	.open		= acpi_battery_alarm_open_fs,
-	.read		= seq_read,
-	.write		= acpi_battery_write_alarm,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_battery_alarm_open_fs,
+	.read = seq_read,
+	.write = acpi_battery_write_alarm,
+	.llseek = seq_lseek,
+	.release = single_release,
 	.owner = THIS_MODULE,
 };
 
-static int
-acpi_battery_add_fs (
-	struct acpi_device	*device)
+static int acpi_battery_add_fs(struct acpi_device *device)
 {
-	struct proc_dir_entry	*entry = NULL;
+	struct proc_dir_entry *entry = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
 
 	if (!acpi_device_dir(device)) {
 		acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-			acpi_battery_dir);
+						     acpi_battery_dir);
 		if (!acpi_device_dir(device))
 			return_VALUE(-ENODEV);
 		acpi_device_dir(device)->owner = THIS_MODULE;
@@ -624,24 +607,24 @@ acpi_battery_add_fs (
 
 	/* 'info' [R] */
 	entry = create_proc_entry(ACPI_BATTERY_FILE_INFO,
-		S_IRUGO, acpi_device_dir(device));
+				  S_IRUGO, acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create '%s' fs entry\n",
-			ACPI_BATTERY_FILE_INFO));
+				  "Unable to create '%s' fs entry\n",
+				  ACPI_BATTERY_FILE_INFO));
 	else {
-		entry->proc_fops = &acpi_battery_info_ops; 
+		entry->proc_fops = &acpi_battery_info_ops;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}
 
 	/* 'status' [R] */
 	entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS,
-		S_IRUGO, acpi_device_dir(device));
+				  S_IRUGO, acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create '%s' fs entry\n",
-			ACPI_BATTERY_FILE_STATUS));
+				  "Unable to create '%s' fs entry\n",
+				  ACPI_BATTERY_FILE_STATUS));
 	else {
 		entry->proc_fops = &acpi_battery_state_ops;
 		entry->data = acpi_driver_data(device);
@@ -650,11 +633,12 @@ acpi_battery_add_fs (
 
 	/* 'alarm' [R/W] */
 	entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM,
-		S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+				  S_IFREG | S_IRUGO | S_IWUSR,
+				  acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create '%s' fs entry\n",
-			ACPI_BATTERY_FILE_ALARM));
+				  "Unable to create '%s' fs entry\n",
+				  ACPI_BATTERY_FILE_ALARM));
 	else {
 		entry->proc_fops = &acpi_battery_alarm_ops;
 		entry->data = acpi_driver_data(device);
@@ -664,10 +648,7 @@ acpi_battery_add_fs (
 	return_VALUE(0);
 }
 
-
-static int
-acpi_battery_remove_fs (
-	struct acpi_device	*device)
+static int acpi_battery_remove_fs(struct acpi_device *device)
 {
 	ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
 
@@ -686,19 +667,14 @@ acpi_battery_remove_fs (
 	return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static void
-acpi_battery_notify (
-	acpi_handle		handle,
-	u32			event,
-	void			*data)
+static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct acpi_battery	*battery = (struct acpi_battery *) data;
-	struct acpi_device	*device = NULL;
+	struct acpi_battery *battery = (struct acpi_battery *)data;
+	struct acpi_device *device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_notify");
 
@@ -716,24 +692,21 @@ acpi_battery_notify (
 		break;
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"Unsupported event [0x%x]\n", event));
+				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 
 	return_VOID;
 }
 
-
-static int
-acpi_battery_add (
-	struct acpi_device	*device)
+static int acpi_battery_add(struct acpi_device *device)
 {
-	int			result = 0;
-	acpi_status		status = 0;
-	struct acpi_battery	*battery = NULL;
+	int result = 0;
+	acpi_status status = 0;
+	struct acpi_battery *battery = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_add");
-	
+
 	if (!device)
 		return_VALUE(-EINVAL);
 
@@ -756,19 +729,20 @@ acpi_battery_add (
 		goto end;
 
 	status = acpi_install_notify_handler(battery->handle,
-		ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery);
+					     ACPI_DEVICE_NOTIFY,
+					     acpi_battery_notify, battery);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error installing notify handler\n"));
+				  "Error installing notify handler\n"));
 		result = -ENODEV;
 		goto end;
 	}
 
 	printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
-		ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
-		device->status.battery_present?"present":"absent");
-		
-end:
+	       ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
+	       device->status.battery_present ? "present" : "absent");
+
+      end:
 	if (result) {
 		acpi_battery_remove_fs(device);
 		kfree(battery);
@@ -777,27 +751,24 @@ end:
 	return_VALUE(result);
 }
 
-
-static int
-acpi_battery_remove (
-	struct acpi_device	*device,
-	int			type)
+static int acpi_battery_remove(struct acpi_device *device, int type)
 {
-	acpi_status		status = 0;
-	struct acpi_battery	*battery = NULL;
+	acpi_status status = 0;
+	struct acpi_battery *battery = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_remove");
 
 	if (!device || !acpi_driver_data(device))
 		return_VALUE(-EINVAL);
 
-	battery = (struct acpi_battery *) acpi_driver_data(device);
+	battery = (struct acpi_battery *)acpi_driver_data(device);
 
 	status = acpi_remove_notify_handler(battery->handle,
-		ACPI_DEVICE_NOTIFY, acpi_battery_notify);
+					    ACPI_DEVICE_NOTIFY,
+					    acpi_battery_notify);
 	if (ACPI_FAILURE(status))
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error removing notify handler\n"));
+				  "Error removing notify handler\n"));
 
 	acpi_battery_remove_fs(device);
 
@@ -806,11 +777,9 @@ acpi_battery_remove (
 	return_VALUE(0);
 }
 
-
-static int __init
-acpi_battery_init (void)
+static int __init acpi_battery_init(void)
 {
-	int			result = 0;
+	int result = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_battery_init");
 
@@ -828,9 +797,7 @@ acpi_battery_init (void)
 	return_VALUE(0);
 }
 
-
-static void __exit
-acpi_battery_exit (void)
+static void __exit acpi_battery_exit(void)
 {
 	ACPI_FUNCTION_TRACE("acpi_battery_exit");
 
@@ -841,6 +808,5 @@ acpi_battery_exit (void)
 	return_VOID;
 }
 
-
 module_init(acpi_battery_init);
 module_exit(acpi_battery_exit);

+ 66 - 56
drivers/acpi/blacklist.c

@@ -26,7 +26,6 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -34,49 +33,49 @@
 #include <acpi/acpi_bus.h>
 #include <linux/dmi.h>
 
-enum acpi_blacklist_predicates
-{
-        all_versions,
-        less_than_or_equal,
-        equal,
-        greater_than_or_equal,
+enum acpi_blacklist_predicates {
+	all_versions,
+	less_than_or_equal,
+	equal,
+	greater_than_or_equal,
 };
 
-struct acpi_blacklist_item
-{
-        char            oem_id[7];
-        char            oem_table_id[9];
-        u32             oem_revision;
-        acpi_table_type table;
-        enum acpi_blacklist_predicates oem_revision_predicate;
-        char            *reason;
-        u32             is_critical_error;
+struct acpi_blacklist_item {
+	char oem_id[7];
+	char oem_table_id[9];
+	u32 oem_revision;
+	acpi_table_type table;
+	enum acpi_blacklist_predicates oem_revision_predicate;
+	char *reason;
+	u32 is_critical_error;
 };
 
 /*
  * POLICY: If *anything* doesn't work, put it on the blacklist.
  *	   If they are critical errors, mark it critical, and abort driver load.
  */
-static struct acpi_blacklist_item acpi_blacklist[] __initdata =
-{
+static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
 	/* Compaq Presario 1700 */
-	{"PTLTD ", "  DSDT  ", 0x06040000, ACPI_DSDT, less_than_or_equal, "Multiple problems", 1},
+	{"PTLTD ", "  DSDT  ", 0x06040000, ACPI_DSDT, less_than_or_equal,
+	 "Multiple problems", 1},
 	/* Sony FX120, FX140, FX150? */
-	{"SONY  ", "U0      ", 0x20010313, ACPI_DSDT, less_than_or_equal, "ACPI driver problem", 1},
+	{"SONY  ", "U0      ", 0x20010313, ACPI_DSDT, less_than_or_equal,
+	 "ACPI driver problem", 1},
 	/* Compaq Presario 800, Insyde BIOS */
-	{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1},
+	{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal,
+	 "Does not use _REG to protect EC OpRegions", 1},
 	/* IBM 600E - _ADR should return 7, but it returns 1 */
-	{"IBM   ", "TP600E  ", 0x00000105, ACPI_DSDT, less_than_or_equal, "Incorrect _ADR", 1},
-	{"ASUS\0\0", "P2B-S   ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
+	{"IBM   ", "TP600E  ", 0x00000105, ACPI_DSDT, less_than_or_equal,
+	 "Incorrect _ADR", 1},
+	{"ASUS\0\0", "P2B-S   ", 0, ACPI_DSDT, all_versions,
+	 "Bogus PCI routing", 1},
 
 	{""}
 };
 
-
 #if	CONFIG_ACPI_BLACKLIST_YEAR
 
-static int __init
-blacklist_by_year(void)
+static int __init blacklist_by_year(void)
 {
 	int year;
 	char *s = dmi_get_system_info(DMI_BIOS_DATE);
@@ -92,36 +91,38 @@ blacklist_by_year(void)
 
 	s += 1;
 
-	year = simple_strtoul(s,NULL,0); 
+	year = simple_strtoul(s, NULL, 0);
 
-	if (year < 100) {		/* 2-digit year */
+	if (year < 100) {	/* 2-digit year */
 		year += 1900;
 		if (year < 1996)	/* no dates < spec 1.0 */
 			year += 100;
 	}
 
 	if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
-		printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " 
-			"acpi=force is required to enable ACPI\n",
-			year, CONFIG_ACPI_BLACKLIST_YEAR);
+		printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
+		       "acpi=force is required to enable ACPI\n",
+		       year, CONFIG_ACPI_BLACKLIST_YEAR);
 		return 1;
 	}
 	return 0;
 }
 #else
-static inline int blacklist_by_year(void) { return 0; }
+static inline int blacklist_by_year(void)
+{
+	return 0;
+}
 #endif
 
-int __init
-acpi_blacklisted(void)
+int __init acpi_blacklisted(void)
 {
 	int i = 0;
 	int blacklisted = 0;
 	struct acpi_table_header *table_header;
 
-	while (acpi_blacklist[i].oem_id[0] != '\0')
-	{
-		if (acpi_get_table_header_early(acpi_blacklist[i].table, &table_header)) {
+	while (acpi_blacklist[i].oem_id[0] != '\0') {
+		if (acpi_get_table_header_early
+		    (acpi_blacklist[i].table, &table_header)) {
 			i++;
 			continue;
 		}
@@ -131,33 +132,43 @@ acpi_blacklisted(void)
 			continue;
 		}
 
-		if (strncmp(acpi_blacklist[i].oem_table_id, table_header->oem_table_id, 8)) {
+		if (strncmp
+		    (acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
+		     8)) {
 			i++;
 			continue;
 		}
 
 		if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
-		    || (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
-		        && table_header->oem_revision <= acpi_blacklist[i].oem_revision)
-		    || (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
-		        && table_header->oem_revision >= acpi_blacklist[i].oem_revision)
+		    || (acpi_blacklist[i].oem_revision_predicate ==
+			less_than_or_equal
+			&& table_header->oem_revision <=
+			acpi_blacklist[i].oem_revision)
+		    || (acpi_blacklist[i].oem_revision_predicate ==
+			greater_than_or_equal
+			&& table_header->oem_revision >=
+			acpi_blacklist[i].oem_revision)
 		    || (acpi_blacklist[i].oem_revision_predicate == equal
-		        && table_header->oem_revision == acpi_blacklist[i].oem_revision)) {
-
-			printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
-				"Revision 0x%x has a known ACPI BIOS problem.\n",
-				acpi_blacklist[i].oem_id,
-				acpi_blacklist[i].oem_table_id,
-				acpi_blacklist[i].oem_revision);
-
-			printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n",
-				acpi_blacklist[i].reason,
-				(acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
+			&& table_header->oem_revision ==
+			acpi_blacklist[i].oem_revision)) {
+
+			printk(KERN_ERR PREFIX
+			       "Vendor \"%6.6s\" System \"%8.8s\" "
+			       "Revision 0x%x has a known ACPI BIOS problem.\n",
+			       acpi_blacklist[i].oem_id,
+			       acpi_blacklist[i].oem_table_id,
+			       acpi_blacklist[i].oem_revision);
+
+			printk(KERN_ERR PREFIX
+			       "Reason: %s. This is a %s error\n",
+			       acpi_blacklist[i].reason,
+			       (acpi_blacklist[i].
+				is_critical_error ? "non-recoverable" :
+				"recoverable"));
 
 			blacklisted = acpi_blacklist[i].is_critical_error;
 			break;
-		}
-		else {
+		} else {
 			i++;
 		}
 	}
@@ -166,4 +177,3 @@ acpi_blacklisted(void)
 
 	return blacklisted;
 }
-

+ 151 - 159
drivers/acpi/bus.c

@@ -36,19 +36,17 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT		ACPI_BUS_COMPONENT
-ACPI_MODULE_NAME		("acpi_bus")
-
+ACPI_MODULE_NAME("acpi_bus")
 #ifdef	CONFIG_X86
 extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
 #endif
 
-FADT_DESCRIPTOR			acpi_fadt;
+FADT_DESCRIPTOR acpi_fadt;
 EXPORT_SYMBOL(acpi_fadt);
 
-struct acpi_device		*acpi_root;
-struct proc_dir_entry		*acpi_root_dir;
+struct acpi_device *acpi_root;
+struct proc_dir_entry *acpi_root_dir;
 EXPORT_SYMBOL(acpi_root_dir);
 
 #define STRUCT_TO_INT(s)	(*((int*)&s))
@@ -57,12 +55,9 @@ EXPORT_SYMBOL(acpi_root_dir);
                                 Device Management
    -------------------------------------------------------------------------- */
 
-int
-acpi_bus_get_device (
-	acpi_handle		handle,
-	struct acpi_device	**device)
+int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
 {
-	acpi_status		status = AE_OK;
+	acpi_status status = AE_OK;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_get_device");
 
@@ -71,24 +66,23 @@ acpi_bus_get_device (
 
 	/* TBD: Support fixed-feature devices */
 
-	status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device);
+	status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
 	if (ACPI_FAILURE(status) || !*device) {
 		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n",
-			handle));
+				  handle));
 		return_VALUE(-ENODEV);
 	}
 
 	return_VALUE(0);
 }
+
 EXPORT_SYMBOL(acpi_bus_get_device);
 
-int
-acpi_bus_get_status (
-	struct acpi_device	*device)
+int acpi_bus_get_status(struct acpi_device *device)
 {
-	acpi_status		status = AE_OK;
-	unsigned long		sta = 0;
-	
+	acpi_status status = AE_OK;
+	unsigned long sta = 0;
+
 	ACPI_FUNCTION_TRACE("acpi_bus_get_status");
 
 	if (!device)
@@ -98,10 +92,11 @@ acpi_bus_get_status (
 	 * Evaluate _STA if present.
 	 */
 	if (device->flags.dynamic_status) {
-		status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
+		status =
+		    acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
 		if (ACPI_FAILURE(status))
 			return_VALUE(-ENODEV);
-		STRUCT_TO_INT(device->status) = (int) sta;
+		STRUCT_TO_INT(device->status) = (int)sta;
 	}
 
 	/*
@@ -115,33 +110,30 @@ acpi_bus_get_status (
 
 	if (device->status.functional && !device->status.present) {
 		printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
-			"functional but not present; setting present\n",
-			device->pnp.bus_id,
-			(u32) STRUCT_TO_INT(device->status));
+		       "functional but not present; setting present\n",
+		       device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
 		device->status.present = 1;
 	}
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 
-		device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
+			  device->pnp.bus_id,
+			  (u32) STRUCT_TO_INT(device->status)));
 
 	return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_bus_get_status);
 
+EXPORT_SYMBOL(acpi_bus_get_status);
 
 /* --------------------------------------------------------------------------
                                  Power Management
    -------------------------------------------------------------------------- */
 
-int
-acpi_bus_get_power (
-	acpi_handle		handle,
-	int			*state)
+int acpi_bus_get_power(acpi_handle handle, int *state)
 {
-	int			result = 0;
-	acpi_status             status = 0;
-	struct acpi_device	*device = NULL;
-	unsigned long		psc = 0;
+	int result = 0;
+	acpi_status status = 0;
+	struct acpi_device *device = NULL;
+	unsigned long psc = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_get_power");
 
@@ -157,20 +149,18 @@ acpi_bus_get_power (
 			*state = device->parent->power.state;
 		else
 			*state = ACPI_STATE_D0;
-	}
-	else {
+	} else {
 		/*
 		 * Get the device's power state either directly (via _PSC) or 
 		 * indirectly (via power resources).
 		 */
 		if (device->power.flags.explicit_get) {
-			status = acpi_evaluate_integer(device->handle, "_PSC", 
-				NULL, &psc);
+			status = acpi_evaluate_integer(device->handle, "_PSC",
+						       NULL, &psc);
 			if (ACPI_FAILURE(status))
 				return_VALUE(-ENODEV);
-			device->power.state = (int) psc;
-		}
-		else if (device->power.flags.power_resources) {
+			device->power.state = (int)psc;
+		} else if (device->power.flags.power_resources) {
 			result = acpi_power_get_inferred_state(device);
 			if (result)
 				return_VALUE(result);
@@ -180,22 +170,19 @@ acpi_bus_get_power (
 	}
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
-		device->pnp.bus_id, device->power.state));
+			  device->pnp.bus_id, device->power.state));
 
 	return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_bus_get_power);
 
+EXPORT_SYMBOL(acpi_bus_get_power);
 
-int
-acpi_bus_set_power (
-	acpi_handle		handle,
-	int			state)
+int acpi_bus_set_power(acpi_handle handle, int state)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	struct acpi_device	*device = NULL;
-	char			object_name[5] = {'_','P','S','0'+state,'\0'};
+	int result = 0;
+	acpi_status status = AE_OK;
+	struct acpi_device *device = NULL;
+	char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
 
 	ACPI_FUNCTION_TRACE("acpi_bus_set_power");
 
@@ -209,7 +196,8 @@ acpi_bus_set_power (
 	/* Make sure this is a valid target state */
 
 	if (!device->flags.power_manageable) {
-		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "Device is not power manageable\n"));
 		return_VALUE(-ENODEV);
 	}
 	/*
@@ -219,15 +207,18 @@ acpi_bus_set_power (
 	if (device->power.state == ACPI_STATE_UNKNOWN)
 		acpi_bus_get_power(device->handle, &device->power.state);
 	if (state == device->power.state) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
+				  state));
 		return_VALUE(0);
 	}
 	if (!device->power.states[state].flags.valid) {
-		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state));
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n",
+				  state));
 		return_VALUE(-ENODEV);
 	}
 	if (device->parent && (state < device->parent->power.state)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "Cannot set device to a higher-powered state than parent\n"));
 		return_VALUE(-ENODEV);
 	}
 
@@ -245,18 +236,17 @@ acpi_bus_set_power (
 				goto end;
 		}
 		if (device->power.states[state].flags.explicit_set) {
-			status = acpi_evaluate_object(device->handle, 
-				object_name, NULL, NULL);
+			status = acpi_evaluate_object(device->handle,
+						      object_name, NULL, NULL);
 			if (ACPI_FAILURE(status)) {
 				result = -ENODEV;
 				goto end;
 			}
 		}
-	}
-	else {
+	} else {
 		if (device->power.states[state].flags.explicit_set) {
-			status = acpi_evaluate_object(device->handle, 
-				object_name, NULL, NULL);
+			status = acpi_evaluate_object(device->handle,
+						      object_name, NULL, NULL);
 			if (ACPI_FAILURE(status)) {
 				result = -ENODEV;
 				goto end;
@@ -269,19 +259,20 @@ acpi_bus_set_power (
 		}
 	}
 
-end:
+      end:
 	if (result)
-		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
-			device->pnp.bus_id, state));
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "Error transitioning device [%s] to D%d\n",
+				  device->pnp.bus_id, state));
 	else
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n",
-			device->pnp.bus_id, state));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Device [%s] transitioned to D%d\n",
+				  device->pnp.bus_id, state));
 
 	return_VALUE(result);
 }
-EXPORT_SYMBOL(acpi_bus_set_power);
-
 
+EXPORT_SYMBOL(acpi_bus_set_power);
 
 /* --------------------------------------------------------------------------
                                 Event Management
@@ -292,16 +283,12 @@ static DEFINE_SPINLOCK(acpi_bus_event_lock);
 LIST_HEAD(acpi_bus_event_list);
 DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
 
-extern int			event_is_open;
+extern int event_is_open;
 
-int
-acpi_bus_generate_event (
-	struct acpi_device	*device,
-	u8			type,
-	int			data)
+int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
 {
-	struct acpi_bus_event	*event = NULL;
-	unsigned long		flags = 0;
+	struct acpi_bus_event *event = NULL;
+	unsigned long flags = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
 
@@ -329,14 +316,13 @@ acpi_bus_generate_event (
 
 	return_VALUE(0);
 }
+
 EXPORT_SYMBOL(acpi_bus_generate_event);
 
-int
-acpi_bus_receive_event (
-	struct acpi_bus_event	*event)
+int acpi_bus_receive_event(struct acpi_bus_event *event)
 {
-	unsigned long		flags = 0;
-	struct acpi_bus_event	*entry = NULL;
+	unsigned long flags = 0;
+	struct acpi_bus_event *entry = NULL;
 
 	DECLARE_WAITQUEUE(wait, current);
 
@@ -361,7 +347,8 @@ acpi_bus_receive_event (
 	}
 
 	spin_lock_irqsave(&acpi_bus_event_lock, flags);
-	entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
+	entry =
+	    list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
 	if (entry)
 		list_del(&entry->node);
 	spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
@@ -375,19 +362,17 @@ acpi_bus_receive_event (
 
 	return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_bus_receive_event);
 
+EXPORT_SYMBOL(acpi_bus_receive_event);
 
 /* --------------------------------------------------------------------------
                              Notification Handling
    -------------------------------------------------------------------------- */
 
 static int
-acpi_bus_check_device (
-	struct acpi_device	*device,
-	int			*status_changed)
+acpi_bus_check_device(struct acpi_device *device, int *status_changed)
 {
-	acpi_status             status = 0;
+	acpi_status status = 0;
 	struct acpi_device_status old_status;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_check_device");
@@ -422,15 +407,14 @@ acpi_bus_check_device (
 
 	if (status_changed)
 		*status_changed = 1;
-	
+
 	/*
 	 * Device Insertion/Removal
 	 */
 	if ((device->status.present) && !(old_status.present)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
 		/* TBD: Handle device insertion */
-	}
-	else if (!(device->status.present) && (old_status.present)) {
+	} else if (!(device->status.present) && (old_status.present)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
 		/* TBD: Handle device removal */
 	}
@@ -438,13 +422,10 @@ acpi_bus_check_device (
 	return_VALUE(0);
 }
 
-
-static int
-acpi_bus_check_scope (
-	struct acpi_device	*device)
+static int acpi_bus_check_scope(struct acpi_device *device)
 {
-	int			result = 0;
-	int			status_changed = 0;
+	int result = 0;
+	int status_changed = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
 
@@ -467,20 +448,15 @@ acpi_bus_check_scope (
 	return_VALUE(0);
 }
 
-
 /**
  * acpi_bus_notify
  * ---------------
  * Callback for all 'system-level' device notifications (values 0x00-0x7F).
  */
-static void 
-acpi_bus_notify (
-	acpi_handle             handle,
-	u32                     type,
-	void                    *data)
+static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
 {
-	int			result = 0;
-	struct acpi_device	*device = NULL;
+	int result = 0;
+	struct acpi_device *device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_notify");
 
@@ -490,64 +466,73 @@ acpi_bus_notify (
 	switch (type) {
 
 	case ACPI_NOTIFY_BUS_CHECK:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received BUS CHECK notification for device [%s]\n",
+				  device->pnp.bus_id));
 		result = acpi_bus_check_scope(device);
 		/* 
 		 * TBD: We'll need to outsource certain events to non-ACPI
-		 *	drivers via the device manager (device.c).
+		 *      drivers via the device manager (device.c).
 		 */
 		break;
 
 	case ACPI_NOTIFY_DEVICE_CHECK:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received DEVICE CHECK notification for device [%s]\n",
+				  device->pnp.bus_id));
 		result = acpi_bus_check_device(device, NULL);
 		/* 
 		 * TBD: We'll need to outsource certain events to non-ACPI
-		 *	drivers via the device manager (device.c).
+		 *      drivers via the device manager (device.c).
 		 */
 		break;
 
 	case ACPI_NOTIFY_DEVICE_WAKE:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received DEVICE WAKE notification for device [%s]\n",
+				  device->pnp.bus_id));
 		/* TBD */
 		break;
 
 	case ACPI_NOTIFY_EJECT_REQUEST:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received EJECT REQUEST notification for device [%s]\n",
+				  device->pnp.bus_id));
 		/* TBD */
 		break;
 
 	case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received DEVICE CHECK LIGHT notification for device [%s]\n",
+				  device->pnp.bus_id));
 		/* TBD: Exactly what does 'light' mean? */
 		break;
 
 	case ACPI_NOTIFY_FREQUENCY_MISMATCH:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received FREQUENCY MISMATCH notification for device [%s]\n",
+				  device->pnp.bus_id));
 		/* TBD */
 		break;
 
 	case ACPI_NOTIFY_BUS_MODE_MISMATCH:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received BUS MODE MISMATCH notification for device [%s]\n",
+				  device->pnp.bus_id));
 		/* TBD */
 		break;
 
 	case ACPI_NOTIFY_POWER_FAULT:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n", 
-			device->pnp.bus_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received POWER FAULT notification for device [%s]\n",
+				  device->pnp.bus_id));
 		/* TBD */
 		break;
 
 	default:
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n", 
-			type));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Received unknown/unsupported notification [%08x]\n",
+				  type));
 		break;
 	}
 
@@ -558,13 +543,12 @@ acpi_bus_notify (
                              Initialization/Cleanup
    -------------------------------------------------------------------------- */
 
-static int __init
-acpi_bus_init_irq (void)
+static int __init acpi_bus_init_irq(void)
 {
-	acpi_status		status = AE_OK;
-	union acpi_object	arg = {ACPI_TYPE_INTEGER};
-	struct acpi_object_list	arg_list = {1, &arg};
-	char			*message = NULL;
+	acpi_status status = AE_OK;
+	union acpi_object arg = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list arg_list = { 1, &arg };
+	char *message = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
 
@@ -601,12 +585,10 @@ acpi_bus_init_irq (void)
 	return_VALUE(0);
 }
 
-
-void __init
-acpi_early_init (void)
+void __init acpi_early_init(void)
 {
-	acpi_status		status = AE_OK;
-	struct acpi_buffer	buffer = {sizeof(acpi_fadt), &acpi_fadt};
+	acpi_status status = AE_OK;
+	struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
 
 	ACPI_FUNCTION_TRACE("acpi_early_init");
 
@@ -619,13 +601,15 @@ acpi_early_init (void)
 
 	status = acpi_initialize_subsystem();
 	if (ACPI_FAILURE(status)) {
-		printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
+		printk(KERN_ERR PREFIX
+		       "Unable to initialize the ACPI Interpreter\n");
 		goto error0;
 	}
 
 	status = acpi_load_tables();
 	if (ACPI_FAILURE(status)) {
-		printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
+		printk(KERN_ERR PREFIX
+		       "Unable to load the System Description Tables\n");
 		goto error0;
 	}
 
@@ -637,7 +621,6 @@ acpi_early_init (void)
 		printk(KERN_ERR PREFIX "Unable to get the FADT\n");
 		goto error0;
 	}
-
 #ifdef CONFIG_X86
 	if (!acpi_ioapic) {
 		extern acpi_interrupt_flags acpi_sci_flags;
@@ -647,7 +630,8 @@ acpi_early_init (void)
 			acpi_sci_flags.trigger = 3;
 
 		/* Set PIC-mode SCI trigger type */
-		acpi_pic_sci_set_trigger(acpi_fadt.sci_int, acpi_sci_flags.trigger);
+		acpi_pic_sci_set_trigger(acpi_fadt.sci_int,
+					 acpi_sci_flags.trigger);
 	} else {
 		extern int acpi_sci_override_gsi;
 		/*
@@ -658,7 +642,10 @@ acpi_early_init (void)
 	}
 #endif
 
-	status = acpi_enable_subsystem(~(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE));
+	status =
+	    acpi_enable_subsystem(~
+				  (ACPI_NO_HARDWARE_INIT |
+				   ACPI_NO_ACPI_ENABLE));
 	if (ACPI_FAILURE(status)) {
 		printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
 		goto error0;
@@ -666,30 +653,32 @@ acpi_early_init (void)
 
 	return_VOID;
 
-error0:
+      error0:
 	disable_acpi();
 	return_VOID;
 }
 
-static int __init
-acpi_bus_init (void)
+static int __init acpi_bus_init(void)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	extern acpi_status	acpi_os_initialize1(void);
+	int result = 0;
+	acpi_status status = AE_OK;
+	extern acpi_status acpi_os_initialize1(void);
 
 	ACPI_FUNCTION_TRACE("acpi_bus_init");
 
 	status = acpi_os_initialize1();
 
-	status = acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
+	status =
+	    acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
 	if (ACPI_FAILURE(status)) {
-		printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
+		printk(KERN_ERR PREFIX
+		       "Unable to start the ACPI Interpreter\n");
 		goto error1;
 	}
 
 	if (ACPI_FAILURE(status)) {
-		printk(KERN_ERR PREFIX "Unable to initialize ACPI OS objects\n");
+		printk(KERN_ERR PREFIX
+		       "Unable to initialize ACPI OS objects\n");
 		goto error1;
 	}
 #ifdef CONFIG_ACPI_EC
@@ -723,9 +712,12 @@ acpi_bus_init (void)
 	/*
 	 * Register the for all standard device notifications.
 	 */
-	status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
+	status =
+	    acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
+					&acpi_bus_notify, NULL);
 	if (ACPI_FAILURE(status)) {
-		printk(KERN_ERR PREFIX "Unable to register for device notifications\n");
+		printk(KERN_ERR PREFIX
+		       "Unable to register for device notifications\n");
 		goto error1;
 	}
 
@@ -737,21 +729,20 @@ acpi_bus_init (void)
 	return_VALUE(0);
 
 	/* Mimic structured exception handling */
-error1:
+      error1:
 	acpi_terminate();
 	return_VALUE(-ENODEV);
 }
 
-decl_subsys(acpi,NULL,NULL);
+decl_subsys(acpi, NULL, NULL);
 
-static int __init acpi_init (void)
+static int __init acpi_init(void)
 {
-	int			result = 0;
+	int result = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_init");
 
-	printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
-		ACPI_CA_VERSION);
+	printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
 
 	if (acpi_disabled) {
 		printk(KERN_INFO PREFIX "Interpreter disabled.\n");
@@ -767,7 +758,8 @@ static int __init acpi_init (void)
 		if (!PM_IS_ACTIVE())
 			pm_active = 1;
 		else {
-			printk(KERN_INFO PREFIX "APM is already active, exiting\n");
+			printk(KERN_INFO PREFIX
+			       "APM is already active, exiting\n");
 			disable_acpi();
 			result = -ENODEV;
 		}

+ 123 - 151
drivers/acpi/button.c

@@ -32,7 +32,6 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_BUTTON_COMPONENT		0x00080000
 #define ACPI_BUTTON_DRIVER_NAME		"ACPI Button Driver"
 #define ACPI_BUTTON_CLASS		"button"
@@ -42,7 +41,7 @@
 #define ACPI_BUTTON_NOTIFY_STATUS	0x80
 
 #define ACPI_BUTTON_SUBCLASS_POWER	"power"
-#define ACPI_BUTTON_HID_POWER		"PNP0C0C"	
+#define ACPI_BUTTON_HID_POWER		"PNP0C0C"
 #define ACPI_BUTTON_DEVICE_NAME_POWER	"Power Button (CM)"
 #define ACPI_BUTTON_DEVICE_NAME_POWERF	"Power Button (FF)"
 #define ACPI_BUTTON_TYPE_POWER		0x01
@@ -61,65 +60,65 @@
 #define ACPI_BUTTON_TYPE_LID		0x05
 
 #define _COMPONENT		ACPI_BUTTON_COMPONENT
-ACPI_MODULE_NAME		("acpi_button")
+ACPI_MODULE_NAME("acpi_button")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-
-static int acpi_button_add (struct acpi_device *device);
-static int acpi_button_remove (struct acpi_device *device, int type);
+static int acpi_button_add(struct acpi_device *device);
+static int acpi_button_remove(struct acpi_device *device, int type);
 static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
 static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
 
 static struct acpi_driver acpi_button_driver = {
-	.name =		ACPI_BUTTON_DRIVER_NAME,
-	.class =	ACPI_BUTTON_CLASS,
-	.ids =		"ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
-	.ops =		{
-				.add =		acpi_button_add,
-				.remove =	acpi_button_remove,
-			},
+	.name = ACPI_BUTTON_DRIVER_NAME,
+	.class = ACPI_BUTTON_CLASS,
+	.ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
+	.ops = {
+		.add = acpi_button_add,
+		.remove = acpi_button_remove,
+		},
 };
 
 struct acpi_button {
-	acpi_handle		handle;
-	struct acpi_device	*device;	/* Fixed button kludge */
-	u8			type;
-	unsigned long		pushed;
+	acpi_handle handle;
+	struct acpi_device *device;	/* Fixed button kludge */
+	u8 type;
+	unsigned long pushed;
 };
 
 static struct file_operations acpi_button_info_fops = {
-	.open		= acpi_button_info_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_button_info_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
 static struct file_operations acpi_button_state_fops = {
-	.open		= acpi_button_state_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_button_state_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
+
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry	*acpi_button_dir;
+static struct proc_dir_entry *acpi_button_dir;
 
 static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_button	*button = (struct acpi_button *) seq->private;
+	struct acpi_button *button = (struct acpi_button *)seq->private;
 
 	ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
 
 	if (!button || !button->device)
 		return_VALUE(0);
 
-	seq_printf(seq, "type:                    %s\n", 
-		acpi_device_name(button->device));
+	seq_printf(seq, "type:                    %s\n",
+		   acpi_device_name(button->device));
 
 	return_VALUE(0);
 }
@@ -128,24 +127,24 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_button_info_seq_show, PDE(inode)->data);
 }
-	
+
 static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_button	*button = (struct acpi_button *) seq->private;
-	acpi_status		status;
-	unsigned long		state;
+	struct acpi_button *button = (struct acpi_button *)seq->private;
+	acpi_status status;
+	unsigned long state;
 
 	ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
 
 	if (!button || !button->device)
 		return_VALUE(0);
 
-	status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
+	status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
 	if (ACPI_FAILURE(status)) {
 		seq_printf(seq, "state:      unsupported\n");
-	}
-	else{
-		seq_printf(seq, "state:      %s\n", (state ? "open" : "closed")); 
+	} else {
+		seq_printf(seq, "state:      %s\n",
+			   (state ? "open" : "closed"));
 	}
 
 	return_VALUE(0);
@@ -160,12 +159,10 @@ static struct proc_dir_entry *acpi_power_dir;
 static struct proc_dir_entry *acpi_sleep_dir;
 static struct proc_dir_entry *acpi_lid_dir;
 
-static int
-acpi_button_add_fs (
-	struct acpi_device	*device)
+static int acpi_button_add_fs(struct acpi_device *device)
 {
-	struct proc_dir_entry	*entry = NULL;
-	struct acpi_button	*button = NULL;
+	struct proc_dir_entry *entry = NULL;
+	struct acpi_button *button = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_button_add_fs");
 
@@ -178,21 +175,21 @@ acpi_button_add_fs (
 	case ACPI_BUTTON_TYPE_POWER:
 	case ACPI_BUTTON_TYPE_POWERF:
 		if (!acpi_power_dir)
-			acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, 
-				acpi_button_dir);
+			acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
+						    acpi_button_dir);
 		entry = acpi_power_dir;
 		break;
 	case ACPI_BUTTON_TYPE_SLEEP:
 	case ACPI_BUTTON_TYPE_SLEEPF:
 		if (!acpi_sleep_dir)
-			acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, 
-				acpi_button_dir);
+			acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
+						    acpi_button_dir);
 		entry = acpi_sleep_dir;
 		break;
 	case ACPI_BUTTON_TYPE_LID:
 		if (!acpi_lid_dir)
-			acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, 
-				acpi_button_dir);
+			acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
+						  acpi_button_dir);
 		entry = acpi_lid_dir;
 		break;
 	}
@@ -208,11 +205,11 @@ acpi_button_add_fs (
 
 	/* 'info' [R] */
 	entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
-		S_IRUGO, acpi_device_dir(device));
+				  S_IRUGO, acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create '%s' fs entry\n",
-			ACPI_BUTTON_FILE_INFO));
+				  "Unable to create '%s' fs entry\n",
+				  ACPI_BUTTON_FILE_INFO));
 	else {
 		entry->proc_fops = &acpi_button_info_fops;
 		entry->data = acpi_driver_data(device);
@@ -222,11 +219,11 @@ acpi_button_add_fs (
 	/* show lid state [R] */
 	if (button->type == ACPI_BUTTON_TYPE_LID) {
 		entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
-			S_IRUGO, acpi_device_dir(device));
+					  S_IRUGO, acpi_device_dir(device));
 		if (!entry)
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				"Unable to create '%s' fs entry\n",
-				ACPI_BUTTON_FILE_INFO));
+					  "Unable to create '%s' fs entry\n",
+					  ACPI_BUTTON_FILE_INFO));
 		else {
 			entry->proc_fops = &acpi_button_state_fops;
 			entry->data = acpi_driver_data(device);
@@ -237,12 +234,9 @@ acpi_button_add_fs (
 	return_VALUE(0);
 }
 
-
-static int
-acpi_button_remove_fs (
-	struct acpi_device	*device)
+static int acpi_button_remove_fs(struct acpi_device *device)
 {
-	struct acpi_button	*button = NULL;
+	struct acpi_button *button = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
 
@@ -250,30 +244,25 @@ acpi_button_remove_fs (
 	if (acpi_device_dir(device)) {
 		if (button->type == ACPI_BUTTON_TYPE_LID)
 			remove_proc_entry(ACPI_BUTTON_FILE_STATE,
-					     acpi_device_dir(device));
+					  acpi_device_dir(device));
 		remove_proc_entry(ACPI_BUTTON_FILE_INFO,
-				     acpi_device_dir(device));
+				  acpi_device_dir(device));
 
 		remove_proc_entry(acpi_device_bid(device),
-				     acpi_device_dir(device)->parent);
+				  acpi_device_dir(device)->parent);
 		acpi_device_dir(device) = NULL;
 	}
 
 	return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                 Driver Interface
    -------------------------------------------------------------------------- */
 
-static void
-acpi_button_notify (
-	acpi_handle		handle,
-	u32			event,
-	void			*data)
+static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct acpi_button	*button = (struct acpi_button *) data;
+	struct acpi_button *button = (struct acpi_button *)data;
 
 	ACPI_FUNCTION_TRACE("acpi_button_notify");
 
@@ -282,24 +271,22 @@ acpi_button_notify (
 
 	switch (event) {
 	case ACPI_BUTTON_NOTIFY_STATUS:
-		acpi_bus_generate_event(button->device, event, ++button->pushed);
+		acpi_bus_generate_event(button->device, event,
+					++button->pushed);
 		break;
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"Unsupported event [0x%x]\n", event));
+				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 
 	return_VOID;
 }
 
-
-static acpi_status
-acpi_button_notify_fixed (
-	void			*data)
+static acpi_status acpi_button_notify_fixed(void *data)
 {
-	struct acpi_button	*button = (struct acpi_button *) data;
-	
+	struct acpi_button *button = (struct acpi_button *)data;
+
 	ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
 
 	if (!button)
@@ -310,14 +297,11 @@ acpi_button_notify_fixed (
 	return_ACPI_STATUS(AE_OK);
 }
 
-
-static int
-acpi_button_add (
-	struct acpi_device	*device)
+static int acpi_button_add(struct acpi_device *device)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	struct acpi_button	*button = NULL;
+	int result = 0;
+	acpi_status status = AE_OK;
+	struct acpi_button *button = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_button_add");
 
@@ -339,42 +323,34 @@ acpi_button_add (
 	 */
 	if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
 		button->type = ACPI_BUTTON_TYPE_POWER;
-		strcpy(acpi_device_name(device),
-			ACPI_BUTTON_DEVICE_NAME_POWER);
-		sprintf(acpi_device_class(device), "%s/%s", 
+		strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
-	}
-	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
 		button->type = ACPI_BUTTON_TYPE_POWERF;
 		strcpy(acpi_device_name(device),
-			ACPI_BUTTON_DEVICE_NAME_POWERF);
-		sprintf(acpi_device_class(device), "%s/%s", 
+		       ACPI_BUTTON_DEVICE_NAME_POWERF);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
-	}
-	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
 		button->type = ACPI_BUTTON_TYPE_SLEEP;
-		strcpy(acpi_device_name(device),
-			ACPI_BUTTON_DEVICE_NAME_SLEEP);
-		sprintf(acpi_device_class(device), "%s/%s", 
+		strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
-	}
-	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
 		button->type = ACPI_BUTTON_TYPE_SLEEPF;
 		strcpy(acpi_device_name(device),
-			ACPI_BUTTON_DEVICE_NAME_SLEEPF);
-		sprintf(acpi_device_class(device), "%s/%s", 
+		       ACPI_BUTTON_DEVICE_NAME_SLEEPF);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
-	}
-	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
 		button->type = ACPI_BUTTON_TYPE_LID;
-		strcpy(acpi_device_name(device),
-			ACPI_BUTTON_DEVICE_NAME_LID);
-		sprintf(acpi_device_class(device), "%s/%s", 
+		strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
-	}
-	else {
+	} else {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
-			acpi_device_hid(device)));
+				  acpi_device_hid(device)));
 		result = -ENODEV;
 		goto end;
 	}
@@ -385,46 +361,46 @@ acpi_button_add (
 
 	switch (button->type) {
 	case ACPI_BUTTON_TYPE_POWERF:
-		status = acpi_install_fixed_event_handler (
-			ACPI_EVENT_POWER_BUTTON,
-			acpi_button_notify_fixed,
-			button);
+		status =
+		    acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
+						     acpi_button_notify_fixed,
+						     button);
 		break;
 	case ACPI_BUTTON_TYPE_SLEEPF:
-		status = acpi_install_fixed_event_handler (
-			ACPI_EVENT_SLEEP_BUTTON,
-			acpi_button_notify_fixed,
-			button);
+		status =
+		    acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
+						     acpi_button_notify_fixed,
+						     button);
 		break;
 	default:
-		status = acpi_install_notify_handler (
-			button->handle,
-			ACPI_DEVICE_NOTIFY,
-			acpi_button_notify,
-			button);
+		status = acpi_install_notify_handler(button->handle,
+						     ACPI_DEVICE_NOTIFY,
+						     acpi_button_notify,
+						     button);
 		break;
 	}
 
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error installing notify handler\n"));
+				  "Error installing notify handler\n"));
 		result = -ENODEV;
 		goto end;
 	}
 
 	if (device->wakeup.flags.valid) {
 		/* Button's GPE is run-wake GPE */
-		acpi_set_gpe_type(device->wakeup.gpe_device, 
-			device->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN);
-		acpi_enable_gpe(device->wakeup.gpe_device, 
-			device->wakeup.gpe_number, ACPI_NOT_ISR);
+		acpi_set_gpe_type(device->wakeup.gpe_device,
+				  device->wakeup.gpe_number,
+				  ACPI_GPE_TYPE_WAKE_RUN);
+		acpi_enable_gpe(device->wakeup.gpe_device,
+				device->wakeup.gpe_number, ACPI_NOT_ISR);
 		device->wakeup.state.enabled = 1;
 	}
 
-	printk(KERN_INFO PREFIX "%s [%s]\n", 
-		acpi_device_name(device), acpi_device_bid(device));
+	printk(KERN_INFO PREFIX "%s [%s]\n",
+	       acpi_device_name(device), acpi_device_bid(device));
 
-end:
+      end:
 	if (result) {
 		acpi_button_remove_fs(device);
 		kfree(button);
@@ -433,12 +409,10 @@ end:
 	return_VALUE(result);
 }
 
-
-static int
-acpi_button_remove (struct acpi_device *device, int type)
+static int acpi_button_remove(struct acpi_device *device, int type)
 {
-	acpi_status		status = 0;
-	struct acpi_button	*button = NULL;
+	acpi_status status = 0;
+	struct acpi_button *button = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_button_remove");
 
@@ -450,35 +424,36 @@ acpi_button_remove (struct acpi_device *device, int type)
 	/* Unregister for device notifications. */
 	switch (button->type) {
 	case ACPI_BUTTON_TYPE_POWERF:
-		status = acpi_remove_fixed_event_handler(
-			ACPI_EVENT_POWER_BUTTON, acpi_button_notify_fixed);
+		status =
+		    acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
+						    acpi_button_notify_fixed);
 		break;
 	case ACPI_BUTTON_TYPE_SLEEPF:
-		status = acpi_remove_fixed_event_handler(
-			ACPI_EVENT_SLEEP_BUTTON, acpi_button_notify_fixed);
+		status =
+		    acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
+						    acpi_button_notify_fixed);
 		break;
 	default:
 		status = acpi_remove_notify_handler(button->handle,
-			ACPI_DEVICE_NOTIFY, acpi_button_notify);
+						    ACPI_DEVICE_NOTIFY,
+						    acpi_button_notify);
 		break;
 	}
 
 	if (ACPI_FAILURE(status))
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error removing notify handler\n"));
+				  "Error removing notify handler\n"));
 
-	acpi_button_remove_fs(device);	
+	acpi_button_remove_fs(device);
 
 	kfree(button);
 
 	return_VALUE(0);
 }
 
-
-static int __init
-acpi_button_init (void)
+static int __init acpi_button_init(void)
 {
-	int			result = 0;
+	int result = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_button_init");
 
@@ -495,15 +470,13 @@ acpi_button_init (void)
 	return_VALUE(0);
 }
 
-
-static void __exit
-acpi_button_exit (void)
+static void __exit acpi_button_exit(void)
 {
 	ACPI_FUNCTION_TRACE("acpi_button_exit");
 
 	acpi_bus_unregister_driver(&acpi_button_driver);
 
-	if (acpi_power_dir) 
+	if (acpi_power_dir)
 		remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir);
 	if (acpi_sleep_dir)
 		remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir);
@@ -514,6 +487,5 @@ acpi_button_exit (void)
 	return_VOID;
 }
 
-
 module_init(acpi_button_init);
 module_exit(acpi_button_exit);

+ 56 - 72
drivers/acpi/container.c

@@ -44,9 +44,9 @@
 
 #define ACPI_CONTAINER_COMPONENT	0x01000000
 #define _COMPONENT			ACPI_CONTAINER_COMPONENT
-ACPI_MODULE_NAME			("acpi_container")
+ACPI_MODULE_NAME("acpi_container")
 
-MODULE_AUTHOR("Anil S Keshavamurthy");
+    MODULE_AUTHOR("Anil S Keshavamurthy");
 MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
@@ -56,41 +56,38 @@ static int acpi_container_add(struct acpi_device *device);
 static int acpi_container_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_container_driver = {
-	.name =		ACPI_CONTAINER_DRIVER_NAME,
-	.class =	ACPI_CONTAINER_CLASS,
-	.ids =		"ACPI0004,PNP0A05,PNP0A06",
-	.ops =		{
-				.add =		acpi_container_add,
-				.remove =	acpi_container_remove,
-			},
+	.name = ACPI_CONTAINER_DRIVER_NAME,
+	.class = ACPI_CONTAINER_CLASS,
+	.ids = "ACPI0004,PNP0A05,PNP0A06",
+	.ops = {
+		.add = acpi_container_add,
+		.remove = acpi_container_remove,
+		},
 };
 
-
 /*******************************************************************/
 
-static int
-is_device_present(acpi_handle handle)
+static int is_device_present(acpi_handle handle)
 {
-	acpi_handle		temp;
-	acpi_status		status;
-	unsigned long	sta;
+	acpi_handle temp;
+	acpi_status status;
+	unsigned long sta;
 
 	ACPI_FUNCTION_TRACE("is_device_present");
 
 	status = acpi_get_handle(handle, "_STA", &temp);
 	if (ACPI_FAILURE(status))
-		return_VALUE(1); /* _STA not found, assmue device present */
+		return_VALUE(1);	/* _STA not found, assmue device present */
 
 	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
 	if (ACPI_FAILURE(status))
-		return_VALUE(0); /* Firmware error */
+		return_VALUE(0);	/* Firmware error */
 
 	return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
 }
 
 /*******************************************************************/
-static int
-acpi_container_add(struct acpi_device *device)
+static int acpi_container_add(struct acpi_device *device)
 {
 	struct acpi_container *container;
 
@@ -102,28 +99,26 @@ acpi_container_add(struct acpi_device *device)
 	}
 
 	container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
-	if(!container)
+	if (!container)
 		return_VALUE(-ENOMEM);
-	
+
 	memset(container, 0, sizeof(struct acpi_container));
 	container->handle = device->handle;
 	strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
 	acpi_driver_data(device) = container;
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",	\
-		acpi_device_name(device), acpi_device_bid(device)));
-
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
+			  acpi_device_name(device), acpi_device_bid(device)));
 
 	return_VALUE(0);
 }
 
-static int
-acpi_container_remove(struct acpi_device *device, int type)
+static int acpi_container_remove(struct acpi_device *device, int type)
 {
-	acpi_status		status = AE_OK;
-	struct acpi_container	*pc = NULL;
-	pc = (struct acpi_container*) acpi_driver_data(device);
+	acpi_status status = AE_OK;
+	struct acpi_container *pc = NULL;
+	pc = (struct acpi_container *)acpi_driver_data(device);
 
 	if (pc)
 		kfree(pc);
@@ -131,9 +126,7 @@ acpi_container_remove(struct acpi_device *device, int type)
 	return status;
 }
 
-
-static int
-container_device_add(struct acpi_device **device, acpi_handle handle)
+static int container_device_add(struct acpi_device **device, acpi_handle handle)
 {
 	acpi_handle phandle;
 	struct acpi_device *pdev;
@@ -158,10 +151,9 @@ container_device_add(struct acpi_device **device, acpi_handle handle)
 	return_VALUE(result);
 }
 
-static void
-container_notify_cb(acpi_handle handle, u32 type, void *context)
+static void container_notify_cb(acpi_handle handle, u32 type, void *context)
 {
-	struct acpi_device		*device = NULL;
+	struct acpi_device *device = NULL;
 	int result;
 	int present;
 	acpi_status status;
@@ -169,14 +161,14 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
 	ACPI_FUNCTION_TRACE("container_notify_cb");
 
 	present = is_device_present(handle);
-	
+
 	switch (type) {
 	case ACPI_NOTIFY_BUS_CHECK:
 		/* Fall through */
 	case ACPI_NOTIFY_DEVICE_CHECK:
 		printk("Container driver received %s event\n",
-			(type == ACPI_NOTIFY_BUS_CHECK)?
-			"ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK");
+		       (type == ACPI_NOTIFY_BUS_CHECK) ?
+		       "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
 		status = acpi_bus_get_device(handle, &device);
 		if (present) {
 			if (ACPI_FAILURE(status) || !device) {
@@ -207,15 +199,13 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
 
 static acpi_status
 container_walk_namespace_cb(acpi_handle handle,
-	u32 lvl,
-	void *context,
-	void **rv)
+			    u32 lvl, void *context, void **rv)
 {
-	char 				*hid = NULL;
-	struct acpi_buffer 		buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-	struct acpi_device_info 	*info;
-	acpi_status 			status;
-	int 				*action = context;
+	char *hid = NULL;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	struct acpi_device_info *info;
+	acpi_status status;
+	int *action = context;
 
 	ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
 
@@ -233,66 +223,60 @@ container_walk_namespace_cb(acpi_handle handle,
 	}
 
 	if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
-			strcmp(hid, "PNP0A06")) {
+	    strcmp(hid, "PNP0A06")) {
 		goto end;
 	}
 
-	switch(*action) {
+	switch (*action) {
 	case INSTALL_NOTIFY_HANDLER:
 		acpi_install_notify_handler(handle,
-			ACPI_SYSTEM_NOTIFY,
-			container_notify_cb,
-			NULL);
+					    ACPI_SYSTEM_NOTIFY,
+					    container_notify_cb, NULL);
 		break;
 	case UNINSTALL_NOTIFY_HANDLER:
 		acpi_remove_notify_handler(handle,
-			ACPI_SYSTEM_NOTIFY,
-			container_notify_cb);
+					   ACPI_SYSTEM_NOTIFY,
+					   container_notify_cb);
 		break;
 	default:
 		break;
 	}
 
-end:
+      end:
 	acpi_os_free(buffer.pointer);
 
 	return_ACPI_STATUS(AE_OK);
 }
 
-
-static int __init
-acpi_container_init(void)
+static int __init acpi_container_init(void)
 {
-	int	result = 0;
-	int	action = INSTALL_NOTIFY_HANDLER;
+	int result = 0;
+	int action = INSTALL_NOTIFY_HANDLER;
 
 	result = acpi_bus_register_driver(&acpi_container_driver);
 	if (result < 0) {
-		return(result);
+		return (result);
 	}
 
 	/* register notify handler to every container device */
 	acpi_walk_namespace(ACPI_TYPE_DEVICE,
-				     ACPI_ROOT_OBJECT,
-				     ACPI_UINT32_MAX,
-				     container_walk_namespace_cb,
-				     &action, NULL);
+			    ACPI_ROOT_OBJECT,
+			    ACPI_UINT32_MAX,
+			    container_walk_namespace_cb, &action, NULL);
 
-	return(0);
+	return (0);
 }
 
-static void __exit
-acpi_container_exit(void)
+static void __exit acpi_container_exit(void)
 {
-	int			action = UNINSTALL_NOTIFY_HANDLER;
+	int action = UNINSTALL_NOTIFY_HANDLER;
 
 	ACPI_FUNCTION_TRACE("acpi_container_exit");
 
 	acpi_walk_namespace(ACPI_TYPE_DEVICE,
-				     ACPI_ROOT_OBJECT,
-				     ACPI_UINT32_MAX,
-				     container_walk_namespace_cb,
-				     &action, NULL);
+			    ACPI_ROOT_OBJECT,
+			    ACPI_UINT32_MAX,
+			    container_walk_namespace_cb, &action, NULL);
 
 	acpi_bus_unregister_driver(&acpi_container_driver);
 

+ 55 - 60
drivers/acpi/debug.c

@@ -12,17 +12,14 @@
 #include <acpi/acglobal.h>
 
 #define _COMPONENT		ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME		("debug")
-
+ACPI_MODULE_NAME("debug")
 #define ACPI_SYSTEM_FILE_DEBUG_LAYER	"debug_layer"
 #define ACPI_SYSTEM_FILE_DEBUG_LEVEL	"debug_level"
-
 #ifdef MODULE_PARAM_PREFIX
 #undef MODULE_PARAM_PREFIX
 #endif
-
 #define MODULE_PARAM_PREFIX
-module_param(acpi_dbg_layer, uint, 0400);
+    module_param(acpi_dbg_layer, uint, 0400);
 module_param(acpi_dbg_level, uint, 0400);
 
 struct acpi_dlayer {
@@ -35,8 +32,7 @@ struct acpi_dlevel {
 };
 #define ACPI_DEBUG_INIT(v)	{ .name = #v, .value = v }
 
-static const struct acpi_dlayer acpi_debug_layers[] =
-{
+static const struct acpi_dlayer acpi_debug_layers[] = {
 	ACPI_DEBUG_INIT(ACPI_UTILITIES),
 	ACPI_DEBUG_INIT(ACPI_HARDWARE),
 	ACPI_DEBUG_INIT(ACPI_EVENTS),
@@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] =
 	ACPI_DEBUG_INIT(ACPI_TOOLS),
 };
 
-static const struct acpi_dlevel acpi_debug_levels[] =
-{
+static const struct acpi_dlevel acpi_debug_levels[] = {
 	ACPI_DEBUG_INIT(ACPI_LV_ERROR),
 	ACPI_DEBUG_INIT(ACPI_LV_WARN),
 	ACPI_DEBUG_INIT(ACPI_LV_INIT),
@@ -88,81 +83,77 @@ static const struct acpi_dlevel acpi_debug_levels[] =
 	ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
 	ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
 	ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
-	ACPI_DEBUG_INIT(ACPI_LV_EVENTS),             
+	ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
 };
 
 static int
-acpi_system_read_debug (
-	char			*page,
-	char			**start,
-	off_t			off,
-	int 			count,
-	int 			*eof,
-	void			*data)
+acpi_system_read_debug(char *page,
+		       char **start, off_t off, int count, int *eof, void *data)
 {
-	char			*p = page;
-	int 			size = 0;
-	unsigned int		i;
+	char *p = page;
+	int size = 0;
+	unsigned int i;
 
 	if (off != 0)
 		goto end;
 
 	p += sprintf(p, "%-25s\tHex        SET\n", "Description");
 
-	switch ((unsigned long) data) {
+	switch ((unsigned long)data) {
 	case 0:
 		for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
 			p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
-				acpi_debug_layers[i].name,
-				acpi_debug_layers[i].value,
-				(acpi_dbg_layer & acpi_debug_layers[i].value) ?
-				'*' : ' ');
+				     acpi_debug_layers[i].name,
+				     acpi_debug_layers[i].value,
+				     (acpi_dbg_layer & acpi_debug_layers[i].
+				      value) ? '*' : ' ');
 		}
 		p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
-			ACPI_ALL_DRIVERS,
-			(acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
-			'*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
-			' ' : '-');
+			     ACPI_ALL_DRIVERS,
+			     (acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
+			     ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
+						       ACPI_ALL_DRIVERS) ==
+			     0 ? ' ' : '-');
 		p += sprintf(p,
-			"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
-			acpi_dbg_layer);
+			     "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
+			     acpi_dbg_layer);
 		break;
 	case 1:
 		for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
 			p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
-				acpi_debug_levels[i].name,
-				acpi_debug_levels[i].value,
-				(acpi_dbg_level & acpi_debug_levels[i].value) ?
-				'*' : ' ');
+				     acpi_debug_levels[i].name,
+				     acpi_debug_levels[i].value,
+				     (acpi_dbg_level & acpi_debug_levels[i].
+				      value) ? '*' : ' ');
 		}
 		p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
-				acpi_dbg_level);
+			     acpi_dbg_level);
 		break;
 	default:
 		p += sprintf(p, "Invalid debug option\n");
 		break;
 	}
-	
-end:
+
+      end:
 	size = (p - page);
-	if (size <= off+count) *eof = 1;
+	if (size <= off + count)
+		*eof = 1;
 	*start = page + off;
 	size -= off;
-	if (size>count) size = count;
-	if (size<0) size = 0;
+	if (size > count)
+		size = count;
+	if (size < 0)
+		size = 0;
 
 	return size;
 }
 
-
 static int
-acpi_system_write_debug (
-	struct file             *file,
-        const char              __user *buffer,
-	unsigned long           count,
-        void                    *data)
+acpi_system_write_debug(struct file *file,
+			const char __user * buffer,
+			unsigned long count, void *data)
 {
-	char			debug_string[12] = {'\0'};
+	char debug_string[12] = { '\0' };
 
 	ACPI_FUNCTION_TRACE("acpi_system_write_debug");
 
@@ -174,7 +165,7 @@ acpi_system_write_debug (
 
 	debug_string[count] = '\0';
 
-	switch ((unsigned long) data) {
+	switch ((unsigned long)data) {
 	case 0:
 		acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
 		break;
@@ -190,9 +181,9 @@ acpi_system_write_debug (
 
 static int __init acpi_debug_init(void)
 {
-	struct proc_dir_entry	*entry;
+	struct proc_dir_entry *entry;
 	int error = 0;
-	char * name;
+	char *name;
 
 	ACPI_FUNCTION_TRACE("acpi_debug_init");
 
@@ -201,8 +192,10 @@ static int __init acpi_debug_init(void)
 
 	/* 'debug_layer' [R/W] */
 	name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
-	entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
-				       acpi_system_read_debug,(void *)0);
+	entry =
+	    create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
+				   acpi_root_dir, acpi_system_read_debug,
+				   (void *)0);
 	if (entry)
 		entry->write_proc = acpi_system_write_debug;
 	else
@@ -210,19 +203,21 @@ static int __init acpi_debug_init(void)
 
 	/* 'debug_level' [R/W] */
 	name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
-	entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
-				       acpi_system_read_debug, (void *)1);
-	if (entry) 
+	entry =
+	    create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
+				   acpi_root_dir, acpi_system_read_debug,
+				   (void *)1);
+	if (entry)
 		entry->write_proc = acpi_system_write_debug;
 	else
 		goto Error;
 
- Done:
+      Done:
 	return_VALUE(error);
 
- Error:
-	ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-			 "Unable to create '%s' proc fs entry\n", name));
+      Error:
+	ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			  "Unable to create '%s' proc fs entry\n", name));
 
 	remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
 	remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);

+ 161 - 185
drivers/acpi/dispatcher/dsfield.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acdispat.h>
@@ -49,18 +48,14 @@
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dsfield")
+ACPI_MODULE_NAME("dsfield")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ds_get_field_names (
-	struct acpi_create_field_info   *info,
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *arg);
-
+acpi_ds_get_field_names(struct acpi_create_field_info *info,
+			struct acpi_walk_state *walk_state,
+			union acpi_parse_object *arg);
 
 /*******************************************************************************
  *
@@ -82,41 +77,36 @@ acpi_ds_get_field_names (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_buffer_field (
-	union acpi_parse_object         *op,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_create_buffer_field(union acpi_parse_object *op,
+			    struct acpi_walk_state *walk_state)
 {
-	union acpi_parse_object         *arg;
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *second_desc = NULL;
-	u32                             flags;
-
-
-	ACPI_FUNCTION_TRACE ("ds_create_buffer_field");
+	union acpi_parse_object *arg;
+	struct acpi_namespace_node *node;
+	acpi_status status;
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *second_desc = NULL;
+	u32 flags;
 
+	ACPI_FUNCTION_TRACE("ds_create_buffer_field");
 
 	/* Get the name_string argument */
 
 	if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
-		arg = acpi_ps_get_arg (op, 3);
-	}
-	else {
+		arg = acpi_ps_get_arg(op, 3);
+	} else {
 		/* Create Bit/Byte/Word/Dword field */
 
-		arg = acpi_ps_get_arg (op, 2);
+		arg = acpi_ps_get_arg(op, 2);
 	}
 
 	if (!arg) {
-		return_ACPI_STATUS (AE_AML_NO_OPERAND);
+		return_ACPI_STATUS(AE_AML_NO_OPERAND);
 	}
 
 	if (walk_state->deferred_node) {
 		node = walk_state->deferred_node;
 		status = AE_OK;
-	}
-	else {
+	} else {
 		/*
 		 * During the load phase, we want to enter the name of the field into
 		 * the namespace.  During the execute phase (when we evaluate the size
@@ -124,21 +114,22 @@ acpi_ds_create_buffer_field (
 		 */
 		if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) {
 			flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
-		}
-		else {
+		} else {
 			flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
-					ACPI_NS_ERROR_IF_FOUND;
+			    ACPI_NS_ERROR_IF_FOUND;
 		}
 
 		/*
 		 * Enter the name_string into the namespace
 		 */
-		status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-				 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
-				 flags, walk_state, &(node));
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_NSERROR (arg->common.value.string, status);
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ns_lookup(walk_state->scope_info,
+				   arg->common.value.string, ACPI_TYPE_ANY,
+				   ACPI_IMODE_LOAD_PASS1, flags, walk_state,
+				   &(node));
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_NSERROR(arg->common.value.string, status);
+			return_ACPI_STATUS(status);
 		}
 	}
 
@@ -153,9 +144,9 @@ acpi_ds_create_buffer_field (
 	 * and we need to create the field object.  Otherwise, this was a lookup
 	 * of an existing node and we don't want to create the field object again.
 	 */
-	obj_desc = acpi_ns_get_attached_object (node);
+	obj_desc = acpi_ns_get_attached_object(node);
 	if (obj_desc) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/*
@@ -165,7 +156,7 @@ acpi_ds_create_buffer_field (
 
 	/* Create the buffer field object */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD);
 	if (!obj_desc) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
@@ -176,28 +167,26 @@ acpi_ds_create_buffer_field (
 	 * opcode and operands -- since the buffer and index
 	 * operands must be evaluated.
 	 */
-	second_desc                 = obj_desc->common.next_object;
+	second_desc = obj_desc->common.next_object;
 	second_desc->extra.aml_start = op->named.data;
 	second_desc->extra.aml_length = op->named.length;
 	obj_desc->buffer_field.node = node;
 
 	/* Attach constructed field descriptors to parent node */
 
-	status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
-
-cleanup:
+      cleanup:
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_field_names
@@ -214,17 +203,14 @@ cleanup:
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_get_field_names (
-	struct acpi_create_field_info   *info,
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *arg)
+acpi_ds_get_field_names(struct acpi_create_field_info *info,
+			struct acpi_walk_state *walk_state,
+			union acpi_parse_object *arg)
 {
-	acpi_status                     status;
-	acpi_integer                    position;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_get_field_names", info);
+	acpi_status status;
+	acpi_integer position;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info);
 
 	/* First field starts at bit zero */
 
@@ -243,18 +229,16 @@ acpi_ds_get_field_names (
 		case AML_INT_RESERVEDFIELD_OP:
 
 			position = (acpi_integer) info->field_bit_position
-					 + (acpi_integer) arg->common.value.size;
+			    + (acpi_integer) arg->common.value.size;
 
 			if (position > ACPI_UINT32_MAX) {
-				ACPI_REPORT_ERROR ((
-					"Bit offset within field too large (> 0xFFFFFFFF)\n"));
-				return_ACPI_STATUS (AE_SUPPORT);
+				ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n"));
+				return_ACPI_STATUS(AE_SUPPORT);
 			}
 
 			info->field_bit_position = (u32) position;
 			break;
 
-
 		case AML_INT_ACCESSFIELD_OP:
 
 			/*
@@ -266,73 +250,70 @@ acpi_ds_get_field_names (
 			 * ACCESS_TYPE bits
 			 */
 			info->field_flags = (u8)
-				((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
-				((u8) ((u32) arg->common.value.integer >> 8)));
+			    ((info->
+			      field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
+			     ((u8) ((u32) arg->common.value.integer >> 8)));
 
 			info->attribute = (u8) (arg->common.value.integer);
 			break;
 
-
 		case AML_INT_NAMEDFIELD_OP:
 
 			/* Lookup the name */
 
-			status = acpi_ns_lookup (walk_state->scope_info,
-					  (char *) &arg->named.name,
-					  info->field_type, ACPI_IMODE_EXECUTE,
-					  ACPI_NS_DONT_OPEN_SCOPE,
-					  walk_state, &info->field_node);
-			if (ACPI_FAILURE (status)) {
-				ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
+			status = acpi_ns_lookup(walk_state->scope_info,
+						(char *)&arg->named.name,
+						info->field_type,
+						ACPI_IMODE_EXECUTE,
+						ACPI_NS_DONT_OPEN_SCOPE,
+						walk_state, &info->field_node);
+			if (ACPI_FAILURE(status)) {
+				ACPI_REPORT_NSERROR((char *)&arg->named.name,
+						    status);
 				if (status != AE_ALREADY_EXISTS) {
-					return_ACPI_STATUS (status);
+					return_ACPI_STATUS(status);
 				}
 
 				/* Already exists, ignore error */
-			}
-			else {
+			} else {
 				arg->common.node = info->field_node;
 				info->field_bit_length = arg->common.value.size;
 
 				/* Create and initialize an object for the new Field Node */
 
-				status = acpi_ex_prep_field_value (info);
-				if (ACPI_FAILURE (status)) {
-					return_ACPI_STATUS (status);
+				status = acpi_ex_prep_field_value(info);
+				if (ACPI_FAILURE(status)) {
+					return_ACPI_STATUS(status);
 				}
 			}
 
 			/* Keep track of bit position for the next field */
 
 			position = (acpi_integer) info->field_bit_position
-					 + (acpi_integer) arg->common.value.size;
+			    + (acpi_integer) arg->common.value.size;
 
 			if (position > ACPI_UINT32_MAX) {
-				ACPI_REPORT_ERROR ((
-					"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
-					(char *) &info->field_node->name));
-				return_ACPI_STATUS (AE_SUPPORT);
+				ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name));
+				return_ACPI_STATUS(AE_SUPPORT);
 			}
 
 			info->field_bit_position += info->field_bit_length;
 			break;
 
-
 		default:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Invalid opcode in field list: %X\n",
-				arg->common.aml_opcode));
-			return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Invalid opcode in field list: %X\n",
+					  arg->common.aml_opcode));
+			return_ACPI_STATUS(AE_AML_BAD_OPCODE);
 		}
 
 		arg = arg->common.next;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_field
@@ -348,29 +329,28 @@ acpi_ds_get_field_names (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_field (
-	union acpi_parse_object         *op,
-	struct acpi_namespace_node      *region_node,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_create_field(union acpi_parse_object *op,
+		     struct acpi_namespace_node *region_node,
+		     struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_parse_object         *arg;
-	struct acpi_create_field_info   info;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_create_field", op);
+	acpi_status status;
+	union acpi_parse_object *arg;
+	struct acpi_create_field_info info;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_create_field", op);
 
 	/* First arg is the name of the parent op_region (must already exist) */
 
 	arg = op->common.value.arg;
 	if (!region_node) {
-		status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
-				  ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
-				  ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_NSERROR (arg->common.value.name, status);
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ns_lookup(walk_state->scope_info,
+				   arg->common.value.name, ACPI_TYPE_REGION,
+				   ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+				   walk_state, &region_node);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_NSERROR(arg->common.value.name, status);
+			return_ACPI_STATUS(status);
 		}
 	}
 
@@ -385,12 +365,11 @@ acpi_ds_create_field (
 	info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
 	info.region_node = region_node;
 
-	status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
+	status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_init_field_objects
@@ -407,37 +386,34 @@ acpi_ds_create_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_init_field_objects (
-	union acpi_parse_object         *op,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_init_field_objects(union acpi_parse_object *op,
+			   struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_parse_object         *arg = NULL;
-	struct acpi_namespace_node      *node;
-	u8                              type = 0;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_init_field_objects", op);
+	acpi_status status;
+	union acpi_parse_object *arg = NULL;
+	struct acpi_namespace_node *node;
+	u8 type = 0;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op);
 
 	switch (walk_state->opcode) {
 	case AML_FIELD_OP:
-		arg = acpi_ps_get_arg (op, 2);
+		arg = acpi_ps_get_arg(op, 2);
 		type = ACPI_TYPE_LOCAL_REGION_FIELD;
 		break;
 
 	case AML_BANK_FIELD_OP:
-		arg = acpi_ps_get_arg (op, 4);
+		arg = acpi_ps_get_arg(op, 4);
 		type = ACPI_TYPE_LOCAL_BANK_FIELD;
 		break;
 
 	case AML_INDEX_FIELD_OP:
-		arg = acpi_ps_get_arg (op, 3);
+		arg = acpi_ps_get_arg(op, 3);
 		type = ACPI_TYPE_LOCAL_INDEX_FIELD;
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
@@ -447,16 +423,18 @@ acpi_ds_init_field_objects (
 		/* Ignore OFFSET and ACCESSAS terms here */
 
 		if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
-			status = acpi_ns_lookup (walk_state->scope_info,
-					  (char *) &arg->named.name,
-					  type, ACPI_IMODE_LOAD_PASS1,
-					  ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
-					  ACPI_NS_ERROR_IF_FOUND,
-					  walk_state, &node);
-			if (ACPI_FAILURE (status)) {
-				ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
+			status = acpi_ns_lookup(walk_state->scope_info,
+						(char *)&arg->named.name,
+						type, ACPI_IMODE_LOAD_PASS1,
+						ACPI_NS_NO_UPSEARCH |
+						ACPI_NS_DONT_OPEN_SCOPE |
+						ACPI_NS_ERROR_IF_FOUND,
+						walk_state, &node);
+			if (ACPI_FAILURE(status)) {
+				ACPI_REPORT_NSERROR((char *)&arg->named.name,
+						    status);
 				if (status != AE_ALREADY_EXISTS) {
-					return_ACPI_STATUS (status);
+					return_ACPI_STATUS(status);
 				}
 
 				/* Name already exists, just ignore this error */
@@ -472,10 +450,9 @@ acpi_ds_init_field_objects (
 		arg = arg->common.next;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_bank_field
@@ -491,41 +468,42 @@ acpi_ds_init_field_objects (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_bank_field (
-	union acpi_parse_object         *op,
-	struct acpi_namespace_node      *region_node,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_create_bank_field(union acpi_parse_object *op,
+			  struct acpi_namespace_node *region_node,
+			  struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_parse_object         *arg;
-	struct acpi_create_field_info   info;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_create_bank_field", op);
+	acpi_status status;
+	union acpi_parse_object *arg;
+	struct acpi_create_field_info info;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op);
 
 	/* First arg is the name of the parent op_region (must already exist) */
 
 	arg = op->common.value.arg;
 	if (!region_node) {
-		status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
-				  ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
-				  ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_NSERROR (arg->common.value.name, status);
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ns_lookup(walk_state->scope_info,
+				   arg->common.value.name, ACPI_TYPE_REGION,
+				   ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+				   walk_state, &region_node);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_NSERROR(arg->common.value.name, status);
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Second arg is the Bank Register (Field) (must already exist) */
 
 	arg = arg->common.next;
-	status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-			  ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-			  ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_NSERROR (arg->common.value.string, status);
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
+			   ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+			   ACPI_NS_SEARCH_PARENT, walk_state,
+			   &info.register_node);
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_NSERROR(arg->common.value.string, status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Third arg is the bank_value */
@@ -543,12 +521,11 @@ acpi_ds_create_bank_field (
 	info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
 	info.region_node = region_node;
 
-	status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
+	status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_index_field
@@ -564,39 +541,40 @@ acpi_ds_create_bank_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_index_field (
-	union acpi_parse_object         *op,
-	struct acpi_namespace_node      *region_node,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_create_index_field(union acpi_parse_object *op,
+			   struct acpi_namespace_node *region_node,
+			   struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_parse_object         *arg;
-	struct acpi_create_field_info   info;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_create_index_field", op);
+	acpi_status status;
+	union acpi_parse_object *arg;
+	struct acpi_create_field_info info;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op);
 
 	/* First arg is the name of the Index register (must already exist) */
 
 	arg = op->common.value.arg;
-	status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-			  ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-			  ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_NSERROR (arg->common.value.string, status);
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
+			   ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+			   ACPI_NS_SEARCH_PARENT, walk_state,
+			   &info.register_node);
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_NSERROR(arg->common.value.string, status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Second arg is the data register (must already exist) */
 
 	arg = arg->common.next;
-	status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-			  ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-			  ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_NSERROR (arg->common.value.string, status);
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
+			   ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+			   ACPI_NS_SEARCH_PARENT, walk_state,
+			   &info.data_register_node);
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_NSERROR(arg->common.value.string, status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Next arg is the field flags */
@@ -609,9 +587,7 @@ acpi_ds_create_index_field (
 	info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
 	info.region_node = region_node;
 
-	status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
+	status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 55 - 68
drivers/acpi/dispatcher/dsinit.c

@@ -41,23 +41,17 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dsinit")
+ACPI_MODULE_NAME("dsinit")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ds_init_one_object (
-	acpi_handle                     obj_handle,
-	u32                             level,
-	void                            *context,
-	void                            **return_value);
-
+acpi_ds_init_one_object(acpi_handle obj_handle,
+			u32 level, void *context, void **return_value);
 
 /*******************************************************************************
  *
@@ -80,20 +74,17 @@ acpi_ds_init_one_object (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_init_one_object (
-	acpi_handle                     obj_handle,
-	u32                             level,
-	void                            *context,
-	void                            **return_value)
+acpi_ds_init_one_object(acpi_handle obj_handle,
+			u32 level, void *context, void **return_value)
 {
-	struct acpi_init_walk_info      *info = (struct acpi_init_walk_info *) context;
-	struct acpi_namespace_node      *node = (struct acpi_namespace_node *) obj_handle;
-	acpi_object_type                type;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_NAME ("ds_init_one_object");
+	struct acpi_init_walk_info *info =
+	    (struct acpi_init_walk_info *)context;
+	struct acpi_namespace_node *node =
+	    (struct acpi_namespace_node *)obj_handle;
+	acpi_object_type type;
+	acpi_status status;
 
+	ACPI_FUNCTION_NAME("ds_init_one_object");
 
 	/*
 	 * We are only interested in NS nodes owned by the table that
@@ -107,23 +98,23 @@ acpi_ds_init_one_object (
 
 	/* And even then, we are only interested in a few object types */
 
-	type = acpi_ns_get_type (obj_handle);
+	type = acpi_ns_get_type(obj_handle);
 
 	switch (type) {
 	case ACPI_TYPE_REGION:
 
-		status = acpi_ds_initialize_region (obj_handle);
-		if (ACPI_FAILURE (status)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Region %p [%4.4s] - Init failure, %s\n",
-				obj_handle, acpi_ut_get_node_name (obj_handle),
-				acpi_format_exception (status)));
+		status = acpi_ds_initialize_region(obj_handle);
+		if (ACPI_FAILURE(status)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Region %p [%4.4s] - Init failure, %s\n",
+					  obj_handle,
+					  acpi_ut_get_node_name(obj_handle),
+					  acpi_format_exception(status)));
 		}
 
 		info->op_region_count++;
 		break;
 
-
 	case ACPI_TYPE_METHOD:
 
 		/*
@@ -131,7 +122,7 @@ acpi_ds_init_one_object (
 		 * the entire pathname
 		 */
 		if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
-			ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+			ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
 		}
 
 		/*
@@ -148,12 +139,13 @@ acpi_ds_init_one_object (
 		 * Always parse methods to detect errors, we will delete
 		 * the parse tree below
 		 */
-		status = acpi_ds_parse_method (obj_handle);
-		if (ACPI_FAILURE (status)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"\n+Method %p [%4.4s] - parse failure, %s\n",
-				obj_handle, acpi_ut_get_node_name (obj_handle),
-				acpi_format_exception (status)));
+		status = acpi_ds_parse_method(obj_handle);
+		if (ACPI_FAILURE(status)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "\n+Method %p [%4.4s] - parse failure, %s\n",
+					  obj_handle,
+					  acpi_ut_get_node_name(obj_handle),
+					  acpi_format_exception(status)));
 
 			/* This parse failed, but we will continue parsing more methods */
 		}
@@ -161,13 +153,11 @@ acpi_ds_init_one_object (
 		info->method_count++;
 		break;
 
-
 	case ACPI_TYPE_DEVICE:
 
 		info->device_count++;
 		break;
 
-
 	default:
 		break;
 	}
@@ -179,7 +169,6 @@ acpi_ds_init_one_object (
 	return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_initialize_objects
@@ -195,45 +184,43 @@ acpi_ds_init_one_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_initialize_objects (
-	struct acpi_table_desc          *table_desc,
-	struct acpi_namespace_node      *start_node)
+acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
+			   struct acpi_namespace_node * start_node)
 {
-	acpi_status                     status;
-	struct acpi_init_walk_info      info;
-
+	acpi_status status;
+	struct acpi_init_walk_info info;
 
-	ACPI_FUNCTION_TRACE ("ds_initialize_objects");
+	ACPI_FUNCTION_TRACE("ds_initialize_objects");
 
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "**** Starting initialization of namespace objects ****\n"));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:"));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"**** Starting initialization of namespace objects ****\n"));
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
-
-	info.method_count   = 0;
+	info.method_count = 0;
 	info.op_region_count = 0;
-	info.object_count   = 0;
-	info.device_count   = 0;
-	info.table_desc     = table_desc;
+	info.object_count = 0;
+	info.device_count = 0;
+	info.table_desc = table_desc;
 
 	/* Walk entire namespace from the supplied root */
 
-	status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
-			  acpi_ds_init_one_object, &info, NULL);
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
-			acpi_format_exception (status)));
+	status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
+				     acpi_ds_init_one_object, &info, NULL);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
+				  acpi_format_exception(status)));
 	}
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-		"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
-		table_desc->pointer->signature, table_desc->owner_id, info.object_count,
-		info.device_count, info.method_count, info.op_region_count));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
+			      table_desc->pointer->signature,
+			      table_desc->owner_id, info.object_count,
+			      info.device_count, info.method_count,
+			      info.op_region_count));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "%hd Methods, %hd Regions\n", info.method_count,
+			  info.op_region_count));
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-
-

+ 171 - 183
drivers/acpi/dispatcher/dsmethod.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
@@ -49,10 +48,8 @@
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dsmethod")
-
+ACPI_MODULE_NAME("dsmethod")
 
 /*******************************************************************************
  *
@@ -67,45 +64,41 @@
  * MUTEX:       Assumes parser is locked
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ds_parse_method (
-	struct acpi_namespace_node      *node)
+acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *obj_desc;
-	union acpi_parse_object         *op;
-	struct acpi_walk_state          *walk_state;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node);
+	acpi_status status;
+	union acpi_operand_object *obj_desc;
+	union acpi_parse_object *op;
+	struct acpi_walk_state *walk_state;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node);
 
 	/* Parameter Validation */
 
 	if (!node) {
-		return_ACPI_STATUS (AE_NULL_ENTRY);
+		return_ACPI_STATUS(AE_NULL_ENTRY);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n",
-		acpi_ut_get_node_name (node), node));
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+			  "**** Parsing [%4.4s] **** named_obj=%p\n",
+			  acpi_ut_get_node_name(node), node));
 
 	/* Extract the method object from the method Node */
 
-	obj_desc = acpi_ns_get_attached_object (node);
+	obj_desc = acpi_ns_get_attached_object(node);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NULL_OBJECT);
+		return_ACPI_STATUS(AE_NULL_OBJECT);
 	}
 
 	/* Create a mutex for the method if there is a concurrency limit */
 
 	if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) &&
-		(!obj_desc->method.semaphore)) {
-		status = acpi_os_create_semaphore (obj_desc->method.concurrency,
-				   obj_desc->method.concurrency,
-				   &obj_desc->method.semaphore);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+	    (!obj_desc->method.semaphore)) {
+		status = acpi_os_create_semaphore(obj_desc->method.concurrency,
+						  obj_desc->method.concurrency,
+						  &obj_desc->method.semaphore);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
@@ -113,14 +106,14 @@ acpi_ds_parse_method (
 	 * Allocate a new parser op to be the root of the parsed
 	 * method tree
 	 */
-	op = acpi_ps_alloc_op (AML_METHOD_OP);
+	op = acpi_ps_alloc_op(AML_METHOD_OP);
 	if (!op) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Init new op with the method name and pointer back to the Node */
 
-	acpi_ps_set_name (op, node->name.integer);
+	acpi_ps_set_name(op, node->name.integer);
 	op->common.node = node;
 
 	/*
@@ -128,25 +121,26 @@ acpi_ds_parse_method (
 	 * objects (such as Operation Regions) can be created during the
 	 * first pass parse.
 	 */
-	status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/* Create and initialize a new walk state */
 
-	walk_state = acpi_ds_create_walk_state (
-			  obj_desc->method.owner_id, NULL, NULL, NULL);
+	walk_state =
+	    acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
+				      NULL);
 	if (!walk_state) {
 		status = AE_NO_MEMORY;
 		goto cleanup2;
 	}
 
-	status = acpi_ds_init_aml_walk (walk_state, op, node,
-			  obj_desc->method.aml_start,
-			  obj_desc->method.aml_length, NULL, 1);
-	if (ACPI_FAILURE (status)) {
-		acpi_ds_delete_walk_state (walk_state);
+	status = acpi_ds_init_aml_walk(walk_state, op, node,
+				       obj_desc->method.aml_start,
+				       obj_desc->method.aml_length, NULL, 1);
+	if (ACPI_FAILURE(status)) {
+		acpi_ds_delete_walk_state(walk_state);
 		goto cleanup2;
 	}
 
@@ -159,32 +153,31 @@ acpi_ds_parse_method (
 	 * method so that operands to the named objects can take on dynamic
 	 * run-time values.
 	 */
-	status = acpi_ps_parse_aml (walk_state);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ps_parse_aml(walk_state);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup2;
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-		"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
-		acpi_ut_get_node_name (node), node, op));
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+			  "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
+			  acpi_ut_get_node_name(node), node, op));
 
 	/*
 	 * Delete the parse tree. We simply re-parse the method for every
 	 * execution since there isn't much overhead (compared to keeping lots
 	 * of parse trees around)
 	 */
-	acpi_ns_delete_namespace_subtree (node);
-	acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id);
+	acpi_ns_delete_namespace_subtree(node);
+	acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
 
-cleanup2:
-	acpi_ut_release_owner_id (&obj_desc->method.owner_id);
+      cleanup2:
+	acpi_ut_release_owner_id(&obj_desc->method.owner_id);
 
-cleanup:
-	acpi_ps_delete_parse_tree (op);
-	return_ACPI_STATUS (status);
+      cleanup:
+	acpi_ps_delete_parse_tree(op);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_begin_method_execution
@@ -202,19 +195,16 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ds_begin_method_execution (
-	struct acpi_namespace_node      *method_node,
-	union acpi_operand_object       *obj_desc,
-	struct acpi_namespace_node      *calling_method_node)
+acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
+			       union acpi_operand_object *obj_desc,
+			       struct acpi_namespace_node *calling_method_node)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_begin_method_execution", method_node);
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node);
 
 	if (!method_node) {
-		return_ACPI_STATUS (AE_NULL_ENTRY);
+		return_ACPI_STATUS(AE_NULL_ENTRY);
 	}
 
 	/*
@@ -231,8 +221,9 @@ acpi_ds_begin_method_execution (
 		 * thread that is making recursive method calls.
 		 */
 		if (method_node == calling_method_node) {
-			if (obj_desc->method.thread_count >= obj_desc->method.concurrency) {
-				return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
+			if (obj_desc->method.thread_count >=
+			    obj_desc->method.concurrency) {
+				return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
 			}
 		}
 
@@ -240,8 +231,9 @@ acpi_ds_begin_method_execution (
 		 * Get a unit from the method semaphore. This releases the
 		 * interpreter if we block
 		 */
-		status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore,
-				 ACPI_WAIT_FOREVER);
+		status =
+		    acpi_ex_system_wait_semaphore(obj_desc->method.semaphore,
+						  ACPI_WAIT_FOREVER);
 	}
 
 	/*
@@ -249,10 +241,9 @@ acpi_ds_begin_method_execution (
 	 * reentered one more time (even if it is the same thread)
 	 */
 	obj_desc->method.thread_count++;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_call_control_method
@@ -268,85 +259,86 @@ acpi_ds_begin_method_execution (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_call_control_method (
-	struct acpi_thread_state        *thread,
-	struct acpi_walk_state          *this_walk_state,
-	union acpi_parse_object         *op)
+acpi_ds_call_control_method(struct acpi_thread_state *thread,
+			    struct acpi_walk_state *this_walk_state,
+			    union acpi_parse_object *op)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *method_node;
-	struct acpi_walk_state          *next_walk_state = NULL;
-	union acpi_operand_object       *obj_desc;
-	struct acpi_parameter_info      info;
-	u32                             i;
-
+	acpi_status status;
+	struct acpi_namespace_node *method_node;
+	struct acpi_walk_state *next_walk_state = NULL;
+	union acpi_operand_object *obj_desc;
+	struct acpi_parameter_info info;
+	u32 i;
 
-	ACPI_FUNCTION_TRACE_PTR ("ds_call_control_method", this_walk_state);
+	ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
-		this_walk_state->prev_op, this_walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "Execute method %p, currentstate=%p\n",
+			  this_walk_state->prev_op, this_walk_state));
 
 	/*
 	 * Get the namespace entry for the control method we are about to call
 	 */
 	method_node = this_walk_state->method_call_node;
 	if (!method_node) {
-		return_ACPI_STATUS (AE_NULL_ENTRY);
+		return_ACPI_STATUS(AE_NULL_ENTRY);
 	}
 
-	obj_desc = acpi_ns_get_attached_object (method_node);
+	obj_desc = acpi_ns_get_attached_object(method_node);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NULL_OBJECT);
+		return_ACPI_STATUS(AE_NULL_OBJECT);
 	}
 
-	status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Init for new method, wait on concurrency semaphore */
 
-	status = acpi_ds_begin_method_execution (method_node, obj_desc,
-			  this_walk_state->method_node);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ds_begin_method_execution(method_node, obj_desc,
+						this_walk_state->method_node);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
 		/* 1) Parse: Create a new walk state for the preempting walk */
 
-		next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
-				  op, obj_desc, NULL);
+		next_walk_state =
+		    acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
+					      obj_desc, NULL);
 		if (!next_walk_state) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/* Create and init a Root Node */
 
-		op = acpi_ps_create_scope_op ();
+		op = acpi_ps_create_scope_op();
 		if (!op) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		status = acpi_ds_init_aml_walk (next_walk_state, op, method_node,
-				  obj_desc->method.aml_start, obj_desc->method.aml_length,
-				  NULL, 1);
-		if (ACPI_FAILURE (status)) {
-			acpi_ds_delete_walk_state (next_walk_state);
+		status = acpi_ds_init_aml_walk(next_walk_state, op, method_node,
+					       obj_desc->method.aml_start,
+					       obj_desc->method.aml_length,
+					       NULL, 1);
+		if (ACPI_FAILURE(status)) {
+			acpi_ds_delete_walk_state(next_walk_state);
 			goto cleanup;
 		}
 
 		/* Begin AML parse */
 
-		status = acpi_ps_parse_aml (next_walk_state);
-		acpi_ps_delete_parse_tree (op);
+		status = acpi_ps_parse_aml(next_walk_state);
+		acpi_ps_delete_parse_tree(op);
 	}
 
 	/* 2) Execute: Create a new state for the preempting walk */
 
-	next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
-			  NULL, obj_desc, thread);
+	next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id,
+						    NULL, obj_desc, thread);
 	if (!next_walk_state) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
@@ -357,15 +349,15 @@ acpi_ds_call_control_method (
 	 * start at index 0.
 	 * Null terminate the list of arguments
 	 */
-	this_walk_state->operands [this_walk_state->num_operands] = NULL;
+	this_walk_state->operands[this_walk_state->num_operands] = NULL;
 
 	info.parameters = &this_walk_state->operands[0];
 	info.parameter_type = ACPI_PARAM_ARGS;
 
-	status = acpi_ds_init_aml_walk (next_walk_state, NULL, method_node,
-			  obj_desc->method.aml_start, obj_desc->method.aml_length,
-			  &info, 3);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node,
+				       obj_desc->method.aml_start,
+				       obj_desc->method.aml_length, &info, 3);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
@@ -374,40 +366,39 @@ acpi_ds_call_control_method (
 	 * (they were copied to new objects)
 	 */
 	for (i = 0; i < obj_desc->method.param_count; i++) {
-		acpi_ut_remove_reference (this_walk_state->operands [i]);
-		this_walk_state->operands [i] = NULL;
+		acpi_ut_remove_reference(this_walk_state->operands[i]);
+		this_walk_state->operands[i] = NULL;
 	}
 
 	/* Clear the operand stack */
 
 	this_walk_state->num_operands = 0;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"Starting nested execution, newstate=%p\n", next_walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "Starting nested execution, newstate=%p\n",
+			  next_walk_state));
 
 	if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
-		status = obj_desc->method.implementation (next_walk_state);
-		return_ACPI_STATUS (status);
+		status = obj_desc->method.implementation(next_walk_state);
+		return_ACPI_STATUS(status);
 	}
 
-	return_ACPI_STATUS (AE_OK);
-
+	return_ACPI_STATUS(AE_OK);
 
 	/* On error, we must delete the new walk state */
 
-cleanup:
-	acpi_ut_release_owner_id (&obj_desc->method.owner_id);
+      cleanup:
+	acpi_ut_release_owner_id(&obj_desc->method.owner_id);
 	if (next_walk_state && (next_walk_state->method_desc)) {
 		/* Decrement the thread count on the method parse tree */
 
-	   next_walk_state->method_desc->method.thread_count--;
+		next_walk_state->method_desc->method.thread_count--;
 	}
-	(void) acpi_ds_terminate_control_method (next_walk_state);
-	acpi_ds_delete_walk_state (next_walk_state);
-	return_ACPI_STATUS (status);
+	(void)acpi_ds_terminate_control_method(next_walk_state);
+	acpi_ds_delete_walk_state(next_walk_state);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_restart_control_method
@@ -423,25 +414,22 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ds_restart_control_method (
-	struct acpi_walk_state          *walk_state,
-	union acpi_operand_object       *return_desc)
+acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
+			       union acpi_operand_object *return_desc)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE_PTR ("ds_restart_control_method", walk_state);
+	ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state);
 
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "****Restart [%4.4s] Op %p return_value_from_callee %p\n",
+			  (char *)&walk_state->method_node->name,
+			  walk_state->method_call_op, return_desc));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"****Restart [%4.4s] Op %p return_value_from_callee %p\n",
-		(char *) &walk_state->method_node->name, walk_state->method_call_op,
-		return_desc));
-
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"    return_from_this_method_used?=%X res_stack %p Walk %p\n",
-		walk_state->return_used,
-		walk_state->results, walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "    return_from_this_method_used?=%X res_stack %p Walk %p\n",
+			  walk_state->return_used,
+			  walk_state->results, walk_state));
 
 	/* Did the called method return a value? */
 
@@ -451,10 +439,10 @@ acpi_ds_restart_control_method (
 		if (walk_state->return_used) {
 			/* Save the return value from the previous method */
 
-			status = acpi_ds_result_push (return_desc, walk_state);
-			if (ACPI_FAILURE (status)) {
-				acpi_ut_remove_reference (return_desc);
-				return_ACPI_STATUS (status);
+			status = acpi_ds_result_push(return_desc, walk_state);
+			if (ACPI_FAILURE(status)) {
+				acpi_ut_remove_reference(return_desc);
+				return_ACPI_STATUS(status);
 			}
 
 			/*
@@ -472,19 +460,19 @@ acpi_ds_restart_control_method (
 		 * NOTE: this is optional because the ASL language does not actually
 		 * support this behavior.
 		 */
-		else if (!acpi_ds_do_implicit_return (return_desc, walk_state, FALSE)) {
+		else if (!acpi_ds_do_implicit_return
+			 (return_desc, walk_state, FALSE)) {
 			/*
 			 * Delete the return value if it will not be used by the
 			 * calling method
 			 */
-			acpi_ut_remove_reference (return_desc);
+			acpi_ut_remove_reference(return_desc);
 		}
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_terminate_control_method
@@ -499,17 +487,13 @@ acpi_ds_restart_control_method (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_terminate_control_method (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *obj_desc;
-	struct acpi_namespace_node      *method_node;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_terminate_control_method", walk_state);
+	union acpi_operand_object *obj_desc;
+	struct acpi_namespace_node *method_node;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state);
 
 	if (!walk_state) {
 		return (AE_BAD_PARAMETER);
@@ -519,30 +503,31 @@ acpi_ds_terminate_control_method (
 
 	obj_desc = walk_state->method_desc;
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Delete all arguments and locals */
 
-	acpi_ds_method_data_delete_all (walk_state);
+	acpi_ds_method_data_delete_all(walk_state);
 
 	/*
 	 * Lock the parser while we terminate this method.
 	 * If this is the last thread executing the method,
 	 * we have additional cleanup to perform
 	 */
-	status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Signal completion of the execution of this method if necessary */
 
 	if (walk_state->method_desc->method.semaphore) {
-		status = acpi_os_signal_semaphore (
-				  walk_state->method_desc->method.semaphore, 1);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
+		status =
+		    acpi_os_signal_semaphore(walk_state->method_desc->method.
+					     semaphore, 1);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("Could not signal method semaphore\n"));
 			status = AE_OK;
 
 			/* Ignore error and continue cleanup */
@@ -550,9 +535,10 @@ acpi_ds_terminate_control_method (
 	}
 
 	if (walk_state->method_desc->method.thread_count) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-			"*** Not deleting method namespace, there are still %d threads\n",
-			walk_state->method_desc->method.thread_count));
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "*** Not deleting method namespace, there are still %d threads\n",
+				  walk_state->method_desc->method.
+				  thread_count));
 	}
 
 	if (!walk_state->method_desc->method.thread_count) {
@@ -567,9 +553,11 @@ acpi_ds_terminate_control_method (
 		 * before creating the synchronization semaphore.
 		 */
 		if ((walk_state->method_desc->method.concurrency == 1) &&
-			(!walk_state->method_desc->method.semaphore)) {
-			status = acpi_os_create_semaphore (1, 1,
-					 &walk_state->method_desc->method.semaphore);
+		    (!walk_state->method_desc->method.semaphore)) {
+			status = acpi_os_create_semaphore(1, 1,
+							  &walk_state->
+							  method_desc->method.
+							  semaphore);
 		}
 
 		/*
@@ -584,30 +572,30 @@ acpi_ds_terminate_control_method (
 		 * Delete any namespace entries created immediately underneath
 		 * the method
 		 */
-		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		if (method_node->child) {
-			acpi_ns_delete_namespace_subtree (method_node);
+			acpi_ns_delete_namespace_subtree(method_node);
 		}
 
 		/*
 		 * Delete any namespace entries created anywhere else within
 		 * the namespace
 		 */
-		acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
-		status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-		acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id);
-
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		acpi_ns_delete_namespace_by_owner(walk_state->method_desc->
+						  method.owner_id);
+		status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+		acpi_ut_release_owner_id(&walk_state->method_desc->method.
+					 owner_id);
+
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
-	status = acpi_ut_release_mutex (ACPI_MTX_PARSER);
-	return_ACPI_STATUS (status);
+	status = acpi_ut_release_mutex(ACPI_MTX_PARSER);
+	return_ACPI_STATUS(status);
 }
-
-

+ 194 - 219
drivers/acpi/dispatcher/dsmthdat.c

@@ -41,41 +41,32 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dsmthdat")
+ACPI_MODULE_NAME("dsmthdat")
 
 /* Local prototypes */
-
 static void
-acpi_ds_method_data_delete_value (
-	u16                             opcode,
-	u32                             index,
-	struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_delete_value(u16 opcode,
+				 u32 index, struct acpi_walk_state *walk_state);
 
 static acpi_status
-acpi_ds_method_data_set_value (
-	u16                             opcode,
-	u32                             index,
-	union acpi_operand_object       *object,
-	struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_set_value(u16 opcode,
+			      u32 index,
+			      union acpi_operand_object *object,
+			      struct acpi_walk_state *walk_state);
 
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 acpi_object_type
-acpi_ds_method_data_get_type (
-	u16                             opcode,
-	u32                             index,
-	struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_get_type(u16 opcode,
+			     u32 index, struct acpi_walk_state *walk_state);
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_init
@@ -97,45 +88,41 @@ acpi_ds_method_data_get_type (
  *
  ******************************************************************************/
 
-void
-acpi_ds_method_data_init (
-	struct acpi_walk_state          *walk_state)
+void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
 {
-	u32                             i;
-
-
-	ACPI_FUNCTION_TRACE ("ds_method_data_init");
+	u32 i;
 
+	ACPI_FUNCTION_TRACE("ds_method_data_init");
 
 	/* Init the method arguments */
 
 	for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
-		ACPI_MOVE_32_TO_32 (&walk_state->arguments[i].name,
+		ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name,
 				   NAMEOF_ARG_NTE);
 		walk_state->arguments[i].name.integer |= (i << 24);
-		walk_state->arguments[i].descriptor   = ACPI_DESC_TYPE_NAMED;
-		walk_state->arguments[i].type         = ACPI_TYPE_ANY;
-		walk_state->arguments[i].flags        = ANOBJ_END_OF_PEER_LIST |
-				  ANOBJ_METHOD_ARG;
+		walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
+		walk_state->arguments[i].type = ACPI_TYPE_ANY;
+		walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
+		    ANOBJ_METHOD_ARG;
 	}
 
 	/* Init the method locals */
 
 	for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
-		ACPI_MOVE_32_TO_32 (&walk_state->local_variables[i].name,
+		ACPI_MOVE_32_TO_32(&walk_state->local_variables[i].name,
 				   NAMEOF_LOCAL_NTE);
 
 		walk_state->local_variables[i].name.integer |= (i << 24);
-		walk_state->local_variables[i].descriptor  = ACPI_DESC_TYPE_NAMED;
-		walk_state->local_variables[i].type        = ACPI_TYPE_ANY;
-		walk_state->local_variables[i].flags       = ANOBJ_END_OF_PEER_LIST |
-				 ANOBJ_METHOD_LOCAL;
+		walk_state->local_variables[i].descriptor =
+		    ACPI_DESC_TYPE_NAMED;
+		walk_state->local_variables[i].type = ACPI_TYPE_ANY;
+		walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
+		    ANOBJ_METHOD_LOCAL;
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_delete_all
@@ -149,26 +136,25 @@ acpi_ds_method_data_init (
  *
  ******************************************************************************/
 
-void
-acpi_ds_method_data_delete_all (
-	struct acpi_walk_state          *walk_state)
+void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
 {
-	u32                             index;
-
-
-	ACPI_FUNCTION_TRACE ("ds_method_data_delete_all");
+	u32 index;
 
+	ACPI_FUNCTION_TRACE("ds_method_data_delete_all");
 
 	/* Detach the locals */
 
 	for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
 		if (walk_state->local_variables[index].object) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
-					index, walk_state->local_variables[index].object));
+			ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
+					  index,
+					  walk_state->local_variables[index].
+					  object));
 
 			/* Detach object (if present) and remove a reference */
 
-			acpi_ns_detach_object (&walk_state->local_variables[index]);
+			acpi_ns_detach_object(&walk_state->
+					      local_variables[index]);
 		}
 	}
 
@@ -176,19 +162,19 @@ acpi_ds_method_data_delete_all (
 
 	for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
 		if (walk_state->arguments[index].object) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
-					index, walk_state->arguments[index].object));
+			ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
+					  index,
+					  walk_state->arguments[index].object));
 
 			/* Detach object (if present) and remove a reference */
 
-			acpi_ns_detach_object (&walk_state->arguments[index]);
+			acpi_ns_detach_object(&walk_state->arguments[index]);
 		}
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_init_args
@@ -206,47 +192,44 @@ acpi_ds_method_data_delete_all (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_init_args (
-	union acpi_operand_object       **params,
-	u32                             max_param_count,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_init_args(union acpi_operand_object **params,
+			      u32 max_param_count,
+			      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	u32                             index = 0;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_method_data_init_args", params);
+	acpi_status status;
+	u32 index = 0;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params);
 
 	if (!params) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
-		return_ACPI_STATUS (AE_OK);
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "No param list passed to method\n"));
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Copy passed parameters into the new method stack frame */
 
 	while ((index < ACPI_METHOD_NUM_ARGS) &&
-		   (index < max_param_count)      &&
-			params[index]) {
+	       (index < max_param_count) && params[index]) {
 		/*
 		 * A valid parameter.
 		 * Store the argument in the method/walk descriptor.
 		 * Do not copy the arg in order to implement call by reference
 		 */
-		status = acpi_ds_method_data_set_value (AML_ARG_OP, index,
-				 params[index], walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ds_method_data_set_value(AML_ARG_OP, index,
+						       params[index],
+						       walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		index++;
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", index));
-	return_ACPI_STATUS (AE_OK);
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%d args passed to method\n", index));
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_get_node
@@ -263,14 +246,12 @@ acpi_ds_method_data_init_args (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_node (
-	u16                             opcode,
-	u32                             index,
-	struct acpi_walk_state          *walk_state,
-	struct acpi_namespace_node      **node)
+acpi_ds_method_data_get_node(u16 opcode,
+			     u32 index,
+			     struct acpi_walk_state *walk_state,
+			     struct acpi_namespace_node **node)
 {
-	ACPI_FUNCTION_TRACE ("ds_method_data_get_node");
-
+	ACPI_FUNCTION_TRACE("ds_method_data_get_node");
 
 	/*
 	 * Method Locals and Arguments are supported
@@ -279,10 +260,10 @@ acpi_ds_method_data_get_node (
 	case AML_LOCAL_OP:
 
 		if (index > ACPI_METHOD_MAX_LOCAL) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Local index %d is invalid (max %d)\n",
-				index, ACPI_METHOD_MAX_LOCAL));
-			return_ACPI_STATUS (AE_AML_INVALID_INDEX);
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Local index %d is invalid (max %d)\n",
+					  index, ACPI_METHOD_MAX_LOCAL));
+			return_ACPI_STATUS(AE_AML_INVALID_INDEX);
 		}
 
 		/* Return a pointer to the pseudo-node */
@@ -293,10 +274,10 @@ acpi_ds_method_data_get_node (
 	case AML_ARG_OP:
 
 		if (index > ACPI_METHOD_MAX_ARG) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Arg index %d is invalid (max %d)\n",
-				index, ACPI_METHOD_MAX_ARG));
-			return_ACPI_STATUS (AE_AML_INVALID_INDEX);
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Arg index %d is invalid (max %d)\n",
+					  index, ACPI_METHOD_MAX_ARG));
+			return_ACPI_STATUS(AE_AML_INVALID_INDEX);
 		}
 
 		/* Return a pointer to the pseudo-node */
@@ -305,14 +286,14 @@ acpi_ds_method_data_get_node (
 		break;
 
 	default:
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
-		return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n",
+				  opcode));
+		return_ACPI_STATUS(AE_AML_BAD_OPCODE);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_set_value
@@ -330,29 +311,26 @@ acpi_ds_method_data_get_node (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_method_data_set_value (
-	u16                             opcode,
-	u32                             index,
-	union acpi_operand_object       *object,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_set_value(u16 opcode,
+			      u32 index,
+			      union acpi_operand_object *object,
+			      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-
+	acpi_status status;
+	struct acpi_namespace_node *node;
 
-	ACPI_FUNCTION_TRACE ("ds_method_data_set_value");
+	ACPI_FUNCTION_TRACE("ds_method_data_set_value");
 
-
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-		"new_obj %p Opcode %X, Refs=%d [%s]\n", object,
-		opcode, object->common.reference_count,
-		acpi_ut_get_type_name (object->common.type)));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "new_obj %p Opcode %X, Refs=%d [%s]\n", object,
+			  opcode, object->common.reference_count,
+			  acpi_ut_get_type_name(object->common.type)));
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -361,15 +339,14 @@ acpi_ds_method_data_set_value (
 	 * reference semantics of ACPI Control Method invocation.
 	 * (See ACPI specification 2.0_c)
 	 */
-	acpi_ut_add_reference (object);
+	acpi_ut_add_reference(object);
 
 	/* Install the object */
 
 	node->object = object;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_get_value
@@ -387,32 +364,30 @@ acpi_ds_method_data_set_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_value (
-	u16                             opcode,
-	u32                             index,
-	struct acpi_walk_state          *walk_state,
-	union acpi_operand_object       **dest_desc)
+acpi_ds_method_data_get_value(u16 opcode,
+			      u32 index,
+			      struct acpi_walk_state *walk_state,
+			      union acpi_operand_object **dest_desc)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	union acpi_operand_object       *object;
-
-
-	ACPI_FUNCTION_TRACE ("ds_method_data_get_value");
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	union acpi_operand_object *object;
 
+	ACPI_FUNCTION_TRACE("ds_method_data_get_value");
 
 	/* Validate the object descriptor */
 
 	if (!dest_desc) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Null object descriptor pointer\n"));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Get the object from the node */
@@ -433,9 +408,10 @@ acpi_ds_method_data_get_value (
 		/* If slack enabled, init the local_x/arg_x to an Integer of value zero */
 
 		if (acpi_gbl_enable_interpreter_slack) {
-			object = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+			object =
+			    acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 			if (!object) {
-				return_ACPI_STATUS (AE_NO_MEMORY);
+				return_ACPI_STATUS(AE_NO_MEMORY);
 			}
 
 			object->integer.value = 0;
@@ -444,27 +420,29 @@ acpi_ds_method_data_get_value (
 
 		/* Otherwise, return the error */
 
-		else switch (opcode) {
-		case AML_ARG_OP:
+		else
+			switch (opcode) {
+			case AML_ARG_OP:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Uninitialized Arg[%d] at node %p\n",
-				index, node));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Uninitialized Arg[%d] at node %p\n",
+						  index, node));
 
-			return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
+				return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
 
-		case AML_LOCAL_OP:
+			case AML_LOCAL_OP:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Uninitialized Local[%d] at node %p\n",
-				index, node));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Uninitialized Local[%d] at node %p\n",
+						  index, node));
 
-			return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
+				return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
 
-		default:
-			ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode));
-			return_ACPI_STATUS (AE_AML_INTERNAL);
-		}
+			default:
+				ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n",
+						   opcode));
+				return_ACPI_STATUS(AE_AML_INTERNAL);
+			}
 	}
 
 	/*
@@ -472,12 +450,11 @@ acpi_ds_method_data_get_value (
 	 * Return an additional reference to the object
 	 */
 	*dest_desc = object;
-	acpi_ut_add_reference (object);
+	acpi_ut_add_reference(object);
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_delete_value
@@ -494,29 +471,25 @@ acpi_ds_method_data_get_value (
  ******************************************************************************/
 
 static void
-acpi_ds_method_data_delete_value (
-	u16                             opcode,
-	u32                             index,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_delete_value(u16 opcode,
+				 u32 index, struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	union acpi_operand_object       *object;
-
-
-	ACPI_FUNCTION_TRACE ("ds_method_data_delete_value");
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	union acpi_operand_object *object;
 
+	ACPI_FUNCTION_TRACE("ds_method_data_delete_value");
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	if (ACPI_FAILURE(status)) {
 		return_VOID;
 	}
 
 	/* Get the associated object */
 
-	object = acpi_ns_get_attached_object (node);
+	object = acpi_ns_get_attached_object(node);
 
 	/*
 	 * Undefine the Arg or Local by setting its descriptor
@@ -526,19 +499,18 @@ acpi_ds_method_data_delete_value (
 	node->object = NULL;
 
 	if ((object) &&
-		(ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) {
+	    (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_OPERAND)) {
 		/*
 		 * There is a valid object.
 		 * Decrement the reference count by one to balance the
 		 * increment when the object was stored.
 		 */
-		acpi_ut_remove_reference (object);
+		acpi_ut_remove_reference(object);
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_store_object_to_local
@@ -557,40 +529,38 @@ acpi_ds_method_data_delete_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_store_object_to_local (
-	u16                             opcode,
-	u32                             index,
-	union acpi_operand_object       *obj_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_store_object_to_local(u16 opcode,
+			      u32 index,
+			      union acpi_operand_object *obj_desc,
+			      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	union acpi_operand_object       *current_obj_desc;
-	union acpi_operand_object       *new_obj_desc;
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	union acpi_operand_object *current_obj_desc;
+	union acpi_operand_object *new_obj_desc;
 
-
-	ACPI_FUNCTION_TRACE ("ds_store_object_to_local");
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
-		opcode, index, obj_desc));
+	ACPI_FUNCTION_TRACE("ds_store_object_to_local");
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
+			  opcode, index, obj_desc));
 
 	/* Parameter validation */
 
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	current_obj_desc = acpi_ns_get_attached_object (node);
+	current_obj_desc = acpi_ns_get_attached_object(node);
 	if (current_obj_desc == obj_desc) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
-			obj_desc));
-		return_ACPI_STATUS (status);
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p already installed!\n",
+				  obj_desc));
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -602,9 +572,11 @@ acpi_ds_store_object_to_local (
 	 */
 	new_obj_desc = obj_desc;
 	if (obj_desc->common.reference_count > 1) {
-		status = acpi_ut_copy_iobject_to_iobject (obj_desc, &new_obj_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc,
+						    walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
@@ -636,28 +608,36 @@ acpi_ds_store_object_to_local (
 			 * If we have a valid reference object that came from ref_of(),
 			 * do the indirect store
 			 */
-			if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
-				(current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
-				(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-						"Arg (%p) is an obj_ref(Node), storing in node %p\n",
-						new_obj_desc, current_obj_desc));
+			if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) ==
+			     ACPI_DESC_TYPE_OPERAND)
+			    && (current_obj_desc->common.type ==
+				ACPI_TYPE_LOCAL_REFERENCE)
+			    && (current_obj_desc->reference.opcode ==
+				AML_REF_OF_OP)) {
+				ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+						  "Arg (%p) is an obj_ref(Node), storing in node %p\n",
+						  new_obj_desc,
+						  current_obj_desc));
 
 				/*
 				 * Store this object to the Node (perform the indirect store)
 				 * NOTE: No implicit conversion is performed, as per the ACPI
 				 * specification rules on storing to Locals/Args.
 				 */
-				status = acpi_ex_store_object_to_node (new_obj_desc,
-						 current_obj_desc->reference.object, walk_state,
-						 ACPI_NO_IMPLICIT_CONVERSION);
+				status =
+				    acpi_ex_store_object_to_node(new_obj_desc,
+								 current_obj_desc->
+								 reference.
+								 object,
+								 walk_state,
+								 ACPI_NO_IMPLICIT_CONVERSION);
 
 				/* Remove local reference if we copied the object above */
 
 				if (new_obj_desc != obj_desc) {
-					acpi_ut_remove_reference (new_obj_desc);
+					acpi_ut_remove_reference(new_obj_desc);
 				}
-				return_ACPI_STATUS (status);
+				return_ACPI_STATUS(status);
 			}
 		}
 
@@ -665,7 +645,7 @@ acpi_ds_store_object_to_local (
 		 * Delete the existing object
 		 * before storing the new one
 		 */
-		acpi_ds_method_data_delete_value (opcode, index, walk_state);
+		acpi_ds_method_data_delete_value(opcode, index, walk_state);
 	}
 
 	/*
@@ -673,18 +653,19 @@ acpi_ds_store_object_to_local (
 	 * the descriptor for the Arg or Local.
 	 * (increments the object reference count by one)
 	 */
-	status = acpi_ds_method_data_set_value (opcode, index, new_obj_desc, walk_state);
+	status =
+	    acpi_ds_method_data_set_value(opcode, index, new_obj_desc,
+					  walk_state);
 
 	/* Remove local reference if we copied the object above */
 
 	if (new_obj_desc != obj_desc) {
-		acpi_ut_remove_reference (new_obj_desc);
+		acpi_ut_remove_reference(new_obj_desc);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
@@ -701,39 +682,33 @@ acpi_ds_store_object_to_local (
  ******************************************************************************/
 
 acpi_object_type
-acpi_ds_method_data_get_type (
-	u16                             opcode,
-	u32                             index,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_get_type(u16 opcode,
+			     u32 index, struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	union acpi_operand_object       *object;
-
-
-	ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	union acpi_operand_object *object;
 
+	ACPI_FUNCTION_TRACE("ds_method_data_get_type");
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-	if (ACPI_FAILURE (status)) {
-		return_VALUE ((ACPI_TYPE_NOT_FOUND));
+	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	if (ACPI_FAILURE(status)) {
+		return_VALUE((ACPI_TYPE_NOT_FOUND));
 	}
 
 	/* Get the object */
 
-	object = acpi_ns_get_attached_object (node);
+	object = acpi_ns_get_attached_object(node);
 	if (!object) {
 		/* Uninitialized local/arg, return TYPE_ANY */
 
-		return_VALUE (ACPI_TYPE_ANY);
+		return_VALUE(ACPI_TYPE_ANY);
 	}
 
 	/* Get the object type */
 
-	return_VALUE (ACPI_GET_OBJECT_TYPE (object));
+	return_VALUE(ACPI_GET_OBJECT_TYPE(object));
 }
 #endif
-
-

+ 157 - 172
drivers/acpi/dispatcher/dsobject.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
@@ -50,14 +49,12 @@
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dsobject")
+ACPI_MODULE_NAME("dsobject")
 
 static acpi_status
-acpi_ds_build_internal_object (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *op,
-	union acpi_operand_object       **obj_desc_ptr);
-
+acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
+			      union acpi_parse_object *op,
+			      union acpi_operand_object **obj_desc_ptr);
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
@@ -76,17 +73,14 @@ acpi_ds_build_internal_object (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_build_internal_object (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *op,
-	union acpi_operand_object       **obj_desc_ptr)
+acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
+			      union acpi_parse_object *op,
+			      union acpi_operand_object **obj_desc_ptr)
 {
-	union acpi_operand_object       *obj_desc;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ds_build_internal_object");
+	union acpi_operand_object *obj_desc;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ds_build_internal_object");
 
 	*obj_desc_ptr = NULL;
 	if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
@@ -96,40 +90,44 @@ acpi_ds_build_internal_object (
 		 * Otherwise, go ahead and look it up now
 		 */
 		if (!op->common.node) {
-			status = acpi_ns_lookup (walk_state->scope_info,
-					  op->common.value.string,
-					  ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-					  ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-					  NULL,
-					  (struct acpi_namespace_node **) &(op->common.node));
-
-			if (ACPI_FAILURE (status)) {
-				ACPI_REPORT_NSERROR (op->common.value.string, status);
-				return_ACPI_STATUS (status);
+			status = acpi_ns_lookup(walk_state->scope_info,
+						op->common.value.string,
+						ACPI_TYPE_ANY,
+						ACPI_IMODE_EXECUTE,
+						ACPI_NS_SEARCH_PARENT |
+						ACPI_NS_DONT_OPEN_SCOPE, NULL,
+						(struct acpi_namespace_node **)
+						&(op->common.node));
+
+			if (ACPI_FAILURE(status)) {
+				ACPI_REPORT_NSERROR(op->common.value.string,
+						    status);
+				return_ACPI_STATUS(status);
 			}
 		}
 	}
 
 	/* Create and init the internal ACPI object */
 
-	obj_desc = acpi_ut_create_internal_object (
-			 (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
+	obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
+						   (op->common.aml_opcode))->
+						  object_type);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
-	status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
-			 &obj_desc);
-	if (ACPI_FAILURE (status)) {
-		acpi_ut_remove_reference (obj_desc);
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode,
+					&obj_desc);
+	if (ACPI_FAILURE(status)) {
+		acpi_ut_remove_reference(obj_desc);
+		return_ACPI_STATUS(status);
 	}
 
 	*obj_desc_ptr = obj_desc;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_build_internal_buffer_obj
@@ -147,20 +145,17 @@ acpi_ds_build_internal_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_build_internal_buffer_obj (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *op,
-	u32                             buffer_length,
-	union acpi_operand_object       **obj_desc_ptr)
+acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
+				  union acpi_parse_object *op,
+				  u32 buffer_length,
+				  union acpi_operand_object **obj_desc_ptr)
 {
-	union acpi_parse_object         *arg;
-	union acpi_operand_object       *obj_desc;
-	union acpi_parse_object         *byte_list;
-	u32                             byte_list_length = 0;
-
-
-	ACPI_FUNCTION_TRACE ("ds_build_internal_buffer_obj");
+	union acpi_parse_object *arg;
+	union acpi_operand_object *obj_desc;
+	union acpi_parse_object *byte_list;
+	u32 byte_list_length = 0;
 
+	ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
 
 	obj_desc = *obj_desc_ptr;
 	if (obj_desc) {
@@ -168,14 +163,13 @@ acpi_ds_build_internal_buffer_obj (
 		 * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
 		 * The buffer object already exists (from the NS node)
 		 */
-	}
-	else {
+	} else {
 		/* Create a new buffer object */
 
-		obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+		obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
 		*obj_desc_ptr = obj_desc;
 		if (!obj_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 	}
 
@@ -184,16 +178,17 @@ acpi_ds_build_internal_buffer_obj (
 	 * individual bytes or a string initializer.  In either case, a
 	 * byte_list appears in the AML.
 	 */
-	arg = op->common.value.arg;         /* skip first arg */
+	arg = op->common.value.arg;	/* skip first arg */
 
 	byte_list = arg->named.next;
 	if (byte_list) {
 		if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Expecting bytelist, got AML opcode %X in op %p\n",
-				byte_list->common.aml_opcode, byte_list));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Expecting bytelist, got AML opcode %X in op %p\n",
+					  byte_list->common.aml_opcode,
+					  byte_list));
 
-			acpi_ut_remove_reference (obj_desc);
+			acpi_ut_remove_reference(obj_desc);
 			return (AE_TYPE);
 		}
 
@@ -214,31 +209,29 @@ acpi_ds_build_internal_buffer_obj (
 
 	if (obj_desc->buffer.length == 0) {
 		obj_desc->buffer.pointer = NULL;
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"Buffer defined with zero length in AML, creating\n"));
-	}
-	else {
-		obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE (
-				   obj_desc->buffer.length);
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Buffer defined with zero length in AML, creating\n"));
+	} else {
+		obj_desc->buffer.pointer =
+		    ACPI_MEM_CALLOCATE(obj_desc->buffer.length);
 		if (!obj_desc->buffer.pointer) {
-			acpi_ut_delete_object_desc (obj_desc);
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			acpi_ut_delete_object_desc(obj_desc);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/* Initialize buffer from the byte_list (if present) */
 
 		if (byte_list) {
-			ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->named.data,
-					  byte_list_length);
+			ACPI_MEMCPY(obj_desc->buffer.pointer,
+				    byte_list->named.data, byte_list_length);
 		}
 	}
 
 	obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
-	op->common.node = (struct acpi_namespace_node *) obj_desc;
-	return_ACPI_STATUS (AE_OK);
+	op->common.node = (struct acpi_namespace_node *)obj_desc;
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_build_internal_package_obj
@@ -256,28 +249,25 @@ acpi_ds_build_internal_buffer_obj (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_build_internal_package_obj (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *op,
-	u32                             package_length,
-	union acpi_operand_object       **obj_desc_ptr)
+acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
+				   union acpi_parse_object *op,
+				   u32 package_length,
+				   union acpi_operand_object **obj_desc_ptr)
 {
-	union acpi_parse_object         *arg;
-	union acpi_parse_object         *parent;
-	union acpi_operand_object       *obj_desc = NULL;
-	u32                             package_list_length;
-	acpi_status                     status = AE_OK;
-	u32                             i;
-
-
-	ACPI_FUNCTION_TRACE ("ds_build_internal_package_obj");
+	union acpi_parse_object *arg;
+	union acpi_parse_object *parent;
+	union acpi_operand_object *obj_desc = NULL;
+	u32 package_list_length;
+	acpi_status status = AE_OK;
+	u32 i;
 
+	ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
 
 	/* Find the parent of a possibly nested package */
 
 	parent = op->common.parent;
-	while ((parent->common.aml_opcode == AML_PACKAGE_OP)    ||
-		   (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
+	while ((parent->common.aml_opcode == AML_PACKAGE_OP) ||
+	       (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
 		parent = parent->common.parent;
 	}
 
@@ -287,12 +277,11 @@ acpi_ds_build_internal_package_obj (
 		 * We are evaluating a Named package object "Name (xxxx, Package)".
 		 * Get the existing package object from the NS node
 		 */
-	}
-	else {
-		obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
+	} else {
+		obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
 		*obj_desc_ptr = obj_desc;
 		if (!obj_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		obj_desc->package.node = parent->common.node;
@@ -323,12 +312,13 @@ acpi_ds_build_internal_package_obj (
 	 * individual objects). Add an extra pointer slot so
 	 * that the list is always null terminated.
 	 */
-	obj_desc->package.elements = ACPI_MEM_CALLOCATE (
-			 ((acpi_size) obj_desc->package.count + 1) * sizeof (void *));
+	obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc->
+							 package.count +
+							 1) * sizeof(void *));
 
 	if (!obj_desc->package.elements) {
-		acpi_ut_delete_object_desc (obj_desc);
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		acpi_ut_delete_object_desc(obj_desc);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/*
@@ -342,11 +332,13 @@ acpi_ds_build_internal_package_obj (
 			/* Object (package or buffer) is already built */
 
 			obj_desc->package.elements[i] =
-				ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
-		}
-		else {
-			status = acpi_ds_build_internal_object (walk_state, arg,
-					 &obj_desc->package.elements[i]);
+			    ACPI_CAST_PTR(union acpi_operand_object,
+					  arg->common.node);
+		} else {
+			status = acpi_ds_build_internal_object(walk_state, arg,
+							       &obj_desc->
+							       package.
+							       elements[i]);
 		}
 
 		i++;
@@ -354,11 +346,10 @@ acpi_ds_build_internal_package_obj (
 	}
 
 	obj_desc->package.flags |= AOPOBJ_DATA_VALID;
-	op->common.node = (struct acpi_namespace_node *) obj_desc;
-	return_ACPI_STATUS (status);
+	op->common.node = (struct acpi_namespace_node *)obj_desc;
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_node
@@ -374,57 +365,53 @@ acpi_ds_build_internal_package_obj (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_node (
-	struct acpi_walk_state          *walk_state,
-	struct acpi_namespace_node      *node,
-	union acpi_parse_object         *op)
+acpi_ds_create_node(struct acpi_walk_state *walk_state,
+		    struct acpi_namespace_node *node,
+		    union acpi_parse_object *op)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_create_node", op);
+	acpi_status status;
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_create_node", op);
 
 	/*
 	 * Because of the execution pass through the non-control-method
 	 * parts of the table, we can arrive here twice.  Only init
 	 * the named object node the first time through
 	 */
-	if (acpi_ns_get_attached_object (node)) {
-		return_ACPI_STATUS (AE_OK);
+	if (acpi_ns_get_attached_object(node)) {
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	if (!op->common.value.arg) {
 		/* No arguments, there is nothing to do */
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Build an internal object for the argument(s) */
 
-	status = acpi_ds_build_internal_object (walk_state, op->common.value.arg,
-			 &obj_desc);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ds_build_internal_object(walk_state, op->common.value.arg,
+					       &obj_desc);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Re-type the object according to its argument */
 
-	node->type = ACPI_GET_OBJECT_TYPE (obj_desc);
+	node->type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
 	/* Attach obj to node */
 
-	status = acpi_ns_attach_object (node, obj_desc, node->type);
+	status = acpi_ns_attach_object(node, obj_desc, node->type);
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 
-#endif /* ACPI_NO_METHOD_EXECUTION */
-
+#endif				/* ACPI_NO_METHOD_EXECUTION */
 
 /*******************************************************************************
  *
@@ -444,55 +431,50 @@ acpi_ds_create_node (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_init_object_from_op (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *op,
-	u16                             opcode,
-	union acpi_operand_object       **ret_obj_desc)
+acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
+			    union acpi_parse_object *op,
+			    u16 opcode,
+			    union acpi_operand_object **ret_obj_desc)
 {
-	const struct acpi_opcode_info   *op_info;
-	union acpi_operand_object       *obj_desc;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ds_init_object_from_op");
+	const struct acpi_opcode_info *op_info;
+	union acpi_operand_object *obj_desc;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ds_init_object_from_op");
 
 	obj_desc = *ret_obj_desc;
-	op_info = acpi_ps_get_opcode_info (opcode);
+	op_info = acpi_ps_get_opcode_info(opcode);
 	if (op_info->class == AML_CLASS_UNKNOWN) {
 		/* Unknown opcode */
 
-		return_ACPI_STATUS (AE_TYPE);
+		return_ACPI_STATUS(AE_TYPE);
 	}
 
 	/* Perform per-object initialization */
 
-	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 	case ACPI_TYPE_BUFFER:
 
 		/*
 		 * Defer evaluation of Buffer term_arg operand
 		 */
-		obj_desc->buffer.node     = (struct acpi_namespace_node *)
-				   walk_state->operands[0];
+		obj_desc->buffer.node = (struct acpi_namespace_node *)
+		    walk_state->operands[0];
 		obj_desc->buffer.aml_start = op->named.data;
 		obj_desc->buffer.aml_length = op->named.length;
 		break;
 
-
 	case ACPI_TYPE_PACKAGE:
 
 		/*
 		 * Defer evaluation of Package term_arg operand
 		 */
-		obj_desc->package.node     = (struct acpi_namespace_node *)
-				   walk_state->operands[0];
+		obj_desc->package.node = (struct acpi_namespace_node *)
+		    walk_state->operands[0];
 		obj_desc->package.aml_start = op->named.data;
 		obj_desc->package.aml_length = op->named.length;
 		break;
 
-
 	case ACPI_TYPE_INTEGER:
 
 		switch (op_info->type) {
@@ -525,7 +507,7 @@ acpi_ds_init_object_from_op (
 				/* Truncate value if we are executing from a 32-bit ACPI table */
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-				acpi_ex_truncate_for32bit_table (obj_desc);
+				acpi_ex_truncate_for32bit_table(obj_desc);
 #endif
 				break;
 
@@ -536,36 +518,36 @@ acpi_ds_init_object_from_op (
 
 			default:
 
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Unknown constant opcode %X\n", opcode));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Unknown constant opcode %X\n",
+						  opcode));
 				status = AE_AML_OPERAND_TYPE;
 				break;
 			}
 			break;
 
-
 		case AML_TYPE_LITERAL:
 
 			obj_desc->integer.value = op->common.value.integer;
 #ifndef ACPI_NO_METHOD_EXECUTION
-			acpi_ex_truncate_for32bit_table (obj_desc);
+			acpi_ex_truncate_for32bit_table(obj_desc);
 #endif
 			break;
 
-
 		default:
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
-				op_info->type));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Unknown Integer type %X\n",
+					  op_info->type));
 			status = AE_AML_OPERAND_TYPE;
 			break;
 		}
 		break;
 
-
 	case ACPI_TYPE_STRING:
 
 		obj_desc->string.pointer = op->common.value.string;
-		obj_desc->string.length = (u32) ACPI_STRLEN (op->common.value.string);
+		obj_desc->string.length =
+		    (u32) ACPI_STRLEN(op->common.value.string);
 
 		/*
 		 * The string is contained in the ACPI table, don't ever try
@@ -574,11 +556,9 @@ acpi_ds_init_object_from_op (
 		obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
 		break;
 
-
 	case ACPI_TYPE_METHOD:
 		break;
 
-
 	case ACPI_TYPE_LOCAL_REFERENCE:
 
 		switch (op_info->type) {
@@ -590,14 +570,17 @@ acpi_ds_init_object_from_op (
 			obj_desc->reference.offset = opcode - AML_LOCAL_OP;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-			status = acpi_ds_method_data_get_node (AML_LOCAL_OP,
-					 obj_desc->reference.offset,
-					 walk_state,
-					 (struct acpi_namespace_node **) &obj_desc->reference.object);
+			status = acpi_ds_method_data_get_node(AML_LOCAL_OP,
+							      obj_desc->
+							      reference.offset,
+							      walk_state,
+							      (struct
+							       acpi_namespace_node
+							       **)&obj_desc->
+							      reference.object);
 #endif
 			break;
 
-
 		case AML_TYPE_METHOD_ARGUMENT:
 
 			/* Split the opcode into a base opcode + offset */
@@ -606,14 +589,18 @@ acpi_ds_init_object_from_op (
 			obj_desc->reference.offset = opcode - AML_ARG_OP;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-			status = acpi_ds_method_data_get_node (AML_ARG_OP,
-					 obj_desc->reference.offset,
-					 walk_state,
-					 (struct acpi_namespace_node **) &obj_desc->reference.object);
+			status = acpi_ds_method_data_get_node(AML_ARG_OP,
+							      obj_desc->
+							      reference.offset,
+							      walk_state,
+							      (struct
+							       acpi_namespace_node
+							       **)&obj_desc->
+							      reference.object);
 #endif
 			break;
 
-		default: /* Other literals, etc.. */
+		default:	/* Other literals, etc.. */
 
 			if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
 				/* Node was saved in Op */
@@ -626,17 +613,15 @@ acpi_ds_init_object_from_op (
 		}
 		break;
 
-
 	default:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
-			ACPI_GET_OBJECT_TYPE (obj_desc)));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unimplemented data type: %X\n",
+				  ACPI_GET_OBJECT_TYPE(obj_desc)));
 
 		status = AE_AML_OPERAND_TYPE;
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 262 - 296
drivers/acpi/dispatcher/dsopcode.c


+ 203 - 218
drivers/acpi/dispatcher/dsutils.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
@@ -51,8 +50,7 @@
 #include <acpi/acdebug.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dsutils")
-
+ACPI_MODULE_NAME("dsutils")
 
 /*******************************************************************************
  *
@@ -68,13 +66,9 @@
  *              parent method exits.)
  *
  ******************************************************************************/
-
-void
-acpi_ds_clear_implicit_return (
-	struct acpi_walk_state          *walk_state)
+void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state)
 {
-	ACPI_FUNCTION_NAME ("ds_clear_implicit_return");
-
+	ACPI_FUNCTION_NAME("ds_clear_implicit_return");
 
 	/*
 	 * Slack must be enabled for this feature
@@ -89,16 +83,15 @@ acpi_ds_clear_implicit_return (
 		 * complex statements, the implicit return value can be
 		 * bubbled up several levels.
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-			"Removing reference on stale implicit return obj %p\n",
-			walk_state->implicit_return_obj));
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "Removing reference on stale implicit return obj %p\n",
+				  walk_state->implicit_return_obj));
 
-		acpi_ut_remove_reference (walk_state->implicit_return_obj);
+		acpi_ut_remove_reference(walk_state->implicit_return_obj);
 		walk_state->implicit_return_obj = NULL;
 	}
 }
 
-
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
  *
@@ -119,27 +112,22 @@ acpi_ds_clear_implicit_return (
  ******************************************************************************/
 
 u8
-acpi_ds_do_implicit_return (
-	union acpi_operand_object       *return_desc,
-	struct acpi_walk_state          *walk_state,
-	u8                              add_reference)
+acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
+			   struct acpi_walk_state *walk_state, u8 add_reference)
 {
-	ACPI_FUNCTION_NAME ("ds_do_implicit_return");
-
+	ACPI_FUNCTION_NAME("ds_do_implicit_return");
 
 	/*
 	 * Slack must be enabled for this feature, and we must
 	 * have a valid return object
 	 */
-	if ((!acpi_gbl_enable_interpreter_slack) ||
-		(!return_desc)) {
+	if ((!acpi_gbl_enable_interpreter_slack) || (!return_desc)) {
 		return (FALSE);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-			"Result %p will be implicitly returned; Prev=%p\n",
-			return_desc,
-			walk_state->implicit_return_obj));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "Result %p will be implicitly returned; Prev=%p\n",
+			  return_desc, walk_state->implicit_return_obj));
 
 	/*
 	 * Delete any "stale" implicit return value first. However, in
@@ -151,20 +139,19 @@ acpi_ds_do_implicit_return (
 		if (walk_state->implicit_return_obj == return_desc) {
 			return (TRUE);
 		}
-		acpi_ds_clear_implicit_return (walk_state);
+		acpi_ds_clear_implicit_return(walk_state);
 	}
 
 	/* Save the implicit return value, add a reference if requested */
 
 	walk_state->implicit_return_obj = return_desc;
 	if (add_reference) {
-		acpi_ut_add_reference (return_desc);
+		acpi_ut_add_reference(return_desc);
 	}
 
 	return (TRUE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_is_result_used
@@ -179,20 +166,18 @@ acpi_ds_do_implicit_return (
  ******************************************************************************/
 
 u8
-acpi_ds_is_result_used (
-	union acpi_parse_object         *op,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_is_result_used(union acpi_parse_object * op,
+		       struct acpi_walk_state * walk_state)
 {
-	const struct acpi_opcode_info   *parent_info;
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_is_result_used", op);
+	const struct acpi_opcode_info *parent_info;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op);
 
 	/* Must have both an Op and a Result Object */
 
 	if (!op) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
-		return_VALUE (TRUE);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
+		return_VALUE(TRUE);
 	}
 
 	/*
@@ -204,7 +189,8 @@ acpi_ds_is_result_used (
 	 * NOTE: this is optional because the ASL language does not actually
 	 * support this behavior.
 	 */
-	(void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
+	(void)acpi_ds_do_implicit_return(walk_state->result_obj, walk_state,
+					 TRUE);
 
 	/*
 	 * Now determine if the parent will use the result
@@ -215,22 +201,24 @@ acpi_ds_is_result_used (
 	 * via execute_control_method has a scope_op as the parent.
 	 */
 	if ((!op->common.parent) ||
-		(op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
+	    (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
 		/* No parent, the return value cannot possibly be used */
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-			"At Method level, result of [%s] not used\n",
-			acpi_ps_get_opcode_name (op->common.aml_opcode)));
-		return_VALUE (FALSE);
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "At Method level, result of [%s] not used\n",
+				  acpi_ps_get_opcode_name(op->common.
+							  aml_opcode)));
+		return_VALUE(FALSE);
 	}
 
 	/* Get info on the parent. The root_op is AML_SCOPE */
 
-	parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
+	parent_info =
+	    acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
 	if (parent_info->class == AML_CLASS_UNKNOWN) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Unknown parent opcode. Op=%p\n", op));
-		return_VALUE (FALSE);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unknown parent opcode. Op=%p\n", op));
+		return_VALUE(FALSE);
 	}
 
 	/*
@@ -256,8 +244,10 @@ acpi_ds_is_result_used (
 			 * If we are executing the predicate AND this is the predicate op,
 			 * we will use the return value
 			 */
-			if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) &&
-				(walk_state->control_state->control.predicate_op == op)) {
+			if ((walk_state->control_state->common.state ==
+			     ACPI_CONTROL_PREDICATE_EXECUTING)
+			    && (walk_state->control_state->control.
+				predicate_op == op)) {
 				goto result_used;
 			}
 			break;
@@ -271,7 +261,6 @@ acpi_ds_is_result_used (
 
 		goto result_not_used;
 
-
 	case AML_CLASS_CREATE:
 
 		/*
@@ -280,15 +269,16 @@ acpi_ds_is_result_used (
 		 */
 		goto result_used;
 
-
 	case AML_CLASS_NAMED_OBJECT:
 
-		if ((op->common.parent->common.aml_opcode == AML_REGION_OP)      ||
-			(op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
-			(op->common.parent->common.aml_opcode == AML_PACKAGE_OP)     ||
-			(op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) ||
-			(op->common.parent->common.aml_opcode == AML_BUFFER_OP)      ||
-			(op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) {
+		if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
+		    (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP)
+		    || (op->common.parent->common.aml_opcode == AML_PACKAGE_OP)
+		    || (op->common.parent->common.aml_opcode ==
+			AML_VAR_PACKAGE_OP)
+		    || (op->common.parent->common.aml_opcode == AML_BUFFER_OP)
+		    || (op->common.parent->common.aml_opcode ==
+			AML_INT_EVAL_SUBTREE_OP)) {
 			/*
 			 * These opcodes allow term_arg(s) as operands and therefore
 			 * the operands can be method calls.  The result is used.
@@ -298,7 +288,6 @@ acpi_ds_is_result_used (
 
 		goto result_not_used;
 
-
 	default:
 
 		/*
@@ -308,26 +297,25 @@ acpi_ds_is_result_used (
 		goto result_used;
 	}
 
+      result_used:
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "Result of [%s] used by Parent [%s] Op=%p\n",
+			  acpi_ps_get_opcode_name(op->common.aml_opcode),
+			  acpi_ps_get_opcode_name(op->common.parent->common.
+						  aml_opcode), op));
 
-result_used:
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"Result of [%s] used by Parent [%s] Op=%p\n",
-		acpi_ps_get_opcode_name (op->common.aml_opcode),
-		acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
-
-	return_VALUE (TRUE);
-
+	return_VALUE(TRUE);
 
-result_not_used:
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"Result of [%s] not used by Parent [%s] Op=%p\n",
-		acpi_ps_get_opcode_name (op->common.aml_opcode),
-		acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
+      result_not_used:
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "Result of [%s] not used by Parent [%s] Op=%p\n",
+			  acpi_ps_get_opcode_name(op->common.aml_opcode),
+			  acpi_ps_get_opcode_name(op->common.parent->common.
+						  aml_opcode), op));
 
-	return_VALUE (FALSE);
+	return_VALUE(FALSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_delete_result_if_not_used
@@ -346,20 +334,17 @@ result_not_used:
  ******************************************************************************/
 
 void
-acpi_ds_delete_result_if_not_used (
-	union acpi_parse_object         *op,
-	union acpi_operand_object       *result_obj,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
+				  union acpi_operand_object *result_obj,
+				  struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *obj_desc;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_delete_result_if_not_used", result_obj);
+	union acpi_operand_object *obj_desc;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
 
 	if (!op) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
 		return_VOID;
 	}
 
@@ -367,19 +352,18 @@ acpi_ds_delete_result_if_not_used (
 		return_VOID;
 	}
 
-	if (!acpi_ds_is_result_used (op, walk_state)) {
+	if (!acpi_ds_is_result_used(op, walk_state)) {
 		/* Must pop the result stack (obj_desc should be equal to result_obj) */
 
-		status = acpi_ds_result_pop (&obj_desc, walk_state);
-		if (ACPI_SUCCESS (status)) {
-			acpi_ut_remove_reference (result_obj);
+		status = acpi_ds_result_pop(&obj_desc, walk_state);
+		if (ACPI_SUCCESS(status)) {
+			acpi_ut_remove_reference(result_obj);
 		}
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_resolve_operands
@@ -394,16 +378,12 @@ acpi_ds_delete_result_if_not_used (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_resolve_operands (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)
 {
-	u32                             i;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_resolve_operands", walk_state);
+	u32 i;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state);
 
 	/*
 	 * Attempt to resolve each of the valid operands
@@ -411,16 +391,17 @@ acpi_ds_resolve_operands (
 	 * that the actual objects are passed, not copies of the objects.
 	 */
 	for (i = 0; i < walk_state->num_operands; i++) {
-		status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ex_resolve_to_value(&walk_state->operands[i],
+					     walk_state);
+		if (ACPI_FAILURE(status)) {
 			break;
 		}
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_clear_operands
@@ -433,15 +414,11 @@ acpi_ds_resolve_operands (
  *
  ******************************************************************************/
 
-void
-acpi_ds_clear_operands (
-	struct acpi_walk_state          *walk_state)
+void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
 {
-	u32                             i;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state);
+	u32 i;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state);
 
 	/* Remove a reference on each operand on the stack */
 
@@ -450,7 +427,7 @@ acpi_ds_clear_operands (
 		 * Remove a reference to all operands, including both
 		 * "Arguments" and "Targets".
 		 */
-		acpi_ut_remove_reference (walk_state->operands[i]);
+		acpi_ut_remove_reference(walk_state->operands[i]);
 		walk_state->operands[i] = NULL;
 	}
 
@@ -459,7 +436,6 @@ acpi_ds_clear_operands (
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_operand
@@ -478,37 +454,36 @@ acpi_ds_clear_operands (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_operand (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *arg,
-	u32                             arg_index)
+acpi_ds_create_operand(struct acpi_walk_state *walk_state,
+		       union acpi_parse_object *arg, u32 arg_index)
 {
-	acpi_status                     status = AE_OK;
-	char                            *name_string;
-	u32                             name_length;
-	union acpi_operand_object       *obj_desc;
-	union acpi_parse_object         *parent_op;
-	u16                             opcode;
-	acpi_interpreter_mode           interpreter_mode;
-	const struct acpi_opcode_info   *op_info;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_create_operand", arg);
+	acpi_status status = AE_OK;
+	char *name_string;
+	u32 name_length;
+	union acpi_operand_object *obj_desc;
+	union acpi_parse_object *parent_op;
+	u16 opcode;
+	acpi_interpreter_mode interpreter_mode;
+	const struct acpi_opcode_info *op_info;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg);
 
 	/* A valid name must be looked up in the namespace */
 
 	if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
-		(arg->common.value.string)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg));
+	    (arg->common.value.string)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n",
+				  arg));
 
 		/* Get the entire name string from the AML stream */
 
-		status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer,
-				  &name_string, &name_length);
+		status =
+		    acpi_ex_get_name_string(ACPI_TYPE_ANY,
+					    arg->common.value.buffer,
+					    &name_string, &name_length);
 
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/* All prefixes have been handled, and the name is in name_string */
@@ -523,13 +498,14 @@ acpi_ds_create_operand (
 		 * actual opcode exists.
 		 */
 		if ((walk_state->deferred_node) &&
-			(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
-			(arg_index != 0)) {
-			obj_desc = ACPI_CAST_PTR (
-					 union acpi_operand_object, walk_state->deferred_node);
+		    (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
+		    && (arg_index != 0)) {
+			obj_desc =
+			    ACPI_CAST_PTR(union acpi_operand_object,
+					  walk_state->deferred_node);
 			status = AE_OK;
-		}
-		else    /* All other opcodes */ {
+		} else {	/* All other opcodes */
+
 			/*
 			 * Differentiate between a namespace "create" operation
 			 * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
@@ -537,43 +513,51 @@ acpi_ds_create_operand (
 			 * namespace objects during the execution of control methods.
 			 */
 			parent_op = arg->common.parent;
-			op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode);
-			if ((op_info->flags & AML_NSNODE) &&
-				(parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) &&
-				(parent_op->common.aml_opcode != AML_REGION_OP) &&
-				(parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) {
+			op_info =
+			    acpi_ps_get_opcode_info(parent_op->common.
+						    aml_opcode);
+			if ((op_info->flags & AML_NSNODE)
+			    && (parent_op->common.aml_opcode !=
+				AML_INT_METHODCALL_OP)
+			    && (parent_op->common.aml_opcode != AML_REGION_OP)
+			    && (parent_op->common.aml_opcode !=
+				AML_INT_NAMEPATH_OP)) {
 				/* Enter name into namespace if not found */
 
 				interpreter_mode = ACPI_IMODE_LOAD_PASS2;
-			}
-			else {
+			} else {
 				/* Return a failure if name not found */
 
 				interpreter_mode = ACPI_IMODE_EXECUTE;
 			}
 
-			status = acpi_ns_lookup (walk_state->scope_info, name_string,
-					 ACPI_TYPE_ANY, interpreter_mode,
-					 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-					 walk_state,
-					 ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &obj_desc));
+			status =
+			    acpi_ns_lookup(walk_state->scope_info, name_string,
+					   ACPI_TYPE_ANY, interpreter_mode,
+					   ACPI_NS_SEARCH_PARENT |
+					   ACPI_NS_DONT_OPEN_SCOPE, walk_state,
+					   ACPI_CAST_INDIRECT_PTR(struct
+								  acpi_namespace_node,
+								  &obj_desc));
 			/*
 			 * The only case where we pass through (ignore) a NOT_FOUND
 			 * error is for the cond_ref_of opcode.
 			 */
 			if (status == AE_NOT_FOUND) {
-				if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) {
+				if (parent_op->common.aml_opcode ==
+				    AML_COND_REF_OF_OP) {
 					/*
 					 * For the Conditional Reference op, it's OK if
 					 * the name is not found;  We just need a way to
 					 * indicate this to the interpreter, set the
 					 * object to the root
 					 */
-					obj_desc = ACPI_CAST_PTR (
-							 union acpi_operand_object, acpi_gbl_root_node);
+					obj_desc =
+					    ACPI_CAST_PTR(union
+							  acpi_operand_object,
+							  acpi_gbl_root_node);
 					status = AE_OK;
-				}
-				else {
+				} else {
 					/*
 					 * We just plain didn't find it -- which is a
 					 * very serious error at this point
@@ -582,30 +566,30 @@ acpi_ds_create_operand (
 				}
 			}
 
-			if (ACPI_FAILURE (status)) {
-				ACPI_REPORT_NSERROR (name_string, status);
+			if (ACPI_FAILURE(status)) {
+				ACPI_REPORT_NSERROR(name_string, status);
 			}
 		}
 
 		/* Free the namestring created above */
 
-		ACPI_MEM_FREE (name_string);
+		ACPI_MEM_FREE(name_string);
 
 		/* Check status from the lookup */
 
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/* Put the resulting object onto the current object stack */
 
-		status = acpi_ds_obj_stack_push (obj_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ds_obj_stack_push(obj_desc, walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
-		ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
-	}
-	else {
+		ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
+				   (obj_desc, walk_state));
+	} else {
 		/* Check for null name case */
 
 		if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
@@ -615,77 +599,83 @@ acpi_ds_create_operand (
 			 * in the original ASL.  Create a Zero Constant for a
 			 * placeholder.  (Store to a constant is a Noop.)
 			 */
-			opcode = AML_ZERO_OP;       /* Has no arguments! */
+			opcode = AML_ZERO_OP;	/* Has no arguments! */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-				"Null namepath: Arg=%p\n", arg));
-		}
-		else {
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "Null namepath: Arg=%p\n", arg));
+		} else {
 			opcode = arg->common.aml_opcode;
 		}
 
 		/* Get the object type of the argument */
 
-		op_info = acpi_ps_get_opcode_info (opcode);
+		op_info = acpi_ps_get_opcode_info(opcode);
 		if (op_info->object_type == ACPI_TYPE_INVALID) {
-			return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+			return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
 		}
 
 		if (op_info->flags & AML_HAS_RETVAL) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-				"Argument previously created, already stacked \n"));
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "Argument previously created, already stacked \n"));
 
-			ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (
-				walk_state->operands [walk_state->num_operands - 1], walk_state));
+			ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
+					   (walk_state->
+					    operands[walk_state->num_operands -
+						     1], walk_state));
 
 			/*
 			 * Use value that was already previously returned
 			 * by the evaluation of this argument
 			 */
-			status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_ds_result_pop_from_bottom(&obj_desc,
+							   walk_state);
+			if (ACPI_FAILURE(status)) {
 				/*
 				 * Only error is underflow, and this indicates
 				 * a missing or null operand!
 				 */
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Missing or null operand, %s\n",
-					acpi_format_exception (status)));
-				return_ACPI_STATUS (status);
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Missing or null operand, %s\n",
+						  acpi_format_exception
+						  (status)));
+				return_ACPI_STATUS(status);
 			}
-		}
-		else {
+		} else {
 			/* Create an ACPI_INTERNAL_OBJECT for the argument */
 
-			obj_desc = acpi_ut_create_internal_object (op_info->object_type);
+			obj_desc =
+			    acpi_ut_create_internal_object(op_info->
+							   object_type);
 			if (!obj_desc) {
-				return_ACPI_STATUS (AE_NO_MEMORY);
+				return_ACPI_STATUS(AE_NO_MEMORY);
 			}
 
 			/* Initialize the new object */
 
-			status = acpi_ds_init_object_from_op (
-					 walk_state, arg, opcode, &obj_desc);
-			if (ACPI_FAILURE (status)) {
-				acpi_ut_delete_object_desc (obj_desc);
-				return_ACPI_STATUS (status);
+			status =
+			    acpi_ds_init_object_from_op(walk_state, arg, opcode,
+							&obj_desc);
+			if (ACPI_FAILURE(status)) {
+				acpi_ut_delete_object_desc(obj_desc);
+				return_ACPI_STATUS(status);
 			}
 		}
 
 		/* Put the operand object on the object stack */
 
-		status = acpi_ds_obj_stack_push (obj_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ds_obj_stack_push(obj_desc, walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
-		ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
+		ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
+				   (obj_desc, walk_state));
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_operands
@@ -702,29 +692,27 @@ acpi_ds_create_operand (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_operands (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *first_arg)
+acpi_ds_create_operands(struct acpi_walk_state *walk_state,
+			union acpi_parse_object *first_arg)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_parse_object         *arg;
-	u32                             arg_count = 0;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_create_operands", first_arg);
+	acpi_status status = AE_OK;
+	union acpi_parse_object *arg;
+	u32 arg_count = 0;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg);
 
 	/* For all arguments in the list... */
 
 	arg = first_arg;
 	while (arg) {
-		status = acpi_ds_create_operand (walk_state, arg, arg_count);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ds_create_operand(walk_state, arg, arg_count);
+		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
-			arg_count, arg, first_arg));
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "Arg #%d (%p) done, Arg1=%p\n", arg_count,
+				  arg, first_arg));
 
 		/* Move on to next argument, if any */
 
@@ -732,20 +720,17 @@ acpi_ds_create_operands (
 		arg_count++;
 	}
 
-	return_ACPI_STATUS (status);
-
+	return_ACPI_STATUS(status);
 
-cleanup:
+      cleanup:
 	/*
 	 * We must undo everything done above; meaning that we must
 	 * pop everything off of the operand stack and delete those
 	 * objects
 	 */
-	(void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
+	(void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
-		(arg_count + 1), acpi_format_exception (status)));
-	return_ACPI_STATUS (status);
+	ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
+			  (arg_count + 1), acpi_format_exception(status)));
+	return_ACPI_STATUS(status);
 }
-
-

+ 269 - 250
drivers/acpi/dispatcher/dswexec.c

@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
@@ -52,27 +51,26 @@
 #include <acpi/acdebug.h>
 #include <acpi/acdisasm.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dswexec")
+ACPI_MODULE_NAME("dswexec")
 
 /*
  * Dispatch table for opcode classes
  */
-static ACPI_EXECUTE_OP      acpi_gbl_op_type_dispatch [] = {
-			  acpi_ex_opcode_0A_0T_1R,
-			  acpi_ex_opcode_1A_0T_0R,
-			  acpi_ex_opcode_1A_0T_1R,
-			  acpi_ex_opcode_1A_1T_0R,
-			  acpi_ex_opcode_1A_1T_1R,
-			  acpi_ex_opcode_2A_0T_0R,
-			  acpi_ex_opcode_2A_0T_1R,
-			  acpi_ex_opcode_2A_1T_1R,
-			  acpi_ex_opcode_2A_2T_1R,
-			  acpi_ex_opcode_3A_0T_0R,
-			  acpi_ex_opcode_3A_1T_1R,
-			  acpi_ex_opcode_6A_0T_1R};
-
+static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = {
+	acpi_ex_opcode_0A_0T_1R,
+	acpi_ex_opcode_1A_0T_0R,
+	acpi_ex_opcode_1A_0T_1R,
+	acpi_ex_opcode_1A_1T_0R,
+	acpi_ex_opcode_1A_1T_1R,
+	acpi_ex_opcode_2A_0T_0R,
+	acpi_ex_opcode_2A_0T_1R,
+	acpi_ex_opcode_2A_1T_1R,
+	acpi_ex_opcode_2A_2T_1R,
+	acpi_ex_opcode_3A_0T_0R,
+	acpi_ex_opcode_3A_1T_1R,
+	acpi_ex_opcode_6A_0T_1R
+};
 
 /*****************************************************************************
  *
@@ -88,64 +86,64 @@ static ACPI_EXECUTE_OP      acpi_gbl_op_type_dispatch [] = {
  ****************************************************************************/
 
 acpi_status
-acpi_ds_get_predicate_value (
-	struct acpi_walk_state          *walk_state,
-	union acpi_operand_object       *result_obj) {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *local_obj_desc = NULL;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_get_predicate_value", walk_state);
+acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
+			    union acpi_operand_object *result_obj)
+{
+	acpi_status status = AE_OK;
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *local_obj_desc = NULL;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state);
 
 	walk_state->control_state->common.state = 0;
 
 	if (result_obj) {
-		status = acpi_ds_result_pop (&obj_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Could not get result from predicate evaluation, %s\n",
-				acpi_format_exception (status)));
+		status = acpi_ds_result_pop(&obj_desc, walk_state);
+		if (ACPI_FAILURE(status)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Could not get result from predicate evaluation, %s\n",
+					  acpi_format_exception(status)));
 
-			return_ACPI_STATUS (status);
+			return_ACPI_STATUS(status);
 		}
-	}
-	else {
-		status = acpi_ds_create_operand (walk_state, walk_state->op, 0);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+	} else {
+		status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
-		status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ex_resolve_to_value(&walk_state->operands[0],
+					     walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
-		obj_desc = walk_state->operands [0];
+		obj_desc = walk_state->operands[0];
 	}
 
 	if (!obj_desc) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"No predicate obj_desc=%p State=%p\n",
-			obj_desc, walk_state));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "No predicate obj_desc=%p State=%p\n",
+				  obj_desc, walk_state));
 
-		return_ACPI_STATUS (AE_AML_NO_OPERAND);
+		return_ACPI_STATUS(AE_AML_NO_OPERAND);
 	}
 
 	/*
 	 * Result of predicate evaluation must be an Integer
 	 * object. Implicitly convert the argument if necessary.
 	 */
-	status = acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, 16);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, 16);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
-	if (ACPI_GET_OBJECT_TYPE (local_obj_desc) != ACPI_TYPE_INTEGER) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
-			obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc)));
+	if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
+				  obj_desc, walk_state,
+				  ACPI_GET_OBJECT_TYPE(obj_desc)));
 
 		status = AE_AML_OPERAND_TYPE;
 		goto cleanup;
@@ -153,7 +151,7 @@ acpi_ds_get_predicate_value (
 
 	/* Truncate the predicate to 32-bits if necessary */
 
-	acpi_ex_truncate_for32bit_table (local_obj_desc);
+	acpi_ex_truncate_for32bit_table(local_obj_desc);
 
 	/*
 	 * Save the result of the predicate evaluation on
@@ -161,8 +159,7 @@ acpi_ds_get_predicate_value (
 	 */
 	if (local_obj_desc->integer.value) {
 		walk_state->control_state->common.value = TRUE;
-	}
-	else {
+	} else {
 		/*
 		 * Predicate is FALSE, we will just toss the
 		 * rest of the package
@@ -171,30 +168,30 @@ acpi_ds_get_predicate_value (
 		status = AE_CTRL_FALSE;
 	}
 
+      cleanup:
 
-cleanup:
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
+			  walk_state->control_state->common.value,
+			  walk_state->op));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
-		walk_state->control_state->common.value, walk_state->op));
+	/* Break to debugger to display result */
 
-	 /* Break to debugger to display result */
-
-	ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (local_obj_desc, walk_state));
+	ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
+			   (local_obj_desc, walk_state));
 
 	/*
 	 * Delete the predicate result object (we know that
 	 * we don't need it anymore)
 	 */
 	if (local_obj_desc != obj_desc) {
-		acpi_ut_remove_reference (local_obj_desc);
+		acpi_ut_remove_reference(local_obj_desc);
 	}
-	acpi_ut_remove_reference (obj_desc);
+	acpi_ut_remove_reference(obj_desc);
 
 	walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*****************************************************************************
  *
  * FUNCTION:    acpi_ds_exec_begin_op
@@ -211,38 +208,39 @@ cleanup:
  ****************************************************************************/
 
 acpi_status
-acpi_ds_exec_begin_op (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         **out_op)
+acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
+		      union acpi_parse_object **out_op)
 {
-	union acpi_parse_object         *op;
-	acpi_status                     status = AE_OK;
-	u32                             opcode_class;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ds_exec_begin_op", walk_state);
+	union acpi_parse_object *op;
+	acpi_status status = AE_OK;
+	u32 opcode_class;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state);
 
 	op = walk_state->op;
 	if (!op) {
-		status = acpi_ds_load2_begin_op (walk_state, out_op);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ds_load2_begin_op(walk_state, out_op);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		op = *out_op;
 		walk_state->op = op;
 		walk_state->opcode = op->common.aml_opcode;
-		walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-
-		if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-				"(%s) Popping scope for Op %p\n",
-				acpi_ut_get_type_name (walk_state->op_info->object_type), op));
-
-			status = acpi_ds_scope_stack_pop (walk_state);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+		walk_state->op_info =
+		    acpi_ps_get_opcode_info(op->common.aml_opcode);
+
+		if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "(%s) Popping scope for Op %p\n",
+					  acpi_ut_get_type_name(walk_state->
+								op_info->
+								object_type),
+					  op));
+
+			status = acpi_ds_scope_stack_pop(walk_state);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
 	}
@@ -252,7 +250,7 @@ acpi_ds_exec_begin_op (
 			*out_op = op;
 		}
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/*
@@ -261,19 +259,20 @@ acpi_ds_exec_begin_op (
 	 * Save this knowledge in the current scope descriptor
 	 */
 	if ((walk_state->control_state) &&
-		(walk_state->control_state->common.state ==
-			ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
-				  op, walk_state));
+	    (walk_state->control_state->common.state ==
+	     ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Exec predicate Op=%p State=%p\n", op,
+				  walk_state));
 
-		walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING;
+		walk_state->control_state->common.state =
+		    ACPI_CONTROL_PREDICATE_EXECUTING;
 
 		/* Save start of predicate */
 
 		walk_state->control_state->control.predicate_op = op;
 	}
 
-
 	opcode_class = walk_state->op_info->class;
 
 	/* We want to send namepaths to the load code */
@@ -288,15 +287,14 @@ acpi_ds_exec_begin_op (
 	switch (opcode_class) {
 	case AML_CLASS_CONTROL:
 
-		status = acpi_ds_result_stack_push (walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ds_result_stack_push(walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
-		status = acpi_ds_exec_begin_control_op (walk_state, op);
+		status = acpi_ds_exec_begin_control_op(walk_state, op);
 		break;
 
-
 	case AML_CLASS_NAMED_OBJECT:
 
 		if (walk_state->walk_type == ACPI_WALK_METHOD) {
@@ -306,15 +304,14 @@ acpi_ds_exec_begin_op (
 			 * object is temporary and will be deleted upon completion of
 			 * the execution of this method.
 			 */
-			status = acpi_ds_load2_begin_op (walk_state, NULL);
+			status = acpi_ds_load2_begin_op(walk_state, NULL);
 		}
 
 		if (op->common.aml_opcode == AML_REGION_OP) {
-			status = acpi_ds_result_stack_push (walk_state);
+			status = acpi_ds_result_stack_push(walk_state);
 		}
 		break;
 
-
 	case AML_CLASS_EXECUTE:
 	case AML_CLASS_CREATE:
 
@@ -322,20 +319,18 @@ acpi_ds_exec_begin_op (
 		 * Most operators with arguments.
 		 * Start a new result/operand state
 		 */
-		status = acpi_ds_result_stack_push (walk_state);
+		status = acpi_ds_result_stack_push(walk_state);
 		break;
 
-
 	default:
 		break;
 	}
 
 	/* Nothing to do here during method execution */
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*****************************************************************************
  *
  * FUNCTION:    acpi_ds_exec_end_op
@@ -350,28 +345,25 @@ acpi_ds_exec_begin_op (
  *
  ****************************************************************************/
 
-acpi_status
-acpi_ds_exec_end_op (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 {
-	union acpi_parse_object         *op;
-	acpi_status                     status = AE_OK;
-	u32                             op_type;
-	u32                             op_class;
-	union acpi_parse_object         *next_op;
-	union acpi_parse_object         *first_arg;
+	union acpi_parse_object *op;
+	acpi_status status = AE_OK;
+	u32 op_type;
+	u32 op_class;
+	union acpi_parse_object *next_op;
+	union acpi_parse_object *first_arg;
 
+	ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
 
-	ACPI_FUNCTION_TRACE_PTR ("ds_exec_end_op", walk_state);
-
-
-	op      = walk_state->op;
+	op = walk_state->op;
 	op_type = walk_state->op_info->type;
 	op_class = walk_state->op_info->class;
 
 	if (op_class == AML_CLASS_UNKNOWN) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode));
-		return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
+				  op->common.aml_opcode));
+		return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
 	}
 
 	first_arg = op->common.value.arg;
@@ -384,29 +376,31 @@ acpi_ds_exec_end_op (
 
 	/* Call debugger for single step support (DEBUG build only) */
 
-	ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class));
-	ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
+	ACPI_DEBUGGER_EXEC(status =
+			   acpi_db_single_step(walk_state, op, op_class));
+	ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) {
+			   return_ACPI_STATUS(status);}
+	) ;
 
 	/* Decode the Opcode Class */
 
 	switch (op_class) {
-	case AML_CLASS_ARGUMENT:    /* constants, literals, etc. - do nothing */
+	case AML_CLASS_ARGUMENT:	/* constants, literals, etc. - do nothing */
 		break;
 
-
-	case AML_CLASS_EXECUTE:     /* most operators with arguments */
+	case AML_CLASS_EXECUTE:	/* most operators with arguments */
 
 		/* Build resolved operand stack */
 
-		status = acpi_ds_create_operands (walk_state, first_arg);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ds_create_operands(walk_state, first_arg);
+		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
 
 		/* Done with this result state (Now that operand stack is built) */
 
-		status = acpi_ds_result_stack_pop (walk_state);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ds_result_stack_pop(walk_state);
+		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
 
@@ -417,86 +411,93 @@ acpi_ds_exec_end_op (
 		if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
 			/* Resolve all operands */
 
-			status = acpi_ex_resolve_operands (walk_state->opcode,
-					 &(walk_state->operands [walk_state->num_operands -1]),
-					 walk_state);
-			if (ACPI_SUCCESS (status)) {
-				ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
-					acpi_ps_get_opcode_name (walk_state->opcode),
-					walk_state->num_operands, "after ex_resolve_operands");
+			status = acpi_ex_resolve_operands(walk_state->opcode,
+							  &(walk_state->
+							    operands
+							    [walk_state->
+							     num_operands - 1]),
+							  walk_state);
+			if (ACPI_SUCCESS(status)) {
+				ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
+						   ACPI_IMODE_EXECUTE,
+						   acpi_ps_get_opcode_name
+						   (walk_state->opcode),
+						   walk_state->num_operands,
+						   "after ex_resolve_operands");
 			}
 		}
 
-		if (ACPI_SUCCESS (status)) {
+		if (ACPI_SUCCESS(status)) {
 			/*
 			 * Dispatch the request to the appropriate interpreter handler
 			 * routine.  There is one routine per opcode "type" based upon the
 			 * number of opcode arguments and return type.
 			 */
-			status = acpi_gbl_op_type_dispatch[op_type] (walk_state);
-		}
-		else {
+			status =
+			    acpi_gbl_op_type_dispatch[op_type] (walk_state);
+		} else {
 			/*
 			 * Treat constructs of the form "Store(local_x,local_x)" as noops when the
 			 * Local is uninitialized.
 			 */
-			if  ((status == AE_AML_UNINITIALIZED_LOCAL) &&
-				(walk_state->opcode == AML_STORE_OP) &&
-				(walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
-				(walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
-				(walk_state->operands[0]->reference.opcode ==
-				 walk_state->operands[1]->reference.opcode) &&
-				(walk_state->operands[0]->reference.offset ==
-				 walk_state->operands[1]->reference.offset)) {
+			if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
+			    (walk_state->opcode == AML_STORE_OP) &&
+			    (walk_state->operands[0]->common.type ==
+			     ACPI_TYPE_LOCAL_REFERENCE)
+			    && (walk_state->operands[1]->common.type ==
+				ACPI_TYPE_LOCAL_REFERENCE)
+			    && (walk_state->operands[0]->reference.opcode ==
+				walk_state->operands[1]->reference.opcode)
+			    && (walk_state->operands[0]->reference.offset ==
+				walk_state->operands[1]->reference.offset)) {
 				status = AE_OK;
-			}
-			else {
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"[%s]: Could not resolve operands, %s\n",
-					acpi_ps_get_opcode_name (walk_state->opcode),
-					acpi_format_exception (status)));
+			} else {
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "[%s]: Could not resolve operands, %s\n",
+						  acpi_ps_get_opcode_name
+						  (walk_state->opcode),
+						  acpi_format_exception
+						  (status)));
 			}
 		}
 
 		/* Always delete the argument objects and clear the operand stack */
 
-		acpi_ds_clear_operands (walk_state);
+		acpi_ds_clear_operands(walk_state);
 
 		/*
 		 * If a result object was returned from above, push it on the
 		 * current result stack
 		 */
-		if (ACPI_SUCCESS (status) &&
-			walk_state->result_obj) {
-			status = acpi_ds_result_push (walk_state->result_obj, walk_state);
+		if (ACPI_SUCCESS(status) && walk_state->result_obj) {
+			status =
+			    acpi_ds_result_push(walk_state->result_obj,
+						walk_state);
 		}
 
 		break;
 
-
 	default:
 
 		switch (op_type) {
-		case AML_TYPE_CONTROL:    /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
+		case AML_TYPE_CONTROL:	/* Type 1 opcode, IF/ELSE/WHILE/NOOP */
 
 			/* 1 Operand, 0 external_result, 0 internal_result */
 
-			status = acpi_ds_exec_end_control_op (walk_state, op);
+			status = acpi_ds_exec_end_control_op(walk_state, op);
 
 			/* Make sure to properly pop the result stack */
 
-			if (ACPI_SUCCESS (status)) {
-				status = acpi_ds_result_stack_pop (walk_state);
-			}
-			else if (status == AE_CTRL_PENDING) {
-				status = acpi_ds_result_stack_pop (walk_state);
-				if (ACPI_SUCCESS (status)) {
+			if (ACPI_SUCCESS(status)) {
+				status = acpi_ds_result_stack_pop(walk_state);
+			} else if (status == AE_CTRL_PENDING) {
+				status = acpi_ds_result_stack_pop(walk_state);
+				if (ACPI_SUCCESS(status)) {
 					status = AE_CTRL_PENDING;
 				}
 			}
 			break;
 
-
 		case AML_TYPE_METHOD_CALL:
 
 			/*
@@ -505,16 +506,22 @@ acpi_ds_exec_end_op (
 			 * a reference to it.
 			 */
 			if ((op->asl.parent) &&
-			   ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
-				(op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-					"Method Reference in a Package, Op=%p\n", op));
-				op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
-				acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
-				return_ACPI_STATUS (AE_OK);
+			    ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
+			     || (op->asl.parent->asl.aml_opcode ==
+				 AML_VAR_PACKAGE_OP))) {
+				ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+						  "Method Reference in a Package, Op=%p\n",
+						  op));
+				op->common.node =
+				    (struct acpi_namespace_node *)op->asl.value.
+				    arg->asl.node->object;
+				acpi_ut_add_reference(op->asl.value.arg->asl.
+						      node->object);
+				return_ACPI_STATUS(AE_OK);
 			}
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op));
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "Method invocation, Op=%p\n", op));
 
 			/*
 			 * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
@@ -531,8 +538,8 @@ acpi_ds_exec_end_op (
 			/*
 			 * Get the method's arguments and put them on the operand stack
 			 */
-			status = acpi_ds_create_operands (walk_state, next_op);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ds_create_operands(walk_state, next_op);
+			if (ACPI_FAILURE(status)) {
 				break;
 			}
 
@@ -541,11 +548,11 @@ acpi_ds_exec_end_op (
 			 * we must resolve all local references here (Local variables,
 			 * arguments to *this* method, etc.)
 			 */
-			status = acpi_ds_resolve_operands (walk_state);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ds_resolve_operands(walk_state);
+			if (ACPI_FAILURE(status)) {
 				/* On error, clear all resolved operands */
 
-				acpi_ds_clear_operands (walk_state);
+				acpi_ds_clear_operands(walk_state);
 				break;
 			}
 
@@ -559,27 +566,28 @@ acpi_ds_exec_end_op (
 			 * Return now; we don't want to disturb anything,
 			 * especially the operand count!
 			 */
-			return_ACPI_STATUS (status);
-
+			return_ACPI_STATUS(status);
 
 		case AML_TYPE_CREATE_FIELD:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-				"Executing create_field Buffer/Index Op=%p\n", op));
+			ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+					  "Executing create_field Buffer/Index Op=%p\n",
+					  op));
 
-			status = acpi_ds_load2_end_op (walk_state);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ds_load2_end_op(walk_state);
+			if (ACPI_FAILURE(status)) {
 				break;
 			}
 
-			status = acpi_ds_eval_buffer_field_operands (walk_state, op);
+			status =
+			    acpi_ds_eval_buffer_field_operands(walk_state, op);
 			break;
 
-
 		case AML_TYPE_CREATE_OBJECT:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-				"Executing create_object (Buffer/Package) Op=%p\n", op));
+			ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+					  "Executing create_object (Buffer/Package) Op=%p\n",
+					  op));
 
 			switch (op->common.parent->common.aml_opcode) {
 			case AML_NAME_OP:
@@ -588,13 +596,15 @@ acpi_ds_exec_end_op (
 				 * Put the Node on the object stack (Contains the ACPI Name
 				 * of this object)
 				 */
-				walk_state->operands[0] = (void *) op->common.parent->common.node;
+				walk_state->operands[0] =
+				    (void *)op->common.parent->common.node;
 				walk_state->num_operands = 1;
 
-				status = acpi_ds_create_node (walk_state,
-						 op->common.parent->common.node,
-						 op->common.parent);
-				if (ACPI_FAILURE (status)) {
+				status = acpi_ds_create_node(walk_state,
+							     op->common.parent->
+							     common.node,
+							     op->common.parent);
+				if (ACPI_FAILURE(status)) {
 					break;
 				}
 
@@ -603,20 +613,26 @@ acpi_ds_exec_end_op (
 
 			case AML_INT_EVAL_SUBTREE_OP:
 
-				status = acpi_ds_eval_data_object_operands (walk_state, op,
-						 acpi_ns_get_attached_object (op->common.parent->common.node));
+				status =
+				    acpi_ds_eval_data_object_operands
+				    (walk_state, op,
+				     acpi_ns_get_attached_object(op->common.
+								 parent->common.
+								 node));
 				break;
 
 			default:
 
-				status = acpi_ds_eval_data_object_operands (walk_state, op, NULL);
+				status =
+				    acpi_ds_eval_data_object_operands
+				    (walk_state, op, NULL);
 				break;
 			}
 
 			/* Done with result state (Now that operand stack is built) */
 
-			status = acpi_ds_result_stack_pop (walk_state);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ds_result_stack_pop(walk_state);
+			if (ACPI_FAILURE(status)) {
 				goto cleanup;
 			}
 
@@ -625,56 +641,58 @@ acpi_ds_exec_end_op (
 			 * current result stack
 			 */
 			if (walk_state->result_obj) {
-				status = acpi_ds_result_push (walk_state->result_obj, walk_state);
+				status =
+				    acpi_ds_result_push(walk_state->result_obj,
+							walk_state);
 			}
 			break;
 
-
 		case AML_TYPE_NAMED_FIELD:
 		case AML_TYPE_NAMED_COMPLEX:
 		case AML_TYPE_NAMED_SIMPLE:
 		case AML_TYPE_NAMED_NO_OBJ:
 
-			status = acpi_ds_load2_end_op (walk_state);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ds_load2_end_op(walk_state);
+			if (ACPI_FAILURE(status)) {
 				break;
 			}
 
 			if (op->common.aml_opcode == AML_REGION_OP) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-					"Executing op_region Address/Length Op=%p\n", op));
-
-				status = acpi_ds_eval_region_operands (walk_state, op);
-				if (ACPI_FAILURE (status)) {
+				ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+						  "Executing op_region Address/Length Op=%p\n",
+						  op));
+
+				status =
+				    acpi_ds_eval_region_operands(walk_state,
+								 op);
+				if (ACPI_FAILURE(status)) {
 					break;
 				}
 
-				status = acpi_ds_result_stack_pop (walk_state);
+				status = acpi_ds_result_stack_pop(walk_state);
 			}
 
 			break;
 
-
 		case AML_TYPE_UNDEFINED:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Undefined opcode type Op=%p\n", op));
-			return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
-
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Undefined opcode type Op=%p\n", op));
+			return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
 
 		case AML_TYPE_BOGUS:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-				"Internal opcode=%X type Op=%p\n",
-				walk_state->opcode, op));
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "Internal opcode=%X type Op=%p\n",
+					  walk_state->opcode, op));
 			break;
 
-
 		default:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
-				op_class, op_type, op->common.aml_opcode, op));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
+					  op_class, op_type,
+					  op->common.aml_opcode, op));
 
 			status = AE_NOT_IMPLEMENTED;
 			break;
@@ -685,55 +703,58 @@ acpi_ds_exec_end_op (
 	 * ACPI 2.0 support for 64-bit integers: Truncate numeric
 	 * result value if we are executing from a 32-bit ACPI table
 	 */
-	acpi_ex_truncate_for32bit_table (walk_state->result_obj);
+	acpi_ex_truncate_for32bit_table(walk_state->result_obj);
 
 	/*
 	 * Check if we just completed the evaluation of a
 	 * conditional predicate
 	 */
 
-	if ((ACPI_SUCCESS (status)) &&
-		(walk_state->control_state) &&
-		(walk_state->control_state->common.state ==
-			ACPI_CONTROL_PREDICATE_EXECUTING) &&
-		(walk_state->control_state->control.predicate_op == op)) {
-		status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj);
+	if ((ACPI_SUCCESS(status)) &&
+	    (walk_state->control_state) &&
+	    (walk_state->control_state->common.state ==
+	     ACPI_CONTROL_PREDICATE_EXECUTING) &&
+	    (walk_state->control_state->control.predicate_op == op)) {
+		status =
+		    acpi_ds_get_predicate_value(walk_state,
+						walk_state->result_obj);
 		walk_state->result_obj = NULL;
 	}
 
-
-cleanup:
+      cleanup:
 
 	/* Invoke exception handler on error */
 
-	if (ACPI_FAILURE (status) &&
-		acpi_gbl_exception_handler &&
-		!(status & AE_CODE_CONTROL)) {
-		acpi_ex_exit_interpreter ();
-		status = acpi_gbl_exception_handler (status,
-				 walk_state->method_node->name.integer, walk_state->opcode,
-				 walk_state->aml_offset, NULL);
-		(void) acpi_ex_enter_interpreter ();
+	if (ACPI_FAILURE(status) &&
+	    acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
+		acpi_ex_exit_interpreter();
+		status = acpi_gbl_exception_handler(status,
+						    walk_state->method_node->
+						    name.integer,
+						    walk_state->opcode,
+						    walk_state->aml_offset,
+						    NULL);
+		(void)acpi_ex_enter_interpreter();
 	}
 
 	if (walk_state->result_obj) {
 		/* Break to debugger to display result */
 
-		ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj,
-				 walk_state));
+		ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
+				   (walk_state->result_obj, walk_state));
 
 		/*
 		 * Delete the result op if and only if:
 		 * Parent will not use the result -- such as any
 		 * non-nested type2 op in a method (parent will be method)
 		 */
-		acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state);
+		acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
+						  walk_state);
 	}
-
 #ifdef _UNDER_DEVELOPMENT
 
 	if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
-		acpi_db_method_end (walk_state);
+		acpi_db_method_end(walk_state);
 	}
 #endif
 
@@ -745,12 +766,10 @@ cleanup:
 
 	/* On error, display method locals/args */
 
-	if (ACPI_FAILURE (status)) {
-		acpi_dm_dump_method_info (status, walk_state, op);
+	if (ACPI_FAILURE(status)) {
+		acpi_dm_dump_method_info(status, walk_state, op);
 	}
 #endif
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 242 - 246
drivers/acpi/dispatcher/dswload.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
@@ -55,8 +54,7 @@
 #endif
 
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dswload")
-
+ACPI_MODULE_NAME("dswload")
 
 /*******************************************************************************
  *
@@ -70,32 +68,29 @@
  * DESCRIPTION: Init walk state callbacks
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ds_init_callbacks (
-	struct acpi_walk_state          *walk_state,
-	u32                             pass_number)
+acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
 {
 
 	switch (pass_number) {
 	case 1:
-		walk_state->parse_flags       = ACPI_PARSE_LOAD_PASS1 |
-				   ACPI_PARSE_DELETE_TREE;
+		walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
+		    ACPI_PARSE_DELETE_TREE;
 		walk_state->descending_callback = acpi_ds_load1_begin_op;
 		walk_state->ascending_callback = acpi_ds_load1_end_op;
 		break;
 
 	case 2:
-		walk_state->parse_flags       = ACPI_PARSE_LOAD_PASS1 |
-				   ACPI_PARSE_DELETE_TREE;
+		walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
+		    ACPI_PARSE_DELETE_TREE;
 		walk_state->descending_callback = acpi_ds_load2_begin_op;
 		walk_state->ascending_callback = acpi_ds_load2_end_op;
 		break;
 
 	case 3:
 #ifndef ACPI_NO_METHOD_EXECUTION
-		walk_state->parse_flags      |= ACPI_PARSE_EXECUTE  |
-				   ACPI_PARSE_DELETE_TREE;
+		walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
+		    ACPI_PARSE_DELETE_TREE;
 		walk_state->descending_callback = acpi_ds_exec_begin_op;
 		walk_state->ascending_callback = acpi_ds_exec_end_op;
 #endif
@@ -108,7 +103,6 @@ acpi_ds_init_callbacks (
 	return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load1_begin_op
@@ -123,23 +117,21 @@ acpi_ds_init_callbacks (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_load1_begin_op (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         **out_op)
+acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
+		       union acpi_parse_object ** out_op)
 {
-	union acpi_parse_object         *op;
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-	acpi_object_type                object_type;
-	char                            *path;
-	u32                             flags;
-
-
-	ACPI_FUNCTION_NAME ("ds_load1_begin_op");
+	union acpi_parse_object *op;
+	struct acpi_namespace_node *node;
+	acpi_status status;
+	acpi_object_type object_type;
+	char *path;
+	u32 flags;
 
+	ACPI_FUNCTION_NAME("ds_load1_begin_op");
 
 	op = walk_state->op;
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
+			  walk_state));
 
 	/* We are only interested in opcodes that have an associated name */
 
@@ -157,14 +149,15 @@ acpi_ds_load1_begin_op (
 		}
 	}
 
-	path = acpi_ps_get_next_namestring (&walk_state->parser_state);
+	path = acpi_ps_get_next_namestring(&walk_state->parser_state);
 
 	/* Map the raw opcode into an internal object type */
 
 	object_type = walk_state->op_info->object_type;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"State=%p Op=%p [%s]\n", walk_state, op, acpi_ut_get_type_name (object_type)));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "State=%p Op=%p [%s]\n", walk_state, op,
+			  acpi_ut_get_type_name(object_type)));
 
 	switch (walk_state->opcode) {
 	case AML_SCOPE_OP:
@@ -174,8 +167,10 @@ acpi_ds_load1_begin_op (
 		 * that we can actually open the scope to enter new names underneath it.
 		 * Allow search-to-root for single namesegs.
 		 */
-		status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
-				  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
+		status =
+		    acpi_ns_lookup(walk_state->scope_info, path, object_type,
+				   ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+				   walk_state, &(node));
 #ifdef ACPI_ASL_COMPILER
 		if (status == AE_NOT_FOUND) {
 			/*
@@ -183,14 +178,16 @@ acpi_ds_load1_begin_op (
 			 * Target of Scope() not found.  Generate an External for it, and
 			 * insert the name into the namespace.
 			 */
-			acpi_dm_add_to_external_list (path);
-			status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
-					   ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
-					   walk_state, &(node));
+			acpi_dm_add_to_external_list(path);
+			status =
+			    acpi_ns_lookup(walk_state->scope_info, path,
+					   object_type, ACPI_IMODE_LOAD_PASS1,
+					   ACPI_NS_SEARCH_PARENT, walk_state,
+					   &(node));
 		}
 #endif
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_NSERROR (path, status);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_NSERROR(path, status);
 			return (status);
 		}
 
@@ -199,7 +196,7 @@ acpi_ds_load1_begin_op (
 		 * one of the opcodes that actually opens a scope
 		 */
 		switch (node->type) {
-		case ACPI_TYPE_LOCAL_SCOPE:         /* Scope  */
+		case ACPI_TYPE_LOCAL_SCOPE:	/* Scope  */
 		case ACPI_TYPE_DEVICE:
 		case ACPI_TYPE_POWER:
 		case ACPI_TYPE_PROCESSOR:
@@ -223,9 +220,10 @@ acpi_ds_load1_begin_op (
 			 * a warning
 			 */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-				"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
-				path, acpi_ut_get_type_name (node->type)));
+			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+					  "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
+					  path,
+					  acpi_ut_get_type_name(node->type)));
 
 			node->type = ACPI_TYPE_ANY;
 			walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -235,15 +233,12 @@ acpi_ds_load1_begin_op (
 
 			/* All other types are an error */
 
-			ACPI_REPORT_ERROR ((
-				"Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
-				acpi_ut_get_type_name (node->type), path));
+			ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path));
 
 			return (AE_AML_OPERAND_TYPE);
 		}
 		break;
 
-
 	default:
 
 		/*
@@ -272,15 +267,15 @@ acpi_ds_load1_begin_op (
 
 		flags = ACPI_NS_NO_UPSEARCH;
 		if ((walk_state->opcode != AML_SCOPE_OP) &&
-			(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
+		    (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
 			flags |= ACPI_NS_ERROR_IF_FOUND;
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
-					acpi_ut_get_type_name (object_type)));
-		}
-		else {
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-				"[%s] Both Find or Create allowed\n",
-					acpi_ut_get_type_name (object_type)));
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "[%s] Cannot already exist\n",
+					  acpi_ut_get_type_name(object_type)));
+		} else {
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "[%s] Both Find or Create allowed\n",
+					  acpi_ut_get_type_name(object_type)));
 		}
 
 		/*
@@ -289,22 +284,23 @@ acpi_ds_load1_begin_op (
 		 * involve arguments to the opcode must be created as we go back up the
 		 * parse tree later.
 		 */
-		status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
-				  ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_NSERROR (path, status);
+		status =
+		    acpi_ns_lookup(walk_state->scope_info, path, object_type,
+				   ACPI_IMODE_LOAD_PASS1, flags, walk_state,
+				   &(node));
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_NSERROR(path, status);
 			return (status);
 		}
 		break;
 	}
 
-
 	/* Common exit */
 
 	if (!op) {
 		/* Create a new op */
 
-		op = acpi_ps_alloc_op (walk_state->opcode);
+		op = acpi_ps_alloc_op(walk_state->opcode);
 		if (!op) {
 			return (AE_NO_MEMORY);
 		}
@@ -318,19 +314,18 @@ acpi_ds_load1_begin_op (
 	op->named.path = (u8 *) path;
 #endif
 
-
 	/*
 	 * Put the Node in the "op" object that the parser uses, so we
 	 * can get it again quickly when this scope is closed
 	 */
 	op->common.node = node;
-	acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op);
+	acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state),
+			   op);
 
 	*out_op = op;
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load1_end_op
@@ -344,20 +339,17 @@ acpi_ds_load1_begin_op (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_load1_end_op (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
 {
-	union acpi_parse_object         *op;
-	acpi_object_type                object_type;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_NAME ("ds_load1_end_op");
+	union acpi_parse_object *op;
+	acpi_object_type object_type;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_NAME("ds_load1_end_op");
 
 	op = walk_state->op;
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
+			  walk_state));
 
 	/* We are only interested in opcodes that have an associated name */
 
@@ -371,21 +363,20 @@ acpi_ds_load1_end_op (
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 	if (walk_state->op_info->flags & AML_FIELD) {
-		if (walk_state->opcode == AML_FIELD_OP         ||
-			walk_state->opcode == AML_BANK_FIELD_OP    ||
-			walk_state->opcode == AML_INDEX_FIELD_OP) {
-			status = acpi_ds_init_field_objects (op, walk_state);
+		if (walk_state->opcode == AML_FIELD_OP ||
+		    walk_state->opcode == AML_BANK_FIELD_OP ||
+		    walk_state->opcode == AML_INDEX_FIELD_OP) {
+			status = acpi_ds_init_field_objects(op, walk_state);
 		}
 		return (status);
 	}
 
-
 	if (op->common.aml_opcode == AML_REGION_OP) {
-		status = acpi_ex_create_region (op->named.data, op->named.length,
-				   (acpi_adr_space_type)
-						 ((op->common.value.arg)->common.value.integer),
-						 walk_state);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ex_create_region(op->named.data, op->named.length,
+					       (acpi_adr_space_type)
+					       ((op->common.value.arg)->common.
+						value.integer), walk_state);
+		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
 	}
@@ -395,8 +386,11 @@ acpi_ds_load1_end_op (
 		/* For Name opcode, get the object type from the argument */
 
 		if (op->common.value.arg) {
-			object_type = (acpi_ps_get_opcode_info (
-				(op->common.value.arg)->common.aml_opcode))->object_type;
+			object_type = (acpi_ps_get_opcode_info((op->common.
+								value.arg)->
+							       common.
+							       aml_opcode))->
+			    object_type;
 			op->common.node->type = (u8) object_type;
 		}
 	}
@@ -410,23 +404,26 @@ acpi_ds_load1_end_op (
 		 * of invocations of the method (need to know the number of
 		 * arguments.)
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-			"LOADING-Method: State=%p Op=%p named_obj=%p\n",
-			walk_state, op, op->named.node));
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "LOADING-Method: State=%p Op=%p named_obj=%p\n",
+				  walk_state, op, op->named.node));
 
-		if (!acpi_ns_get_attached_object (op->named.node)) {
-			walk_state->operands[0] = (void *) op->named.node;
+		if (!acpi_ns_get_attached_object(op->named.node)) {
+			walk_state->operands[0] = (void *)op->named.node;
 			walk_state->num_operands = 1;
 
-			status = acpi_ds_create_operands (walk_state, op->common.value.arg);
-			if (ACPI_SUCCESS (status)) {
-				status = acpi_ex_create_method (op->named.data,
-						   op->named.length, walk_state);
+			status =
+			    acpi_ds_create_operands(walk_state,
+						    op->common.value.arg);
+			if (ACPI_SUCCESS(status)) {
+				status = acpi_ex_create_method(op->named.data,
+							       op->named.length,
+							       walk_state);
 			}
 			walk_state->operands[0] = NULL;
 			walk_state->num_operands = 0;
 
-			if (ACPI_FAILURE (status)) {
+			if (ACPI_FAILURE(status)) {
 				return (status);
 			}
 		}
@@ -434,17 +431,17 @@ acpi_ds_load1_end_op (
 
 	/* Pop the scope stack */
 
-	if (acpi_ns_opens_scope (object_type)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
-			acpi_ut_get_type_name (object_type), op));
+	if (acpi_ns_opens_scope(object_type)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "(%s): Popping scope for Op %p\n",
+				  acpi_ut_get_type_name(object_type), op));
 
-		status = acpi_ds_scope_stack_pop (walk_state);
+		status = acpi_ds_scope_stack_pop(walk_state);
 	}
 
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load2_begin_op
@@ -459,50 +456,50 @@ acpi_ds_load1_end_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_load2_begin_op (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         **out_op)
+acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
+		       union acpi_parse_object ** out_op)
 {
-	union acpi_parse_object         *op;
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-	acpi_object_type                object_type;
-	char                            *buffer_ptr;
-
-
-	ACPI_FUNCTION_TRACE ("ds_load2_begin_op");
+	union acpi_parse_object *op;
+	struct acpi_namespace_node *node;
+	acpi_status status;
+	acpi_object_type object_type;
+	char *buffer_ptr;
 
+	ACPI_FUNCTION_TRACE("ds_load2_begin_op");
 
 	op = walk_state->op;
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
+			  walk_state));
 
 	if (op) {
 		if ((walk_state->control_state) &&
-			(walk_state->control_state->common.state ==
-				ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+		    (walk_state->control_state->common.state ==
+		     ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
 			/* We are executing a while loop outside of a method */
 
-			status = acpi_ds_exec_begin_op (walk_state, out_op);
-			return_ACPI_STATUS (status);
+			status = acpi_ds_exec_begin_op(walk_state, out_op);
+			return_ACPI_STATUS(status);
 		}
 
 		/* We only care about Namespace opcodes here */
 
 		if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
-			  (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
-			(!(walk_state->op_info->flags & AML_NAMED))) {
+		     (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
+		    (!(walk_state->op_info->flags & AML_NAMED))) {
 			if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
-				(walk_state->op_info->class == AML_CLASS_CONTROL)) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-					"Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
-					walk_state->op_info->flags));
+			    (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+				ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+						  "Begin/EXEC: %s (fl %8.8X)\n",
+						  walk_state->op_info->name,
+						  walk_state->op_info->flags));
 
 				/* Executing a type1 or type2 opcode outside of a method */
 
-				status = acpi_ds_exec_begin_op (walk_state, out_op);
-				return_ACPI_STATUS (status);
+				status =
+				    acpi_ds_exec_begin_op(walk_state, out_op);
+				return_ACPI_STATUS(status);
 			}
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 
 		/* Get the name we are going to enter or lookup in the namespace */
@@ -514,28 +511,27 @@ acpi_ds_load2_begin_op (
 			if (!buffer_ptr) {
 				/* No name, just exit */
 
-				return_ACPI_STATUS (AE_OK);
+				return_ACPI_STATUS(AE_OK);
 			}
-		}
-		else {
+		} else {
 			/* Get name from the op */
 
-			buffer_ptr = (char *) &op->named.name;
+			buffer_ptr = (char *)&op->named.name;
 		}
-	}
-	else {
+	} else {
 		/* Get the namestring from the raw AML */
 
-		buffer_ptr = acpi_ps_get_next_namestring (&walk_state->parser_state);
+		buffer_ptr =
+		    acpi_ps_get_next_namestring(&walk_state->parser_state);
 	}
 
 	/* Map the opcode into an internal object type */
 
 	object_type = walk_state->op_info->object_type;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"State=%p Op=%p Type=%X\n", walk_state, op, object_type));
-
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "State=%p Op=%p Type=%X\n", walk_state, op,
+			  object_type));
 
 	switch (walk_state->opcode) {
 	case AML_FIELD_OP:
@@ -553,9 +549,10 @@ acpi_ds_load2_begin_op (
 		 * Don't enter the name into the namespace, but look it up
 		 * for use later.
 		 */
-		status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-				  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
-				  walk_state, &(node));
+		status =
+		    acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
+				   object_type, ACPI_IMODE_EXECUTE,
+				   ACPI_NS_SEARCH_PARENT, walk_state, &(node));
 		break;
 
 	case AML_SCOPE_OP:
@@ -565,28 +562,28 @@ acpi_ds_load2_begin_op (
 		 * Don't enter the name into the namespace, but look it up
 		 * for use later.
 		 */
-		status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-				  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
-				  walk_state, &(node));
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
+				   object_type, ACPI_IMODE_EXECUTE,
+				   ACPI_NS_SEARCH_PARENT, walk_state, &(node));
+		if (ACPI_FAILURE(status)) {
 #ifdef ACPI_ASL_COMPILER
 			if (status == AE_NOT_FOUND) {
 				status = AE_OK;
-			}
-			else {
-				ACPI_REPORT_NSERROR (buffer_ptr, status);
+			} else {
+				ACPI_REPORT_NSERROR(buffer_ptr, status);
 			}
 #else
-			ACPI_REPORT_NSERROR (buffer_ptr, status);
+			ACPI_REPORT_NSERROR(buffer_ptr, status);
 #endif
-			return_ACPI_STATUS (status);
+			return_ACPI_STATUS(status);
 		}
 		/*
 		 * We must check to make sure that the target is
 		 * one of the opcodes that actually opens a scope
 		 */
 		switch (node->type) {
-		case ACPI_TYPE_LOCAL_SCOPE:         /* Scope */
+		case ACPI_TYPE_LOCAL_SCOPE:	/* Scope */
 		case ACPI_TYPE_DEVICE:
 		case ACPI_TYPE_POWER:
 		case ACPI_TYPE_PROCESSOR:
@@ -607,9 +604,7 @@ acpi_ds_load2_begin_op (
 			 *  Scope (DEB) { ... }
 			 */
 
-			ACPI_REPORT_WARNING ((
-				"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
-				buffer_ptr, acpi_ut_get_type_name (node->type)));
+			ACPI_REPORT_WARNING(("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", buffer_ptr, acpi_ut_get_type_name(node->type)));
 
 			node->type = ACPI_TYPE_ANY;
 			walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -619,9 +614,7 @@ acpi_ds_load2_begin_op (
 
 			/* All other types are an error */
 
-			ACPI_REPORT_ERROR ((
-				"Invalid type (%s) for target of Scope operator [%4.4s]\n",
-				acpi_ut_get_type_name (node->type), buffer_ptr));
+			ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr));
 
 			return (AE_AML_OPERAND_TYPE);
 		}
@@ -636,14 +629,16 @@ acpi_ds_load2_begin_op (
 
 			node = op->common.node;
 
-			if (acpi_ns_opens_scope (object_type)) {
-				status = acpi_ds_scope_stack_push (node, object_type, walk_state);
-				if (ACPI_FAILURE (status)) {
-					return_ACPI_STATUS (status);
+			if (acpi_ns_opens_scope(object_type)) {
+				status =
+				    acpi_ds_scope_stack_push(node, object_type,
+							     walk_state);
+				if (ACPI_FAILURE(status)) {
+					return_ACPI_STATUS(status);
 				}
 
 			}
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 
 		/*
@@ -664,23 +659,24 @@ acpi_ds_load2_begin_op (
 
 		/* Add new entry into namespace */
 
-		status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-				  ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
-				  walk_state, &(node));
+		status =
+		    acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
+				   object_type, ACPI_IMODE_LOAD_PASS2,
+				   ACPI_NS_NO_UPSEARCH, walk_state, &(node));
 		break;
 	}
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_NSERROR (buffer_ptr, status);
-		return_ACPI_STATUS (status);
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_NSERROR(buffer_ptr, status);
+		return_ACPI_STATUS(status);
 	}
 
 	if (!op) {
 		/* Create a new op */
 
-		op = acpi_ps_alloc_op (walk_state->opcode);
+		op = acpi_ps_alloc_op(walk_state->opcode);
 		if (!op) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/* Initialize the new op */
@@ -697,10 +693,9 @@ acpi_ds_load2_begin_op (
 	 */
 	op->common.node = node;
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load2_end_op
@@ -714,26 +709,23 @@ acpi_ds_load2_begin_op (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_load2_end_op (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
 {
-	union acpi_parse_object         *op;
-	acpi_status                     status = AE_OK;
-	acpi_object_type                object_type;
-	struct acpi_namespace_node      *node;
-	union acpi_parse_object         *arg;
-	struct acpi_namespace_node      *new_node;
+	union acpi_parse_object *op;
+	acpi_status status = AE_OK;
+	acpi_object_type object_type;
+	struct acpi_namespace_node *node;
+	union acpi_parse_object *arg;
+	struct acpi_namespace_node *new_node;
 #ifndef ACPI_NO_METHOD_EXECUTION
-	u32                             i;
+	u32 i;
 #endif
 
-
-	ACPI_FUNCTION_TRACE ("ds_load2_end_op");
+	ACPI_FUNCTION_TRACE("ds_load2_end_op");
 
 	op = walk_state->op;
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
-			walk_state->op_info->name, op, walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
+			  walk_state->op_info->name, op, walk_state));
 
 	/* Check if opcode had an associated namespace object */
 
@@ -742,23 +734,25 @@ acpi_ds_load2_end_op (
 		/* No namespace object. Executable opcode? */
 
 		if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
-			(walk_state->op_info->class == AML_CLASS_CONTROL)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-				"End/EXEC:   %s (fl %8.8X)\n", walk_state->op_info->name,
-				walk_state->op_info->flags));
+		    (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+					  "End/EXEC:   %s (fl %8.8X)\n",
+					  walk_state->op_info->name,
+					  walk_state->op_info->flags));
 
 			/* Executing a type1 or type2 opcode outside of a method */
 
-			status = acpi_ds_exec_end_op (walk_state);
-			return_ACPI_STATUS (status);
+			status = acpi_ds_exec_end_op(walk_state);
+			return_ACPI_STATUS(status);
 		}
 #endif
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	if (op->common.aml_opcode == AML_SCOPE_OP) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-			"Ending scope Op=%p State=%p\n", op, walk_state));
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "Ending scope Op=%p State=%p\n", op,
+				  walk_state));
 	}
 
 	object_type = walk_state->op_info->object_type;
@@ -773,18 +767,19 @@ acpi_ds_load2_end_op (
 	 * Put the Node on the object stack (Contains the ACPI Name of
 	 * this object)
 	 */
-	walk_state->operands[0] = (void *) node;
+	walk_state->operands[0] = (void *)node;
 	walk_state->num_operands = 1;
 
 	/* Pop the scope stack */
 
-	if (acpi_ns_opens_scope (object_type) &&
-	   (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
-			acpi_ut_get_type_name (object_type), op));
+	if (acpi_ns_opens_scope(object_type) &&
+	    (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "(%s) Popping scope for Op %p\n",
+				  acpi_ut_get_type_name(object_type), op));
 
-		status = acpi_ds_scope_stack_pop (walk_state);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ds_scope_stack_pop(walk_state);
+		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
 	}
@@ -817,9 +812,10 @@ acpi_ds_load2_end_op (
 	 * AML_THERMALZONE
 	 */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"Create-Load [%s] State=%p Op=%p named_obj=%p\n",
-		acpi_ps_get_opcode_name (op->common.aml_opcode), walk_state, op, node));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "Create-Load [%s] State=%p Op=%p named_obj=%p\n",
+			  acpi_ps_get_opcode_name(op->common.aml_opcode),
+			  walk_state, op, node));
 
 	/* Decode the opcode */
 
@@ -834,27 +830,32 @@ acpi_ds_load2_end_op (
 		 * Create the field object, but the field buffer and index must
 		 * be evaluated later during the execution phase
 		 */
-		status = acpi_ds_create_buffer_field (op, walk_state);
+		status = acpi_ds_create_buffer_field(op, walk_state);
 		break;
 
-
-	 case AML_TYPE_NAMED_FIELD:
+	case AML_TYPE_NAMED_FIELD:
 
 		switch (op->common.aml_opcode) {
 		case AML_INDEX_FIELD_OP:
 
-			status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
-					 walk_state);
+			status =
+			    acpi_ds_create_index_field(op,
+						       (acpi_handle) arg->
+						       common.node, walk_state);
 			break;
 
 		case AML_BANK_FIELD_OP:
 
-			status = acpi_ds_create_bank_field (op, arg->common.node, walk_state);
+			status =
+			    acpi_ds_create_bank_field(op, arg->common.node,
+						      walk_state);
 			break;
 
 		case AML_FIELD_OP:
 
-			status = acpi_ds_create_field (op, arg->common.node, walk_state);
+			status =
+			    acpi_ds_create_field(op, arg->common.node,
+						 walk_state);
 			break;
 
 		default:
@@ -863,43 +864,42 @@ acpi_ds_load2_end_op (
 		}
 		break;
 
+	case AML_TYPE_NAMED_SIMPLE:
 
-	 case AML_TYPE_NAMED_SIMPLE:
-
-		status = acpi_ds_create_operands (walk_state, arg);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ds_create_operands(walk_state, arg);
+		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
 
 		switch (op->common.aml_opcode) {
 		case AML_PROCESSOR_OP:
 
-			status = acpi_ex_create_processor (walk_state);
+			status = acpi_ex_create_processor(walk_state);
 			break;
 
 		case AML_POWER_RES_OP:
 
-			status = acpi_ex_create_power_resource (walk_state);
+			status = acpi_ex_create_power_resource(walk_state);
 			break;
 
 		case AML_MUTEX_OP:
 
-			status = acpi_ex_create_mutex (walk_state);
+			status = acpi_ex_create_mutex(walk_state);
 			break;
 
 		case AML_EVENT_OP:
 
-			status = acpi_ex_create_event (walk_state);
+			status = acpi_ex_create_event(walk_state);
 			break;
 
 		case AML_DATA_REGION_OP:
 
-			status = acpi_ex_create_table_region (walk_state);
+			status = acpi_ex_create_table_region(walk_state);
 			break;
 
 		case AML_ALIAS_OP:
 
-			status = acpi_ex_create_alias (walk_state);
+			status = acpi_ex_create_alias(walk_state);
 			break;
 
 		default:
@@ -912,12 +912,12 @@ acpi_ds_load2_end_op (
 		/* Delete operands */
 
 		for (i = 1; i < walk_state->num_operands; i++) {
-			acpi_ut_remove_reference (walk_state->operands[i]);
+			acpi_ut_remove_reference(walk_state->operands[i]);
 			walk_state->operands[i] = NULL;
 		}
 
 		break;
-#endif /* ACPI_NO_METHOD_EXECUTION */
+#endif				/* ACPI_NO_METHOD_EXECUTION */
 
 	case AML_TYPE_NAMED_COMPLEX:
 
@@ -933,9 +933,10 @@ acpi_ds_load2_end_op (
 			 * If we have a valid region, initialize it
 			 * Namespace is NOT locked at this point.
 			 */
-			status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node),
-					 FALSE);
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_ev_initialize_region
+			    (acpi_ns_get_attached_object(node), FALSE);
+			if (ACPI_FAILURE(status)) {
 				/*
 				 *  If AE_NOT_EXIST is returned, it is not fatal
 				 *  because many regions get created before a handler
@@ -947,13 +948,11 @@ acpi_ds_load2_end_op (
 			}
 			break;
 
-
 		case AML_NAME_OP:
 
-			status = acpi_ds_create_node (walk_state, node, op);
+			status = acpi_ds_create_node(walk_state, node, op);
 			break;
-#endif /* ACPI_NO_METHOD_EXECUTION */
-
+#endif				/* ACPI_NO_METHOD_EXECUTION */
 
 		default:
 			/* All NAMED_COMPLEX opcodes must be handled above */
@@ -962,27 +961,28 @@ acpi_ds_load2_end_op (
 		}
 		break;
 
-
 	case AML_CLASS_INTERNAL:
 
 		/* case AML_INT_NAMEPATH_OP: */
 		break;
 
-
 	case AML_CLASS_METHOD_CALL:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-			"RESOLVING-method_call: State=%p Op=%p named_obj=%p\n",
-			walk_state, op, node));
+		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+				  "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n",
+				  walk_state, op, node));
 
 		/*
 		 * Lookup the method name and save the Node
 		 */
-		status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-				  ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
-				  ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-				  walk_state, &(new_node));
-		if (ACPI_SUCCESS (status)) {
+		status =
+		    acpi_ns_lookup(walk_state->scope_info,
+				   arg->common.value.string, ACPI_TYPE_ANY,
+				   ACPI_IMODE_LOAD_PASS2,
+				   ACPI_NS_SEARCH_PARENT |
+				   ACPI_NS_DONT_OPEN_SCOPE, walk_state,
+				   &(new_node));
+		if (ACPI_SUCCESS(status)) {
 
 			/*
 			 * Make sure that what we found is indeed a method
@@ -998,24 +998,20 @@ acpi_ds_load2_end_op (
 			 * parser uses, so we can get it again at the end of this scope
 			 */
 			op->common.node = new_node;
-		}
-		else {
-			ACPI_REPORT_NSERROR (arg->common.value.string, status);
+		} else {
+			ACPI_REPORT_NSERROR(arg->common.value.string, status);
 		}
 		break;
 
-
 	default:
 		break;
 	}
 
-cleanup:
+      cleanup:
 
 	/* Remove the Node pushed at the very beginning */
 
 	walk_state->operands[0] = NULL;
 	walk_state->num_operands = 0;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 61 - 78
drivers/acpi/dispatcher/dswscope.c

@@ -41,14 +41,11 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-	 ACPI_MODULE_NAME    ("dswscope")
-
+ACPI_MODULE_NAME("dswscope")
 
 /****************************************************************************
  *
@@ -62,15 +59,11 @@
  *              root scope object (which remains at the stack top.)
  *
  ***************************************************************************/
-
-void
-acpi_ds_scope_stack_clear (
-	struct acpi_walk_state          *walk_state)
+void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state)
 {
-	union acpi_generic_state        *scope_info;
-
-	ACPI_FUNCTION_NAME ("ds_scope_stack_clear");
+	union acpi_generic_state *scope_info;
 
+	ACPI_FUNCTION_NAME("ds_scope_stack_clear");
 
 	while (walk_state->scope_info) {
 		/* Pop a scope off the stack */
@@ -78,14 +71,14 @@ acpi_ds_scope_stack_clear (
 		scope_info = walk_state->scope_info;
 		walk_state->scope_info = scope_info->scope.next;
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"Popped object type (%s)\n",
-			acpi_ut_get_type_name (scope_info->common.value)));
-		acpi_ut_delete_generic_state (scope_info);
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Popped object type (%s)\n",
+				  acpi_ut_get_type_name(scope_info->common.
+							value)));
+		acpi_ut_delete_generic_state(scope_info);
 	}
 }
 
-
 /****************************************************************************
  *
  * FUNCTION:    acpi_ds_scope_stack_push
@@ -102,74 +95,70 @@ acpi_ds_scope_stack_clear (
  ***************************************************************************/
 
 acpi_status
-acpi_ds_scope_stack_push (
-	struct acpi_namespace_node      *node,
-	acpi_object_type                type,
-	struct acpi_walk_state          *walk_state)
+acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
+			 acpi_object_type type,
+			 struct acpi_walk_state *walk_state)
 {
-	union acpi_generic_state        *scope_info;
-	union acpi_generic_state        *old_scope_info;
-
-
-	ACPI_FUNCTION_TRACE ("ds_scope_stack_push");
+	union acpi_generic_state *scope_info;
+	union acpi_generic_state *old_scope_info;
 
+	ACPI_FUNCTION_TRACE("ds_scope_stack_push");
 
 	if (!node) {
 		/* Invalid scope   */
 
-		ACPI_REPORT_ERROR (("ds_scope_stack_push: null scope passed\n"));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n"));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Make sure object type is valid */
 
-	if (!acpi_ut_valid_object_type (type)) {
-		ACPI_REPORT_WARNING ((
-			"ds_scope_stack_push: Invalid object type: 0x%X\n", type));
+	if (!acpi_ut_valid_object_type(type)) {
+		ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
 	}
 
 	/* Allocate a new scope object */
 
-	scope_info = acpi_ut_create_generic_state ();
+	scope_info = acpi_ut_create_generic_state();
 	if (!scope_info) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Init new scope object */
 
 	scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE;
-	scope_info->scope.node      = node;
-	scope_info->common.value    = (u16) type;
+	scope_info->scope.node = node;
+	scope_info->common.value = (u16) type;
 
 	walk_state->scope_depth++;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-		"[%.2d] Pushed scope ", (u32) walk_state->scope_depth));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "[%.2d] Pushed scope ",
+			  (u32) walk_state->scope_depth));
 
 	old_scope_info = walk_state->scope_info;
 	if (old_scope_info) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-			"[%4.4s] (%s)",
-			acpi_ut_get_node_name (old_scope_info->scope.node),
-			acpi_ut_get_type_name (old_scope_info->common.value)));
-	}
-	else {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-			"[\\___] (%s)", "ROOT"));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
+				      "[%4.4s] (%s)",
+				      acpi_ut_get_node_name(old_scope_info->
+							    scope.node),
+				      acpi_ut_get_type_name(old_scope_info->
+							    common.value)));
+	} else {
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (%s)", "ROOT"));
 	}
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-		", New scope -> [%4.4s] (%s)\n",
-		acpi_ut_get_node_name (scope_info->scope.node),
-		acpi_ut_get_type_name (scope_info->common.value)));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
+			      ", New scope -> [%4.4s] (%s)\n",
+			      acpi_ut_get_node_name(scope_info->scope.node),
+			      acpi_ut_get_type_name(scope_info->common.value)));
 
 	/* Push new scope object onto stack */
 
-	acpi_ut_push_generic_state (&walk_state->scope_info, scope_info);
-	return_ACPI_STATUS (AE_OK);
+	acpi_ut_push_generic_state(&walk_state->scope_info, scope_info);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /****************************************************************************
  *
  * FUNCTION:    acpi_ds_scope_stack_pop
@@ -182,47 +171,41 @@ acpi_ds_scope_stack_push (
  *
  ***************************************************************************/
 
-acpi_status
-acpi_ds_scope_stack_pop (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state)
 {
-	union acpi_generic_state        *scope_info;
-	union acpi_generic_state        *new_scope_info;
-
-
-	ACPI_FUNCTION_TRACE ("ds_scope_stack_pop");
+	union acpi_generic_state *scope_info;
+	union acpi_generic_state *new_scope_info;
 
+	ACPI_FUNCTION_TRACE("ds_scope_stack_pop");
 
 	/*
 	 * Pop scope info object off the stack.
 	 */
-	scope_info = acpi_ut_pop_generic_state (&walk_state->scope_info);
+	scope_info = acpi_ut_pop_generic_state(&walk_state->scope_info);
 	if (!scope_info) {
-		return_ACPI_STATUS (AE_STACK_UNDERFLOW);
+		return_ACPI_STATUS(AE_STACK_UNDERFLOW);
 	}
 
 	walk_state->scope_depth--;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-		"[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
-		(u32) walk_state->scope_depth,
-		acpi_ut_get_node_name (scope_info->scope.node),
-		acpi_ut_get_type_name (scope_info->common.value)));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
+			  (u32) walk_state->scope_depth,
+			  acpi_ut_get_node_name(scope_info->scope.node),
+			  acpi_ut_get_type_name(scope_info->common.value)));
 
 	new_scope_info = walk_state->scope_info;
 	if (new_scope_info) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-			"[%4.4s] (%s)\n",
-			acpi_ut_get_node_name (new_scope_info->scope.node),
-			acpi_ut_get_type_name (new_scope_info->common.value)));
-	}
-	else {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-			"[\\___] (ROOT)\n"));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
+				      "[%4.4s] (%s)\n",
+				      acpi_ut_get_node_name(new_scope_info->
+							    scope.node),
+				      acpi_ut_get_type_name(new_scope_info->
+							    common.value)));
+	} else {
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (ROOT)\n"));
 	}
 
-	acpi_ut_delete_generic_state (scope_info);
-	return_ACPI_STATUS (AE_OK);
+	acpi_ut_delete_generic_state(scope_info);
+	return_ACPI_STATUS(AE_OK);
 }
-
-

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 271 - 304
drivers/acpi/dispatcher/dswstate.c


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 260 - 333
drivers/acpi/ec.c


+ 31 - 31
drivers/acpi/event.c

@@ -13,16 +13,15 @@
 #include <acpi/acpi_drivers.h>
 
 #define _COMPONENT		ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME		("event")
+ACPI_MODULE_NAME("event")
 
 /* Global vars for handling event proc entry */
 static DEFINE_SPINLOCK(acpi_system_event_lock);
-int				event_is_open = 0;
-extern struct list_head		acpi_bus_event_list;
-extern wait_queue_head_t	acpi_bus_event_queue;
+int event_is_open = 0;
+extern struct list_head acpi_bus_event_list;
+extern wait_queue_head_t acpi_bus_event_queue;
 
-static int
-acpi_system_open_event(struct inode *inode, struct file *file)
+static int acpi_system_open_event(struct inode *inode, struct file *file)
 {
 	spin_lock_irq(&acpi_system_event_lock);
 
@@ -34,20 +33,20 @@ acpi_system_open_event(struct inode *inode, struct file *file)
 	spin_unlock_irq(&acpi_system_event_lock);
 	return 0;
 
-out_busy:
+      out_busy:
 	spin_unlock_irq(&acpi_system_event_lock);
 	return -EBUSY;
 }
 
 static ssize_t
-acpi_system_read_event(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
+acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
+		       loff_t * ppos)
 {
-	int			result = 0;
-	struct acpi_bus_event	event;
-	static char		str[ACPI_MAX_STRING];
-	static int		chars_remaining = 0;
-	static char		*ptr;
-
+	int result = 0;
+	struct acpi_bus_event event;
+	static char str[ACPI_MAX_STRING];
+	static int chars_remaining = 0;
+	static char *ptr;
 
 	ACPI_FUNCTION_TRACE("acpi_system_read_event");
 
@@ -63,10 +62,12 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof
 			return_VALUE(-EIO);
 		}
 
-		chars_remaining = sprintf(str, "%s %s %08x %08x\n", 
-			event.device_class?event.device_class:"<unknown>",
-			event.bus_id?event.bus_id:"<unknown>", 
-			event.type, event.data);
+		chars_remaining = sprintf(str, "%s %s %08x %08x\n",
+					  event.device_class ? event.
+					  device_class : "<unknown>",
+					  event.bus_id ? event.
+					  bus_id : "<unknown>", event.type,
+					  event.data);
 		ptr = str;
 	}
 
@@ -84,17 +85,15 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof
 	return_VALUE(count);
 }
 
-static int
-acpi_system_close_event(struct inode *inode, struct file *file)
+static int acpi_system_close_event(struct inode *inode, struct file *file)
 {
-	spin_lock_irq (&acpi_system_event_lock);
+	spin_lock_irq(&acpi_system_event_lock);
 	event_is_open = 0;
-	spin_unlock_irq (&acpi_system_event_lock);
+	spin_unlock_irq(&acpi_system_event_lock);
 	return 0;
 }
 
-static unsigned int
-acpi_system_poll_event(struct file *file, poll_table *wait)
+static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
 {
 	poll_wait(file, &acpi_bus_event_queue, wait);
 	if (!list_empty(&acpi_bus_event_list))
@@ -103,15 +102,15 @@ acpi_system_poll_event(struct file *file, poll_table *wait)
 }
 
 static struct file_operations acpi_system_event_ops = {
-	.open =		acpi_system_open_event,
-	.read =		acpi_system_read_event,
-	.release =	acpi_system_close_event,
-	.poll =		acpi_system_poll_event,
+	.open = acpi_system_open_event,
+	.read = acpi_system_read_event,
+	.release = acpi_system_close_event,
+	.poll = acpi_system_poll_event,
 };
 
 static int __init acpi_event_init(void)
 {
-	struct proc_dir_entry	*entry;
+	struct proc_dir_entry *entry;
 	int error = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_event_init");
@@ -124,8 +123,9 @@ static int __init acpi_event_init(void)
 	if (entry)
 		entry->proc_fops = &acpi_system_event_ops;
 	else {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-				  "Unable to create '%s' proc fs entry\n","event" ));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unable to create '%s' proc fs entry\n",
+				  "event"));
 		error = -EFAULT;
 	}
 	return_VALUE(error);

+ 66 - 102
drivers/acpi/events/evevent.c

@@ -45,18 +45,12 @@
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evevent")
+ACPI_MODULE_NAME("evevent")
 
 /* Local prototypes */
+static acpi_status acpi_ev_fixed_event_initialize(void);
 
-static acpi_status
-acpi_ev_fixed_event_initialize (
-	void);
-
-static u32
-acpi_ev_fixed_event_dispatch (
-	u32                             event);
-
+static u32 acpi_ev_fixed_event_dispatch(u32 event);
 
 /*******************************************************************************
  *
@@ -70,21 +64,17 @@ acpi_ev_fixed_event_dispatch (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_initialize_events (
-	void)
+acpi_status acpi_ev_initialize_events(void)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_initialize_events");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_initialize_events");
 
 	/* Make sure we have ACPI tables */
 
 	if (!acpi_gbl_DSDT) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
-		return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n"));
+		return_ACPI_STATUS(AE_NO_ACPI_TABLES);
 	}
 
 	/*
@@ -92,26 +82,22 @@ acpi_ev_initialize_events (
 	 * enabling SCIs to prevent interrupts from occurring before the handlers are
 	 * installed.
 	 */
-	status = acpi_ev_fixed_event_initialize ();
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_ERROR ((
-				"Unable to initialize fixed events, %s\n",
-				acpi_format_exception (status)));
-		return_ACPI_STATUS (status);
+	status = acpi_ev_fixed_event_initialize();
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
+				   acpi_format_exception(status)));
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ev_gpe_initialize ();
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_ERROR ((
-				"Unable to initialize general purpose events, %s\n",
-				acpi_format_exception (status)));
-		return_ACPI_STATUS (status);
+	status = acpi_ev_gpe_initialize();
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
+		return_ACPI_STATUS(status);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_xrupt_handlers
@@ -124,41 +110,32 @@ acpi_ev_initialize_events (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_install_xrupt_handlers (
-	void)
+acpi_status acpi_ev_install_xrupt_handlers(void)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_install_xrupt_handlers");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
 
 	/* Install the SCI handler */
 
-	status = acpi_ev_install_sci_handler ();
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_ERROR ((
-				"Unable to install System Control Interrupt Handler, %s\n",
-				acpi_format_exception (status)));
-		return_ACPI_STATUS (status);
+	status = acpi_ev_install_sci_handler();
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
+		return_ACPI_STATUS(status);
 	}
 
 	/* Install the handler for the Global Lock */
 
-	status = acpi_ev_init_global_lock_handler ();
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_ERROR ((
-				"Unable to initialize Global Lock handler, %s\n",
-				acpi_format_exception (status)));
-		return_ACPI_STATUS (status);
+	status = acpi_ev_init_global_lock_handler();
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
+		return_ACPI_STATUS(status);
 	}
 
 	acpi_gbl_events_initialized = TRUE;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_fixed_event_initialize
@@ -171,13 +148,10 @@ acpi_ev_install_xrupt_handlers (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ev_fixed_event_initialize (
-	void)
+static acpi_status acpi_ev_fixed_event_initialize(void)
 {
-	acpi_native_uint                i;
-	acpi_status                     status;
-
+	acpi_native_uint i;
+	acpi_status status;
 
 	/*
 	 * Initialize the structure that keeps track of fixed event handlers
@@ -190,10 +164,11 @@ acpi_ev_fixed_event_initialize (
 		/* Enable the fixed event */
 
 		if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
-			status = acpi_set_register (
-					 acpi_gbl_fixed_event_info[i].enable_register_id,
-					 0, ACPI_MTX_LOCK);
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_set_register(acpi_gbl_fixed_event_info[i].
+					      enable_register_id, 0,
+					      ACPI_MTX_LOCK);
+			if (ACPI_FAILURE(status)) {
 				return (status);
 			}
 		}
@@ -202,7 +177,6 @@ acpi_ev_fixed_event_initialize (
 	return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_fixed_event_detect
@@ -215,31 +189,27 @@ acpi_ev_fixed_event_initialize (
  *
  ******************************************************************************/
 
-u32
-acpi_ev_fixed_event_detect (
-	void)
+u32 acpi_ev_fixed_event_detect(void)
 {
-	u32                             int_status = ACPI_INTERRUPT_NOT_HANDLED;
-	u32                             fixed_status;
-	u32                             fixed_enable;
-	acpi_native_uint                i;
-
-
-	ACPI_FUNCTION_NAME ("ev_fixed_event_detect");
+	u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
+	u32 fixed_status;
+	u32 fixed_enable;
+	acpi_native_uint i;
 
+	ACPI_FUNCTION_NAME("ev_fixed_event_detect");
 
 	/*
 	 * Read the fixed feature status and enable registers, as all the cases
 	 * depend on their values.  Ignore errors here.
 	 */
-	(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
-			 &fixed_status);
-	(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
-			 &fixed_enable);
+	(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+				    ACPI_REGISTER_PM1_STATUS, &fixed_status);
+	(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+				    ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
-		"Fixed Event Block: Enable %08X Status %08X\n",
-		fixed_enable, fixed_status));
+	ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
+			  "Fixed Event Block: Enable %08X Status %08X\n",
+			  fixed_enable, fixed_status));
 
 	/*
 	 * Check for all possible Fixed Events and dispatch those that are active
@@ -247,18 +217,19 @@ acpi_ev_fixed_event_detect (
 	for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
 		/* Both the status and enable bits must be on for this event */
 
-		if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
-			(fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
+		if ((fixed_status & acpi_gbl_fixed_event_info[i].
+		     status_bit_mask)
+		    && (fixed_enable & acpi_gbl_fixed_event_info[i].
+			enable_bit_mask)) {
 			/* Found an active (signalled) event */
 
-			int_status |= acpi_ev_fixed_event_dispatch ((u32) i);
+			int_status |= acpi_ev_fixed_event_dispatch((u32) i);
 		}
 	}
 
 	return (int_status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_fixed_event_dispatch
@@ -272,39 +243,32 @@ acpi_ev_fixed_event_detect (
  *
  ******************************************************************************/
 
-static u32
-acpi_ev_fixed_event_dispatch (
-	u32                             event)
+static u32 acpi_ev_fixed_event_dispatch(u32 event)
 {
 
-
-	ACPI_FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY();
 
 	/* Clear the status bit */
 
-	(void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
-			 1, ACPI_MTX_DO_NOT_LOCK);
+	(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
+				status_register_id, 1, ACPI_MTX_DO_NOT_LOCK);
 
 	/*
 	 * Make sure we've got a handler.  If not, report an error.
 	 * The event is disabled to prevent further interrupts.
 	 */
 	if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
-		(void) acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-				0, ACPI_MTX_DO_NOT_LOCK);
+		(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
+					enable_register_id, 0,
+					ACPI_MTX_DO_NOT_LOCK);
 
-		ACPI_REPORT_ERROR (
-			("No installed handler for fixed event [%08X]\n",
-			event));
+		ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
 
 		return (ACPI_INTERRUPT_NOT_HANDLED);
 	}
 
 	/* Invoke the Fixed Event handler */
 
-	return ((acpi_gbl_fixed_event_handlers[event].handler)(
-			  acpi_gbl_fixed_event_handlers[event].context));
+	return ((acpi_gbl_fixed_event_handlers[event].
+		 handler) (acpi_gbl_fixed_event_handlers[event].context));
 }
-
-

+ 196 - 232
drivers/acpi/events/evgpe.c

@@ -46,14 +46,10 @@
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evgpe")
+ACPI_MODULE_NAME("evgpe")
 
 /* Local prototypes */
-
-static void ACPI_SYSTEM_XFACE
-acpi_ev_asynch_execute_gpe_method (
-	void                            *context);
-
+static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context);
 
 /*******************************************************************************
  *
@@ -69,15 +65,11 @@ acpi_ev_asynch_execute_gpe_method (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_set_gpe_type (
-	struct acpi_gpe_event_info      *gpe_event_info,
-	u8                              type)
+acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_set_gpe_type");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_set_gpe_type");
 
 	/* Validate type and update register enable masks */
 
@@ -88,21 +80,20 @@ acpi_ev_set_gpe_type (
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Disable the GPE if currently enabled */
 
-	status = acpi_ev_disable_gpe (gpe_event_info);
+	status = acpi_ev_disable_gpe(gpe_event_info);
 
 	/* Type was validated above */
 
-	gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
-	gpe_event_info->flags |= type;              /* Insert type */
-	return_ACPI_STATUS (status);
+	gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK;	/* Clear type bits */
+	gpe_event_info->flags |= type;	/* Insert type */
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_update_gpe_enable_masks
@@ -118,57 +109,55 @@ acpi_ev_set_gpe_type (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_update_gpe_enable_masks (
-	struct acpi_gpe_event_info      *gpe_event_info,
-	u8                              type)
+acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
+				u8 type)
 {
-	struct acpi_gpe_register_info   *gpe_register_info;
-	u8                              register_bit;
-
-
-	ACPI_FUNCTION_TRACE ("ev_update_gpe_enable_masks");
+	struct acpi_gpe_register_info *gpe_register_info;
+	u8 register_bit;
 
+	ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks");
 
 	gpe_register_info = gpe_event_info->register_info;
 	if (!gpe_register_info) {
-		return_ACPI_STATUS (AE_NOT_EXIST);
+		return_ACPI_STATUS(AE_NOT_EXIST);
 	}
 	register_bit = gpe_event_info->register_bit;
 
 	/* 1) Disable case.  Simply clear all enable bits */
 
 	if (type == ACPI_GPE_DISABLE) {
-		ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
-		ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
-		return_ACPI_STATUS (AE_OK);
+		ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
+			       register_bit);
+		ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* 2) Enable case.  Set/Clear the appropriate enable bits */
 
 	switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
 	case ACPI_GPE_TYPE_WAKE:
-		ACPI_SET_BIT   (gpe_register_info->enable_for_wake, register_bit);
-		ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
+		ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
+		ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
 		break;
 
 	case ACPI_GPE_TYPE_RUNTIME:
-		ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
-		ACPI_SET_BIT   (gpe_register_info->enable_for_run, register_bit);
+		ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
+			       register_bit);
+		ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
 		break;
 
 	case ACPI_GPE_TYPE_WAKE_RUN:
-		ACPI_SET_BIT   (gpe_register_info->enable_for_wake, register_bit);
-		ACPI_SET_BIT   (gpe_register_info->enable_for_run, register_bit);
+		ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
+		ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_enable_gpe
@@ -184,21 +173,19 @@ acpi_ev_update_gpe_enable_masks (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_enable_gpe (
-	struct acpi_gpe_event_info      *gpe_event_info,
-	u8                              write_to_hardware)
+acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
+		   u8 write_to_hardware)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_enable_gpe");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_enable_gpe");
 
 	/* Make sure HW enable masks are updated */
 
-	status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Mark wake-enabled or HW enable, or both */
@@ -206,41 +193,40 @@ acpi_ev_enable_gpe (
 	switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
 	case ACPI_GPE_TYPE_WAKE:
 
-		ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+		ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
 		break;
 
 	case ACPI_GPE_TYPE_WAKE_RUN:
 
-		ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+		ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
 
 		/*lint -fallthrough */
 
 	case ACPI_GPE_TYPE_RUNTIME:
 
-		ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
+		ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
 
 		if (write_to_hardware) {
 			/* Clear the GPE (of stale events), then enable it */
 
-			status = acpi_hw_clear_gpe (gpe_event_info);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status = acpi_hw_clear_gpe(gpe_event_info);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 
 			/* Enable the requested runtime GPE */
 
-			status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
+			status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
 		}
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_disable_gpe
@@ -253,36 +239,33 @@ acpi_ev_enable_gpe (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_disable_gpe (
-	struct acpi_gpe_event_info      *gpe_event_info)
+acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_disable_gpe");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_disable_gpe");
 
 	if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Make sure HW enable masks are updated */
 
-	status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Mark wake-disabled or HW disable, or both */
 
 	switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
 	case ACPI_GPE_TYPE_WAKE:
-		ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+		ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
 		break;
 
 	case ACPI_GPE_TYPE_WAKE_RUN:
-		ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+		ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
 
 		/*lint -fallthrough */
 
@@ -290,18 +273,17 @@ acpi_ev_disable_gpe (
 
 		/* Disable the requested runtime GPE */
 
-		ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
-		status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
+		ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
+		status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_get_gpe_event_info
@@ -319,18 +301,14 @@ acpi_ev_disable_gpe (
  *
  ******************************************************************************/
 
-struct acpi_gpe_event_info *
-acpi_ev_get_gpe_event_info (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number)
+struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
+						       u32 gpe_number)
 {
-	union acpi_operand_object       *obj_desc;
-	struct acpi_gpe_block_info      *gpe_block;
-	acpi_native_uint                i;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_operand_object *obj_desc;
+	struct acpi_gpe_block_info *gpe_block;
+	acpi_native_uint i;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/* A NULL gpe_block means use the FADT-defined GPE block(s) */
 
@@ -340,11 +318,14 @@ acpi_ev_get_gpe_event_info (
 		for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
 			gpe_block = acpi_gbl_gpe_fadt_blocks[i];
 			if (gpe_block) {
-				if ((gpe_number >= gpe_block->block_base_number) &&
-					(gpe_number < gpe_block->block_base_number +
-						(gpe_block->register_count * 8))) {
-					return (&gpe_block->event_info[gpe_number -
-						gpe_block->block_base_number]);
+				if ((gpe_number >= gpe_block->block_base_number)
+				    && (gpe_number <
+					gpe_block->block_base_number +
+					(gpe_block->register_count * 8))) {
+					return (&gpe_block->
+						event_info[gpe_number -
+							   gpe_block->
+							   block_base_number]);
 				}
 			}
 		}
@@ -356,23 +337,25 @@ acpi_ev_get_gpe_event_info (
 
 	/* A Non-NULL gpe_device means this is a GPE Block Device */
 
-	obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) gpe_device);
-	if (!obj_desc ||
-		!obj_desc->device.gpe_block) {
+	obj_desc =
+	    acpi_ns_get_attached_object((struct acpi_namespace_node *)
+					gpe_device);
+	if (!obj_desc || !obj_desc->device.gpe_block) {
 		return (NULL);
 	}
 
 	gpe_block = obj_desc->device.gpe_block;
 
 	if ((gpe_number >= gpe_block->block_base_number) &&
-		(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
-		return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]);
+	    (gpe_number <
+	     gpe_block->block_base_number + (gpe_block->register_count * 8))) {
+		return (&gpe_block->
+			event_info[gpe_number - gpe_block->block_base_number]);
 	}
 
 	return (NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_gpe_detect
@@ -387,23 +370,20 @@ acpi_ev_get_gpe_event_info (
  *
  ******************************************************************************/
 
-u32
-acpi_ev_gpe_detect (
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_list)
+u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 {
-	u32                             int_status = ACPI_INTERRUPT_NOT_HANDLED;
-	u8                              enabled_status_byte;
-	struct acpi_gpe_register_info   *gpe_register_info;
-	u32                             status_reg;
-	u32                             enable_reg;
-	u32                             flags;
-	acpi_status                     status;
-	struct acpi_gpe_block_info      *gpe_block;
-	acpi_native_uint                i;
-	acpi_native_uint                j;
-
-
-	ACPI_FUNCTION_NAME ("ev_gpe_detect");
+	u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
+	u8 enabled_status_byte;
+	struct acpi_gpe_register_info *gpe_register_info;
+	u32 status_reg;
+	u32 enable_reg;
+	u32 flags;
+	acpi_status status;
+	struct acpi_gpe_block_info *gpe_block;
+	acpi_native_uint i;
+	acpi_native_uint j;
+
+	ACPI_FUNCTION_NAME("ev_gpe_detect");
 
 	/* Check for the case where there are no GPEs */
 
@@ -413,7 +393,7 @@ acpi_ev_gpe_detect (
 
 	/* Examine all GPE blocks attached to this interrupt level */
 
-	flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
+	flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 	gpe_block = gpe_xrupt_list->gpe_block_list_head;
 	while (gpe_block) {
 		/*
@@ -428,23 +408,30 @@ acpi_ev_gpe_detect (
 
 			/* Read the Status Register */
 
-			status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &status_reg,
-					 &gpe_register_info->status_address);
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
+						   &status_reg,
+						   &gpe_register_info->
+						   status_address);
+			if (ACPI_FAILURE(status)) {
 				goto unlock_and_exit;
 			}
 
 			/* Read the Enable Register */
 
-			status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &enable_reg,
-					 &gpe_register_info->enable_address);
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
+						   &enable_reg,
+						   &gpe_register_info->
+						   enable_address);
+			if (ACPI_FAILURE(status)) {
 				goto unlock_and_exit;
 			}
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
-				"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
-				gpe_register_info->base_gpe_number, status_reg, enable_reg));
+			ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
+					  "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
+					  gpe_register_info->base_gpe_number,
+					  status_reg, enable_reg));
 
 			/* Check if there is anything active at all in this register */
 
@@ -460,14 +447,21 @@ acpi_ev_gpe_detect (
 			for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
 				/* Examine one GPE bit */
 
-				if (enabled_status_byte & acpi_gbl_decode_to8bit[j]) {
+				if (enabled_status_byte &
+				    acpi_gbl_decode_to8bit[j]) {
 					/*
 					 * Found an active GPE. Dispatch the event to a handler
 					 * or method.
 					 */
-					int_status |= acpi_ev_gpe_dispatch (
-						&gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
-						(u32) j + gpe_register_info->base_gpe_number);
+					int_status |=
+					    acpi_ev_gpe_dispatch(&gpe_block->
+								 event_info[(i *
+									     ACPI_GPE_REGISTER_WIDTH)
+									    +
+									    j],
+								 (u32) j +
+								 gpe_register_info->
+								 base_gpe_number);
 				}
 			}
 		}
@@ -475,13 +469,12 @@ acpi_ev_gpe_detect (
 		gpe_block = gpe_block->next;
 	}
 
-unlock_and_exit:
+      unlock_and_exit:
 
-	acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
+	acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 	return (int_status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_asynch_execute_gpe_method
@@ -498,45 +491,41 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_asynch_execute_gpe_method (
-	void                            *context)
+static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 {
-	struct acpi_gpe_event_info      *gpe_event_info = (void *) context;
-	u32                             gpe_number = 0;
-	acpi_status                     status;
-	struct acpi_gpe_event_info      local_gpe_event_info;
-	struct acpi_parameter_info      info;
-
+	struct acpi_gpe_event_info *gpe_event_info = (void *)context;
+	u32 gpe_number = 0;
+	acpi_status status;
+	struct acpi_gpe_event_info local_gpe_event_info;
+	struct acpi_parameter_info info;
 
-	ACPI_FUNCTION_TRACE ("ev_asynch_execute_gpe_method");
+	ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method");
 
-
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
 		return_VOID;
 	}
 
 	/* Must revalidate the gpe_number/gpe_block */
 
-	if (!acpi_ev_valid_gpe_event (gpe_event_info)) {
-		status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+	if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
+		status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
 		return_VOID;
 	}
 
 	/* Set the GPE flags for return to enabled state */
 
-	(void) acpi_ev_enable_gpe (gpe_event_info, FALSE);
+	(void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
 
 	/*
 	 * Take a snapshot of the GPE info for this level - we copy the
 	 * info to prevent a race condition with remove_handler/remove_block.
 	 */
-	ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info,
-		sizeof (struct acpi_gpe_event_info));
+	ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info,
+		    sizeof(struct acpi_gpe_event_info));
 
-	status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
 		return_VOID;
 	}
 
@@ -545,44 +534,40 @@ acpi_ev_asynch_execute_gpe_method (
 	 * time to avoid race with ev_gpe_install_handler
 	 */
 	if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
-			ACPI_GPE_DISPATCH_METHOD) {
+	    ACPI_GPE_DISPATCH_METHOD) {
 		/*
 		 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
 		 * control method that corresponds to this GPE
 		 */
 		info.node = local_gpe_event_info.dispatch.method_node;
-		info.parameters = ACPI_CAST_PTR (union acpi_operand_object *, gpe_event_info);
+		info.parameters =
+		    ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info);
 		info.parameter_type = ACPI_PARAM_GPE;
 
-		status = acpi_ns_evaluate_by_handle (&info);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR ((
-				"%s while evaluating method [%4.4s] for GPE[%2X]\n",
-				acpi_format_exception (status),
-				acpi_ut_get_node_name (local_gpe_event_info.dispatch.method_node),
-				gpe_number));
+		status = acpi_ns_evaluate_by_handle(&info);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number));
 		}
 	}
 
 	if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
-			ACPI_GPE_LEVEL_TRIGGERED) {
+	    ACPI_GPE_LEVEL_TRIGGERED) {
 		/*
 		 * GPE is level-triggered, we clear the GPE status bit after
 		 * handling the event.
 		 */
-		status = acpi_hw_clear_gpe (&local_gpe_event_info);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_hw_clear_gpe(&local_gpe_event_info);
+		if (ACPI_FAILURE(status)) {
 			return_VOID;
 		}
 	}
 
 	/* Enable this GPE */
 
-	(void) acpi_hw_write_gpe_enable_reg (&local_gpe_event_info);
+	(void)acpi_hw_write_gpe_enable_reg(&local_gpe_event_info);
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_gpe_dispatch
@@ -600,38 +585,31 @@ acpi_ev_asynch_execute_gpe_method (
  ******************************************************************************/
 
 u32
-acpi_ev_gpe_dispatch (
-	struct acpi_gpe_event_info      *gpe_event_info,
-	u32                             gpe_number)
+acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_gpe_dispatch");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_gpe_dispatch");
 
 	/*
 	 * If edge-triggered, clear the GPE status bit now.  Note that
 	 * level-triggered events are cleared after the GPE is serviced.
 	 */
 	if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
-			ACPI_GPE_EDGE_TRIGGERED) {
-		status = acpi_hw_clear_gpe (gpe_event_info);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR ((
-				"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
-				acpi_format_exception (status), gpe_number));
-			return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+	    ACPI_GPE_EDGE_TRIGGERED) {
+		status = acpi_hw_clear_gpe(gpe_event_info);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+			return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
 		}
 	}
 
 	/* Save current system state */
 
 	if (acpi_gbl_system_awake_and_running) {
-		ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
-	}
-	else {
-		ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
+		ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
+	} else {
+		ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
 	}
 
 	/*
@@ -648,19 +626,19 @@ acpi_ev_gpe_dispatch (
 		 * Invoke the installed handler (at interrupt level)
 		 * Ignore return status for now.  TBD: leave GPE disabled on error?
 		 */
-		(void) gpe_event_info->dispatch.handler->address (
-				  gpe_event_info->dispatch.handler->context);
+		(void)gpe_event_info->dispatch.handler->address(gpe_event_info->
+								dispatch.
+								handler->
+								context);
 
 		/* It is now safe to clear level-triggered events. */
 
 		if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
-				ACPI_GPE_LEVEL_TRIGGERED) {
-			status = acpi_hw_clear_gpe (gpe_event_info);
-			if (ACPI_FAILURE (status)) {
-				ACPI_REPORT_ERROR ((
-					"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
-					acpi_format_exception (status), gpe_number));
-				return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+		    ACPI_GPE_LEVEL_TRIGGERED) {
+			status = acpi_hw_clear_gpe(gpe_event_info);
+			if (ACPI_FAILURE(status)) {
+				ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+				return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
 			}
 		}
 		break;
@@ -671,24 +649,21 @@ acpi_ev_gpe_dispatch (
 		 * Disable GPE, so it doesn't keep firing before the method has a
 		 * chance to run.
 		 */
-		status = acpi_ev_disable_gpe (gpe_event_info);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR ((
-				"acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
-				acpi_format_exception (status), gpe_number));
-			return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+		status = acpi_ev_disable_gpe(gpe_event_info);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+			return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
 		}
 
 		/*
 		 * Execute the method associated with the GPE
 		 * NOTE: Level-triggered GPEs are cleared after the method completes.
 		 */
-		status = acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
-				 acpi_ev_asynch_execute_gpe_method, gpe_event_info);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR ((
-				"acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n",
-				acpi_format_exception (status), gpe_number));
+		status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
+						     acpi_ev_asynch_execute_gpe_method,
+						     gpe_event_info);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number));
 		}
 		break;
 
@@ -696,28 +671,23 @@ acpi_ev_gpe_dispatch (
 
 		/* No handler or method to run! */
 
-		ACPI_REPORT_ERROR ((
-			"acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n",
-			gpe_number));
+		ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number));
 
 		/*
 		 * Disable the GPE.  The GPE will remain disabled until the ACPI
 		 * Core Subsystem is restarted, or a handler is installed.
 		 */
-		status = acpi_ev_disable_gpe (gpe_event_info);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR ((
-				"acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
-				acpi_format_exception (status), gpe_number));
-			return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+		status = acpi_ev_disable_gpe(gpe_event_info);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+			return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
 		}
 		break;
 	}
 
-	return_VALUE (ACPI_INTERRUPT_HANDLED);
+	return_VALUE(ACPI_INTERRUPT_HANDLED);
 }
 
-
 #ifdef ACPI_GPE_NOTIFY_CHECK
 /*******************************************************************************
  * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
@@ -736,35 +706,29 @@ acpi_ev_gpe_dispatch (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_check_for_wake_only_gpe (
-	struct acpi_gpe_event_info      *gpe_event_info)
+acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
-	acpi_status                     status;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe");
 
-	ACPI_FUNCTION_TRACE ("ev_check_for_wake_only_gpe");
-
-
-	if ((gpe_event_info) &&  /* Only >0 for _Lxx/_Exx */
-	   ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */ {
+	if ((gpe_event_info) &&	/* Only >0 for _Lxx/_Exx */
+	    ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) {	/* System state at GPE time */
 		/* This must be a wake-only GPE, disable it */
 
-		status = acpi_ev_disable_gpe (gpe_event_info);
+		status = acpi_ev_disable_gpe(gpe_event_info);
 
 		/* Set GPE to wake-only.  Do not change wake disabled/enabled status */
 
-		acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE);
+		acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
 
-		ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n",
-				gpe_event_info));
+		ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info));
 
 		/* This was a wake-only GPE */
 
-		return_ACPI_STATUS (AE_WAKE_ONLY_GPE);
+		return_ACPI_STATUS(AE_WAKE_ONLY_GPE);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 #endif
-
-

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 290 - 327
drivers/acpi/events/evgpeblk.c


+ 126 - 168
drivers/acpi/events/evmisc.c

@@ -47,12 +47,10 @@
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evmisc")
-
+ACPI_MODULE_NAME("evmisc")
 
 #ifdef ACPI_DEBUG_OUTPUT
-static const char                *acpi_notify_value_names[] =
-{
+static const char *acpi_notify_value_names[] = {
 	"Bus Check",
 	"Device Check",
 	"Device Wake",
@@ -66,18 +64,11 @@ static const char                *acpi_notify_value_names[] =
 
 /* Local prototypes */
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_notify_dispatch (
-	void                            *context);
-
-static void ACPI_SYSTEM_XFACE
-acpi_ev_global_lock_thread (
-	void                            *context);
+static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
 
-static u32
-acpi_ev_global_lock_handler (
-	void                            *context);
+static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context);
 
+static u32 acpi_ev_global_lock_handler(void *context);
 
 /*******************************************************************************
  *
@@ -93,9 +84,7 @@ acpi_ev_global_lock_handler (
  *
  ******************************************************************************/
 
-u8
-acpi_ev_is_notify_object (
-	struct acpi_namespace_node      *node)
+u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
 {
 	switch (node->type) {
 	case ACPI_TYPE_DEVICE:
@@ -112,7 +101,6 @@ acpi_ev_is_notify_object (
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_queue_notify_request
@@ -128,18 +116,15 @@ acpi_ev_is_notify_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_queue_notify_request (
-	struct acpi_namespace_node      *node,
-	u32                             notify_value)
+acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
+			     u32 notify_value)
 {
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *handler_obj = NULL;
-	union acpi_generic_state        *notify_info;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_NAME ("ev_queue_notify_request");
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *handler_obj = NULL;
+	union acpi_generic_state *notify_info;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_NAME("ev_queue_notify_request");
 
 	/*
 	 * For value 3 (Ejection Request), some device method may need to be run.
@@ -148,22 +133,22 @@ acpi_ev_queue_notify_request (
 	 * For value 0x80 (Status Change) on the power button or sleep button,
 	 *   initiate soft-off or sleep operation?
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-		"Dispatching Notify(%X) on node %p\n", notify_value, node));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "Dispatching Notify(%X) on node %p\n", notify_value,
+			  node));
 
 	if (notify_value <= 7) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
-				acpi_notify_value_names[notify_value]));
-	}
-	else {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"Notify value: 0x%2.2X **Device Specific**\n",
-			notify_value));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n",
+				  acpi_notify_value_names[notify_value]));
+	} else {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Notify value: 0x%2.2X **Device Specific**\n",
+				  notify_value));
 	}
 
 	/* Get the notify object attached to the NS Node */
 
-	obj_desc = acpi_ns_get_attached_object (node);
+	obj_desc = acpi_ns_get_attached_object(node);
 	if (obj_desc) {
 		/* We have the notify object, Get the right handler */
 
@@ -174,10 +159,11 @@ acpi_ev_queue_notify_request (
 		case ACPI_TYPE_POWER:
 
 			if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
-				handler_obj = obj_desc->common_notify.system_notify;
-			}
-			else {
-				handler_obj = obj_desc->common_notify.device_notify;
+				handler_obj =
+				    obj_desc->common_notify.system_notify;
+			} else {
+				handler_obj =
+				    obj_desc->common_notify.device_notify;
 			}
 			break;
 
@@ -189,23 +175,25 @@ acpi_ev_queue_notify_request (
 
 	/* If there is any handler to run, schedule the dispatcher */
 
-	if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
-		(acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) ||
-		handler_obj) {
-		notify_info = acpi_ut_create_generic_state ();
+	if ((acpi_gbl_system_notify.handler
+	     && (notify_value <= ACPI_MAX_SYS_NOTIFY))
+	    || (acpi_gbl_device_notify.handler
+		&& (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) {
+		notify_info = acpi_ut_create_generic_state();
 		if (!notify_info) {
 			return (AE_NO_MEMORY);
 		}
 
 		notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
-		notify_info->notify.node      = node;
-		notify_info->notify.value     = (u16) notify_value;
+		notify_info->notify.node = node;
+		notify_info->notify.value = (u16) notify_value;
 		notify_info->notify.handler_obj = handler_obj;
 
-		status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
-				  acpi_ev_notify_dispatch, notify_info);
-		if (ACPI_FAILURE (status)) {
-			acpi_ut_delete_generic_state (notify_info);
+		status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
+						     acpi_ev_notify_dispatch,
+						     notify_info);
+		if (ACPI_FAILURE(status)) {
+			acpi_ut_delete_generic_state(notify_info);
 		}
 	}
 
@@ -214,15 +202,15 @@ acpi_ev_queue_notify_request (
 		 * There is no per-device notify handler for this device.
 		 * This may or may not be a problem.
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"No notify handler for Notify(%4.4s, %X) node %p\n",
-			acpi_ut_get_node_name (node), notify_value, node));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "No notify handler for Notify(%4.4s, %X) node %p\n",
+				  acpi_ut_get_node_name(node), notify_value,
+				  node));
 	}
 
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_notify_dispatch
@@ -236,18 +224,15 @@ acpi_ev_queue_notify_request (
  *
  ******************************************************************************/
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_notify_dispatch (
-	void                            *context)
+static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
 {
-	union acpi_generic_state        *notify_info = (union acpi_generic_state *) context;
-	acpi_notify_handler             global_handler = NULL;
-	void                            *global_context = NULL;
-	union acpi_operand_object       *handler_obj;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_generic_state *notify_info =
+	    (union acpi_generic_state *)context;
+	acpi_notify_handler global_handler = NULL;
+	void *global_context = NULL;
+	union acpi_operand_object *handler_obj;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * We will invoke a global notify handler if installed.
@@ -261,8 +246,7 @@ acpi_ev_notify_dispatch (
 			global_handler = acpi_gbl_system_notify.handler;
 			global_context = acpi_gbl_system_notify.context;
 		}
-	}
-	else {
+	} else {
 		/* Global driver notification handler */
 
 		if (acpi_gbl_device_notify.handler) {
@@ -274,25 +258,24 @@ acpi_ev_notify_dispatch (
 	/* Invoke the system handler first, if present */
 
 	if (global_handler) {
-		global_handler (notify_info->notify.node, notify_info->notify.value,
-			global_context);
+		global_handler(notify_info->notify.node,
+			       notify_info->notify.value, global_context);
 	}
 
 	/* Now invoke the per-device handler, if present */
 
 	handler_obj = notify_info->notify.handler_obj;
 	if (handler_obj) {
-		handler_obj->notify.handler (notify_info->notify.node,
-			notify_info->notify.value,
-			handler_obj->notify.context);
+		handler_obj->notify.handler(notify_info->notify.node,
+					    notify_info->notify.value,
+					    handler_obj->notify.context);
 	}
 
 	/* All done with the info object */
 
-	acpi_ut_delete_generic_state (notify_info);
+	acpi_ut_delete_generic_state(notify_info);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_global_lock_thread
@@ -307,27 +290,24 @@ acpi_ev_notify_dispatch (
  *
  ******************************************************************************/
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_global_lock_thread (
-	void                            *context)
+static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
 	/* Signal threads that are waiting for the lock */
 
 	if (acpi_gbl_global_lock_thread_count) {
 		/* Send sufficient units to the semaphore */
 
-		status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,
-				 acpi_gbl_global_lock_thread_count);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
+		status =
+		    acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
+					     acpi_gbl_global_lock_thread_count);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n"));
 		}
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_global_lock_handler
@@ -342,20 +322,17 @@ acpi_ev_global_lock_thread (
  *
  ******************************************************************************/
 
-static u32
-acpi_ev_global_lock_handler (
-	void                            *context)
+static u32 acpi_ev_global_lock_handler(void *context)
 {
-	u8                              acquired = FALSE;
-	acpi_status                     status;
-
+	u8 acquired = FALSE;
+	acpi_status status;
 
 	/*
 	 * Attempt to get the lock
 	 * If we don't get it now, it will be marked pending and we will
 	 * take another interrupt when it becomes free.
 	 */
-	ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
+	ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
 	if (acquired) {
 		/* Got the lock, now wake all threads waiting for it */
 
@@ -363,11 +340,11 @@ acpi_ev_global_lock_handler (
 
 		/* Run the Global Lock thread which will signal all waiting threads */
 
-		status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
-				  acpi_ev_global_lock_thread, context);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
-				acpi_format_exception (status)));
+		status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
+						     acpi_ev_global_lock_thread,
+						     context);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status)));
 
 			return (ACPI_INTERRUPT_NOT_HANDLED);
 		}
@@ -376,7 +353,6 @@ acpi_ev_global_lock_handler (
 	return (ACPI_INTERRUPT_HANDLED);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_init_global_lock_handler
@@ -389,19 +365,16 @@ acpi_ev_global_lock_handler (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_init_global_lock_handler (
-	void)
+acpi_status acpi_ev_init_global_lock_handler(void)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_init_global_lock_handler");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_init_global_lock_handler");
 
 	acpi_gbl_global_lock_present = TRUE;
-	status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
-			 acpi_ev_global_lock_handler, NULL);
+	status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
+						  acpi_ev_global_lock_handler,
+						  NULL);
 
 	/*
 	 * If the global lock does not exist on this platform, the attempt
@@ -411,17 +384,15 @@ acpi_ev_init_global_lock_handler (
 	 * with an error.
 	 */
 	if (status == AE_NO_HARDWARE_RESPONSE) {
-		ACPI_REPORT_ERROR ((
-			"No response from Global Lock hardware, disabling lock\n"));
+		ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n"));
 
 		acpi_gbl_global_lock_present = FALSE;
 		status = AE_OK;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_acquire_global_lock
@@ -434,22 +405,18 @@ acpi_ev_init_global_lock_handler (
  *
  *****************************************************************************/
 
-acpi_status
-acpi_ev_acquire_global_lock (
-	u16                             timeout)
+acpi_status acpi_ev_acquire_global_lock(u16 timeout)
 {
-	acpi_status                     status = AE_OK;
-	u8                              acquired = FALSE;
-
-
-	ACPI_FUNCTION_TRACE ("ev_acquire_global_lock");
+	acpi_status status = AE_OK;
+	u8 acquired = FALSE;
 
+	ACPI_FUNCTION_TRACE("ev_acquire_global_lock");
 
 #ifndef ACPI_APPLICATION
 	/* Make sure that we actually have a global lock */
 
 	if (!acpi_gbl_global_lock_present) {
-		return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
+		return_ACPI_STATUS(AE_NO_GLOBAL_LOCK);
 	}
 #endif
 
@@ -462,37 +429,37 @@ acpi_ev_acquire_global_lock (
 	 * we are done
 	 */
 	if (acpi_gbl_global_lock_acquired) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* We must acquire the actual hardware lock */
 
-	ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
+	ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
 	if (acquired) {
-	   /* We got the lock */
+		/* We got the lock */
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Acquired the HW Global Lock\n"));
 
 		acpi_gbl_global_lock_acquired = TRUE;
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/*
 	 * Did not get the lock.  The pending bit was set above, and we must now
 	 * wait until we get the global lock released interrupt.
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
 
 	/*
 	 * Acquire the global lock semaphore first.
 	 * Since this wait will block, we must release the interpreter
 	 */
-	status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
-			  timeout);
-	return_ACPI_STATUS (status);
+	status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
+					       timeout);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_release_global_lock
@@ -505,21 +472,16 @@ acpi_ev_acquire_global_lock (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_release_global_lock (
-	void)
+acpi_status acpi_ev_release_global_lock(void)
 {
-	u8                              pending = FALSE;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ev_release_global_lock");
+	u8 pending = FALSE;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ev_release_global_lock");
 
 	if (!acpi_gbl_global_lock_thread_count) {
-		ACPI_REPORT_WARNING((
-			"Cannot release HW Global Lock, it has not been acquired\n"));
-		return_ACPI_STATUS (AE_NOT_ACQUIRED);
+		ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
+		return_ACPI_STATUS(AE_NOT_ACQUIRED);
 	}
 
 	/* One fewer thread has the global lock */
@@ -528,14 +490,14 @@ acpi_ev_release_global_lock (
 	if (acpi_gbl_global_lock_thread_count) {
 		/* There are still some threads holding the lock, cannot release */
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/*
 	 * No more threads holding lock, we can do the actual hardware
 	 * release
 	 */
-	ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending);
+	ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, pending);
 	acpi_gbl_global_lock_acquired = FALSE;
 
 	/*
@@ -543,14 +505,13 @@ acpi_ev_release_global_lock (
 	 * register
 	 */
 	if (pending) {
-		status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
-				 1, ACPI_MTX_LOCK);
+		status = acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE,
+					   1, ACPI_MTX_LOCK);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_terminate
@@ -563,16 +524,12 @@ acpi_ev_release_global_lock (
  *
  ******************************************************************************/
 
-void
-acpi_ev_terminate (
-	void)
+void acpi_ev_terminate(void)
 {
-	acpi_native_uint                i;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_terminate");
+	acpi_native_uint i;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_terminate");
 
 	if (acpi_gbl_events_initialized) {
 		/*
@@ -583,38 +540,39 @@ acpi_ev_terminate (
 		/* Disable all fixed events */
 
 		for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
-			status = acpi_disable_event ((u32) i, 0);
-			if (ACPI_FAILURE (status)) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Could not disable fixed event %d\n", (u32) i));
+			status = acpi_disable_event((u32) i, 0);
+			if (ACPI_FAILURE(status)) {
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Could not disable fixed event %d\n",
+						  (u32) i));
 			}
 		}
 
 		/* Disable all GPEs in all GPE blocks */
 
-		status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
+		status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
 
 		/* Remove SCI handler */
 
-		status = acpi_ev_remove_sci_handler ();
+		status = acpi_ev_remove_sci_handler();
 		if (ACPI_FAILURE(status)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Could not remove SCI handler\n"));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Could not remove SCI handler\n"));
 		}
 	}
 
 	/* Deallocate all handler objects installed within GPE info structs */
 
-	status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers);
+	status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
 
 	/* Return to original mode if necessary */
 
 	if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
-		status = acpi_disable ();
-		if (ACPI_FAILURE (status)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n"));
+		status = acpi_disable();
+		if (ACPI_FAILURE(status)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+					  "acpi_disable failed\n"));
 		}
 	}
 	return_VOID;
 }
-

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 268 - 286
drivers/acpi/events/evregion.c


+ 151 - 160
drivers/acpi/events/evrgnini.c

@@ -41,14 +41,12 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evrgnini")
-
+ACPI_MODULE_NAME("evrgnini")
 
 /*******************************************************************************
  *
@@ -64,34 +62,31 @@
  * DESCRIPTION: Setup a system_memory operation region
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ev_system_memory_region_setup (
-	acpi_handle                     handle,
-	u32                             function,
-	void                            *handler_context,
-	void                            **region_context)
+acpi_ev_system_memory_region_setup(acpi_handle handle,
+				   u32 function,
+				   void *handler_context, void **region_context)
 {
-	union acpi_operand_object       *region_desc = (union acpi_operand_object *) handle;
-	struct acpi_mem_space_context   *local_region_context;
-
-
-	ACPI_FUNCTION_TRACE ("ev_system_memory_region_setup");
+	union acpi_operand_object *region_desc =
+	    (union acpi_operand_object *)handle;
+	struct acpi_mem_space_context *local_region_context;
 
+	ACPI_FUNCTION_TRACE("ev_system_memory_region_setup");
 
 	if (function == ACPI_REGION_DEACTIVATE) {
 		if (*region_context) {
-			ACPI_MEM_FREE (*region_context);
+			ACPI_MEM_FREE(*region_context);
 			*region_context = NULL;
 		}
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Create a new context */
 
-	local_region_context = ACPI_MEM_CALLOCATE (sizeof (struct acpi_mem_space_context));
+	local_region_context =
+	    ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context));
 	if (!(local_region_context)) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Save the region length and address for use in the handler */
@@ -100,10 +95,9 @@ acpi_ev_system_memory_region_setup (
 	local_region_context->address = region_desc->region.address;
 
 	*region_context = local_region_context;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_io_space_region_setup
@@ -120,26 +114,21 @@ acpi_ev_system_memory_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_io_space_region_setup (
-	acpi_handle                     handle,
-	u32                             function,
-	void                            *handler_context,
-	void                            **region_context)
+acpi_ev_io_space_region_setup(acpi_handle handle,
+			      u32 function,
+			      void *handler_context, void **region_context)
 {
-	ACPI_FUNCTION_TRACE ("ev_io_space_region_setup");
-
+	ACPI_FUNCTION_TRACE("ev_io_space_region_setup");
 
 	if (function == ACPI_REGION_DEACTIVATE) {
 		*region_context = NULL;
-	}
-	else {
+	} else {
 		*region_context = handler_context;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_pci_config_region_setup
@@ -158,24 +147,21 @@ acpi_ev_io_space_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_pci_config_region_setup (
-	acpi_handle                     handle,
-	u32                             function,
-	void                            *handler_context,
-	void                            **region_context)
+acpi_ev_pci_config_region_setup(acpi_handle handle,
+				u32 function,
+				void *handler_context, void **region_context)
 {
-	acpi_status                     status = AE_OK;
-	acpi_integer                    pci_value;
-	struct acpi_pci_id              *pci_id = *region_context;
-	union acpi_operand_object       *handler_obj;
-	struct acpi_namespace_node      *parent_node;
-	struct acpi_namespace_node      *pci_root_node;
-	union acpi_operand_object       *region_obj = (union acpi_operand_object   *) handle;
-	struct acpi_device_id           object_hID;
-
-
-	ACPI_FUNCTION_TRACE ("ev_pci_config_region_setup");
-
+	acpi_status status = AE_OK;
+	acpi_integer pci_value;
+	struct acpi_pci_id *pci_id = *region_context;
+	union acpi_operand_object *handler_obj;
+	struct acpi_namespace_node *parent_node;
+	struct acpi_namespace_node *pci_root_node;
+	union acpi_operand_object *region_obj =
+	    (union acpi_operand_object *)handle;
+	struct acpi_device_id object_hID;
+
+	ACPI_FUNCTION_TRACE("ev_pci_config_region_setup");
 
 	handler_obj = region_obj->region.handler;
 	if (!handler_obj) {
@@ -183,20 +169,21 @@ acpi_ev_pci_config_region_setup (
 		 * No installed handler. This shouldn't happen because the dispatch
 		 * routine checks before we get here, but we check again just in case.
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-			"Attempting to init a region %p, with no handler\n", region_obj));
-		return_ACPI_STATUS (AE_NOT_EXIST);
+		ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+				  "Attempting to init a region %p, with no handler\n",
+				  region_obj));
+		return_ACPI_STATUS(AE_NOT_EXIST);
 	}
 
 	*region_context = NULL;
 	if (function == ACPI_REGION_DEACTIVATE) {
 		if (pci_id) {
-			ACPI_MEM_FREE (pci_id);
+			ACPI_MEM_FREE(pci_id);
 		}
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
-	parent_node = acpi_ns_get_parent_node (region_obj->region.node);
+	parent_node = acpi_ns_get_parent_node(region_obj->region.node);
 
 	/*
 	 * Get the _SEG and _BBN values from the device upon which the handler
@@ -216,22 +203,28 @@ acpi_ev_pci_config_region_setup (
 
 		pci_root_node = parent_node;
 		while (pci_root_node != acpi_gbl_root_node) {
-			status = acpi_ut_execute_HID (pci_root_node, &object_hID);
-			if (ACPI_SUCCESS (status)) {
+			status =
+			    acpi_ut_execute_HID(pci_root_node, &object_hID);
+			if (ACPI_SUCCESS(status)) {
 				/*
 				 * Got a valid _HID string, check if this is a PCI root.
 				 * New for ACPI 3.0: check for a PCI Express root also.
 				 */
-				if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING,
-						   sizeof (PCI_ROOT_HID_STRING))           ||
-					!(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING,
-							  sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) {
+				if (!
+				    (ACPI_STRNCMP
+				     (object_hID.value, PCI_ROOT_HID_STRING,
+				      sizeof(PCI_ROOT_HID_STRING))
+				     ||
+				     !(ACPI_STRNCMP
+				       (object_hID.value,
+					PCI_EXPRESS_ROOT_HID_STRING,
+					sizeof(PCI_EXPRESS_ROOT_HID_STRING)))))
+				{
 					/* Install a handler for this PCI root bridge */
 
-					status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
-							   ACPI_ADR_SPACE_PCI_CONFIG,
-							   ACPI_DEFAULT_HANDLER, NULL, NULL);
-					if (ACPI_FAILURE (status)) {
+					status =
+					    acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
+					if (ACPI_FAILURE(status)) {
 						if (status == AE_SAME_HANDLER) {
 							/*
 							 * It is OK if the handler is already installed on the root
@@ -239,23 +232,19 @@ acpi_ev_pci_config_region_setup (
 							 * new PCI_Config operation region, however.
 							 */
 							status = AE_OK;
-						}
-						else {
-							ACPI_REPORT_ERROR ((
-								"Could not install pci_config handler for Root Bridge %4.4s, %s\n",
-								acpi_ut_get_node_name (pci_root_node), acpi_format_exception (status)));
+						} else {
+							ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status)));
 						}
 					}
 					break;
 				}
 			}
 
-			pci_root_node = acpi_ns_get_parent_node (pci_root_node);
+			pci_root_node = acpi_ns_get_parent_node(pci_root_node);
 		}
 
 		/* PCI root bridge not found, use namespace root node */
-	}
-	else {
+	} else {
 		pci_root_node = handler_obj->address_space.node;
 	}
 
@@ -264,14 +253,14 @@ acpi_ev_pci_config_region_setup (
 	 * (install_address_space_handler could have initialized it)
 	 */
 	if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Region is still not initialized. Create a new context */
 
-	pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id));
+	pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id));
 	if (!pci_id) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/*
@@ -283,40 +272,45 @@ acpi_ev_pci_config_region_setup (
 	 * Get the PCI device and function numbers from the _ADR object
 	 * contained in the parent's scope.
 	 */
-	status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, parent_node, &pci_value);
+	status =
+	    acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, parent_node,
+					    &pci_value);
 
 	/*
 	 * The default is zero, and since the allocation above zeroed
 	 * the data, just do nothing on failure.
 	 */
-	if (ACPI_SUCCESS (status)) {
-		pci_id->device  = ACPI_HIWORD (ACPI_LODWORD (pci_value));
-		pci_id->function = ACPI_LOWORD (ACPI_LODWORD (pci_value));
+	if (ACPI_SUCCESS(status)) {
+		pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value));
+		pci_id->function = ACPI_LOWORD(ACPI_LODWORD(pci_value));
 	}
 
 	/* The PCI segment number comes from the _SEG method */
 
-	status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value);
-	if (ACPI_SUCCESS (status)) {
-		pci_id->segment = ACPI_LOWORD (pci_value);
+	status =
+	    acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node,
+					    &pci_value);
+	if (ACPI_SUCCESS(status)) {
+		pci_id->segment = ACPI_LOWORD(pci_value);
 	}
 
 	/* The PCI bus number comes from the _BBN method */
 
-	status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value);
-	if (ACPI_SUCCESS (status)) {
-		pci_id->bus = ACPI_LOWORD (pci_value);
+	status =
+	    acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node,
+					    &pci_value);
+	if (ACPI_SUCCESS(status)) {
+		pci_id->bus = ACPI_LOWORD(pci_value);
 	}
 
 	/* Complete this device's pci_id */
 
-	acpi_os_derive_pci_id (pci_root_node, region_obj->region.node, &pci_id);
+	acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id);
 
 	*region_context = pci_id;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_pci_bar_region_setup
@@ -335,19 +329,15 @@ acpi_ev_pci_config_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_pci_bar_region_setup (
-	acpi_handle                     handle,
-	u32                             function,
-	void                            *handler_context,
-	void                            **region_context)
+acpi_ev_pci_bar_region_setup(acpi_handle handle,
+			     u32 function,
+			     void *handler_context, void **region_context)
 {
-	ACPI_FUNCTION_TRACE ("ev_pci_bar_region_setup");
-
+	ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup");
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_cmos_region_setup
@@ -366,19 +356,15 @@ acpi_ev_pci_bar_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_cmos_region_setup (
-	acpi_handle                     handle,
-	u32                             function,
-	void                            *handler_context,
-	void                            **region_context)
+acpi_ev_cmos_region_setup(acpi_handle handle,
+			  u32 function,
+			  void *handler_context, void **region_context)
 {
-	ACPI_FUNCTION_TRACE ("ev_cmos_region_setup");
-
+	ACPI_FUNCTION_TRACE("ev_cmos_region_setup");
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_default_region_setup
@@ -395,26 +381,21 @@ acpi_ev_cmos_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_default_region_setup (
-	acpi_handle                     handle,
-	u32                             function,
-	void                            *handler_context,
-	void                            **region_context)
+acpi_ev_default_region_setup(acpi_handle handle,
+			     u32 function,
+			     void *handler_context, void **region_context)
 {
-	ACPI_FUNCTION_TRACE ("ev_default_region_setup");
-
+	ACPI_FUNCTION_TRACE("ev_default_region_setup");
 
 	if (function == ACPI_REGION_DEACTIVATE) {
 		*region_context = NULL;
-	}
-	else {
+	} else {
 		*region_context = handler_context;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_initialize_region
@@ -438,37 +419,34 @@ acpi_ev_default_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_initialize_region (
-	union acpi_operand_object       *region_obj,
-	u8                              acpi_ns_locked)
+acpi_ev_initialize_region(union acpi_operand_object *region_obj,
+			  u8 acpi_ns_locked)
 {
-	union acpi_operand_object       *handler_obj;
-	union acpi_operand_object       *obj_desc;
-	acpi_adr_space_type             space_id;
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-	struct acpi_namespace_node      *method_node;
-	acpi_name                       *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
-	union acpi_operand_object       *region_obj2;
-
-
-	ACPI_FUNCTION_TRACE_U32 ("ev_initialize_region", acpi_ns_locked);
+	union acpi_operand_object *handler_obj;
+	union acpi_operand_object *obj_desc;
+	acpi_adr_space_type space_id;
+	struct acpi_namespace_node *node;
+	acpi_status status;
+	struct acpi_namespace_node *method_node;
+	acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
+	union acpi_operand_object *region_obj2;
 
+	ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked);
 
 	if (!region_obj) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
-	region_obj2 = acpi_ns_get_secondary_object (region_obj);
+	region_obj2 = acpi_ns_get_secondary_object(region_obj);
 	if (!region_obj2) {
-		return_ACPI_STATUS (AE_NOT_EXIST);
+		return_ACPI_STATUS(AE_NOT_EXIST);
 	}
 
-	node = acpi_ns_get_parent_node (region_obj->region.node);
+	node = acpi_ns_get_parent_node(region_obj->region.node);
 	space_id = region_obj->region.space_id;
 
 	/* Setup defaults */
@@ -480,9 +458,9 @@ acpi_ev_initialize_region (
 
 	/* Find any "_REG" method associated with this region definition */
 
-	status = acpi_ns_search_node (*reg_name_ptr, node,
-			  ACPI_TYPE_METHOD, &method_node);
-	if (ACPI_SUCCESS (status)) {
+	status = acpi_ns_search_node(*reg_name_ptr, node,
+				     ACPI_TYPE_METHOD, &method_node);
+	if (ACPI_SUCCESS(status)) {
 		/*
 		 * The _REG method is optional and there can be only one per region
 		 * definition.  This will be executed when the handler is attached
@@ -499,7 +477,7 @@ acpi_ev_initialize_region (
 		/* Check to see if a handler exists */
 
 		handler_obj = NULL;
-		obj_desc = acpi_ns_get_attached_object (node);
+		obj_desc = acpi_ns_get_attached_object(node);
 		if (obj_desc) {
 			/* Can only be a handler if the object exists */
 
@@ -527,37 +505,50 @@ acpi_ev_initialize_region (
 			while (handler_obj) {
 				/* Is this handler of the correct type? */
 
-				if (handler_obj->address_space.space_id == space_id) {
+				if (handler_obj->address_space.space_id ==
+				    space_id) {
 					/* Found correct handler */
 
-					ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-						"Found handler %p for region %p in obj %p\n",
-						handler_obj, region_obj, obj_desc));
+					ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+							  "Found handler %p for region %p in obj %p\n",
+							  handler_obj,
+							  region_obj,
+							  obj_desc));
 
-					status = acpi_ev_attach_region (handler_obj, region_obj,
-							 acpi_ns_locked);
+					status =
+					    acpi_ev_attach_region(handler_obj,
+								  region_obj,
+								  acpi_ns_locked);
 
 					/*
 					 * Tell all users that this region is usable by running the _REG
 					 * method
 					 */
 					if (acpi_ns_locked) {
-						status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-						if (ACPI_FAILURE (status)) {
-							return_ACPI_STATUS (status);
+						status =
+						    acpi_ut_release_mutex
+						    (ACPI_MTX_NAMESPACE);
+						if (ACPI_FAILURE(status)) {
+							return_ACPI_STATUS
+							    (status);
 						}
 					}
 
-					status = acpi_ev_execute_reg_method (region_obj, 1);
+					status =
+					    acpi_ev_execute_reg_method
+					    (region_obj, 1);
 
 					if (acpi_ns_locked) {
-						status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-						if (ACPI_FAILURE (status)) {
-							return_ACPI_STATUS (status);
+						status =
+						    acpi_ut_acquire_mutex
+						    (ACPI_MTX_NAMESPACE);
+						if (ACPI_FAILURE(status)) {
+							return_ACPI_STATUS
+							    (status);
 						}
 					}
 
-					return_ACPI_STATUS (AE_OK);
+					return_ACPI_STATUS(AE_OK);
 				}
 
 				/* Try next handler in the list */
@@ -570,15 +561,15 @@ acpi_ev_initialize_region (
 		 * This node does not have the handler we need;
 		 * Pop up one level
 		 */
-		node = acpi_ns_get_parent_node (node);
+		node = acpi_ns_get_parent_node(node);
 	}
 
 	/* If we get here, there is no handler for this region */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-		"No handler for region_type %s(%X) (region_obj %p)\n",
-		acpi_ut_get_region_name (space_id), space_id, region_obj));
+	ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+			  "No handler for region_type %s(%X) (region_obj %p)\n",
+			  acpi_ut_get_region_name(space_id), space_id,
+			  region_obj));
 
-	return_ACPI_STATUS (AE_NOT_EXIST);
+	return_ACPI_STATUS(AE_NOT_EXIST);
 }
-

+ 26 - 51
drivers/acpi/events/evsci.c

@@ -45,16 +45,11 @@
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 
-
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evsci")
+ACPI_MODULE_NAME("evsci")
 
 /* Local prototypes */
-
-static u32 ACPI_SYSTEM_XFACE
-acpi_ev_sci_xrupt_handler (
-	void                            *context);
-
+static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
 
 /*******************************************************************************
  *
@@ -69,17 +64,13 @@ acpi_ev_sci_xrupt_handler (
  *
  ******************************************************************************/
 
-static u32 ACPI_SYSTEM_XFACE
-acpi_ev_sci_xrupt_handler (
-	void                            *context)
+static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
 {
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_list = context;
-	u32                             interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
-
+	struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
+	u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
 
 	ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
 
-
 	/*
 	 * We are guaranteed by the ACPI CA initialization/shutdown code that
 	 * if this interrupt handler is installed, ACPI is enabled.
@@ -89,18 +80,17 @@ acpi_ev_sci_xrupt_handler (
 	 * Fixed Events:
 	 * Check for and dispatch any Fixed Events that have occurred
 	 */
-	interrupt_handled |= acpi_ev_fixed_event_detect ();
+	interrupt_handled |= acpi_ev_fixed_event_detect();
 
 	/*
 	 * General Purpose Events:
 	 * Check for and dispatch any GPEs that have occurred
 	 */
-	interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
+	interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-	return_VALUE (interrupt_handled);
+	return_VALUE(interrupt_handled);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_gpe_xrupt_handler
@@ -113,17 +103,13 @@ acpi_ev_sci_xrupt_handler (
  *
  ******************************************************************************/
 
-u32 ACPI_SYSTEM_XFACE
-acpi_ev_gpe_xrupt_handler (
-	void                            *context)
+u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
 {
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_list = context;
-	u32                             interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
-
+	struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
+	u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
 
 	ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
 
-
 	/*
 	 * We are guaranteed by the ACPI CA initialization/shutdown code that
 	 * if this interrupt handler is installed, ACPI is enabled.
@@ -133,12 +119,11 @@ acpi_ev_gpe_xrupt_handler (
 	 * GPEs:
 	 * Check for and dispatch any GPEs that have occurred
 	 */
-	interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
+	interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-	return_VALUE (interrupt_handled);
+	return_VALUE(interrupt_handled);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_sci_handler
@@ -151,22 +136,18 @@ acpi_ev_gpe_xrupt_handler (
  *
  ******************************************************************************/
 
-u32
-acpi_ev_install_sci_handler (
-	void)
+u32 acpi_ev_install_sci_handler(void)
 {
-	u32                             status = AE_OK;
-
+	u32 status = AE_OK;
 
-	ACPI_FUNCTION_TRACE ("ev_install_sci_handler");
+	ACPI_FUNCTION_TRACE("ev_install_sci_handler");
 
-
-	status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
-			   acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head);
-	return_ACPI_STATUS (status);
+	status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
+						   acpi_ev_sci_xrupt_handler,
+						   acpi_gbl_gpe_xrupt_list_head);
+	return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_remove_sci_handler
@@ -186,22 +167,16 @@ acpi_ev_install_sci_handler (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_remove_sci_handler (
-	void)
+acpi_status acpi_ev_remove_sci_handler(void)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ev_remove_sci_handler");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ev_remove_sci_handler");
 
 	/* Just let the OS remove the handler and disable the level */
 
-	status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
-			   acpi_ev_sci_xrupt_handler);
+	status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
+						  acpi_ev_sci_xrupt_handler);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 202 - 244
drivers/acpi/events/evxface.c

@@ -49,8 +49,7 @@
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evxface")
-
+ACPI_MODULE_NAME("evxface")
 
 /*******************************************************************************
  *
@@ -64,21 +63,16 @@
  * DESCRIPTION: Saves the pointer to the handler function
  *
  ******************************************************************************/
-
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_install_exception_handler (
-	acpi_exception_handler          handler)
+acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE ("acpi_install_exception_handler");
+	ACPI_FUNCTION_TRACE("acpi_install_exception_handler");
 
-
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Don't allow two handlers. */
@@ -92,12 +86,11 @@ acpi_install_exception_handler (
 
 	acpi_gbl_exception_handler = handler;
 
-cleanup:
-	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-	return_ACPI_STATUS (status);
+      cleanup:
+	(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+	return_ACPI_STATUS(status);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif				/*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -116,26 +109,22 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_install_fixed_event_handler (
-	u32                             event,
-	acpi_event_handler              handler,
-	void                            *context)
+acpi_install_fixed_event_handler(u32 event,
+				 acpi_event_handler handler, void *context)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_install_fixed_event_handler");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler");
 
 	/* Parameter validation */
 
 	if (event > ACPI_EVENT_MAX) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Don't allow two handlers. */
@@ -150,29 +139,29 @@ acpi_install_fixed_event_handler (
 	acpi_gbl_fixed_event_handlers[event].handler = handler;
 	acpi_gbl_fixed_event_handlers[event].context = context;
 
-	status = acpi_clear_event (event);
+	status = acpi_clear_event(event);
 	if (ACPI_SUCCESS(status))
-		status = acpi_enable_event (event, 0);
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
+		status = acpi_enable_event(event, 0);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "Could not enable fixed event.\n"));
 
 		/* Remove the handler */
 
 		acpi_gbl_fixed_event_handlers[event].handler = NULL;
 		acpi_gbl_fixed_event_handlers[event].context = NULL;
-	}
-	else {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"Enabled fixed event %X, Handler=%p\n", event, handler));
+	} else {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Enabled fixed event %X, Handler=%p\n", event,
+				  handler));
 	}
 
-
-cleanup:
-	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-	return_ACPI_STATUS (status);
+      cleanup:
+	(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_fixed_event_handler);
 
+EXPORT_SYMBOL(acpi_install_fixed_event_handler);
 
 /*******************************************************************************
  *
@@ -188,49 +177,45 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_fixed_event_handler (
-	u32                             event,
-	acpi_event_handler              handler)
+acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_remove_fixed_event_handler");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler");
 
 	/* Parameter validation */
 
 	if (event > ACPI_EVENT_MAX) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Disable the event before removing the handler */
 
-	status = acpi_disable_event (event, 0);
+	status = acpi_disable_event(event, 0);
 
 	/* Always Remove the handler */
 
 	acpi_gbl_fixed_event_handlers[event].handler = NULL;
 	acpi_gbl_fixed_event_handlers[event].context = NULL;
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
-			"Could not write to fixed event enable register.\n"));
-	}
-	else {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "Could not write to fixed event enable register.\n"));
+	} else {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n",
+				  event));
 	}
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-	return_ACPI_STATUS (status);
+	(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
 
+EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
 
 /*******************************************************************************
  *
@@ -251,37 +236,32 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_install_notify_handler (
-	acpi_handle                     device,
-	u32                             handler_type,
-	acpi_notify_handler             handler,
-	void                            *context)
+acpi_install_notify_handler(acpi_handle device,
+			    u32 handler_type,
+			    acpi_notify_handler handler, void *context)
 {
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *notify_obj;
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_install_notify_handler");
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *notify_obj;
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_install_notify_handler");
 
 	/* Parameter validation */
 
-	if ((!device)  ||
-		(!handler) ||
-		(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	if ((!device) ||
+	    (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Convert and validate the device handle */
 
-	node = acpi_ns_map_handle_to_node (device);
+	node = acpi_ns_map_handle_to_node(device);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -297,21 +277,21 @@ acpi_install_notify_handler (
 		/* Make sure the handler is not already installed */
 
 		if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
-				acpi_gbl_system_notify.handler)     ||
-			((handler_type & ACPI_DEVICE_NOTIFY) &&
-				acpi_gbl_device_notify.handler)) {
+		     acpi_gbl_system_notify.handler) ||
+		    ((handler_type & ACPI_DEVICE_NOTIFY) &&
+		     acpi_gbl_device_notify.handler)) {
 			status = AE_ALREADY_EXISTS;
 			goto unlock_and_exit;
 		}
 
 		if (handler_type & ACPI_SYSTEM_NOTIFY) {
-			acpi_gbl_system_notify.node  = node;
+			acpi_gbl_system_notify.node = node;
 			acpi_gbl_system_notify.handler = handler;
 			acpi_gbl_system_notify.context = context;
 		}
 
 		if (handler_type & ACPI_DEVICE_NOTIFY) {
-			acpi_gbl_device_notify.node  = node;
+			acpi_gbl_device_notify.node = node;
 			acpi_gbl_device_notify.handler = handler;
 			acpi_gbl_device_notify.context = context;
 		}
@@ -327,29 +307,28 @@ acpi_install_notify_handler (
 	else {
 		/* Notifies allowed on this object? */
 
-		if (!acpi_ev_is_notify_object (node)) {
+		if (!acpi_ev_is_notify_object(node)) {
 			status = AE_TYPE;
 			goto unlock_and_exit;
 		}
 
 		/* Check for an existing internal object */
 
-		obj_desc = acpi_ns_get_attached_object (node);
+		obj_desc = acpi_ns_get_attached_object(node);
 		if (obj_desc) {
 			/* Object exists - make sure there's no handler */
 
 			if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
-					obj_desc->common_notify.system_notify) ||
-				((handler_type & ACPI_DEVICE_NOTIFY) &&
-					obj_desc->common_notify.device_notify)) {
+			     obj_desc->common_notify.system_notify) ||
+			    ((handler_type & ACPI_DEVICE_NOTIFY) &&
+			     obj_desc->common_notify.device_notify)) {
 				status = AE_ALREADY_EXISTS;
 				goto unlock_and_exit;
 			}
-		}
-		else {
+		} else {
 			/* Create a new object */
 
-			obj_desc = acpi_ut_create_internal_object (node->type);
+			obj_desc = acpi_ut_create_internal_object(node->type);
 			if (!obj_desc) {
 				status = AE_NO_MEMORY;
 				goto unlock_and_exit;
@@ -357,25 +336,27 @@ acpi_install_notify_handler (
 
 			/* Attach new object to the Node */
 
-			status = acpi_ns_attach_object (device, obj_desc, node->type);
+			status =
+			    acpi_ns_attach_object(device, obj_desc, node->type);
 
 			/* Remove local reference to the object */
 
-			acpi_ut_remove_reference (obj_desc);
-			if (ACPI_FAILURE (status)) {
+			acpi_ut_remove_reference(obj_desc);
+			if (ACPI_FAILURE(status)) {
 				goto unlock_and_exit;
 			}
 		}
 
 		/* Install the handler */
 
-		notify_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_NOTIFY);
+		notify_obj =
+		    acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY);
 		if (!notify_obj) {
 			status = AE_NO_MEMORY;
 			goto unlock_and_exit;
 		}
 
-		notify_obj->notify.node   = node;
+		notify_obj->notify.node = node;
 		notify_obj->notify.handler = handler;
 		notify_obj->notify.context = context;
 
@@ -390,17 +371,16 @@ acpi_install_notify_handler (
 		if (handler_type == ACPI_ALL_NOTIFY) {
 			/* Extra ref if installed in both */
 
-			acpi_ut_add_reference (notify_obj);
+			acpi_ut_add_reference(notify_obj);
 		}
 	}
 
-
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_notify_handler);
 
+EXPORT_SYMBOL(acpi_install_notify_handler);
 
 /*******************************************************************************
  *
@@ -420,36 +400,31 @@ EXPORT_SYMBOL(acpi_install_notify_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_notify_handler (
-	acpi_handle                     device,
-	u32                             handler_type,
-	acpi_notify_handler             handler)
+acpi_remove_notify_handler(acpi_handle device,
+			   u32 handler_type, acpi_notify_handler handler)
 {
-	union acpi_operand_object       *notify_obj;
-	union acpi_operand_object       *obj_desc;
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_remove_notify_handler");
+	union acpi_operand_object *notify_obj;
+	union acpi_operand_object *obj_desc;
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_remove_notify_handler");
 
 	/* Parameter validation */
 
-	if ((!device)  ||
-		(!handler) ||
-		(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	if ((!device) ||
+	    (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Convert and validate the device handle */
 
-	node = acpi_ns_map_handle_to_node (device);
+	node = acpi_ns_map_handle_to_node(device);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -458,34 +433,34 @@ acpi_remove_notify_handler (
 	/* Root Object */
 
 	if (device == ACPI_ROOT_OBJECT) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"Removing notify handler for ROOT object.\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Removing notify handler for ROOT object.\n"));
 
 		if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
-			  !acpi_gbl_system_notify.handler)      ||
-			((handler_type & ACPI_DEVICE_NOTIFY) &&
-			  !acpi_gbl_device_notify.handler)) {
+		     !acpi_gbl_system_notify.handler) ||
+		    ((handler_type & ACPI_DEVICE_NOTIFY) &&
+		     !acpi_gbl_device_notify.handler)) {
 			status = AE_NOT_EXIST;
 			goto unlock_and_exit;
 		}
 
 		/* Make sure all deferred tasks are completed */
 
-		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 		acpi_os_wait_events_complete(NULL);
-		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
- 		}
+		status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
+		}
 
 		if (handler_type & ACPI_SYSTEM_NOTIFY) {
-			acpi_gbl_system_notify.node  = NULL;
+			acpi_gbl_system_notify.node = NULL;
 			acpi_gbl_system_notify.handler = NULL;
 			acpi_gbl_system_notify.context = NULL;
 		}
 
 		if (handler_type & ACPI_DEVICE_NOTIFY) {
-			acpi_gbl_device_notify.node  = NULL;
+			acpi_gbl_device_notify.node = NULL;
 			acpi_gbl_device_notify.handler = NULL;
 			acpi_gbl_device_notify.context = NULL;
 		}
@@ -496,14 +471,14 @@ acpi_remove_notify_handler (
 	else {
 		/* Notifies allowed on this object? */
 
-		if (!acpi_ev_is_notify_object (node)) {
+		if (!acpi_ev_is_notify_object(node)) {
 			status = AE_TYPE;
 			goto unlock_and_exit;
 		}
 
 		/* Check for an existing internal object */
 
-		obj_desc = acpi_ns_get_attached_object (node);
+		obj_desc = acpi_ns_get_attached_object(node);
 		if (!obj_desc) {
 			status = AE_NOT_EXIST;
 			goto unlock_and_exit;
@@ -514,53 +489,52 @@ acpi_remove_notify_handler (
 		if (handler_type & ACPI_SYSTEM_NOTIFY) {
 			notify_obj = obj_desc->common_notify.system_notify;
 			if ((!notify_obj) ||
-				 (notify_obj->notify.handler != handler)) {
+			    (notify_obj->notify.handler != handler)) {
 				status = AE_BAD_PARAMETER;
 				goto unlock_and_exit;
 			}
 			/* Make sure all deferred tasks are completed */
 
-			(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+			(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 			acpi_os_wait_events_complete(NULL);
-			status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
- 			}
+			status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
+			}
 
 			/* Remove the handler */
 			obj_desc->common_notify.system_notify = NULL;
-			acpi_ut_remove_reference (notify_obj);
+			acpi_ut_remove_reference(notify_obj);
 		}
 
 		if (handler_type & ACPI_DEVICE_NOTIFY) {
 			notify_obj = obj_desc->common_notify.device_notify;
 			if ((!notify_obj) ||
-				 (notify_obj->notify.handler != handler)) {
+			    (notify_obj->notify.handler != handler)) {
 				status = AE_BAD_PARAMETER;
 				goto unlock_and_exit;
 			}
 			/* Make sure all deferred tasks are completed */
 
-			(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+			(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 			acpi_os_wait_events_complete(NULL);
-			status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
- 			}
+			status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
+			}
 
 			/* Remove the handler */
 			obj_desc->common_notify.device_notify = NULL;
-			acpi_ut_remove_reference (notify_obj);
+			acpi_ut_remove_reference(notify_obj);
 		}
 	}
 
-
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_notify_handler);
 
+EXPORT_SYMBOL(acpi_remove_notify_handler);
 
 /*******************************************************************************
  *
@@ -581,36 +555,31 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_install_gpe_handler (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number,
-	u32                             type,
-	acpi_event_handler              address,
-	void                            *context)
+acpi_install_gpe_handler(acpi_handle gpe_device,
+			 u32 gpe_number,
+			 u32 type, acpi_event_handler address, void *context)
 {
-	struct acpi_gpe_event_info      *gpe_event_info;
-	struct acpi_handler_info        *handler;
-	acpi_status                     status;
-	u32                             flags;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
+	struct acpi_gpe_event_info *gpe_event_info;
+	struct acpi_handler_info *handler;
+	acpi_status status;
+	u32 flags;
 
+	ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
 
 	/* Parameter validation */
 
 	if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+	gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
 	if (!gpe_event_info) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -618,49 +587,49 @@ acpi_install_gpe_handler (
 
 	/* Make sure that there isn't a handler there already */
 
-	if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) {
+	if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
+	    ACPI_GPE_DISPATCH_HANDLER) {
 		status = AE_ALREADY_EXISTS;
 		goto unlock_and_exit;
 	}
 
 	/* Allocate and init handler object */
 
-	handler = ACPI_MEM_CALLOCATE (sizeof (struct acpi_handler_info));
+	handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info));
 	if (!handler) {
 		status = AE_NO_MEMORY;
 		goto unlock_and_exit;
 	}
 
-	handler->address    = address;
-	handler->context    = context;
+	handler->address = address;
+	handler->context = context;
 	handler->method_node = gpe_event_info->dispatch.method_node;
 
 	/* Disable the GPE before installing the handler */
 
-	status = acpi_ev_disable_gpe (gpe_event_info);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ev_disable_gpe(gpe_event_info);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
 	/* Install the handler */
 
-	flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
+	flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 	gpe_event_info->dispatch.handler = handler;
 
 	/* Setup up dispatch flags to indicate handler (vs. method) */
 
-	gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
+	gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);	/* Clear bits */
 	gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
 
-	acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
-
+	acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_gpe_handler);
 
+EXPORT_SYMBOL(acpi_install_gpe_handler);
 
 /*******************************************************************************
  *
@@ -678,34 +647,30 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_gpe_handler (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number,
-	acpi_event_handler              address)
+acpi_remove_gpe_handler(acpi_handle gpe_device,
+			u32 gpe_number, acpi_event_handler address)
 {
-	struct acpi_gpe_event_info      *gpe_event_info;
-	struct acpi_handler_info        *handler;
-	acpi_status                     status;
-	u32                             flags;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
+	struct acpi_gpe_event_info *gpe_event_info;
+	struct acpi_handler_info *handler;
+	acpi_status status;
+	u32 flags;
 
+	ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
 
 	/* Parameter validation */
 
 	if (!address) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+	gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
 	if (!gpe_event_info) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -713,7 +678,8 @@ acpi_remove_gpe_handler (
 
 	/* Make sure that a handler is indeed installed */
 
-	if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER) {
+	if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) !=
+	    ACPI_GPE_DISPATCH_HANDLER) {
 		status = AE_NOT_EXIST;
 		goto unlock_and_exit;
 	}
@@ -727,45 +693,44 @@ acpi_remove_gpe_handler (
 
 	/* Disable the GPE before removing the handler */
 
-	status = acpi_ev_disable_gpe (gpe_event_info);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ev_disable_gpe(gpe_event_info);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
 	/* Make sure all deferred tasks are completed */
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+	(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
 	acpi_os_wait_events_complete(NULL);
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
- 	}
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
 
 	/* Remove the handler */
 
-	flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
+	flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 	handler = gpe_event_info->dispatch.handler;
 
 	/* Restore Method node (if any), set dispatch flags */
 
 	gpe_event_info->dispatch.method_node = handler->method_node;
-	gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
+	gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;	/* Clear bits */
 	if (handler->method_node) {
 		gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
 	}
-	acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
+	acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
 	/* Now we can free the handler object */
 
-	ACPI_MEM_FREE (handler);
+	ACPI_MEM_FREE(handler);
 
-
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_gpe_handler);
 
+EXPORT_SYMBOL(acpi_remove_gpe_handler);
 
 /*******************************************************************************
  *
@@ -781,35 +746,31 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_acquire_global_lock (
-	u16                             timeout,
-	u32                             *handle)
+acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
 	if (!handle) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ex_enter_interpreter ();
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ex_enter_interpreter();
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
-	status = acpi_ev_acquire_global_lock (timeout);
-	acpi_ex_exit_interpreter ();
+	status = acpi_ev_acquire_global_lock(timeout);
+	acpi_ex_exit_interpreter();
 
-	if (ACPI_SUCCESS (status)) {
+	if (ACPI_SUCCESS(status)) {
 		acpi_gbl_global_lock_handle++;
 		*handle = acpi_gbl_global_lock_handle;
 	}
 
 	return (status);
 }
-EXPORT_SYMBOL(acpi_acquire_global_lock);
 
+EXPORT_SYMBOL(acpi_acquire_global_lock);
 
 /*******************************************************************************
  *
@@ -823,19 +784,16 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_release_global_lock (
-	u32                             handle)
+acpi_status acpi_release_global_lock(u32 handle)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
 	if (handle != acpi_gbl_global_lock_handle) {
 		return (AE_NOT_ACQUIRED);
 	}
 
-	status = acpi_ev_release_global_lock ();
+	status = acpi_ev_release_global_lock();
 	return (status);
 }
-EXPORT_SYMBOL(acpi_release_global_lock);
 
+EXPORT_SYMBOL(acpi_release_global_lock);

+ 199 - 264
drivers/acpi/events/evxfevnt.c

@@ -48,8 +48,7 @@
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evxfevnt")
-
+ACPI_MODULE_NAME("evxfevnt")
 
 /*******************************************************************************
  *
@@ -62,44 +61,39 @@
  * DESCRIPTION: Transfers the system into ACPI mode.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_enable (
-	void)
+acpi_status acpi_enable(void)
 {
-	acpi_status                     status = AE_OK;
-
+	acpi_status status = AE_OK;
 
-	ACPI_FUNCTION_TRACE ("acpi_enable");
+	ACPI_FUNCTION_TRACE("acpi_enable");
 
-
-	/* Make sure we have the FADT*/
+	/* Make sure we have the FADT */
 
 	if (!acpi_gbl_FADT) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
-		return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "No FADT information present!\n"));
+		return_ACPI_STATUS(AE_NO_ACPI_TABLES);
 	}
 
 	if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
-	}
-	else {
+		ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+				  "System is already in ACPI mode\n"));
+	} else {
 		/* Transition to ACPI mode */
 
-		status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI);
-		if (ACPI_FAILURE (status)) {
-			ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
-			return_ACPI_STATUS (status);
+		status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
+		if (ACPI_FAILURE(status)) {
+			ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n"));
+			return_ACPI_STATUS(status);
 		}
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-			"Transition to ACPI mode successful\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+				  "Transition to ACPI mode successful\n"));
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_disable
@@ -112,43 +106,38 @@ acpi_enable (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_disable (
-	void)
+acpi_status acpi_disable(void)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_disable");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("acpi_disable");
 
 	if (!acpi_gbl_FADT) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
-		return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "No FADT information present!\n"));
+		return_ACPI_STATUS(AE_NO_ACPI_TABLES);
 	}
 
 	if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-			"System is already in legacy (non-ACPI) mode\n"));
-	}
-	else {
+		ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+				  "System is already in legacy (non-ACPI) mode\n"));
+	} else {
 		/* Transition to LEGACY mode */
 
-		status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
+		status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
 
-		if (ACPI_FAILURE (status)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Could not exit ACPI mode to legacy mode"));
-			return_ACPI_STATUS (status);
+		if (ACPI_FAILURE(status)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Could not exit ACPI mode to legacy mode"));
+			return_ACPI_STATUS(status);
 		}
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enable_event
@@ -162,52 +151,50 @@ acpi_disable (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_enable_event (
-	u32                             event,
-	u32                             flags)
+acpi_status acpi_enable_event(u32 event, u32 flags)
 {
-	acpi_status                     status = AE_OK;
-	u32                             value;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_enable_event");
+	acpi_status status = AE_OK;
+	u32 value;
 
+	ACPI_FUNCTION_TRACE("acpi_enable_event");
 
 	/* Decode the Fixed Event */
 
 	if (event > ACPI_EVENT_MAX) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
 	 * Enable the requested fixed event (by writing a one to the
 	 * enable register bit)
 	 */
-	status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-			 1, ACPI_MTX_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_set_register(acpi_gbl_fixed_event_info[event].
+			      enable_register_id, 1, ACPI_MTX_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Make sure that the hardware responded */
 
-	status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-			  &value, ACPI_MTX_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_get_register(acpi_gbl_fixed_event_info[event].
+			      enable_register_id, &value, ACPI_MTX_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	if (value != 1) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Could not enable %s event\n", acpi_ut_get_event_name (event)));
-		return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Could not enable %s event\n",
+				  acpi_ut_get_event_name(event)));
+		return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_enable_event);
 
+EXPORT_SYMBOL(acpi_enable_event);
 
 /*******************************************************************************
  *
@@ -223,40 +210,34 @@ EXPORT_SYMBOL(acpi_enable_event);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_set_gpe_type (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number,
-	u8                              type)
+acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_gpe_event_info      *gpe_event_info;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_set_gpe_type");
+	acpi_status status = AE_OK;
+	struct acpi_gpe_event_info *gpe_event_info;
 
+	ACPI_FUNCTION_TRACE("acpi_set_gpe_type");
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+	gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
 	if (!gpe_event_info) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
 
 	if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Set the new type (will disable GPE if currently enabled) */
 
-	status = acpi_ev_set_gpe_type (gpe_event_info, type);
+	status = acpi_ev_set_gpe_type(gpe_event_info, type);
 
-unlock_and_exit:
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_set_gpe_type);
 
+EXPORT_SYMBOL(acpi_set_gpe_type);
 
 /*******************************************************************************
  *
@@ -273,31 +254,25 @@ EXPORT_SYMBOL(acpi_set_gpe_type);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_enable_gpe (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number,
-	u32                             flags)
+acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_gpe_event_info      *gpe_event_info;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_enable_gpe");
+	acpi_status status = AE_OK;
+	struct acpi_gpe_event_info *gpe_event_info;
 
+	ACPI_FUNCTION_TRACE("acpi_enable_gpe");
 
 	/* Use semaphore lock if not executing at interrupt level */
 
 	if (flags & ACPI_NOT_ISR) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+	gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
 	if (!gpe_event_info) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -305,16 +280,16 @@ acpi_enable_gpe (
 
 	/* Perform the enable */
 
-	status = acpi_ev_enable_gpe (gpe_event_info, TRUE);
+	status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
 
-unlock_and_exit:
+      unlock_and_exit:
 	if (flags & ACPI_NOT_ISR) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+		(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_enable_gpe);
 
+EXPORT_SYMBOL(acpi_enable_gpe);
 
 /*******************************************************************************
  *
@@ -331,46 +306,39 @@ EXPORT_SYMBOL(acpi_enable_gpe);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_disable_gpe (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number,
-	u32                             flags)
+acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_gpe_event_info      *gpe_event_info;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_disable_gpe");
+	acpi_status status = AE_OK;
+	struct acpi_gpe_event_info *gpe_event_info;
 
+	ACPI_FUNCTION_TRACE("acpi_disable_gpe");
 
 	/* Use semaphore lock if not executing at interrupt level */
 
 	if (flags & ACPI_NOT_ISR) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+	gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
 	if (!gpe_event_info) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
 
-	status = acpi_ev_disable_gpe (gpe_event_info);
+	status = acpi_ev_disable_gpe(gpe_event_info);
 
-unlock_and_exit:
+      unlock_and_exit:
 	if (flags & ACPI_NOT_ISR) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+		(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_disable_event
@@ -384,50 +352,48 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_disable_event (
-	u32                             event,
-	u32                             flags)
+acpi_status acpi_disable_event(u32 event, u32 flags)
 {
-	acpi_status                     status = AE_OK;
-	u32                             value;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_disable_event");
+	acpi_status status = AE_OK;
+	u32 value;
 
+	ACPI_FUNCTION_TRACE("acpi_disable_event");
 
 	/* Decode the Fixed Event */
 
 	if (event > ACPI_EVENT_MAX) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
 	 * Disable the requested fixed event (by writing a zero to the
 	 * enable register bit)
 	 */
-	status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-			 0, ACPI_MTX_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_set_register(acpi_gbl_fixed_event_info[event].
+			      enable_register_id, 0, ACPI_MTX_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-			 &value, ACPI_MTX_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_get_register(acpi_gbl_fixed_event_info[event].
+			      enable_register_id, &value, ACPI_MTX_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	if (value != 0) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Could not disable %s events\n", acpi_ut_get_event_name (event)));
-		return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Could not disable %s events\n",
+				  acpi_ut_get_event_name(event)));
+		return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_disable_event);
 
+EXPORT_SYMBOL(acpi_disable_event);
 
 /*******************************************************************************
  *
@@ -441,33 +407,30 @@ EXPORT_SYMBOL(acpi_disable_event);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_clear_event (
-	u32                             event)
+acpi_status acpi_clear_event(u32 event)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_clear_event");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("acpi_clear_event");
 
 	/* Decode the Fixed Event */
 
 	if (event > ACPI_EVENT_MAX) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
 	 * Clear the requested fixed event (By writing a one to the
 	 * status register bit)
 	 */
-	status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
-			1, ACPI_MTX_LOCK);
+	status =
+	    acpi_set_register(acpi_gbl_fixed_event_info[event].
+			      status_register_id, 1, ACPI_MTX_LOCK);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_clear_event);
 
+EXPORT_SYMBOL(acpi_clear_event);
 
 /*******************************************************************************
  *
@@ -483,46 +446,39 @@ EXPORT_SYMBOL(acpi_clear_event);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_clear_gpe (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number,
-	u32                             flags)
+acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_gpe_event_info      *gpe_event_info;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_clear_gpe");
+	acpi_status status = AE_OK;
+	struct acpi_gpe_event_info *gpe_event_info;
 
+	ACPI_FUNCTION_TRACE("acpi_clear_gpe");
 
 	/* Use semaphore lock if not executing at interrupt level */
 
 	if (flags & ACPI_NOT_ISR) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+	gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
 	if (!gpe_event_info) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
 
-	status = acpi_hw_clear_gpe (gpe_event_info);
+	status = acpi_hw_clear_gpe(gpe_event_info);
 
-unlock_and_exit:
+      unlock_and_exit:
 	if (flags & ACPI_NOT_ISR) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+		(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -538,36 +494,31 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_event_status (
-	u32                             event,
-	acpi_event_status               *event_status)
+acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_get_event_status");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("acpi_get_event_status");
 
 	if (!event_status) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Decode the Fixed Event */
 
 	if (event > ACPI_EVENT_MAX) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Get the status of the requested fixed event */
 
-	status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id,
-			  event_status, ACPI_MTX_LOCK);
+	status =
+	    acpi_get_register(acpi_gbl_fixed_event_info[event].
+			      status_register_id, event_status, ACPI_MTX_LOCK);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_gpe_status
@@ -585,31 +536,26 @@ acpi_get_event_status (
  ******************************************************************************/
 
 acpi_status
-acpi_get_gpe_status (
-	acpi_handle                     gpe_device,
-	u32                             gpe_number,
-	u32                             flags,
-	acpi_event_status               *event_status)
+acpi_get_gpe_status(acpi_handle gpe_device,
+		    u32 gpe_number, u32 flags, acpi_event_status * event_status)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_gpe_event_info      *gpe_event_info;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_get_gpe_status");
+	acpi_status status = AE_OK;
+	struct acpi_gpe_event_info *gpe_event_info;
 
+	ACPI_FUNCTION_TRACE("acpi_get_gpe_status");
 
 	/* Use semaphore lock if not executing at interrupt level */
 
 	if (flags & ACPI_NOT_ISR) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+	gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
 	if (!gpe_event_info) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -617,16 +563,15 @@ acpi_get_gpe_status (
 
 	/* Obtain status on the requested GPE number */
 
-	status = acpi_hw_get_gpe_status (gpe_event_info, event_status);
+	status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
 
-unlock_and_exit:
+      unlock_and_exit:
 	if (flags & ACPI_NOT_ISR) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+		(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif				/*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -644,33 +589,27 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_install_gpe_block (
-	acpi_handle                     gpe_device,
-	struct acpi_generic_address     *gpe_block_address,
-	u32                             register_count,
-	u32                             interrupt_number)
+acpi_install_gpe_block(acpi_handle gpe_device,
+		       struct acpi_generic_address *gpe_block_address,
+		       u32 register_count, u32 interrupt_number)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *obj_desc;
-	struct acpi_namespace_node      *node;
-	struct acpi_gpe_block_info      *gpe_block;
-
+	acpi_status status;
+	union acpi_operand_object *obj_desc;
+	struct acpi_namespace_node *node;
+	struct acpi_gpe_block_info *gpe_block;
 
-	ACPI_FUNCTION_TRACE ("acpi_install_gpe_block");
+	ACPI_FUNCTION_TRACE("acpi_install_gpe_block");
 
-
-	if ((!gpe_device)      ||
-		(!gpe_block_address) ||
-		(!register_count)) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
-	node = acpi_ns_map_handle_to_node (gpe_device);
+	node = acpi_ns_map_handle_to_node(gpe_device);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -680,31 +619,33 @@ acpi_install_gpe_block (
 	 * For user-installed GPE Block Devices, the gpe_block_base_number
 	 * is always zero
 	 */
-	status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
-			  0, interrupt_number, &gpe_block);
-	if (ACPI_FAILURE (status)) {
+	status =
+	    acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
+				     interrupt_number, &gpe_block);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
 	/* Get the device_object attached to the node */
 
-	obj_desc = acpi_ns_get_attached_object (node);
+	obj_desc = acpi_ns_get_attached_object(node);
 	if (!obj_desc) {
 		/* No object, create a new one */
 
-		obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_DEVICE);
+		obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
 		if (!obj_desc) {
 			status = AE_NO_MEMORY;
 			goto unlock_and_exit;
 		}
 
-		status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE);
+		status =
+		    acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
 
 		/* Remove local reference to the object */
 
-		acpi_ut_remove_reference (obj_desc);
+		acpi_ut_remove_reference(obj_desc);
 
-		if (ACPI_FAILURE (status)) {
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 	}
@@ -713,13 +654,12 @@ acpi_install_gpe_block (
 
 	obj_desc->device.gpe_block = gpe_block;
 
-
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_gpe_block);
 
+EXPORT_SYMBOL(acpi_install_gpe_block);
 
 /*******************************************************************************
  *
@@ -733,28 +673,24 @@ EXPORT_SYMBOL(acpi_install_gpe_block);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_remove_gpe_block (
-	acpi_handle                     gpe_device)
+acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
 {
-	union acpi_operand_object       *obj_desc;
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_remove_gpe_block");
+	union acpi_operand_object *obj_desc;
+	acpi_status status;
+	struct acpi_namespace_node *node;
 
+	ACPI_FUNCTION_TRACE("acpi_remove_gpe_block");
 
 	if (!gpe_device) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
-	node = acpi_ns_map_handle_to_node (gpe_device);
+	node = acpi_ns_map_handle_to_node(gpe_device);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -762,22 +698,21 @@ acpi_remove_gpe_block (
 
 	/* Get the device_object attached to the node */
 
-	obj_desc = acpi_ns_get_attached_object (node);
-	if (!obj_desc ||
-		!obj_desc->device.gpe_block) {
-		return_ACPI_STATUS (AE_NULL_OBJECT);
+	obj_desc = acpi_ns_get_attached_object(node);
+	if (!obj_desc || !obj_desc->device.gpe_block) {
+		return_ACPI_STATUS(AE_NULL_OBJECT);
 	}
 
 	/* Delete the GPE block (but not the device_object) */
 
-	status = acpi_ev_delete_gpe_block (obj_desc->device.gpe_block);
-	if (ACPI_SUCCESS (status)) {
+	status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
+	if (ACPI_SUCCESS(status)) {
 		obj_desc->device.gpe_block = NULL;
 	}
 
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
 
 EXPORT_SYMBOL(acpi_remove_gpe_block);

+ 55 - 59
drivers/acpi/events/evxfregn.c

@@ -49,8 +49,7 @@
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EVENTS
-	 ACPI_MODULE_NAME    ("evxfregn")
-
+ACPI_MODULE_NAME("evxfregn")
 
 /*******************************************************************************
  *
@@ -67,36 +66,31 @@
  * DESCRIPTION: Install a handler for all op_regions of a given space_id.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_install_address_space_handler (
-	acpi_handle                     device,
-	acpi_adr_space_type             space_id,
-	acpi_adr_space_handler          handler,
-	acpi_adr_space_setup            setup,
-	void                            *context)
+acpi_install_address_space_handler(acpi_handle device,
+				   acpi_adr_space_type space_id,
+				   acpi_adr_space_handler handler,
+				   acpi_adr_space_setup setup, void *context)
 {
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_install_address_space_handler");
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_install_address_space_handler");
 
 	/* Parameter validation */
 
 	if (!device) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Convert and validate the device handle */
 
-	node = acpi_ns_map_handle_to_node (device);
+	node = acpi_ns_map_handle_to_node(device);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -104,21 +98,23 @@ acpi_install_address_space_handler (
 
 	/* Install the handler for all Regions for this Space ID */
 
-	status = acpi_ev_install_space_handler (node, space_id, handler, setup, context);
-	if (ACPI_FAILURE (status)) {
+	status =
+	    acpi_ev_install_space_handler(node, space_id, handler, setup,
+					  context);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
 	/* Run all _REG methods for this address space */
 
-	status = acpi_ev_execute_reg_methods (node, space_id);
+	status = acpi_ev_execute_reg_methods(node, space_id);
 
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_address_space_handler);
 
+EXPORT_SYMBOL(acpi_install_address_space_handler);
 
 /*******************************************************************************
  *
@@ -135,36 +131,33 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_address_space_handler (
-	acpi_handle                     device,
-	acpi_adr_space_type             space_id,
-	acpi_adr_space_handler          handler)
+acpi_remove_address_space_handler(acpi_handle device,
+				  acpi_adr_space_type space_id,
+				  acpi_adr_space_handler handler)
 {
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *handler_obj;
-	union acpi_operand_object       *region_obj;
-	union acpi_operand_object       **last_obj_ptr;
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_remove_address_space_handler");
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *handler_obj;
+	union acpi_operand_object *region_obj;
+	union acpi_operand_object **last_obj_ptr;
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler");
 
 	/* Parameter validation */
 
 	if (!device) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Convert and validate the device handle */
 
-	node = acpi_ns_map_handle_to_node (device);
+	node = acpi_ns_map_handle_to_node(device);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -172,7 +165,7 @@ acpi_remove_address_space_handler (
 
 	/* Make sure the internal object exists */
 
-	obj_desc = acpi_ns_get_attached_object (node);
+	obj_desc = acpi_ns_get_attached_object(node);
 	if (!obj_desc) {
 		status = AE_NOT_EXIST;
 		goto unlock_and_exit;
@@ -188,10 +181,11 @@ acpi_remove_address_space_handler (
 		if (handler_obj->address_space.space_id == space_id) {
 			/* Matched space_id, first dereference this in the Regions */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-				"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
-				handler_obj, handler, acpi_ut_get_region_name (space_id),
-				node, obj_desc));
+			ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+					  "Removing address handler %p(%p) for region %s on Device %p(%p)\n",
+					  handler_obj, handler,
+					  acpi_ut_get_region_name(space_id),
+					  node, obj_desc));
 
 			region_obj = handler_obj->address_space.region_list;
 
@@ -205,13 +199,14 @@ acpi_remove_address_space_handler (
 				 * The region is just inaccessible as indicated to
 				 * the _REG method
 				 */
-				acpi_ev_detach_region (region_obj, TRUE);
+				acpi_ev_detach_region(region_obj, TRUE);
 
 				/*
 				 * Walk the list: Just grab the head because the
 				 * detach_region removed the previous head.
 				 */
-				region_obj = handler_obj->address_space.region_list;
+				region_obj =
+				    handler_obj->address_space.region_list;
 
 			}
 
@@ -221,7 +216,7 @@ acpi_remove_address_space_handler (
 
 			/* Now we can delete the handler object */
 
-			acpi_ut_remove_reference (handler_obj);
+			acpi_ut_remove_reference(handler_obj);
 			goto unlock_and_exit;
 		}
 
@@ -233,15 +228,16 @@ acpi_remove_address_space_handler (
 
 	/* The handler does not exist */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-		"Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
-		handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+			  "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
+			  handler, acpi_ut_get_region_name(space_id), space_id,
+			  node, obj_desc));
 
 	status = AE_NOT_EXIST;
 
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_address_space_handler);
 
+EXPORT_SYMBOL(acpi_remove_address_space_handler);

+ 155 - 164
drivers/acpi/executer/exconfig.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
@@ -50,18 +49,14 @@
 #include <acpi/actables.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exconfig")
+ACPI_MODULE_NAME("exconfig")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_add_table (
-	struct acpi_table_header        *table,
-	struct acpi_namespace_node      *parent_node,
-	union acpi_operand_object       **ddb_handle);
-
+acpi_ex_add_table(struct acpi_table_header *table,
+		  struct acpi_namespace_node *parent_node,
+		  union acpi_operand_object **ddb_handle);
 
 /*******************************************************************************
  *
@@ -79,24 +74,21 @@ acpi_ex_add_table (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_add_table (
-	struct acpi_table_header        *table,
-	struct acpi_namespace_node      *parent_node,
-	union acpi_operand_object       **ddb_handle)
+acpi_ex_add_table(struct acpi_table_header *table,
+		  struct acpi_namespace_node *parent_node,
+		  union acpi_operand_object **ddb_handle)
 {
-	acpi_status                     status;
-	struct acpi_table_desc          table_info;
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_TRACE ("ex_add_table");
+	acpi_status status;
+	struct acpi_table_desc table_info;
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_TRACE("ex_add_table");
 
 	/* Create an object to be the table handle */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Init the table handle */
@@ -106,45 +98,43 @@ acpi_ex_add_table (
 
 	/* Install the new table into the local data structures */
 
-	ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
+	ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc));
 
-	table_info.type      = ACPI_TABLE_SSDT;
-	table_info.pointer   = table;
-	table_info.length    = (acpi_size) table->length;
+	table_info.type = ACPI_TABLE_SSDT;
+	table_info.pointer = table;
+	table_info.length = (acpi_size) table->length;
 	table_info.allocation = ACPI_MEM_ALLOCATED;
 
-	status = acpi_tb_install_table (&table_info);
+	status = acpi_tb_install_table(&table_info);
 	obj_desc->reference.object = table_info.installed_desc;
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		if (status == AE_ALREADY_EXISTS) {
 			/* Table already exists, just return the handle */
 
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 		goto cleanup;
 	}
 
 	/* Add the table to the namespace */
 
-	status = acpi_ns_load_table (table_info.installed_desc, parent_node);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ns_load_table(table_info.installed_desc, parent_node);
+	if (ACPI_FAILURE(status)) {
 		/* Uninstall table on error */
 
-		(void) acpi_tb_uninstall_table (table_info.installed_desc);
+		(void)acpi_tb_uninstall_table(table_info.installed_desc);
 		goto cleanup;
 	}
 
-	return_ACPI_STATUS (AE_OK);
-
+	return_ACPI_STATUS(AE_OK);
 
-cleanup:
-	acpi_ut_remove_reference (obj_desc);
+      cleanup:
+	acpi_ut_remove_reference(obj_desc);
 	*ddb_handle = NULL;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_load_table_op
@@ -159,56 +149,53 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ex_load_table_op (
-	struct acpi_walk_state          *walk_state,
-	union acpi_operand_object       **return_desc)
+acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
+		      union acpi_operand_object **return_desc)
 {
-	acpi_status                     status;
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	struct acpi_table_header        *table;
-	struct acpi_namespace_node      *parent_node;
-	struct acpi_namespace_node      *start_node;
-	struct acpi_namespace_node      *parameter_node = NULL;
-	union acpi_operand_object       *ddb_handle;
-
-
-	ACPI_FUNCTION_TRACE ("ex_load_table_op");
+	acpi_status status;
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	struct acpi_table_header *table;
+	struct acpi_namespace_node *parent_node;
+	struct acpi_namespace_node *start_node;
+	struct acpi_namespace_node *parameter_node = NULL;
+	union acpi_operand_object *ddb_handle;
 
+	ACPI_FUNCTION_TRACE("ex_load_table_op");
 
 #if 0
 	/*
 	 * Make sure that the signature does not match one of the tables that
 	 * is already loaded.
 	 */
-	status = acpi_tb_match_signature (operand[0]->string.pointer, NULL);
+	status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
 	if (status == AE_OK) {
 		/* Signature matched -- don't allow override */
 
-		return_ACPI_STATUS (AE_ALREADY_EXISTS);
+		return_ACPI_STATUS(AE_ALREADY_EXISTS);
 	}
 #endif
 
 	/* Find the ACPI table */
 
-	status = acpi_tb_find_table (operand[0]->string.pointer,
-			   operand[1]->string.pointer,
-			   operand[2]->string.pointer, &table);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_tb_find_table(operand[0]->string.pointer,
+				    operand[1]->string.pointer,
+				    operand[2]->string.pointer, &table);
+	if (ACPI_FAILURE(status)) {
 		if (status != AE_NOT_FOUND) {
-			return_ACPI_STATUS (status);
+			return_ACPI_STATUS(status);
 		}
 
 		/* Table not found, return an Integer=0 and AE_OK */
 
-		ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 		if (!ddb_handle) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		ddb_handle->integer.value = 0;
 		*return_desc = ddb_handle;
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Default nodes */
@@ -223,10 +210,12 @@ acpi_ex_load_table_op (
 		 * Find the node referenced by the root_path_string. This is the
 		 * location within the namespace where the table will be loaded.
 		 */
-		status = acpi_ns_get_node_by_path (operand[3]->string.pointer, start_node,
-				   ACPI_NS_SEARCH_PARENT, &parent_node);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ns_get_node_by_path(operand[3]->string.pointer,
+					     start_node, ACPI_NS_SEARCH_PARENT,
+					     &parent_node);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
@@ -234,7 +223,7 @@ acpi_ex_load_table_op (
 
 	if (operand[4]->string.length > 0) {
 		if ((operand[4]->string.pointer[0] != '\\') &&
-			(operand[4]->string.pointer[0] != '^')) {
+		    (operand[4]->string.pointer[0] != '^')) {
 			/*
 			 * Path is not absolute, so it will be relative to the node
 			 * referenced by the root_path_string (or the NS root if omitted)
@@ -244,18 +233,20 @@ acpi_ex_load_table_op (
 
 		/* Find the node referenced by the parameter_path_string */
 
-		status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
-				 ACPI_NS_SEARCH_PARENT, &parameter_node);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ns_get_node_by_path(operand[4]->string.pointer,
+					     start_node, ACPI_NS_SEARCH_PARENT,
+					     &parameter_node);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Load the table into the namespace */
 
-	status = acpi_ex_add_table (table, parent_node, &ddb_handle);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ex_add_table(table, parent_node, &ddb_handle);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Parameter Data (optional) */
@@ -263,20 +254,20 @@ acpi_ex_load_table_op (
 	if (parameter_node) {
 		/* Store the parameter data into the optional parameter object */
 
-		status = acpi_ex_store (operand[5],
-				 ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
-				 walk_state);
-		if (ACPI_FAILURE (status)) {
-			(void) acpi_ex_unload_table (ddb_handle);
-			return_ACPI_STATUS (status);
+		status = acpi_ex_store(operand[5],
+				       ACPI_CAST_PTR(union acpi_operand_object,
+						     parameter_node),
+				       walk_state);
+		if (ACPI_FAILURE(status)) {
+			(void)acpi_ex_unload_table(ddb_handle);
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	*return_desc = ddb_handle;
-	return_ACPI_STATUS  (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_load_op
@@ -293,38 +284,37 @@ acpi_ex_load_table_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_load_op (
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       *target,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_load_op(union acpi_operand_object *obj_desc,
+		union acpi_operand_object *target,
+		struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *ddb_handle;
-	union acpi_operand_object       *buffer_desc = NULL;
-	struct acpi_table_header        *table_ptr = NULL;
-	acpi_physical_address           address;
-	struct acpi_table_header        table_header;
-	u32                             i;
-
-	ACPI_FUNCTION_TRACE ("ex_load_op");
+	acpi_status status;
+	union acpi_operand_object *ddb_handle;
+	union acpi_operand_object *buffer_desc = NULL;
+	struct acpi_table_header *table_ptr = NULL;
+	acpi_physical_address address;
+	struct acpi_table_header table_header;
+	u32 i;
 
+	ACPI_FUNCTION_TRACE("ex_load_op");
 
 	/* Object can be either an op_region or a Field */
 
-	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 	case ACPI_TYPE_REGION:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
-			obj_desc, acpi_ut_get_object_type_name (obj_desc)));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n",
+				  obj_desc,
+				  acpi_ut_get_object_type_name(obj_desc)));
 
 		/*
 		 * If the Region Address and Length have not been previously evaluated,
 		 * evaluate them now and save the results.
 		 */
 		if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-			status = acpi_ds_get_region_arguments (obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status = acpi_ds_get_region_arguments(obj_desc);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
 
@@ -336,121 +326,127 @@ acpi_ex_load_op (
 
 		table_header.length = 0;
 		for (i = 0; i < 8; i++) {
-			status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
-					   (acpi_physical_address) (i + address), 8,
-					   ((u8 *) &table_header) + i);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status =
+			    acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
+							   (acpi_physical_address)
+							   (i + address), 8,
+							   ((u8 *) &
+							    table_header) + i);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
 
 		/* Sanity check the table length */
 
-		if (table_header.length < sizeof (struct acpi_table_header)) {
-			return_ACPI_STATUS (AE_BAD_HEADER);
+		if (table_header.length < sizeof(struct acpi_table_header)) {
+			return_ACPI_STATUS(AE_BAD_HEADER);
 		}
 
 		/* Allocate a buffer for the entire table */
 
-		table_ptr = ACPI_MEM_ALLOCATE (table_header.length);
+		table_ptr = ACPI_MEM_ALLOCATE(table_header.length);
 		if (!table_ptr) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/* Get the entire table from the op region */
 
 		for (i = 0; i < table_header.length; i++) {
-			status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
-					   (acpi_physical_address) (i + address), 8,
-					   ((u8 *) table_ptr + i));
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
+							   (acpi_physical_address)
+							   (i + address), 8,
+							   ((u8 *) table_ptr +
+							    i));
+			if (ACPI_FAILURE(status)) {
 				goto cleanup;
 			}
 		}
 		break;
 
-
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 	case ACPI_TYPE_LOCAL_BANK_FIELD:
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
-			obj_desc, acpi_ut_get_object_type_name (obj_desc)));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Field %p %s\n",
+				  obj_desc,
+				  acpi_ut_get_object_type_name(obj_desc)));
 
 		/*
 		 * The length of the field must be at least as large as the table.
 		 * Read the entire field and thus the entire table.  Buffer is
 		 * allocated during the read.
 		 */
-		status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ex_read_data_from_field(walk_state, obj_desc,
+						 &buffer_desc);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
-		table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
-				  buffer_desc->buffer.pointer);
+		table_ptr = ACPI_CAST_PTR(struct acpi_table_header,
+					  buffer_desc->buffer.pointer);
 
 		/* All done with the buffer_desc, delete it */
 
 		buffer_desc->buffer.pointer = NULL;
-		acpi_ut_remove_reference (buffer_desc);
+		acpi_ut_remove_reference(buffer_desc);
 
 		/* Sanity check the table length */
 
-		if (table_ptr->length < sizeof (struct acpi_table_header)) {
+		if (table_ptr->length < sizeof(struct acpi_table_header)) {
 			status = AE_BAD_HEADER;
 			goto cleanup;
 		}
 		break;
 
-
 	default:
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 	}
 
 	/* The table must be either an SSDT or a PSDT */
 
-	if ((!ACPI_STRNCMP (table_ptr->signature,
-			  acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
-			  acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
-		(!ACPI_STRNCMP (table_ptr->signature,
-				 acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
-				 acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
-			table_ptr->signature));
+	if ((!ACPI_STRNCMP(table_ptr->signature,
+			   acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
+			   acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
+	    (!ACPI_STRNCMP(table_ptr->signature,
+			   acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
+			   acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
+				  table_ptr->signature));
 		status = AE_BAD_SIGNATURE;
 		goto cleanup;
 	}
 
 	/* Install the new table into the local data structures */
 
-	status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
+	if (ACPI_FAILURE(status)) {
 		/* On error, table_ptr was deallocated above */
 
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Store the ddb_handle into the Target operand */
 
-	status = acpi_ex_store (ddb_handle, target, walk_state);
-	if (ACPI_FAILURE (status)) {
-		(void) acpi_ex_unload_table (ddb_handle);
+	status = acpi_ex_store(ddb_handle, target, walk_state);
+	if (ACPI_FAILURE(status)) {
+		(void)acpi_ex_unload_table(ddb_handle);
 
 		/* table_ptr was deallocated above */
 
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
-cleanup:
-	if (ACPI_FAILURE (status)) {
-		ACPI_MEM_FREE (table_ptr);
+      cleanup:
+	if (ACPI_FAILURE(status)) {
+		ACPI_MEM_FREE(table_ptr);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_unload_table
@@ -463,17 +459,13 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_unload_table (
-	union acpi_operand_object       *ddb_handle)
+acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *table_desc = ddb_handle;
-	struct acpi_table_desc          *table_info;
-
-
-	ACPI_FUNCTION_TRACE ("ex_unload_table");
+	acpi_status status = AE_OK;
+	union acpi_operand_object *table_desc = ddb_handle;
+	struct acpi_table_desc *table_info;
 
+	ACPI_FUNCTION_TRACE("ex_unload_table");
 
 	/*
 	 * Validate the handle
@@ -482,29 +474,28 @@ acpi_ex_unload_table (
 	 * validated here.
 	 */
 	if ((!ddb_handle) ||
-		(ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
-		(ACPI_GET_OBJECT_TYPE (ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	    (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
+	    (ACPI_GET_OBJECT_TYPE(ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Get the actual table descriptor from the ddb_handle */
 
-	table_info = (struct acpi_table_desc *) table_desc->reference.object;
+	table_info = (struct acpi_table_desc *)table_desc->reference.object;
 
 	/*
 	 * Delete the entire namespace under this table Node
 	 * (Offset contains the table_id)
 	 */
-	acpi_ns_delete_namespace_by_owner (table_info->owner_id);
-	acpi_ut_release_owner_id (&table_info->owner_id);
+	acpi_ns_delete_namespace_by_owner(table_info->owner_id);
+	acpi_ut_release_owner_id(&table_info->owner_id);
 
 	/* Delete the table itself */
 
-	(void) acpi_tb_uninstall_table (table_info->installed_desc);
+	(void)acpi_tb_uninstall_table(table_info->installed_desc);
 
 	/* Delete the table descriptor (ddb_handle) */
 
-	acpi_ut_remove_reference (table_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(table_desc);
+	return_ACPI_STATUS(status);
 }
-

+ 141 - 170
drivers/acpi/executer/exconvrt.c

@@ -41,24 +41,17 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exconvrt")
+ACPI_MODULE_NAME("exconvrt")
 
 /* Local prototypes */
-
 static u32
-acpi_ex_convert_to_ascii (
-	acpi_integer                    integer,
-	u16                             base,
-	u8                              *string,
-	u8                              max_length);
-
+acpi_ex_convert_to_ascii(acpi_integer integer,
+			 u16 base, u8 * string, u8 max_length);
 
 /*******************************************************************************
  *
@@ -76,29 +69,25 @@ acpi_ex_convert_to_ascii (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_integer (
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       **result_desc,
-	u32                             flags)
+acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
+			   union acpi_operand_object **result_desc, u32 flags)
 {
-	union acpi_operand_object       *return_desc;
-	u8                              *pointer;
-	acpi_integer                    result;
-	u32                             i;
-	u32                             count;
-	acpi_status                     status;
-
+	union acpi_operand_object *return_desc;
+	u8 *pointer;
+	acpi_integer result;
+	u32 i;
+	u32 count;
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_integer", obj_desc);
+	ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc);
 
-
-	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 	case ACPI_TYPE_INTEGER:
 
 		/* No conversion necessary */
 
 		*result_desc = obj_desc;
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 
 	case ACPI_TYPE_BUFFER:
 	case ACPI_TYPE_STRING:
@@ -106,11 +95,11 @@ acpi_ex_convert_to_integer (
 		/* Note: Takes advantage of common buffer/string fields */
 
 		pointer = obj_desc->buffer.pointer;
-		count   = obj_desc->buffer.length;
+		count = obj_desc->buffer.length;
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_TYPE);
+		return_ACPI_STATUS(AE_TYPE);
 	}
 
 	/*
@@ -126,7 +115,7 @@ acpi_ex_convert_to_integer (
 
 	/* String conversion is different than Buffer conversion */
 
-	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 	case ACPI_TYPE_STRING:
 
 		/*
@@ -135,19 +124,18 @@ acpi_ex_convert_to_integer (
 		 * of ACPI 3.0) is that the to_integer() operator allows both decimal
 		 * and hexadecimal strings (hex prefixed with "0x").
 		 */
-		status = acpi_ut_strtoul64 ((char *) pointer, flags, &result);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_strtoul64((char *)pointer, flags, &result);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 		break;
 
-
 	case ACPI_TYPE_BUFFER:
 
 		/* Check for zero-length buffer */
 
 		if (!count) {
-			return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
+			return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
 		}
 
 		/* Transfer no more than an integer's worth of data */
@@ -170,7 +158,6 @@ acpi_ex_convert_to_integer (
 		}
 		break;
 
-
 	default:
 		/* No other types can get here */
 		break;
@@ -178,20 +165,19 @@ acpi_ex_convert_to_integer (
 
 	/* Create a new integer */
 
-	return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+	return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 	if (!return_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Save the Result */
 
 	return_desc->integer.value = result;
-	acpi_ex_truncate_for32bit_table (return_desc);
+	acpi_ex_truncate_for32bit_table(return_desc);
 	*result_desc = return_desc;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_buffer
@@ -207,25 +193,21 @@ acpi_ex_convert_to_integer (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_buffer (
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       **result_desc)
+acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
+			  union acpi_operand_object **result_desc)
 {
-	union acpi_operand_object       *return_desc;
-	u8                              *new_buf;
+	union acpi_operand_object *return_desc;
+	u8 *new_buf;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc);
 
-	ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_buffer", obj_desc);
-
-
-	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 	case ACPI_TYPE_BUFFER:
 
 		/* No conversion necessary */
 
 		*result_desc = obj_desc;
-		return_ACPI_STATUS (AE_OK);
-
+		return_ACPI_STATUS(AE_OK);
 
 	case ACPI_TYPE_INTEGER:
 
@@ -233,20 +215,20 @@ acpi_ex_convert_to_buffer (
 		 * Create a new Buffer object.
 		 * Need enough space for one integer
 		 */
-		return_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width);
+		return_desc =
+		    acpi_ut_create_buffer_object(acpi_gbl_integer_byte_width);
 		if (!return_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/* Copy the integer to the buffer, LSB first */
 
 		new_buf = return_desc->buffer.pointer;
-		ACPI_MEMCPY (new_buf,
-				  &obj_desc->integer.value,
-				  acpi_gbl_integer_byte_width);
+		ACPI_MEMCPY(new_buf,
+			    &obj_desc->integer.value,
+			    acpi_gbl_integer_byte_width);
 		break;
 
-
 	case ACPI_TYPE_STRING:
 
 		/*
@@ -258,32 +240,31 @@ acpi_ex_convert_to_buffer (
 		 * ASL/AML code that depends on the null being transferred to the new
 		 * buffer.
 		 */
-		return_desc = acpi_ut_create_buffer_object (
-				  (acpi_size) obj_desc->string.length + 1);
+		return_desc = acpi_ut_create_buffer_object((acpi_size)
+							   obj_desc->string.
+							   length + 1);
 		if (!return_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/* Copy the string to the buffer */
 
 		new_buf = return_desc->buffer.pointer;
-		ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer,
-			obj_desc->string.length);
+		ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer,
+			     obj_desc->string.length);
 		break;
 
-
 	default:
-		return_ACPI_STATUS (AE_TYPE);
+		return_ACPI_STATUS(AE_TYPE);
 	}
 
 	/* Mark buffer initialized */
 
 	return_desc->common.flags |= AOPOBJ_DATA_VALID;
 	*result_desc = return_desc;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_ascii
@@ -300,24 +281,19 @@ acpi_ex_convert_to_buffer (
  ******************************************************************************/
 
 static u32
-acpi_ex_convert_to_ascii (
-	acpi_integer                    integer,
-	u16                             base,
-	u8                              *string,
-	u8                              data_width)
+acpi_ex_convert_to_ascii(acpi_integer integer,
+			 u16 base, u8 * string, u8 data_width)
 {
-	acpi_integer                    digit;
-	acpi_native_uint                i;
-	acpi_native_uint                j;
-	acpi_native_uint                k = 0;
-	acpi_native_uint                hex_length;
-	acpi_native_uint                decimal_length;
-	u32                             remainder;
-	u8                              supress_zeros;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	acpi_integer digit;
+	acpi_native_uint i;
+	acpi_native_uint j;
+	acpi_native_uint k = 0;
+	acpi_native_uint hex_length;
+	acpi_native_uint decimal_length;
+	u32 remainder;
+	u8 supress_zeros;
 
+	ACPI_FUNCTION_ENTRY();
 
 	switch (base) {
 	case 10:
@@ -339,7 +315,7 @@ acpi_ex_convert_to_ascii (
 			break;
 		}
 
-		supress_zeros = TRUE;    /* No leading zeros */
+		supress_zeros = TRUE;	/* No leading zeros */
 		remainder = 0;
 
 		for (i = decimal_length; i > 0; i--) {
@@ -347,7 +323,8 @@ acpi_ex_convert_to_ascii (
 
 			digit = integer;
 			for (j = 0; j < i; j++) {
-				(void) acpi_ut_short_divide (digit, 10, &digit, &remainder);
+				(void)acpi_ut_short_divide(digit, 10, &digit,
+							   &remainder);
 			}
 
 			/* Handle leading zeros */
@@ -367,11 +344,13 @@ acpi_ex_convert_to_ascii (
 
 		/* hex_length: 2 ascii hex chars per data byte */
 
-		hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width);
-		for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
+		hex_length = (acpi_native_uint) ACPI_MUL_2(data_width);
+		for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
 			/* Get one hex digit, most significant digits first */
 
-			string[k] = (u8) acpi_ut_hex_to_ascii_char (integer, ACPI_MUL_4 (j));
+			string[k] =
+			    (u8) acpi_ut_hex_to_ascii_char(integer,
+							   ACPI_MUL_4(j));
 			k++;
 		}
 		break;
@@ -387,15 +366,14 @@ acpi_ex_convert_to_ascii (
 	 * Finally, null terminate the string and return the length
 	 */
 	if (!k) {
-		string [0] = ACPI_ASCII_ZERO;
+		string[0] = ACPI_ASCII_ZERO;
 		k = 1;
 	}
 
-	string [k] = 0;
+	string[k] = 0;
 	return ((u32) k);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_string
@@ -412,30 +390,25 @@ acpi_ex_convert_to_ascii (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_string (
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       **result_desc,
-	u32                             type)
+acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
+			  union acpi_operand_object ** result_desc, u32 type)
 {
-	union acpi_operand_object       *return_desc;
-	u8                              *new_buf;
-	u32                             i;
-	u32                             string_length = 0;
-	u16                             base = 16;
-	u8                              separator = ',';
+	union acpi_operand_object *return_desc;
+	u8 *new_buf;
+	u32 i;
+	u32 string_length = 0;
+	u16 base = 16;
+	u8 separator = ',';
 
+	ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc);
 
-	ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc);
-
-
-	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 	case ACPI_TYPE_STRING:
 
 		/* No conversion necessary */
 
 		*result_desc = obj_desc;
-		return_ACPI_STATUS (AE_OK);
-
+		return_ACPI_STATUS(AE_OK);
 
 	case ACPI_TYPE_INTEGER:
 
@@ -452,7 +425,7 @@ acpi_ex_convert_to_string (
 
 			/* Two hex string characters for each integer byte */
 
-			string_length = ACPI_MUL_2 (acpi_gbl_integer_byte_width);
+			string_length = ACPI_MUL_2(acpi_gbl_integer_byte_width);
 			break;
 		}
 
@@ -460,31 +433,33 @@ acpi_ex_convert_to_string (
 		 * Create a new String
 		 * Need enough space for one ASCII integer (plus null terminator)
 		 */
-		return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
+		return_desc =
+		    acpi_ut_create_string_object((acpi_size) string_length);
 		if (!return_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		new_buf = return_desc->buffer.pointer;
 
 		/* Convert integer to string */
 
-		string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base,
-				   new_buf, acpi_gbl_integer_byte_width);
+		string_length =
+		    acpi_ex_convert_to_ascii(obj_desc->integer.value, base,
+					     new_buf,
+					     acpi_gbl_integer_byte_width);
 
 		/* Null terminate at the correct place */
 
 		return_desc->string.length = string_length;
-		new_buf [string_length] = 0;
+		new_buf[string_length] = 0;
 		break;
 
-
 	case ACPI_TYPE_BUFFER:
 
 		/* Setup string length, base, and separator */
 
 		switch (type) {
-		case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
+		case ACPI_EXPLICIT_CONVERT_DECIMAL:	/* Used by to_decimal_string */
 			/*
 			 * From ACPI: "If Data is a buffer, it is converted to a string of
 			 * decimal values separated by commas."
@@ -498,11 +473,9 @@ acpi_ex_convert_to_string (
 			for (i = 0; i < obj_desc->buffer.length; i++) {
 				if (obj_desc->buffer.pointer[i] >= 100) {
 					string_length += 4;
-				}
-				else if (obj_desc->buffer.pointer[i] >= 10) {
+				} else if (obj_desc->buffer.pointer[i] >= 10) {
 					string_length += 3;
-				}
-				else {
+				} else {
 					string_length += 2;
 				}
 			}
@@ -518,7 +491,7 @@ acpi_ex_convert_to_string (
 			string_length = (obj_desc->buffer.length * 3);
 			break;
 
-		case ACPI_EXPLICIT_CONVERT_HEX:     /* Used by to_hex_string */
+		case ACPI_EXPLICIT_CONVERT_HEX:	/* Used by to_hex_string */
 			/*
 			 * From ACPI: "If Data is a buffer, it is converted to a string of
 			 * hexadecimal values separated by commas."
@@ -527,7 +500,7 @@ acpi_ex_convert_to_string (
 			break;
 
 		default:
-			return_ACPI_STATUS (AE_BAD_PARAMETER);
+			return_ACPI_STATUS(AE_BAD_PARAMETER);
 		}
 
 		/*
@@ -535,15 +508,16 @@ acpi_ex_convert_to_string (
 		 * (-1 because of extra separator included in string_length from above)
 		 */
 		string_length--;
-		if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ {
-			return_ACPI_STATUS (AE_AML_STRING_LIMIT);
+		if (string_length > ACPI_MAX_STRING_CONVERSION) {	/* ACPI limit */
+			return_ACPI_STATUS(AE_AML_STRING_LIMIT);
 		}
 
 		/* Create a new string object and string buffer */
 
-		return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
+		return_desc =
+		    acpi_ut_create_string_object((acpi_size) string_length);
 		if (!return_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		new_buf = return_desc->buffer.pointer;
@@ -553,10 +527,11 @@ acpi_ex_convert_to_string (
 		 * (separated by commas or spaces)
 		 */
 		for (i = 0; i < obj_desc->buffer.length; i++) {
-			new_buf += acpi_ex_convert_to_ascii (
-					 (acpi_integer) obj_desc->buffer.pointer[i], base,
-					 new_buf, 1);
-			*new_buf++ = separator; /* each separated by a comma or space */
+			new_buf += acpi_ex_convert_to_ascii((acpi_integer)
+							    obj_desc->buffer.
+							    pointer[i], base,
+							    new_buf, 1);
+			*new_buf++ = separator;	/* each separated by a comma or space */
 		}
 
 		/*
@@ -568,14 +543,13 @@ acpi_ex_convert_to_string (
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_TYPE);
+		return_ACPI_STATUS(AE_TYPE);
 	}
 
 	*result_desc = return_desc;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_target_type
@@ -592,17 +566,14 @@ acpi_ex_convert_to_string (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_target_type (
-	acpi_object_type                destination_type,
-	union acpi_operand_object       *source_desc,
-	union acpi_operand_object       **result_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_convert_to_target_type(acpi_object_type destination_type,
+			       union acpi_operand_object *source_desc,
+			       union acpi_operand_object **result_desc,
+			       struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ex_convert_to_target_type");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ex_convert_to_target_type");
 
 	/* Default behavior */
 
@@ -612,10 +583,10 @@ acpi_ex_convert_to_target_type (
 	 * If required by the target,
 	 * perform implicit conversion on the source before we store it.
 	 */
-	switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) {
+	switch (GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args)) {
 	case ARGI_SIMPLE_TARGET:
 	case ARGI_FIXED_TARGET:
-	case ARGI_INTEGER_REF:      /* Handles Increment, Decrement cases */
+	case ARGI_INTEGER_REF:	/* Handles Increment, Decrement cases */
 
 		switch (destination_type) {
 		case ACPI_TYPE_LOCAL_REGION_FIELD:
@@ -627,17 +598,19 @@ acpi_ex_convert_to_target_type (
 		default:
 			/* No conversion allowed for these types */
 
-			if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-					"Explicit operator, will store (%s) over existing type (%s)\n",
-					acpi_ut_get_object_type_name (source_desc),
-					acpi_ut_get_type_name (destination_type)));
+			if (destination_type !=
+			    ACPI_GET_OBJECT_TYPE(source_desc)) {
+				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+						  "Explicit operator, will store (%s) over existing type (%s)\n",
+						  acpi_ut_get_object_type_name
+						  (source_desc),
+						  acpi_ut_get_type_name
+						  (destination_type)));
 				status = AE_TYPE;
 			}
 		}
 		break;
 
-
 	case ARGI_TARGETREF:
 
 		switch (destination_type) {
@@ -649,55 +622,55 @@ acpi_ex_convert_to_target_type (
 			 * These types require an Integer operand.  We can convert
 			 * a Buffer or a String to an Integer if necessary.
 			 */
-			status = acpi_ex_convert_to_integer (source_desc, result_desc,
-					 16);
+			status =
+			    acpi_ex_convert_to_integer(source_desc, result_desc,
+						       16);
 			break;
 
-
 		case ACPI_TYPE_STRING:
 			/*
 			 * The operand must be a String.  We can convert an
 			 * Integer or Buffer if necessary
 			 */
-			status = acpi_ex_convert_to_string (source_desc, result_desc,
-					 ACPI_IMPLICIT_CONVERT_HEX);
+			status =
+			    acpi_ex_convert_to_string(source_desc, result_desc,
+						      ACPI_IMPLICIT_CONVERT_HEX);
 			break;
 
-
 		case ACPI_TYPE_BUFFER:
 			/*
 			 * The operand must be a Buffer.  We can convert an
 			 * Integer or String if necessary
 			 */
-			status = acpi_ex_convert_to_buffer (source_desc, result_desc);
+			status =
+			    acpi_ex_convert_to_buffer(source_desc, result_desc);
 			break;
 
-
 		default:
-			ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n",
-				destination_type));
+			ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type));
 			status = AE_AML_INTERNAL;
 			break;
 		}
 		break;
 
-
 	case ARGI_REFERENCE:
 		/*
 		 * create_xxxx_field cases - we are storing the field object into the name
 		 */
 		break;
 
-
 	default:
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Unknown Target type ID 0x%X Op %s dest_type %s\n",
-			GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args),
-			walk_state->op_info->name, acpi_ut_get_type_name (destination_type)));
-
-		ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n",
-			GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)))
-		status = AE_AML_INTERNAL;
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unknown Target type ID 0x%X Op %s dest_type %s\n",
+				  GET_CURRENT_ARG_TYPE(walk_state->op_info->
+						       runtime_args),
+				  walk_state->op_info->name,
+				  acpi_ut_get_type_name(destination_type)));
+
+		ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n",
+				   GET_CURRENT_ARG_TYPE(walk_state->op_info->
+							runtime_args)))
+		    status = AE_AML_INTERNAL;
 	}
 
 	/*
@@ -710,7 +683,5 @@ acpi_ex_convert_to_target_type (
 		status = AE_OK;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 153 - 189
drivers/acpi/executer/excreate.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
@@ -49,10 +48,8 @@
 #include <acpi/acevents.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("excreate")
-
+ACPI_MODULE_NAME("excreate")
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
@@ -66,33 +63,30 @@
  * DESCRIPTION: Create a new named alias
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_create_alias (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
 {
-	struct acpi_namespace_node      *target_node;
-	struct acpi_namespace_node      *alias_node;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ex_create_alias");
+	struct acpi_namespace_node *target_node;
+	struct acpi_namespace_node *alias_node;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ex_create_alias");
 
 	/* Get the source/alias operands (both namespace nodes) */
 
-	alias_node = (struct acpi_namespace_node *) walk_state->operands[0];
-	target_node = (struct acpi_namespace_node *) walk_state->operands[1];
+	alias_node = (struct acpi_namespace_node *)walk_state->operands[0];
+	target_node = (struct acpi_namespace_node *)walk_state->operands[1];
 
 	if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) ||
-		(target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
+	    (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
 		/*
 		 * Dereference an existing alias so that we don't create a chain
 		 * of aliases.  With this code, we guarantee that an alias is
 		 * always exactly one level of indirection away from the
 		 * actual aliased name.
 		 */
-		target_node = ACPI_CAST_PTR (struct acpi_namespace_node, target_node->object);
+		target_node =
+		    ACPI_CAST_PTR(struct acpi_namespace_node,
+				  target_node->object);
 	}
 
 	/*
@@ -115,7 +109,8 @@ acpi_ex_create_alias (
 		 * types, the object can change dynamically via a Store.
 		 */
 		alias_node->type = ACPI_TYPE_LOCAL_ALIAS;
-		alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node);
+		alias_node->object =
+		    ACPI_CAST_PTR(union acpi_operand_object, target_node);
 		break;
 
 	case ACPI_TYPE_METHOD:
@@ -126,7 +121,8 @@ acpi_ex_create_alias (
 		 * types, the object can change dynamically via a Store.
 		 */
 		alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
-		alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node);
+		alias_node->object =
+		    ACPI_CAST_PTR(union acpi_operand_object, target_node);
 		break;
 
 	default:
@@ -139,17 +135,18 @@ acpi_ex_create_alias (
 		 * additional reference to prevent deletion out from under either the
 		 * target node or the alias Node
 		 */
-		status = acpi_ns_attach_object (alias_node,
-				 acpi_ns_get_attached_object (target_node), target_node->type);
+		status = acpi_ns_attach_object(alias_node,
+					       acpi_ns_get_attached_object
+					       (target_node),
+					       target_node->type);
 		break;
 	}
 
 	/* Since both operands are Nodes, we don't need to delete them */
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_event
@@ -162,18 +159,14 @@ acpi_ex_create_alias (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_event (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_TRACE ("ex_create_event");
+	acpi_status status;
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_TRACE("ex_create_event");
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT);
 	if (!obj_desc) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
@@ -183,27 +176,27 @@ acpi_ex_create_event (
 	 * Create the actual OS semaphore, with zero initial units -- meaning
 	 * that the event is created in an unsignalled state
 	 */
-	status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0,
-			 &obj_desc->event.semaphore);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0,
+					  &obj_desc->event.semaphore);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/* Attach object to the Node */
 
-	status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0],
-			 obj_desc, ACPI_TYPE_EVENT);
+	status =
+	    acpi_ns_attach_object((struct acpi_namespace_node *)walk_state->
+				  operands[0], obj_desc, ACPI_TYPE_EVENT);
 
-cleanup:
+      cleanup:
 	/*
 	 * Remove local reference to the object (on error, will cause deletion
 	 * of both object and semaphore if present.)
 	 */
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_mutex
@@ -218,20 +211,16 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_mutex (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_create_mutex", ACPI_WALK_OPERANDS);
+	acpi_status status = AE_OK;
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS);
 
 	/* Create the new mutex object */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX);
 	if (!obj_desc) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
@@ -242,30 +231,30 @@ acpi_ex_create_mutex (
 	 * One unit max to make it a mutex, with one initial unit to allow
 	 * the mutex to be acquired.
 	 */
-	status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/* Init object and attach to NS node */
 
-	obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value;
-	obj_desc->mutex.node = (struct acpi_namespace_node *) walk_state->operands[0];
-
-	status = acpi_ns_attach_object (obj_desc->mutex.node,
-			 obj_desc, ACPI_TYPE_MUTEX);
+	obj_desc->mutex.sync_level =
+	    (u8) walk_state->operands[1]->integer.value;
+	obj_desc->mutex.node =
+	    (struct acpi_namespace_node *)walk_state->operands[0];
 
+	status = acpi_ns_attach_object(obj_desc->mutex.node,
+				       obj_desc, ACPI_TYPE_MUTEX);
 
-cleanup:
+      cleanup:
 	/*
 	 * Remove local reference to the object (on error, will cause deletion
 	 * of both object and semaphore if present.)
 	 */
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_region
@@ -282,20 +271,16 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ex_create_region (
-	u8                              *aml_start,
-	u32                             aml_length,
-	u8                              region_space,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_create_region(u8 * aml_start,
+		      u32 aml_length,
+		      u8 region_space, struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *obj_desc;
-	struct acpi_namespace_node      *node;
-	union acpi_operand_object       *region_obj2;
-
-
-	ACPI_FUNCTION_TRACE ("ex_create_region");
+	acpi_status status;
+	union acpi_operand_object *obj_desc;
+	struct acpi_namespace_node *node;
+	union acpi_operand_object *region_obj2;
 
+	ACPI_FUNCTION_TRACE("ex_create_region");
 
 	/* Get the Namespace Node */
 
@@ -305,8 +290,8 @@ acpi_ex_create_region (
 	 * If the region object is already attached to this node,
 	 * just return
 	 */
-	if (acpi_ns_get_attached_object (node)) {
-		return_ACPI_STATUS (AE_OK);
+	if (acpi_ns_get_attached_object(node)) {
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/*
@@ -314,17 +299,18 @@ acpi_ex_create_region (
 	 * range
 	 */
 	if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
-		(region_space < ACPI_USER_REGION_BEGIN)) {
-		ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space));
-		return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
+	    (region_space < ACPI_USER_REGION_BEGIN)) {
+		ACPI_REPORT_ERROR(("Invalid address_space type %X\n",
+				   region_space));
+		return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
-		acpi_ut_get_region_name (region_space), region_space));
+	ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
+			  acpi_ut_get_region_name(region_space), region_space));
 
 	/* Create the region descriptor */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
 	if (!obj_desc) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
@@ -334,7 +320,7 @@ acpi_ex_create_region (
 	 * Remember location in AML stream of address & length
 	 * operands since they need to be evaluated at run time.
 	 */
-	region_obj2                 = obj_desc->common.next_object;
+	region_obj2 = obj_desc->common.next_object;
 	region_obj2->extra.aml_start = aml_start;
 	region_obj2->extra.aml_length = aml_length;
 
@@ -343,22 +329,20 @@ acpi_ex_create_region (
 	obj_desc->region.space_id = region_space;
 	obj_desc->region.address = 0;
 	obj_desc->region.length = 0;
-	obj_desc->region.node   = node;
+	obj_desc->region.node = node;
 
 	/* Install the new region object in the parent Node */
 
-	status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
+	status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
 
-
-cleanup:
+      cleanup:
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_table_region
@@ -371,20 +355,16 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_table_region (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *obj_desc;
-	struct acpi_namespace_node      *node;
-	struct acpi_table_header        *table;
-	union acpi_operand_object       *region_obj2;
-
-
-	ACPI_FUNCTION_TRACE ("ex_create_table_region");
+	acpi_status status;
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *obj_desc;
+	struct acpi_namespace_node *node;
+	struct acpi_table_header *table;
+	union acpi_operand_object *region_obj2;
 
+	ACPI_FUNCTION_TRACE("ex_create_table_region");
 
 	/* Get the Node from the object stack  */
 
@@ -394,66 +374,64 @@ acpi_ex_create_table_region (
 	 * If the region object is already attached to this node,
 	 * just return
 	 */
-	if (acpi_ns_get_attached_object (node)) {
-		return_ACPI_STATUS (AE_OK);
+	if (acpi_ns_get_attached_object(node)) {
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Find the ACPI table */
 
-	status = acpi_tb_find_table (operand[1]->string.pointer,
-			   operand[2]->string.pointer,
-			   operand[3]->string.pointer, &table);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_tb_find_table(operand[1]->string.pointer,
+				    operand[2]->string.pointer,
+				    operand[3]->string.pointer, &table);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Create the region descriptor */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
-	region_obj2                     = obj_desc->common.next_object;
+	region_obj2 = obj_desc->common.next_object;
 	region_obj2->extra.region_context = NULL;
 
 	/* Init the region from the operands */
 
 	obj_desc->region.space_id = REGION_DATA_TABLE;
-	obj_desc->region.address = (acpi_physical_address) ACPI_TO_INTEGER (table);
+	obj_desc->region.address =
+	    (acpi_physical_address) ACPI_TO_INTEGER(table);
 	obj_desc->region.length = table->length;
-	obj_desc->region.node   = node;
-	obj_desc->region.flags  = AOPOBJ_DATA_VALID;
+	obj_desc->region.node = node;
+	obj_desc->region.flags = AOPOBJ_DATA_VALID;
 
 	/* Install the new region object in the parent Node */
 
-	status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
-	status = acpi_ev_initialize_region (obj_desc, FALSE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ev_initialize_region(obj_desc, FALSE);
+	if (ACPI_FAILURE(status)) {
 		if (status == AE_NOT_EXIST) {
 			status = AE_OK;
-		}
-		else {
+		} else {
 			goto cleanup;
 		}
 	}
 
 	obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE;
 
-
-cleanup:
+      cleanup:
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_processor
@@ -468,43 +446,39 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_processor (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *obj_desc;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_create_processor", walk_state);
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *obj_desc;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state);
 
 	/* Create the processor object */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Initialize the processor object from the operands */
 
-	obj_desc->processor.proc_id = (u8)          operand[1]->integer.value;
-	obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
-	obj_desc->processor.length = (u8)           operand[3]->integer.value;
+	obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
+	obj_desc->processor.address =
+	    (acpi_io_address) operand[2]->integer.value;
+	obj_desc->processor.length = (u8) operand[3]->integer.value;
 
 	/* Install the processor object in the parent Node */
 
-	status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
-			  obj_desc, ACPI_TYPE_PROCESSOR);
+	status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
+				       obj_desc, ACPI_TYPE_PROCESSOR);
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_power_resource
@@ -519,43 +493,39 @@ acpi_ex_create_processor (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_power_resource (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	acpi_status                     status;
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_create_power_resource", walk_state);
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	acpi_status status;
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state);
 
 	/* Create the power resource object */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Initialize the power object from the operands */
 
 	obj_desc->power_resource.system_level = (u8) operand[1]->integer.value;
-	obj_desc->power_resource.resource_order = (u16) operand[2]->integer.value;
+	obj_desc->power_resource.resource_order =
+	    (u16) operand[2]->integer.value;
 
 	/* Install the  power resource object in the parent Node */
 
-	status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
-			  obj_desc, ACPI_TYPE_POWER);
+	status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
+				       obj_desc, ACPI_TYPE_POWER);
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_method
@@ -571,25 +541,21 @@ acpi_ex_create_power_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_create_method (
-	u8                              *aml_start,
-	u32                             aml_length,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_create_method(u8 * aml_start,
+		      u32 aml_length, struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *obj_desc;
-	acpi_status                     status;
-	u8                              method_flags;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_create_method", walk_state);
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *obj_desc;
+	acpi_status status;
+	u8 method_flags;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state);
 
 	/* Create a new method object */
 
-	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD);
+	obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
 	if (!obj_desc) {
-	   return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Save the method's AML pointer and length  */
@@ -603,8 +569,10 @@ acpi_ex_create_method (
 	 */
 	method_flags = (u8) operand[1]->integer.value;
 
-	obj_desc->method.method_flags = (u8) (method_flags & ~AML_METHOD_ARG_COUNT);
-	obj_desc->method.param_count = (u8) (method_flags & AML_METHOD_ARG_COUNT);
+	obj_desc->method.method_flags =
+	    (u8) (method_flags & ~AML_METHOD_ARG_COUNT);
+	obj_desc->method.param_count =
+	    (u8) (method_flags & AML_METHOD_ARG_COUNT);
 
 	/*
 	 * Get the concurrency count.  If required, a semaphore will be
@@ -613,32 +581,28 @@ acpi_ex_create_method (
 	if (acpi_gbl_all_methods_serialized) {
 		obj_desc->method.concurrency = 1;
 		obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
-	}
-	else if (method_flags & AML_METHOD_SERIALIZED) {
+	} else if (method_flags & AML_METHOD_SERIALIZED) {
 		/*
 		 * ACPI 1.0: Concurrency = 1
 		 * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1)
 		 */
 		obj_desc->method.concurrency = (u8)
-				  (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
-	}
-	else {
+		    (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
+	} else {
 		obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
 	}
 
 	/* Attach the new object to the method Node */
 
-	status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
-			  obj_desc, ACPI_TYPE_METHOD);
+	status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
+				       obj_desc, ACPI_TYPE_METHOD);
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
+	acpi_ut_remove_reference(obj_desc);
 
 	/* Remove a reference to the operand */
 
-	acpi_ut_remove_reference (operand[1]);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(operand[1]);
+	return_ACPI_STATUS(status);
 }
-
-

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 327 - 370
drivers/acpi/executer/exdump.c


+ 126 - 126
drivers/acpi/executer/exfield.c

@@ -41,15 +41,12 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exfield")
-
+ACPI_MODULE_NAME("exfield")
 
 /*******************************************************************************
  *
@@ -65,67 +62,70 @@
  *              Buffer, depending on the size of the field.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_read_data_from_field (
-	struct acpi_walk_state          *walk_state,
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       **ret_buffer_desc)
+acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
+			     union acpi_operand_object *obj_desc,
+			     union acpi_operand_object **ret_buffer_desc)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *buffer_desc;
-	acpi_size                       length;
-	void                            *buffer;
-	u8                              locked;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_read_data_from_field", obj_desc);
+	acpi_status status;
+	union acpi_operand_object *buffer_desc;
+	acpi_size length;
+	void *buffer;
+	u8 locked;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc);
 
 	/* Parameter validation */
 
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_AML_NO_OPERAND);
+		return_ACPI_STATUS(AE_AML_NO_OPERAND);
 	}
 	if (!ret_buffer_desc) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
+	if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
 		/*
 		 * If the buffer_field arguments have not been previously evaluated,
 		 * evaluate them now and save the results.
 		 */
 		if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-			status = acpi_ds_get_buffer_field_arguments (obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status = acpi_ds_get_buffer_field_arguments(obj_desc);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
-	}
-	else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
-			 (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
+	} else
+	    if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
+		&& (obj_desc->field.region_obj->region.space_id ==
+		    ACPI_ADR_SPACE_SMBUS)) {
 		/*
 		 * This is an SMBus read.  We must create a buffer to hold the data
 		 * and directly access the region handler.
 		 */
-		buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
+		buffer_desc =
+		    acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
 		if (!buffer_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/* Lock entire transaction if requested */
 
-		locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+		locked =
+		    acpi_ex_acquire_global_lock(obj_desc->common_field.
+						field_flags);
 
 		/*
 		 * Perform the read.
 		 * Note: Smbus protocol value is passed in upper 16-bits of Function
 		 */
-		status = acpi_ex_access_region (obj_desc, 0,
-				 ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
-				 ACPI_READ | (obj_desc->field.attribute << 16));
-		acpi_ex_release_global_lock (locked);
+		status = acpi_ex_access_region(obj_desc, 0,
+					       ACPI_CAST_PTR(acpi_integer,
+							     buffer_desc->
+							     buffer.pointer),
+					       ACPI_READ | (obj_desc->field.
+							    attribute << 16));
+		acpi_ex_release_global_lock(locked);
 		goto exit;
 	}
 
@@ -139,22 +139,22 @@ acpi_ex_read_data_from_field (
 	 *
 	 * Note: Field.length is in bits.
 	 */
-	length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
+	length =
+	    (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
 	if (length > acpi_gbl_integer_byte_width) {
 		/* Field is too large for an Integer, create a Buffer instead */
 
-		buffer_desc = acpi_ut_create_buffer_object (length);
+		buffer_desc = acpi_ut_create_buffer_object(length);
 		if (!buffer_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 		buffer = buffer_desc->buffer.pointer;
-	}
-	else {
+	} else {
 		/* Field will fit within an Integer (normal case) */
 
-		buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 		if (!buffer_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		length = acpi_gbl_integer_byte_width;
@@ -162,37 +162,36 @@ acpi_ex_read_data_from_field (
 		buffer = &buffer_desc->integer.value;
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-		"field_read [TO]:  Obj %p, Type %X, Buf %p, byte_len %X\n",
-		obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length));
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-		"field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
-		obj_desc->common_field.bit_length,
-		obj_desc->common_field.start_field_bit_offset,
-		obj_desc->common_field.base_byte_offset));
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "field_read [TO]:  Obj %p, Type %X, Buf %p, byte_len %X\n",
+			  obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer,
+			  (u32) length));
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
+			  obj_desc->common_field.bit_length,
+			  obj_desc->common_field.start_field_bit_offset,
+			  obj_desc->common_field.base_byte_offset));
 
 	/* Lock entire transaction if requested */
 
-	locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+	locked =
+	    acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
 
 	/* Read from the field */
 
-	status = acpi_ex_extract_from_field (obj_desc, buffer, (u32) length);
-	acpi_ex_release_global_lock (locked);
-
+	status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length);
+	acpi_ex_release_global_lock(locked);
 
-exit:
-	if (ACPI_FAILURE (status)) {
-		acpi_ut_remove_reference (buffer_desc);
-	}
-	else {
+      exit:
+	if (ACPI_FAILURE(status)) {
+		acpi_ut_remove_reference(buffer_desc);
+	} else {
 		*ret_buffer_desc = buffer_desc;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_write_data_to_field
@@ -208,97 +207,96 @@ exit:
  ******************************************************************************/
 
 acpi_status
-acpi_ex_write_data_to_field (
-	union acpi_operand_object       *source_desc,
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       **result_desc)
+acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
+			    union acpi_operand_object *obj_desc,
+			    union acpi_operand_object **result_desc)
 {
-	acpi_status                     status;
-	u32                             length;
-	u32                             required_length;
-	void                            *buffer;
-	void                            *new_buffer;
-	u8                              locked;
-	union acpi_operand_object       *buffer_desc;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_write_data_to_field", obj_desc);
+	acpi_status status;
+	u32 length;
+	u32 required_length;
+	void *buffer;
+	void *new_buffer;
+	u8 locked;
+	union acpi_operand_object *buffer_desc;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc);
 
 	/* Parameter validation */
 
 	if (!source_desc || !obj_desc) {
-		return_ACPI_STATUS (AE_AML_NO_OPERAND);
+		return_ACPI_STATUS(AE_AML_NO_OPERAND);
 	}
 
-	if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
+	if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
 		/*
 		 * If the buffer_field arguments have not been previously evaluated,
 		 * evaluate them now and save the results.
 		 */
 		if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-			status = acpi_ds_get_buffer_field_arguments (obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status = acpi_ds_get_buffer_field_arguments(obj_desc);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
-	}
-	else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
-			 (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
+	} else
+	    if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
+		&& (obj_desc->field.region_obj->region.space_id ==
+		    ACPI_ADR_SPACE_SMBUS)) {
 		/*
 		 * This is an SMBus write.  We will bypass the entire field mechanism
 		 * and handoff the buffer directly to the handler.
 		 *
 		 * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
 		 */
-		if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
-			ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
-				acpi_ut_get_object_type_name (source_desc)));
+		if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
+			ACPI_REPORT_ERROR(("SMBus write requires Buffer, found type %s\n", acpi_ut_get_object_type_name(source_desc)));
 
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
-			ACPI_REPORT_ERROR ((
-				"SMBus write requires Buffer of length %X, found length %X\n",
-				ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
+			ACPI_REPORT_ERROR(("SMBus write requires Buffer of length %X, found length %X\n", ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
 
-			return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
+			return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
 		}
 
-		buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
+		buffer_desc =
+		    acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
 		if (!buffer_desc) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		buffer = buffer_desc->buffer.pointer;
-		ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
-			ACPI_SMBUS_BUFFER_SIZE);
+		ACPI_MEMCPY(buffer, source_desc->buffer.pointer,
+			    ACPI_SMBUS_BUFFER_SIZE);
 
 		/* Lock entire transaction if requested */
 
-		locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+		locked =
+		    acpi_ex_acquire_global_lock(obj_desc->common_field.
+						field_flags);
 
 		/*
 		 * Perform the write (returns status and perhaps data in the
 		 * same buffer)
 		 * Note: SMBus protocol type is passed in upper 16-bits of Function.
 		 */
-		status = acpi_ex_access_region (obj_desc, 0,
-				  (acpi_integer *) buffer,
-				  ACPI_WRITE | (obj_desc->field.attribute << 16));
-		acpi_ex_release_global_lock (locked);
+		status = acpi_ex_access_region(obj_desc, 0,
+					       (acpi_integer *) buffer,
+					       ACPI_WRITE | (obj_desc->field.
+							     attribute << 16));
+		acpi_ex_release_global_lock(locked);
 
 		*result_desc = buffer_desc;
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Get a pointer to the data to be written */
 
-	switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
 	case ACPI_TYPE_INTEGER:
 		buffer = &source_desc->integer.value;
-		length = sizeof (source_desc->integer.value);
+		length = sizeof(source_desc->integer.value);
 		break;
 
 	case ACPI_TYPE_BUFFER:
@@ -312,7 +310,7 @@ acpi_ex_write_data_to_field (
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 	}
 
 	/*
@@ -322,15 +320,15 @@ acpi_ex_write_data_to_field (
 	 * the ACPI specification.
 	 */
 	new_buffer = NULL;
-	required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
-			   obj_desc->common_field.bit_length);
+	required_length =
+	    ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
 
 	if (length < required_length) {
 		/* We need to create a new buffer */
 
-		new_buffer = ACPI_MEM_CALLOCATE (required_length);
+		new_buffer = ACPI_MEM_CALLOCATE(required_length);
 		if (!new_buffer) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/*
@@ -338,40 +336,42 @@ acpi_ex_write_data_to_field (
 		 * at Byte zero.  All unused (upper) bytes of the
 		 * buffer will be 0.
 		 */
-		ACPI_MEMCPY ((char *) new_buffer, (char *) buffer, length);
+		ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length);
 		buffer = new_buffer;
 		length = required_length;
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-		"field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
-		source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
-		ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
-
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-		"field_write [TO]:  Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
-		obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
-		ACPI_GET_OBJECT_TYPE (obj_desc),
-		obj_desc->common_field.bit_length,
-		obj_desc->common_field.start_field_bit_offset,
-		obj_desc->common_field.base_byte_offset));
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
+			  source_desc,
+			  acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
+						(source_desc)),
+			  ACPI_GET_OBJECT_TYPE(source_desc), buffer, length));
+
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "field_write [TO]:  Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
+			  obj_desc,
+			  acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)),
+			  ACPI_GET_OBJECT_TYPE(obj_desc),
+			  obj_desc->common_field.bit_length,
+			  obj_desc->common_field.start_field_bit_offset,
+			  obj_desc->common_field.base_byte_offset));
 
 	/* Lock entire transaction if requested */
 
-	locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+	locked =
+	    acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
 
 	/* Write to the field */
 
-	status = acpi_ex_insert_into_field (obj_desc, buffer, length);
-	acpi_ex_release_global_lock (locked);
+	status = acpi_ex_insert_into_field(obj_desc, buffer, length);
+	acpi_ex_release_global_lock(locked);
 
 	/* Free temporary buffer if we used one */
 
 	if (new_buffer) {
-		ACPI_MEM_FREE (new_buffer);
+		ACPI_MEM_FREE(new_buffer);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 322 - 322
drivers/acpi/executer/exfldio.c

@@ -41,36 +41,28 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acevents.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exfldio")
+ACPI_MODULE_NAME("exfldio")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_field_datum_io (
-	union acpi_operand_object       *obj_desc,
-	u32                             field_datum_byte_offset,
-	acpi_integer                    *value,
-	u32                             read_write);
+acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
+		       u32 field_datum_byte_offset,
+		       acpi_integer * value, u32 read_write);
 
 static u8
-acpi_ex_register_overflow (
-	union acpi_operand_object       *obj_desc,
-	acpi_integer                    value);
+acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
+			  acpi_integer value);
 
 static acpi_status
-acpi_ex_setup_region (
-	union acpi_operand_object       *obj_desc,
-	u32                             field_datum_byte_offset);
-
+acpi_ex_setup_region(union acpi_operand_object *obj_desc,
+		     u32 field_datum_byte_offset);
 
 /*******************************************************************************
  *
@@ -89,27 +81,25 @@ acpi_ex_setup_region (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_setup_region (
-	union acpi_operand_object       *obj_desc,
-	u32                             field_datum_byte_offset)
+acpi_ex_setup_region(union acpi_operand_object *obj_desc,
+		     u32 field_datum_byte_offset)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *rgn_desc;
-
-
-	ACPI_FUNCTION_TRACE_U32 ("ex_setup_region", field_datum_byte_offset);
+	acpi_status status = AE_OK;
+	union acpi_operand_object *rgn_desc;
 
+	ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset);
 
 	rgn_desc = obj_desc->common_field.region_obj;
 
 	/* We must have a valid region */
 
-	if (ACPI_GET_OBJECT_TYPE (rgn_desc) != ACPI_TYPE_REGION) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
-			ACPI_GET_OBJECT_TYPE (rgn_desc),
-			acpi_ut_get_object_type_name (rgn_desc)));
+	if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Needed Region, found type %X (%s)\n",
+				  ACPI_GET_OBJECT_TYPE(rgn_desc),
+				  acpi_ut_get_object_type_name(rgn_desc)));
 
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 	}
 
 	/*
@@ -117,26 +107,25 @@ acpi_ex_setup_region (
 	 * evaluate them now and save the results.
 	 */
 	if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) {
-		status = acpi_ds_get_region_arguments (rgn_desc);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ds_get_region_arguments(rgn_desc);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
 		/* SMBus has a non-linear address space */
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
-
 #ifdef ACPI_UNDER_DEVELOPMENT
 	/*
 	 * If the Field access is any_acc, we can now compute the optimal
 	 * access (because we know know the length of the parent region)
 	 */
 	if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 #endif
@@ -147,56 +136,64 @@ acpi_ex_setup_region (
 	 * (Region length is specified in bytes)
 	 */
 	if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
-			   field_datum_byte_offset +
-			   obj_desc->common_field.access_byte_width)) {
+				       field_datum_byte_offset +
+				       obj_desc->common_field.
+				       access_byte_width)) {
 		if (acpi_gbl_enable_interpreter_slack) {
 			/*
 			 * Slack mode only:  We will go ahead and allow access to this
 			 * field if it is within the region length rounded up to the next
 			 * access width boundary.
 			 */
-			if (ACPI_ROUND_UP (rgn_desc->region.length,
-					   obj_desc->common_field.access_byte_width) >=
-				(obj_desc->common_field.base_byte_offset +
-				 (acpi_native_uint) obj_desc->common_field.access_byte_width +
-				 field_datum_byte_offset)) {
-				return_ACPI_STATUS (AE_OK);
+			if (ACPI_ROUND_UP(rgn_desc->region.length,
+					  obj_desc->common_field.
+					  access_byte_width) >=
+			    (obj_desc->common_field.base_byte_offset +
+			     (acpi_native_uint) obj_desc->common_field.
+			     access_byte_width + field_datum_byte_offset)) {
+				return_ACPI_STATUS(AE_OK);
 			}
 		}
 
-		if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) {
+		if (rgn_desc->region.length <
+		    obj_desc->common_field.access_byte_width) {
 			/*
 			 * This is the case where the access_type (acc_word, etc.) is wider
 			 * than the region itself.  For example, a region of length one
 			 * byte, and a field with Dword access specified.
 			 */
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
-				acpi_ut_get_node_name (obj_desc->common_field.node),
-				obj_desc->common_field.access_byte_width,
-				acpi_ut_get_node_name (rgn_desc->region.node),
-				rgn_desc->region.length));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
+					  acpi_ut_get_node_name(obj_desc->
+								common_field.
+								node),
+					  obj_desc->common_field.
+					  access_byte_width,
+					  acpi_ut_get_node_name(rgn_desc->
+								region.node),
+					  rgn_desc->region.length));
 		}
 
 		/*
 		 * Offset rounded up to next multiple of field width
 		 * exceeds region length, indicate an error
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
-			acpi_ut_get_node_name (obj_desc->common_field.node),
-			obj_desc->common_field.base_byte_offset,
-			field_datum_byte_offset, obj_desc->common_field.access_byte_width,
-			acpi_ut_get_node_name (rgn_desc->region.node),
-			rgn_desc->region.length));
-
-		return_ACPI_STATUS (AE_AML_REGION_LIMIT);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
+				  acpi_ut_get_node_name(obj_desc->common_field.
+							node),
+				  obj_desc->common_field.base_byte_offset,
+				  field_datum_byte_offset,
+				  obj_desc->common_field.access_byte_width,
+				  acpi_ut_get_node_name(rgn_desc->region.node),
+				  rgn_desc->region.length));
+
+		return_ACPI_STATUS(AE_AML_REGION_LIMIT);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_access_region
@@ -216,27 +213,23 @@ acpi_ex_setup_region (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_access_region (
-	union acpi_operand_object       *obj_desc,
-	u32                             field_datum_byte_offset,
-	acpi_integer                    *value,
-	u32                             function)
+acpi_ex_access_region(union acpi_operand_object *obj_desc,
+		      u32 field_datum_byte_offset,
+		      acpi_integer * value, u32 function)
 {
-	acpi_status                     status;
-	union acpi_operand_object       *rgn_desc;
-	acpi_physical_address           address;
-
-
-	ACPI_FUNCTION_TRACE ("ex_access_region");
+	acpi_status status;
+	union acpi_operand_object *rgn_desc;
+	acpi_physical_address address;
 
+	ACPI_FUNCTION_TRACE("ex_access_region");
 
 	/*
 	 * Ensure that the region operands are fully evaluated and verify
 	 * the validity of the request
 	 */
-	status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ex_setup_region(obj_desc, field_datum_byte_offset);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -248,50 +241,53 @@ acpi_ex_access_region (
 	 */
 	rgn_desc = obj_desc->common_field.region_obj;
 	address = rgn_desc->region.address +
-			 obj_desc->common_field.base_byte_offset +
-			 field_datum_byte_offset;
+	    obj_desc->common_field.base_byte_offset + field_datum_byte_offset;
 
 	if ((function & ACPI_IO_MASK) == ACPI_READ) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
-	}
-	else {
-		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]"));
+		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[READ]"));
+	} else {
+		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[WRITE]"));
 	}
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
-		" Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
-		acpi_ut_get_region_name (rgn_desc->region.space_id),
-		rgn_desc->region.space_id,
-		obj_desc->common_field.access_byte_width,
-		obj_desc->common_field.base_byte_offset,
-		field_datum_byte_offset,
-		ACPI_FORMAT_UINT64 (address)));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
+			      " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
+			      acpi_ut_get_region_name(rgn_desc->region.
+						      space_id),
+			      rgn_desc->region.space_id,
+			      obj_desc->common_field.access_byte_width,
+			      obj_desc->common_field.base_byte_offset,
+			      field_datum_byte_offset,
+			      ACPI_FORMAT_UINT64(address)));
 
 	/* Invoke the appropriate address_space/op_region handler */
 
-	status = acpi_ev_address_space_dispatch (rgn_desc, function,
-			 address,
-			 ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
+	status = acpi_ev_address_space_dispatch(rgn_desc, function,
+						address,
+						ACPI_MUL_8(obj_desc->
+							   common_field.
+							   access_byte_width),
+						value);
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		if (status == AE_NOT_IMPLEMENTED) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Region %s(%X) not implemented\n",
-				acpi_ut_get_region_name (rgn_desc->region.space_id),
-				rgn_desc->region.space_id));
-		}
-		else if (status == AE_NOT_EXIST) {
-			ACPI_REPORT_ERROR ((
-				"Region %s(%X) has no handler\n",
-				acpi_ut_get_region_name (rgn_desc->region.space_id),
-				rgn_desc->region.space_id));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Region %s(%X) not implemented\n",
+					  acpi_ut_get_region_name(rgn_desc->
+								  region.
+								  space_id),
+					  rgn_desc->region.space_id));
+		} else if (status == AE_NOT_EXIST) {
+			ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n",
+					   acpi_ut_get_region_name(rgn_desc->
+								   region.
+								   space_id),
+					   rgn_desc->region.space_id));
 		}
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_register_overflow
@@ -310,9 +306,8 @@ acpi_ex_access_region (
  ******************************************************************************/
 
 static u8
-acpi_ex_register_overflow (
-	union acpi_operand_object       *obj_desc,
-	acpi_integer                    value)
+acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
+			  acpi_integer value)
 {
 
 	if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
@@ -336,7 +331,6 @@ acpi_ex_register_overflow (
 	return (FALSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_field_datum_io
@@ -356,18 +350,14 @@ acpi_ex_register_overflow (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_field_datum_io (
-	union acpi_operand_object       *obj_desc,
-	u32                             field_datum_byte_offset,
-	acpi_integer                    *value,
-	u32                             read_write)
+acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
+		       u32 field_datum_byte_offset,
+		       acpi_integer * value, u32 read_write)
 {
-	acpi_status                     status;
-	acpi_integer                    local_value;
-
-
-	ACPI_FUNCTION_TRACE_U32 ("ex_field_datum_io", field_datum_byte_offset);
+	acpi_status status;
+	acpi_integer local_value;
 
+	ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset);
 
 	if (read_write == ACPI_READ) {
 		if (!value) {
@@ -392,16 +382,16 @@ acpi_ex_field_datum_io (
 	 * index_field - Write to an Index Register, then read/write from/to a
 	 *               Data Register
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 	case ACPI_TYPE_BUFFER_FIELD:
 		/*
 		 * If the buffer_field arguments have not been previously evaluated,
 		 * evaluate them now and save the results.
 		 */
 		if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-			status = acpi_ds_get_buffer_field_arguments (obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status = acpi_ds_get_buffer_field_arguments(obj_desc);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
 
@@ -410,47 +400,50 @@ acpi_ex_field_datum_io (
 			 * Copy the data from the source buffer.
 			 * Length is the field width in bytes.
 			 */
-			ACPI_MEMCPY (value,
-				(obj_desc->buffer_field.buffer_obj)->buffer.pointer +
-					obj_desc->buffer_field.base_byte_offset +
-					field_datum_byte_offset,
-				obj_desc->common_field.access_byte_width);
-		}
-		else {
+			ACPI_MEMCPY(value,
+				    (obj_desc->buffer_field.buffer_obj)->buffer.
+				    pointer +
+				    obj_desc->buffer_field.base_byte_offset +
+				    field_datum_byte_offset,
+				    obj_desc->common_field.access_byte_width);
+		} else {
 			/*
 			 * Copy the data to the target buffer.
 			 * Length is the field width in bytes.
 			 */
-			ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer +
-					obj_desc->buffer_field.base_byte_offset +
-					field_datum_byte_offset,
-					value, obj_desc->common_field.access_byte_width);
+			ACPI_MEMCPY((obj_desc->buffer_field.buffer_obj)->buffer.
+				    pointer +
+				    obj_desc->buffer_field.base_byte_offset +
+				    field_datum_byte_offset, value,
+				    obj_desc->common_field.access_byte_width);
 		}
 
 		status = AE_OK;
 		break;
 
-
 	case ACPI_TYPE_LOCAL_BANK_FIELD:
 
 		/*
 		 * Ensure that the bank_value is not beyond the capacity of
 		 * the register
 		 */
-		if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,
-				  (acpi_integer) obj_desc->bank_field.value)) {
-			return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+		if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj,
+					      (acpi_integer) obj_desc->
+					      bank_field.value)) {
+			return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
 		}
 
 		/*
 		 * For bank_fields, we must write the bank_value to the bank_register
 		 * (itself a region_field) before we can access the data.
 		 */
-		status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj,
-				 &obj_desc->bank_field.value,
-				 sizeof (obj_desc->bank_field.value));
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ex_insert_into_field(obj_desc->bank_field.bank_obj,
+					      &obj_desc->bank_field.value,
+					      sizeof(obj_desc->bank_field.
+						     value));
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/*
@@ -460,90 +453,92 @@ acpi_ex_field_datum_io (
 
 		/*lint -fallthrough */
 
-
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 		/*
 		 * For simple region_fields, we just directly access the owning
 		 * Operation Region.
 		 */
-		status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value,
-				  read_write);
+		status =
+		    acpi_ex_access_region(obj_desc, field_datum_byte_offset,
+					  value, read_write);
 		break;
 
-
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-
 		/*
 		 * Ensure that the index_value is not beyond the capacity of
 		 * the register
 		 */
-		if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,
-				  (acpi_integer) obj_desc->index_field.value)) {
-			return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+		if (acpi_ex_register_overflow(obj_desc->index_field.index_obj,
+					      (acpi_integer) obj_desc->
+					      index_field.value)) {
+			return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
 		}
 
 		/* Write the index value to the index_register (itself a region_field) */
 
 		field_datum_byte_offset += obj_desc->index_field.value;
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-				"Write to Index Register: Value %8.8X\n",
-				field_datum_byte_offset));
+		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+				  "Write to Index Register: Value %8.8X\n",
+				  field_datum_byte_offset));
 
-		status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
-				 &field_datum_byte_offset,
-				 sizeof (field_datum_byte_offset));
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ex_insert_into_field(obj_desc->index_field.index_obj,
+					      &field_datum_byte_offset,
+					      sizeof(field_datum_byte_offset));
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-				"I/O to Data Register: value_ptr %p\n",
-				value));
+		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+				  "I/O to Data Register: value_ptr %p\n",
+				  value));
 
 		if (read_write == ACPI_READ) {
 			/* Read the datum from the data_register */
 
-			status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj,
-					  value, sizeof (acpi_integer));
-		}
-		else {
+			status =
+			    acpi_ex_extract_from_field(obj_desc->index_field.
+						       data_obj, value,
+						       sizeof(acpi_integer));
+		} else {
 			/* Write the datum to the data_register */
 
-			status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
-					  value, sizeof (acpi_integer));
+			status =
+			    acpi_ex_insert_into_field(obj_desc->index_field.
+						      data_obj, value,
+						      sizeof(acpi_integer));
 		}
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n",
-			ACPI_GET_OBJECT_TYPE (obj_desc)));
+		ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n",
+				   ACPI_GET_OBJECT_TYPE(obj_desc)));
 		status = AE_AML_INTERNAL;
 		break;
 	}
 
-	if (ACPI_SUCCESS (status)) {
+	if (ACPI_SUCCESS(status)) {
 		if (read_write == ACPI_READ) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-				"Value Read %8.8X%8.8X, Width %d\n",
-				ACPI_FORMAT_UINT64 (*value),
-				obj_desc->common_field.access_byte_width));
-		}
-		else {
-			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-				"Value Written %8.8X%8.8X, Width %d\n",
-				ACPI_FORMAT_UINT64 (*value),
-				obj_desc->common_field.access_byte_width));
+			ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+					  "Value Read %8.8X%8.8X, Width %d\n",
+					  ACPI_FORMAT_UINT64(*value),
+					  obj_desc->common_field.
+					  access_byte_width));
+		} else {
+			ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+					  "Value Written %8.8X%8.8X, Width %d\n",
+					  ACPI_FORMAT_UINT64(*value),
+					  obj_desc->common_field.
+					  access_byte_width));
 		}
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_write_with_update_rule
@@ -560,19 +555,16 @@ acpi_ex_field_datum_io (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_write_with_update_rule (
-	union acpi_operand_object       *obj_desc,
-	acpi_integer                    mask,
-	acpi_integer                    field_value,
-	u32                             field_datum_byte_offset)
+acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
+			       acpi_integer mask,
+			       acpi_integer field_value,
+			       u32 field_datum_byte_offset)
 {
-	acpi_status                     status = AE_OK;
-	acpi_integer                    merged_value;
-	acpi_integer                    current_value;
-
-
-	ACPI_FUNCTION_TRACE_U32 ("ex_write_with_update_rule", mask);
+	acpi_status status = AE_OK;
+	acpi_integer merged_value;
+	acpi_integer current_value;
 
+	ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask);
 
 	/* Start with the new bits  */
 
@@ -583,22 +575,27 @@ acpi_ex_write_with_update_rule (
 	if (mask != ACPI_INTEGER_MAX) {
 		/* Decode the update rule */
 
-		switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) {
+		switch (obj_desc->common_field.
+			field_flags & AML_FIELD_UPDATE_RULE_MASK) {
 		case AML_FIELD_UPDATE_PRESERVE:
 			/*
 			 * Check if update rule needs to be applied (not if mask is all
 			 * ones)  The left shift drops the bits we want to ignore.
 			 */
-			if ((~mask << (ACPI_MUL_8 (sizeof (mask)) -
-					 ACPI_MUL_8 (obj_desc->common_field.access_byte_width))) != 0) {
+			if ((~mask << (ACPI_MUL_8(sizeof(mask)) -
+				       ACPI_MUL_8(obj_desc->common_field.
+						  access_byte_width))) != 0) {
 				/*
 				 * Read the current contents of the byte/word/dword containing
 				 * the field, and merge with the new field value.
 				 */
-				status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
-						  &current_value, ACPI_READ);
-				if (ACPI_FAILURE (status)) {
-					return_ACPI_STATUS (status);
+				status =
+				    acpi_ex_field_datum_io(obj_desc,
+							   field_datum_byte_offset,
+							   &current_value,
+							   ACPI_READ);
+				if (ACPI_FAILURE(status)) {
+					return_ACPI_STATUS(status);
 				}
 
 				merged_value |= (current_value & ~mask);
@@ -621,30 +618,31 @@ acpi_ex_write_with_update_rule (
 
 		default:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"write_with_update_rule: Unknown update_rule setting: %X\n",
-				(obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK)));
-			return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "write_with_update_rule: Unknown update_rule setting: %X\n",
+					  (obj_desc->common_field.
+					   field_flags &
+					   AML_FIELD_UPDATE_RULE_MASK)));
+			return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
 		}
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-		"Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
-		ACPI_FORMAT_UINT64 (mask),
-		field_datum_byte_offset,
-		obj_desc->common_field.access_byte_width,
-		ACPI_FORMAT_UINT64 (field_value),
-		ACPI_FORMAT_UINT64 (merged_value)));
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
+			  ACPI_FORMAT_UINT64(mask),
+			  field_datum_byte_offset,
+			  obj_desc->common_field.access_byte_width,
+			  ACPI_FORMAT_UINT64(field_value),
+			  ACPI_FORMAT_UINT64(merged_value)));
 
 	/* Write the merged value */
 
-	status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
-			  &merged_value, ACPI_WRITE);
+	status = acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset,
+					&merged_value, ACPI_WRITE);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_extract_from_field
@@ -660,54 +658,54 @@ acpi_ex_write_with_update_rule (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_extract_from_field (
-	union acpi_operand_object       *obj_desc,
-	void                            *buffer,
-	u32                             buffer_length)
+acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
+			   void *buffer, u32 buffer_length)
 {
-	acpi_status                     status;
-	acpi_integer                    raw_datum;
-	acpi_integer                    merged_datum;
-	u32                             field_offset = 0;
-	u32                             buffer_offset = 0;
-	u32                             buffer_tail_bits;
-	u32                             datum_count;
-	u32                             field_datum_count;
-	u32                             i;
-
-
-	ACPI_FUNCTION_TRACE ("ex_extract_from_field");
-
+	acpi_status status;
+	acpi_integer raw_datum;
+	acpi_integer merged_datum;
+	u32 field_offset = 0;
+	u32 buffer_offset = 0;
+	u32 buffer_tail_bits;
+	u32 datum_count;
+	u32 field_datum_count;
+	u32 i;
+
+	ACPI_FUNCTION_TRACE("ex_extract_from_field");
 
 	/* Validate target buffer and clear it */
 
-	if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES (
-			 obj_desc->common_field.bit_length)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Field size %X (bits) is too large for buffer (%X)\n",
-			obj_desc->common_field.bit_length, buffer_length));
+	if (buffer_length <
+	    ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Field size %X (bits) is too large for buffer (%X)\n",
+				  obj_desc->common_field.bit_length,
+				  buffer_length));
 
-		return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+		return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
 	}
-	ACPI_MEMSET (buffer, 0, buffer_length);
+	ACPI_MEMSET(buffer, 0, buffer_length);
 
 	/* Compute the number of datums (access width data items) */
 
-	datum_count = ACPI_ROUND_UP_TO (
-			   obj_desc->common_field.bit_length,
-			   obj_desc->common_field.access_bit_width);
-	field_datum_count = ACPI_ROUND_UP_TO (
-			   obj_desc->common_field.bit_length +
-			   obj_desc->common_field.start_field_bit_offset,
-			   obj_desc->common_field.access_bit_width);
+	datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
+				       obj_desc->common_field.access_bit_width);
+	field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
+					     obj_desc->common_field.
+					     start_field_bit_offset,
+					     obj_desc->common_field.
+					     access_bit_width);
 
 	/* Priming read from the field */
 
-	status = acpi_ex_field_datum_io (obj_desc, field_offset, &raw_datum, ACPI_READ);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum,
+				   ACPI_READ);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
-	merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset;
+	merged_datum =
+	    raw_datum >> obj_desc->common_field.start_field_bit_offset;
 
 	/* Read the rest of the field */
 
@@ -715,17 +713,17 @@ acpi_ex_extract_from_field (
 		/* Get next input datum from the field */
 
 		field_offset += obj_desc->common_field.access_byte_width;
-		status = acpi_ex_field_datum_io (obj_desc, field_offset,
-				  &raw_datum, ACPI_READ);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ex_field_datum_io(obj_desc, field_offset,
+						&raw_datum, ACPI_READ);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/* Merge with previous datum if necessary */
 
 		merged_datum |= raw_datum <<
-			(obj_desc->common_field.access_bit_width -
-				obj_desc->common_field.start_field_bit_offset);
+		    (obj_desc->common_field.access_bit_width -
+		     obj_desc->common_field.start_field_bit_offset);
 
 		if (i == datum_count) {
 			break;
@@ -733,32 +731,32 @@ acpi_ex_extract_from_field (
 
 		/* Write merged datum to target buffer */
 
-		ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum,
-			ACPI_MIN(obj_desc->common_field.access_byte_width,
-					 buffer_length - buffer_offset));
+		ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
+			    ACPI_MIN(obj_desc->common_field.access_byte_width,
+				     buffer_length - buffer_offset));
 
 		buffer_offset += obj_desc->common_field.access_byte_width;
-		merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset;
+		merged_datum =
+		    raw_datum >> obj_desc->common_field.start_field_bit_offset;
 	}
 
 	/* Mask off any extra bits in the last datum */
 
 	buffer_tail_bits = obj_desc->common_field.bit_length %
-			   obj_desc->common_field.access_bit_width;
+	    obj_desc->common_field.access_bit_width;
 	if (buffer_tail_bits) {
-		merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
+		merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits);
 	}
 
 	/* Write the last datum to the buffer */
 
-	ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum,
-		ACPI_MIN(obj_desc->common_field.access_byte_width,
-				 buffer_length - buffer_offset));
+	ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
+		    ACPI_MIN(obj_desc->common_field.access_byte_width,
+			     buffer_length - buffer_offset));
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_insert_into_field
@@ -774,53 +772,54 @@ acpi_ex_extract_from_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_insert_into_field (
-	union acpi_operand_object       *obj_desc,
-	void                            *buffer,
-	u32                             buffer_length)
+acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
+			  void *buffer, u32 buffer_length)
 {
-	acpi_status                     status;
-	acpi_integer                    mask;
-	acpi_integer                    merged_datum;
-	acpi_integer                    raw_datum = 0;
-	u32                             field_offset = 0;
-	u32                             buffer_offset = 0;
-	u32                             buffer_tail_bits;
-	u32                             datum_count;
-	u32                             field_datum_count;
-	u32                             i;
-
-
-	ACPI_FUNCTION_TRACE ("ex_insert_into_field");
-
+	acpi_status status;
+	acpi_integer mask;
+	acpi_integer merged_datum;
+	acpi_integer raw_datum = 0;
+	u32 field_offset = 0;
+	u32 buffer_offset = 0;
+	u32 buffer_tail_bits;
+	u32 datum_count;
+	u32 field_datum_count;
+	u32 i;
+
+	ACPI_FUNCTION_TRACE("ex_insert_into_field");
 
 	/* Validate input buffer */
 
-	if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES (
-			 obj_desc->common_field.bit_length)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Field size %X (bits) is too large for buffer (%X)\n",
-			obj_desc->common_field.bit_length, buffer_length));
+	if (buffer_length <
+	    ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Field size %X (bits) is too large for buffer (%X)\n",
+				  obj_desc->common_field.bit_length,
+				  buffer_length));
 
-		return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+		return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
 	}
 
 	/* Compute the number of datums (access width data items) */
 
-	mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset);
-	datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length,
-			  obj_desc->common_field.access_bit_width);
-	field_datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length +
-			   obj_desc->common_field.start_field_bit_offset,
-			   obj_desc->common_field.access_bit_width);
+	mask =
+	    ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
+	datum_count =
+	    ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
+			     obj_desc->common_field.access_bit_width);
+	field_datum_count =
+	    ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
+			     obj_desc->common_field.start_field_bit_offset,
+			     obj_desc->common_field.access_bit_width);
 
 	/* Get initial Datum from the input buffer */
 
-	ACPI_MEMCPY (&raw_datum, buffer,
-		ACPI_MIN(obj_desc->common_field.access_byte_width,
-				 buffer_length - buffer_offset));
+	ACPI_MEMCPY(&raw_datum, buffer,
+		    ACPI_MIN(obj_desc->common_field.access_byte_width,
+			     buffer_length - buffer_offset));
 
-	merged_datum = raw_datum << obj_desc->common_field.start_field_bit_offset;
+	merged_datum =
+	    raw_datum << obj_desc->common_field.start_field_bit_offset;
 
 	/* Write the entire field */
 
@@ -828,18 +827,19 @@ acpi_ex_insert_into_field (
 		/* Write merged datum to the target field */
 
 		merged_datum &= mask;
-		status = acpi_ex_write_with_update_rule (obj_desc, mask,
-				 merged_datum, field_offset);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ex_write_with_update_rule(obj_desc, mask,
+							merged_datum,
+							field_offset);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/* Start new output datum by merging with previous input datum */
 
 		field_offset += obj_desc->common_field.access_byte_width;
 		merged_datum = raw_datum >>
-			(obj_desc->common_field.access_bit_width -
-				obj_desc->common_field.start_field_bit_offset);
+		    (obj_desc->common_field.access_bit_width -
+		     obj_desc->common_field.start_field_bit_offset);
 		mask = ACPI_INTEGER_MAX;
 
 		if (i == datum_count) {
@@ -849,28 +849,28 @@ acpi_ex_insert_into_field (
 		/* Get the next input datum from the buffer */
 
 		buffer_offset += obj_desc->common_field.access_byte_width;
-		ACPI_MEMCPY (&raw_datum, ((char *) buffer) + buffer_offset,
-			ACPI_MIN(obj_desc->common_field.access_byte_width,
-					 buffer_length - buffer_offset));
-		merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset;
+		ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset,
+			    ACPI_MIN(obj_desc->common_field.access_byte_width,
+				     buffer_length - buffer_offset));
+		merged_datum |=
+		    raw_datum << obj_desc->common_field.start_field_bit_offset;
 	}
 
 	/* Mask off any extra bits in the last datum */
 
 	buffer_tail_bits = (obj_desc->common_field.bit_length +
-			obj_desc->common_field.start_field_bit_offset) %
-				obj_desc->common_field.access_bit_width;
+			    obj_desc->common_field.start_field_bit_offset) %
+	    obj_desc->common_field.access_bit_width;
 	if (buffer_tail_bits) {
-		mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
+		mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits);
 	}
 
 	/* Write the last datum to the field */
 
 	merged_datum &= mask;
-	status = acpi_ex_write_with_update_rule (obj_desc,
-			 mask, merged_datum, field_offset);
+	status = acpi_ex_write_with_update_rule(obj_desc,
+						mask, merged_datum,
+						field_offset);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 158 - 200
drivers/acpi/executer/exmisc.c

@@ -42,15 +42,12 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exmisc")
-
+ACPI_MODULE_NAME("exmisc")
 
 /*******************************************************************************
  *
@@ -66,27 +63,23 @@
  *              Common code for the ref_of_op and the cond_ref_of_op.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_get_object_reference (
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       **return_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
+			     union acpi_operand_object **return_desc,
+			     struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *reference_obj;
-	union acpi_operand_object       *referenced_obj;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_get_object_reference", obj_desc);
+	union acpi_operand_object *reference_obj;
+	union acpi_operand_object *referenced_obj;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc);
 
 	*return_desc = NULL;
 
-	switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+	switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
 	case ACPI_DESC_TYPE_OPERAND:
 
-		if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		/*
@@ -104,13 +97,11 @@ acpi_ex_get_object_reference (
 
 		default:
 
-			ACPI_REPORT_ERROR (("Unknown Reference opcode in get_reference %X\n",
-				obj_desc->reference.opcode));
-			return_ACPI_STATUS (AE_AML_INTERNAL);
+			ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode));
+			return_ACPI_STATUS(AE_AML_INTERNAL);
 		}
 		break;
 
-
 	case ACPI_DESC_TYPE_NAMED:
 
 		/*
@@ -119,34 +110,32 @@ acpi_ex_get_object_reference (
 		referenced_obj = obj_desc;
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("Invalid descriptor type in get_reference: %X\n",
-				ACPI_GET_DESCRIPTOR_TYPE (obj_desc)));
-		return_ACPI_STATUS (AE_TYPE);
+		ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc)));
+		return_ACPI_STATUS(AE_TYPE);
 	}
 
-
 	/* Create a new reference object */
 
-	reference_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
+	reference_obj =
+	    acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
 	if (!reference_obj) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	reference_obj->reference.opcode = AML_REF_OF_OP;
 	reference_obj->reference.object = referenced_obj;
 	*return_desc = reference_obj;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-		"Object %p Type [%s], returning Reference %p\n",
-		obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "Object %p Type [%s], returning Reference %p\n",
+			  obj_desc, acpi_ut_get_object_type_name(obj_desc),
+			  *return_desc));
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_concat_template
@@ -163,63 +152,58 @@ acpi_ex_get_object_reference (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_concat_template (
-	union acpi_operand_object       *operand0,
-	union acpi_operand_object       *operand1,
-	union acpi_operand_object       **actual_return_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_concat_template(union acpi_operand_object *operand0,
+			union acpi_operand_object *operand1,
+			union acpi_operand_object **actual_return_desc,
+			struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *return_desc;
-	u8                              *new_buf;
-	u8                              *end_tag1;
-	u8                              *end_tag2;
-	acpi_size                       length1;
-	acpi_size                       length2;
-
-
-	ACPI_FUNCTION_TRACE ("ex_concat_template");
+	union acpi_operand_object *return_desc;
+	u8 *new_buf;
+	u8 *end_tag1;
+	u8 *end_tag2;
+	acpi_size length1;
+	acpi_size length2;
 
+	ACPI_FUNCTION_TRACE("ex_concat_template");
 
 	/* Find the end_tags in each resource template */
 
-	end_tag1 = acpi_ut_get_resource_end_tag (operand0);
-	end_tag2 = acpi_ut_get_resource_end_tag (operand1);
+	end_tag1 = acpi_ut_get_resource_end_tag(operand0);
+	end_tag2 = acpi_ut_get_resource_end_tag(operand1);
 	if (!end_tag1 || !end_tag2) {
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 	}
 
 	/* Compute the length of each part */
 
-	length1 = ACPI_PTR_DIFF (end_tag1, operand0->buffer.pointer);
-	length2 = ACPI_PTR_DIFF (end_tag2, operand1->buffer.pointer) +
-			  2; /* Size of END_TAG */
+	length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer);
+	length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2;	/* Size of END_TAG */
 
 	/* Create a new buffer object for the result */
 
-	return_desc = acpi_ut_create_buffer_object (length1 + length2);
+	return_desc = acpi_ut_create_buffer_object(length1 + length2);
 	if (!return_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Copy the templates to the new descriptor */
 
 	new_buf = return_desc->buffer.pointer;
-	ACPI_MEMCPY (new_buf, operand0->buffer.pointer, length1);
-	ACPI_MEMCPY (new_buf + length1, operand1->buffer.pointer, length2);
+	ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1);
+	ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2);
 
 	/* Compute the new checksum */
 
 	new_buf[return_desc->buffer.length - 1] =
-			acpi_ut_generate_checksum (return_desc->buffer.pointer,
-					   (return_desc->buffer.length - 1));
+	    acpi_ut_generate_checksum(return_desc->buffer.pointer,
+				      (return_desc->buffer.length - 1));
 
 	/* Return the completed template descriptor */
 
 	*actual_return_desc = return_desc;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_concatenate
@@ -236,21 +220,18 @@ acpi_ex_concat_template (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_concatenate (
-	union acpi_operand_object       *operand0,
-	union acpi_operand_object       *operand1,
-	union acpi_operand_object       **actual_return_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_do_concatenate(union acpi_operand_object *operand0,
+		       union acpi_operand_object *operand1,
+		       union acpi_operand_object **actual_return_desc,
+		       struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *local_operand1 = operand1;
-	union acpi_operand_object       *return_desc;
-	char                            *new_buf;
-	acpi_status                     status;
-	acpi_size                       new_length;
-
-
-	ACPI_FUNCTION_TRACE ("ex_do_concatenate");
+	union acpi_operand_object *local_operand1 = operand1;
+	union acpi_operand_object *return_desc;
+	char *new_buf;
+	acpi_status status;
+	acpi_size new_length;
 
+	ACPI_FUNCTION_TRACE("ex_do_concatenate");
 
 	/*
 	 * Convert the second operand if necessary.  The first operand
@@ -259,27 +240,28 @@ acpi_ex_do_concatenate (
 	 * guaranteed to be either Integer/String/Buffer by the operand
 	 * resolution mechanism.
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+	switch (ACPI_GET_OBJECT_TYPE(operand0)) {
 	case ACPI_TYPE_INTEGER:
-		status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
+		status =
+		    acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
 		break;
 
 	case ACPI_TYPE_STRING:
-		status = acpi_ex_convert_to_string (operand1, &local_operand1,
-				 ACPI_IMPLICIT_CONVERT_HEX);
+		status = acpi_ex_convert_to_string(operand1, &local_operand1,
+						   ACPI_IMPLICIT_CONVERT_HEX);
 		break;
 
 	case ACPI_TYPE_BUFFER:
-		status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
+		status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
 		break;
 
 	default:
-		ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",
-				ACPI_GET_OBJECT_TYPE (operand0)));
+		ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n",
+				   ACPI_GET_OBJECT_TYPE(operand0)));
 		status = AE_AML_INTERNAL;
 	}
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
@@ -296,32 +278,33 @@ acpi_ex_do_concatenate (
 	 * 2) Two Strings concatenated to produce a new String
 	 * 3) Two Buffers concatenated to produce a new Buffer
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+	switch (ACPI_GET_OBJECT_TYPE(operand0)) {
 	case ACPI_TYPE_INTEGER:
 
 		/* Result of two Integers is a Buffer */
 		/* Need enough buffer space for two integers */
 
-		return_desc = acpi_ut_create_buffer_object ((acpi_size)
-				   ACPI_MUL_2 (acpi_gbl_integer_byte_width));
+		return_desc = acpi_ut_create_buffer_object((acpi_size)
+							   ACPI_MUL_2
+							   (acpi_gbl_integer_byte_width));
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		new_buf = (char *) return_desc->buffer.pointer;
+		new_buf = (char *)return_desc->buffer.pointer;
 
 		/* Copy the first integer, LSB first */
 
-		ACPI_MEMCPY (new_buf,
-				  &operand0->integer.value,
-				  acpi_gbl_integer_byte_width);
+		ACPI_MEMCPY(new_buf,
+			    &operand0->integer.value,
+			    acpi_gbl_integer_byte_width);
 
 		/* Copy the second integer (LSB first) after the first */
 
-		ACPI_MEMCPY (new_buf + acpi_gbl_integer_byte_width,
-				  &local_operand1->integer.value,
-				  acpi_gbl_integer_byte_width);
+		ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width,
+			    &local_operand1->integer.value,
+			    acpi_gbl_integer_byte_width);
 		break;
 
 	case ACPI_TYPE_STRING:
@@ -329,13 +312,13 @@ acpi_ex_do_concatenate (
 		/* Result of two Strings is a String */
 
 		new_length = (acpi_size) operand0->string.length +
-				 (acpi_size) local_operand1->string.length;
+		    (acpi_size) local_operand1->string.length;
 		if (new_length > ACPI_MAX_STRING_CONVERSION) {
 			status = AE_AML_STRING_LIMIT;
 			goto cleanup;
 		}
 
-		return_desc = acpi_ut_create_string_object (new_length);
+		return_desc = acpi_ut_create_string_object(new_length);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
@@ -345,56 +328,56 @@ acpi_ex_do_concatenate (
 
 		/* Concatenate the strings */
 
-		ACPI_STRCPY (new_buf,
-				  operand0->string.pointer);
-		ACPI_STRCPY (new_buf + operand0->string.length,
-				  local_operand1->string.pointer);
+		ACPI_STRCPY(new_buf, operand0->string.pointer);
+		ACPI_STRCPY(new_buf + operand0->string.length,
+			    local_operand1->string.pointer);
 		break;
 
 	case ACPI_TYPE_BUFFER:
 
 		/* Result of two Buffers is a Buffer */
 
-		return_desc = acpi_ut_create_buffer_object (
-				   (acpi_size) operand0->buffer.length +
-				   (acpi_size) local_operand1->buffer.length);
+		return_desc = acpi_ut_create_buffer_object((acpi_size)
+							   operand0->buffer.
+							   length +
+							   (acpi_size)
+							   local_operand1->
+							   buffer.length);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		new_buf = (char *) return_desc->buffer.pointer;
+		new_buf = (char *)return_desc->buffer.pointer;
 
 		/* Concatenate the buffers */
 
-		ACPI_MEMCPY (new_buf,
-				  operand0->buffer.pointer,
-				  operand0->buffer.length);
-		ACPI_MEMCPY (new_buf + operand0->buffer.length,
-				  local_operand1->buffer.pointer,
-				  local_operand1->buffer.length);
+		ACPI_MEMCPY(new_buf,
+			    operand0->buffer.pointer, operand0->buffer.length);
+		ACPI_MEMCPY(new_buf + operand0->buffer.length,
+			    local_operand1->buffer.pointer,
+			    local_operand1->buffer.length);
 		break;
 
 	default:
 
 		/* Invalid object type, should not happen here */
 
-		ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n",
-				ACPI_GET_OBJECT_TYPE (operand0)));
-		status =AE_AML_INTERNAL;
+		ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n",
+				   ACPI_GET_OBJECT_TYPE(operand0)));
+		status = AE_AML_INTERNAL;
 		goto cleanup;
 	}
 
 	*actual_return_desc = return_desc;
 
-cleanup:
+      cleanup:
 	if (local_operand1 != operand1) {
-		acpi_ut_remove_reference (local_operand1);
+		acpi_ut_remove_reference(local_operand1);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_math_op
@@ -412,62 +395,49 @@ cleanup:
  ******************************************************************************/
 
 acpi_integer
-acpi_ex_do_math_op (
-	u16                             opcode,
-	acpi_integer                    integer0,
-	acpi_integer                    integer1)
+acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
 {
 
-	ACPI_FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY();
 
 	switch (opcode) {
-	case AML_ADD_OP:                /* Add (Integer0, Integer1, Result) */
+	case AML_ADD_OP:	/* Add (Integer0, Integer1, Result) */
 
 		return (integer0 + integer1);
 
-
-	case AML_BIT_AND_OP:            /* And (Integer0, Integer1, Result) */
+	case AML_BIT_AND_OP:	/* And (Integer0, Integer1, Result) */
 
 		return (integer0 & integer1);
 
-
-	case AML_BIT_NAND_OP:           /* NAnd (Integer0, Integer1, Result) */
+	case AML_BIT_NAND_OP:	/* NAnd (Integer0, Integer1, Result) */
 
 		return (~(integer0 & integer1));
 
-
-	case AML_BIT_OR_OP:             /* Or (Integer0, Integer1, Result) */
+	case AML_BIT_OR_OP:	/* Or (Integer0, Integer1, Result) */
 
 		return (integer0 | integer1);
 
-
-	case AML_BIT_NOR_OP:            /* NOr (Integer0, Integer1, Result) */
+	case AML_BIT_NOR_OP:	/* NOr (Integer0, Integer1, Result) */
 
 		return (~(integer0 | integer1));
 
-
-	case AML_BIT_XOR_OP:            /* XOr (Integer0, Integer1, Result) */
+	case AML_BIT_XOR_OP:	/* XOr (Integer0, Integer1, Result) */
 
 		return (integer0 ^ integer1);
 
-
-	case AML_MULTIPLY_OP:           /* Multiply (Integer0, Integer1, Result) */
+	case AML_MULTIPLY_OP:	/* Multiply (Integer0, Integer1, Result) */
 
 		return (integer0 * integer1);
 
-
-	case AML_SHIFT_LEFT_OP:         /* shift_left (Operand, shift_count, Result)*/
+	case AML_SHIFT_LEFT_OP:	/* shift_left (Operand, shift_count, Result) */
 
 		return (integer0 << integer1);
 
-
-	case AML_SHIFT_RIGHT_OP:        /* shift_right (Operand, shift_count, Result) */
+	case AML_SHIFT_RIGHT_OP:	/* shift_right (Operand, shift_count, Result) */
 
 		return (integer0 >> integer1);
 
-
-	case AML_SUBTRACT_OP:           /* Subtract (Integer0, Integer1, Result) */
+	case AML_SUBTRACT_OP:	/* Subtract (Integer0, Integer1, Result) */
 
 		return (integer0 - integer1);
 
@@ -477,7 +447,6 @@ acpi_ex_do_math_op (
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_logical_numeric_op
@@ -499,28 +468,24 @@ acpi_ex_do_math_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_logical_numeric_op (
-	u16                             opcode,
-	acpi_integer                    integer0,
-	acpi_integer                    integer1,
-	u8                              *logical_result)
+acpi_ex_do_logical_numeric_op(u16 opcode,
+			      acpi_integer integer0,
+			      acpi_integer integer1, u8 * logical_result)
 {
-	acpi_status                     status = AE_OK;
-	u8                              local_result = FALSE;
-
-
-	ACPI_FUNCTION_TRACE ("ex_do_logical_numeric_op");
+	acpi_status status = AE_OK;
+	u8 local_result = FALSE;
 
+	ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op");
 
 	switch (opcode) {
-	case AML_LAND_OP:               /* LAnd (Integer0, Integer1) */
+	case AML_LAND_OP:	/* LAnd (Integer0, Integer1) */
 
 		if (integer0 && integer1) {
 			local_result = TRUE;
 		}
 		break;
 
-	case AML_LOR_OP:                /* LOr (Integer0, Integer1) */
+	case AML_LOR_OP:	/* LOr (Integer0, Integer1) */
 
 		if (integer0 || integer1) {
 			local_result = TRUE;
@@ -535,10 +500,9 @@ acpi_ex_do_logical_numeric_op (
 	/* Return the logical result and status */
 
 	*logical_result = local_result;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_logical_op
@@ -566,24 +530,20 @@ acpi_ex_do_logical_numeric_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_logical_op (
-	u16                             opcode,
-	union acpi_operand_object       *operand0,
-	union acpi_operand_object       *operand1,
-	u8                              *logical_result)
+acpi_ex_do_logical_op(u16 opcode,
+		      union acpi_operand_object *operand0,
+		      union acpi_operand_object *operand1, u8 * logical_result)
 {
-	union acpi_operand_object       *local_operand1 = operand1;
-	acpi_integer                    integer0;
-	acpi_integer                    integer1;
-	u32                             length0;
-	u32                             length1;
-	acpi_status                     status = AE_OK;
-	u8                              local_result = FALSE;
-	int                             compare;
-
-
-	ACPI_FUNCTION_TRACE ("ex_do_logical_op");
+	union acpi_operand_object *local_operand1 = operand1;
+	acpi_integer integer0;
+	acpi_integer integer1;
+	u32 length0;
+	u32 length1;
+	acpi_status status = AE_OK;
+	u8 local_result = FALSE;
+	int compare;
 
+	ACPI_FUNCTION_TRACE("ex_do_logical_op");
 
 	/*
 	 * Convert the second operand if necessary.  The first operand
@@ -592,18 +552,19 @@ acpi_ex_do_logical_op (
 	 * guaranteed to be either Integer/String/Buffer by the operand
 	 * resolution mechanism.
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+	switch (ACPI_GET_OBJECT_TYPE(operand0)) {
 	case ACPI_TYPE_INTEGER:
-		status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
+		status =
+		    acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
 		break;
 
 	case ACPI_TYPE_STRING:
-		status = acpi_ex_convert_to_string (operand1, &local_operand1,
-				 ACPI_IMPLICIT_CONVERT_HEX);
+		status = acpi_ex_convert_to_string(operand1, &local_operand1,
+						   ACPI_IMPLICIT_CONVERT_HEX);
 		break;
 
 	case ACPI_TYPE_BUFFER:
-		status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
+		status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
 		break;
 
 	default:
@@ -611,14 +572,14 @@ acpi_ex_do_logical_op (
 		break;
 	}
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/*
 	 * Two cases: 1) Both Integers, 2) Both Strings or Buffers
 	 */
-	if (ACPI_GET_OBJECT_TYPE (operand0) == ACPI_TYPE_INTEGER) {
+	if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) {
 		/*
 		 * 1) Both operands are of type integer
 		 *    Note: local_operand1 may have changed above
@@ -627,21 +588,21 @@ acpi_ex_do_logical_op (
 		integer1 = local_operand1->integer.value;
 
 		switch (opcode) {
-		case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+		case AML_LEQUAL_OP:	/* LEqual (Operand0, Operand1) */
 
 			if (integer0 == integer1) {
 				local_result = TRUE;
 			}
 			break;
 
-		case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+		case AML_LGREATER_OP:	/* LGreater (Operand0, Operand1) */
 
 			if (integer0 > integer1) {
 				local_result = TRUE;
 			}
 			break;
 
-		case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+		case AML_LLESS_OP:	/* LLess (Operand0, Operand1) */
 
 			if (integer0 < integer1) {
 				local_result = TRUE;
@@ -652,8 +613,7 @@ acpi_ex_do_logical_op (
 			status = AE_AML_INTERNAL;
 			break;
 		}
-	}
-	else {
+	} else {
 		/*
 		 * 2) Both operands are Strings or both are Buffers
 		 *    Note: Code below takes advantage of common Buffer/String
@@ -665,31 +625,31 @@ acpi_ex_do_logical_op (
 
 		/* Lexicographic compare: compare the data bytes */
 
-		compare = ACPI_MEMCMP ((const char * ) operand0->buffer.pointer,
-				 (const char * ) local_operand1->buffer.pointer,
-				 (length0 > length1) ? length1 : length0);
+		compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer,
+				      (const char *)local_operand1->buffer.
+				      pointer,
+				      (length0 > length1) ? length1 : length0);
 
 		switch (opcode) {
-		case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+		case AML_LEQUAL_OP:	/* LEqual (Operand0, Operand1) */
 
 			/* Length and all bytes must be equal */
 
-			if ((length0 == length1) &&
-				(compare == 0)) {
+			if ((length0 == length1) && (compare == 0)) {
 				/* Length and all bytes match ==> TRUE */
 
 				local_result = TRUE;
 			}
 			break;
 
-		case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+		case AML_LGREATER_OP:	/* LGreater (Operand0, Operand1) */
 
 			if (compare > 0) {
 				local_result = TRUE;
-				goto cleanup;   /* TRUE */
+				goto cleanup;	/* TRUE */
 			}
 			if (compare < 0) {
-				goto cleanup;   /* FALSE */
+				goto cleanup;	/* FALSE */
 			}
 
 			/* Bytes match (to shortest length), compare lengths */
@@ -699,14 +659,14 @@ acpi_ex_do_logical_op (
 			}
 			break;
 
-		case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+		case AML_LLESS_OP:	/* LLess (Operand0, Operand1) */
 
 			if (compare > 0) {
-				goto cleanup;   /* FALSE */
+				goto cleanup;	/* FALSE */
 			}
 			if (compare < 0) {
 				local_result = TRUE;
-				goto cleanup;   /* TRUE */
+				goto cleanup;	/* TRUE */
 			}
 
 			/* Bytes match (to shortest length), compare lengths */
@@ -722,18 +682,16 @@ acpi_ex_do_logical_op (
 		}
 	}
 
-cleanup:
+      cleanup:
 
 	/* New object was created if implicit conversion performed - delete */
 
 	if (local_operand1 != operand1) {
-		acpi_ut_remove_reference (local_operand1);
+		acpi_ut_remove_reference(local_operand1);
 	}
 
 	/* Return the logical result and status */
 
 	*logical_result = local_result;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 63 - 97
drivers/acpi/executer/exmutex.c

@@ -42,20 +42,16 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exmutex")
+ACPI_MODULE_NAME("exmutex")
 
 /* Local prototypes */
-
 static void
-acpi_ex_link_mutex (
-	union acpi_operand_object       *obj_desc,
-	struct acpi_thread_state        *thread);
-
+acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
+		   struct acpi_thread_state *thread);
 
 /*******************************************************************************
  *
@@ -69,12 +65,9 @@ acpi_ex_link_mutex (
  *
  ******************************************************************************/
 
-void
-acpi_ex_unlink_mutex (
-	union acpi_operand_object       *obj_desc)
+void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc)
 {
-	struct acpi_thread_state        *thread = obj_desc->mutex.owner_thread;
-
+	struct acpi_thread_state *thread = obj_desc->mutex.owner_thread;
 
 	if (!thread) {
 		return;
@@ -88,13 +81,11 @@ acpi_ex_unlink_mutex (
 
 	if (obj_desc->mutex.prev) {
 		(obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next;
-	}
-	else {
+	} else {
 		thread->acquired_mutex_list = obj_desc->mutex.next;
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_link_mutex
@@ -109,12 +100,10 @@ acpi_ex_unlink_mutex (
  ******************************************************************************/
 
 static void
-acpi_ex_link_mutex (
-	union acpi_operand_object       *obj_desc,
-	struct acpi_thread_state        *thread)
+acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
+		   struct acpi_thread_state *thread)
 {
-	union acpi_operand_object       *list_head;
-
+	union acpi_operand_object *list_head;
 
 	list_head = thread->acquired_mutex_list;
 
@@ -134,7 +123,6 @@ acpi_ex_link_mutex (
 	thread->acquired_mutex_list = obj_desc;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_acquire_mutex
@@ -150,27 +138,23 @@ acpi_ex_link_mutex (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_acquire_mutex (
-	union acpi_operand_object       *time_desc,
-	union acpi_operand_object       *obj_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
+		      union acpi_operand_object *obj_desc,
+		      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_acquire_mutex", obj_desc);
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc);
 
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Sanity check -- we must have a valid thread ID */
 
 	if (!walk_state->thread) {
-		ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
-			acpi_ut_get_node_name (obj_desc->mutex.node)));
-		return_ACPI_STATUS (AE_AML_INTERNAL);
+		ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+		return_ACPI_STATUS(AE_AML_INTERNAL);
 	}
 
 	/*
@@ -178,10 +162,8 @@ acpi_ex_acquire_mutex (
 	 * mutex.  This mechanism provides some deadlock prevention
 	 */
 	if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
-		ACPI_REPORT_ERROR ((
-			"Cannot acquire Mutex [%4.4s], incorrect sync_level\n",
-			acpi_ut_get_node_name (obj_desc->mutex.node)));
-		return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+		ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+		return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
 	}
 
 	/* Support for multiple acquires by the owning thread */
@@ -190,43 +172,43 @@ acpi_ex_acquire_mutex (
 		/* Special case for Global Lock, allow all threads */
 
 		if ((obj_desc->mutex.owner_thread->thread_id ==
-				walk_state->thread->thread_id)      ||
-			(obj_desc->mutex.semaphore ==
-				acpi_gbl_global_lock_semaphore)) {
+		     walk_state->thread->thread_id) ||
+		    (obj_desc->mutex.semaphore ==
+		     acpi_gbl_global_lock_semaphore)) {
 			/*
 			 * The mutex is already owned by this thread,
 			 * just increment the acquisition depth
 			 */
 			obj_desc->mutex.acquisition_depth++;
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 	}
 
 	/* Acquire the mutex, wait if necessary */
 
-	status = acpi_ex_system_acquire_mutex (time_desc, obj_desc);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
+	if (ACPI_FAILURE(status)) {
 		/* Includes failure from a timeout on time_desc */
 
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Have the mutex: update mutex and walk info and save the sync_level */
 
-	obj_desc->mutex.owner_thread     = walk_state->thread;
+	obj_desc->mutex.owner_thread = walk_state->thread;
 	obj_desc->mutex.acquisition_depth = 1;
-	obj_desc->mutex.original_sync_level = walk_state->thread->current_sync_level;
+	obj_desc->mutex.original_sync_level =
+	    walk_state->thread->current_sync_level;
 
 	walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
 
 	/* Link the mutex to the current thread for force-unlock at method exit */
 
-	acpi_ex_link_mutex (obj_desc, walk_state->thread);
+	acpi_ex_link_mutex(obj_desc, walk_state->thread);
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_release_mutex
@@ -241,48 +223,40 @@ acpi_ex_acquire_mutex (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_release_mutex (
-	union acpi_operand_object       *obj_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
+		      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ex_release_mutex");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ex_release_mutex");
 
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* The mutex must have been previously acquired in order to release it */
 
 	if (!obj_desc->mutex.owner_thread) {
-		ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n",
-				acpi_ut_get_node_name (obj_desc->mutex.node)));
-		return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
+		ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+		return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
 	}
 
 	/* Sanity check -- we must have a valid thread ID */
 
 	if (!walk_state->thread) {
-		ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n",
-				acpi_ut_get_node_name (obj_desc->mutex.node)));
-		return_ACPI_STATUS (AE_AML_INTERNAL);
+		ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+		return_ACPI_STATUS(AE_AML_INTERNAL);
 	}
 
 	/*
 	 * The Mutex is owned, but this thread must be the owner.
 	 * Special case for Global Lock, any thread can release
 	 */
-	if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) &&
-		(obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) {
-		ACPI_REPORT_ERROR ((
-			"Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
-			walk_state->thread->thread_id,
-			acpi_ut_get_node_name (obj_desc->mutex.node),
-			obj_desc->mutex.owner_thread->thread_id));
-		return_ACPI_STATUS (AE_AML_NOT_OWNER);
+	if ((obj_desc->mutex.owner_thread->thread_id !=
+	     walk_state->thread->thread_id)
+	    && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) {
+		ACPI_REPORT_ERROR(("Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", walk_state->thread->thread_id, acpi_ut_get_node_name(obj_desc->mutex.node), obj_desc->mutex.owner_thread->thread_id));
+		return_ACPI_STATUS(AE_AML_NOT_OWNER);
 	}
 
 	/*
@@ -290,10 +264,8 @@ acpi_ex_release_mutex (
 	 * equal to the current sync level
 	 */
 	if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
-		ACPI_REPORT_ERROR ((
-			"Cannot release Mutex [%4.4s], incorrect sync_level\n",
-			acpi_ut_get_node_name (obj_desc->mutex.node)));
-		return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+		ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+		return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
 	}
 
 	/* Match multiple Acquires with multiple Releases */
@@ -302,26 +274,26 @@ acpi_ex_release_mutex (
 	if (obj_desc->mutex.acquisition_depth != 0) {
 		/* Just decrement the depth and return */
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Unlink the mutex from the owner's list */
 
-	acpi_ex_unlink_mutex (obj_desc);
+	acpi_ex_unlink_mutex(obj_desc);
 
 	/* Release the mutex */
 
-	status = acpi_ex_system_release_mutex (obj_desc);
+	status = acpi_ex_system_release_mutex(obj_desc);
 
 	/* Update the mutex and walk state, restore sync_level before acquire */
 
 	obj_desc->mutex.owner_thread = NULL;
-	walk_state->thread->current_sync_level = obj_desc->mutex.original_sync_level;
+	walk_state->thread->current_sync_level =
+	    obj_desc->mutex.original_sync_level;
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_release_all_mutexes
@@ -334,17 +306,13 @@ acpi_ex_release_mutex (
  *
  ******************************************************************************/
 
-void
-acpi_ex_release_all_mutexes (
-	struct acpi_thread_state        *thread)
+void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
 {
-	union acpi_operand_object       *next = thread->acquired_mutex_list;
-	union acpi_operand_object       *this;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_operand_object *next = thread->acquired_mutex_list;
+	union acpi_operand_object *this;
+	acpi_status status;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/* Traverse the list of owned mutexes, releasing each one */
 
@@ -353,13 +321,13 @@ acpi_ex_release_all_mutexes (
 		next = this->mutex.next;
 
 		this->mutex.acquisition_depth = 1;
-		this->mutex.prev             = NULL;
-		this->mutex.next             = NULL;
+		this->mutex.prev = NULL;
+		this->mutex.next = NULL;
 
-		 /* Release the mutex */
+		/* Release the mutex */
 
-		status = acpi_ex_system_release_mutex (this);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ex_system_release_mutex(this);
+		if (ACPI_FAILURE(status)) {
 			continue;
 		}
 
@@ -372,5 +340,3 @@ acpi_ex_release_all_mutexes (
 		thread->current_sync_level = this->mutex.original_sync_level;
 	}
 }
-
-

+ 106 - 129
drivers/acpi/executer/exnames.c

@@ -42,26 +42,18 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exnames")
+ACPI_MODULE_NAME("exnames")
 
 /* Local prototypes */
-
-static char *
-acpi_ex_allocate_name_string (
-	u32                             prefix_count,
-	u32                             num_name_segs);
+static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs);
 
 static acpi_status
-acpi_ex_name_segment (
-	u8                              **in_aml_address,
-	char                            *name_string);
-
+acpi_ex_name_segment(u8 ** in_aml_address, char *name_string);
 
 /*******************************************************************************
  *
@@ -79,17 +71,13 @@ acpi_ex_name_segment (
  *
  ******************************************************************************/
 
-static char *
-acpi_ex_allocate_name_string (
-	u32                             prefix_count,
-	u32                             num_name_segs)
+static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
 {
-	char                            *temp_ptr;
-	char                            *name_string;
-	u32                              size_needed;
-
-	ACPI_FUNCTION_TRACE ("ex_allocate_name_string");
+	char *temp_ptr;
+	char *name_string;
+	u32 size_needed;
 
+	ACPI_FUNCTION_TRACE("ex_allocate_name_string");
 
 	/*
 	 * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
@@ -100,20 +88,19 @@ acpi_ex_allocate_name_string (
 		/* Special case for root */
 
 		size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
-	}
-	else {
-		size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
+	} else {
+		size_needed =
+		    prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
 	}
 
 	/*
 	 * Allocate a buffer for the name.
 	 * This buffer must be deleted by the caller!
 	 */
-	name_string = ACPI_MEM_ALLOCATE (size_needed);
+	name_string = ACPI_MEM_ALLOCATE(size_needed);
 	if (!name_string) {
-		ACPI_REPORT_ERROR ((
-			"ex_allocate_name_string: Could not allocate size %d\n", size_needed));
-		return_PTR (NULL);
+		ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed));
+		return_PTR(NULL);
 	}
 
 	temp_ptr = name_string;
@@ -122,23 +109,20 @@ acpi_ex_allocate_name_string (
 
 	if (prefix_count == ACPI_UINT32_MAX) {
 		*temp_ptr++ = AML_ROOT_PREFIX;
-	}
-	else {
+	} else {
 		while (prefix_count--) {
 			*temp_ptr++ = AML_PARENT_PREFIX;
 		}
 	}
 
-
 	/* Set up Dual or Multi prefixes if needed */
 
 	if (num_name_segs > 2) {
 		/* Set up multi prefixes   */
 
 		*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
-		*temp_ptr++ = (char) num_name_segs;
-	}
-	else if (2 == num_name_segs) {
+		*temp_ptr++ = (char)num_name_segs;
+	} else if (2 == num_name_segs) {
 		/* Set up dual prefixes */
 
 		*temp_ptr++ = AML_DUAL_NAME_PREFIX;
@@ -150,7 +134,7 @@ acpi_ex_allocate_name_string (
 	 */
 	*temp_ptr = 0;
 
-	return_PTR (name_string);
+	return_PTR(name_string);
 }
 
 /*******************************************************************************
@@ -167,19 +151,14 @@ acpi_ex_allocate_name_string (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ex_name_segment (
-	u8                              **in_aml_address,
-	char                            *name_string)
+static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
 {
-	char                            *aml_address = (void *) *in_aml_address;
-	acpi_status                     status = AE_OK;
-	u32                             index;
-	char                            char_buf[5];
-
-
-	ACPI_FUNCTION_TRACE ("ex_name_segment");
+	char *aml_address = (void *)*in_aml_address;
+	acpi_status status = AE_OK;
+	u32 index;
+	char char_buf[5];
 
+	ACPI_FUNCTION_TRACE("ex_name_segment");
 
 	/*
 	 * If first character is a digit, then we know that we aren't looking at a
@@ -188,20 +167,20 @@ acpi_ex_name_segment (
 	char_buf[0] = *aml_address;
 
 	if ('0' <= char_buf[0] && char_buf[0] <= '9') {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", char_buf[0]));
-		return_ACPI_STATUS (AE_CTRL_PENDING);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n",
+				  char_buf[0]));
+		return_ACPI_STATUS(AE_CTRL_PENDING);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n"));
 
 	for (index = 0;
-		(index < ACPI_NAME_SIZE) && (acpi_ut_valid_acpi_character (*aml_address));
-		index++) {
+	     (index < ACPI_NAME_SIZE)
+	     && (acpi_ut_valid_acpi_character(*aml_address)); index++) {
 		char_buf[index] = *aml_address++;
-		ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[index]));
+		ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
 	}
 
-
 	/* Valid name segment  */
 
 	if (index == 4) {
@@ -210,41 +189,37 @@ acpi_ex_name_segment (
 		char_buf[4] = '\0';
 
 		if (name_string) {
-			ACPI_STRCAT (name_string, char_buf);
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Appended to - %s \n", name_string));
+			ACPI_STRCAT(name_string, char_buf);
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Appended to - %s \n", name_string));
+		} else {
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "No Name string - %s \n", char_buf));
 		}
-		else {
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"No Name string - %s \n", char_buf));
-		}
-	}
-	else if (index == 0) {
+	} else if (index == 0) {
 		/*
 		 * First character was not a valid name character,
 		 * so we are looking at something other than a name.
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"Leading character is not alpha: %02Xh (not a name)\n",
-			char_buf[0]));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Leading character is not alpha: %02Xh (not a name)\n",
+				  char_buf[0]));
 		status = AE_CTRL_PENDING;
-	}
-	else {
+	} else {
 		/*
 		 * Segment started with one or more valid characters, but fewer than
 		 * the required 4
 		 */
 		status = AE_AML_BAD_NAME;
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Bad character %02x in name, at %p\n",
-			*aml_address, aml_address));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Bad character %02x in name, at %p\n",
+				  *aml_address, aml_address));
 	}
 
 	*in_aml_address = (u8 *) aml_address;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_get_name_string
@@ -263,37 +238,32 @@ acpi_ex_name_segment (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_get_name_string (
-	acpi_object_type                data_type,
-	u8                              *in_aml_address,
-	char                            **out_name_string,
-	u32                             *out_name_length)
+acpi_ex_get_name_string(acpi_object_type data_type,
+			u8 * in_aml_address,
+			char **out_name_string, u32 * out_name_length)
 {
-	acpi_status                     status = AE_OK;
-	u8                              *aml_address = in_aml_address;
-	char                            *name_string = NULL;
-	u32                             num_segments;
-	u32                             prefix_count = 0;
-	u8                              has_prefix = FALSE;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_get_name_string", aml_address);
-
-
-	if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type  ||
-		ACPI_TYPE_LOCAL_BANK_FIELD == data_type    ||
-		ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
+	acpi_status status = AE_OK;
+	u8 *aml_address = in_aml_address;
+	char *name_string = NULL;
+	u32 num_segments;
+	u32 prefix_count = 0;
+	u8 has_prefix = FALSE;
+
+	ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address);
+
+	if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
+	    ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
+	    ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
 		/* Disallow prefixes for types associated with field_unit names */
 
-		name_string = acpi_ex_allocate_name_string (0, 1);
+		name_string = acpi_ex_allocate_name_string(0, 1);
 		if (!name_string) {
 			status = AE_NO_MEMORY;
+		} else {
+			status =
+			    acpi_ex_name_segment(&aml_address, name_string);
 		}
-		else {
-			status = acpi_ex_name_segment (&aml_address, name_string);
-		}
-	}
-	else {
+	} else {
 		/*
 		 * data_type is not a field name.
 		 * Examine first character of name for root or parent prefix operators
@@ -301,8 +271,9 @@ acpi_ex_get_name_string (
 		switch (*aml_address) {
 		case AML_ROOT_PREFIX:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
-				aml_address));
+			ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+					  "root_prefix(\\) at %p\n",
+					  aml_address));
 
 			/*
 			 * Remember that we have a root_prefix --
@@ -313,14 +284,14 @@ acpi_ex_get_name_string (
 			has_prefix = TRUE;
 			break;
 
-
 		case AML_PARENT_PREFIX:
 
 			/* Increment past possibly multiple parent prefixes */
 
 			do {
-				ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
-					aml_address));
+				ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+						  "parent_prefix (^) at %p\n",
+						  aml_address));
 
 				aml_address++;
 				prefix_count++;
@@ -330,7 +301,6 @@ acpi_ex_get_name_string (
 			has_prefix = TRUE;
 			break;
 
-
 		default:
 
 			/* Not a prefix character */
@@ -343,11 +313,13 @@ acpi_ex_get_name_string (
 		switch (*aml_address) {
 		case AML_DUAL_NAME_PREFIX:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
-				aml_address));
+			ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+					  "dual_name_prefix at %p\n",
+					  aml_address));
 
 			aml_address++;
-			name_string = acpi_ex_allocate_name_string (prefix_count, 2);
+			name_string =
+			    acpi_ex_allocate_name_string(prefix_count, 2);
 			if (!name_string) {
 				status = AE_NO_MEMORY;
 				break;
@@ -357,24 +329,29 @@ acpi_ex_get_name_string (
 
 			has_prefix = TRUE;
 
-			status = acpi_ex_name_segment (&aml_address, name_string);
-			if (ACPI_SUCCESS (status)) {
-				status = acpi_ex_name_segment (&aml_address, name_string);
+			status =
+			    acpi_ex_name_segment(&aml_address, name_string);
+			if (ACPI_SUCCESS(status)) {
+				status =
+				    acpi_ex_name_segment(&aml_address,
+							 name_string);
 			}
 			break;
 
-
 		case AML_MULTI_NAME_PREFIX_OP:
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
-				aml_address));
+			ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+					  "multi_name_prefix at %p\n",
+					  aml_address));
 
 			/* Fetch count of segments remaining in name path */
 
 			aml_address++;
 			num_segments = *aml_address;
 
-			name_string = acpi_ex_allocate_name_string (prefix_count, num_segments);
+			name_string =
+			    acpi_ex_allocate_name_string(prefix_count,
+							 num_segments);
 			if (!name_string) {
 				status = AE_NO_MEMORY;
 				break;
@@ -386,27 +363,28 @@ acpi_ex_get_name_string (
 			has_prefix = TRUE;
 
 			while (num_segments &&
-					(status = acpi_ex_name_segment (&aml_address, name_string)) ==
-						AE_OK) {
+			       (status =
+				acpi_ex_name_segment(&aml_address,
+						     name_string)) == AE_OK) {
 				num_segments--;
 			}
 
 			break;
 
-
 		case 0:
 
 			/* null_name valid as of 8-12-98 ASL/AML Grammar Update */
 
 			if (prefix_count == ACPI_UINT32_MAX) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-					"name_seg is \"\\\" followed by NULL\n"));
+				ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+						  "name_seg is \"\\\" followed by NULL\n"));
 			}
 
 			/* Consume the NULL byte */
 
 			aml_address++;
-			name_string = acpi_ex_allocate_name_string (prefix_count, 0);
+			name_string =
+			    acpi_ex_allocate_name_string(prefix_count, 0);
 			if (!name_string) {
 				status = AE_NO_MEMORY;
 				break;
@@ -414,18 +392,19 @@ acpi_ex_get_name_string (
 
 			break;
 
-
 		default:
 
 			/* Name segment string */
 
-			name_string = acpi_ex_allocate_name_string (prefix_count, 1);
+			name_string =
+			    acpi_ex_allocate_name_string(prefix_count, 1);
 			if (!name_string) {
 				status = AE_NO_MEMORY;
 				break;
 			}
 
-			status = acpi_ex_name_segment (&aml_address, name_string);
+			status =
+			    acpi_ex_name_segment(&aml_address, name_string);
 			break;
 		}
 	}
@@ -433,22 +412,20 @@ acpi_ex_get_name_string (
 	if (AE_CTRL_PENDING == status && has_prefix) {
 		/* Ran out of segments after processing a prefix */
 
-		ACPI_REPORT_ERROR (
-			("ex_do_name: Malformed Name at %p\n", name_string));
+		ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n",
+				   name_string));
 		status = AE_AML_BAD_NAME;
 	}
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		if (name_string) {
-			ACPI_MEM_FREE (name_string);
+			ACPI_MEM_FREE(name_string);
 		}
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
 	*out_name_string = name_string;
 	*out_name_length = (u32) (aml_address - in_aml_address);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 237 - 261
drivers/acpi/executer/exoparg1.c


+ 140 - 177
drivers/acpi/executer/exoparg2.c

@@ -41,17 +41,14 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acinterp.h>
 #include <acpi/acevents.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exoparg2")
-
+ACPI_MODULE_NAME("exoparg2")
 
 /*!
  * Naming convention for AML interpreter execution routines.
@@ -74,8 +71,6 @@
  * The AcpiExOpcode* functions are called via the Dispatcher component with
  * fully resolved operands.
 !*/
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_0T_0R
@@ -90,29 +85,24 @@
  * ALLOCATION:  Deletes both operands
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_opcode_2A_0T_0R (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	struct acpi_namespace_node      *node;
-	u32                             value;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_0R",
-			acpi_ps_get_opcode_name (walk_state->opcode));
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	struct acpi_namespace_node *node;
+	u32 value;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R",
+				acpi_ps_get_opcode_name(walk_state->opcode));
 
 	/* Examine the opcode */
 
 	switch (walk_state->opcode) {
-	case AML_NOTIFY_OP:         /* Notify (notify_object, notify_value) */
+	case AML_NOTIFY_OP:	/* Notify (notify_object, notify_value) */
 
 		/* The first operand is a namespace node */
 
-		node = (struct acpi_namespace_node *) operand[0];
+		node = (struct acpi_namespace_node *)operand[0];
 
 		/* Second value is the notify value */
 
@@ -120,15 +110,14 @@ acpi_ex_opcode_2A_0T_0R (
 
 		/* Are notifies allowed on this object? */
 
-		if (!acpi_ev_is_notify_object (node)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Unexpected notify object type [%s]\n",
-					acpi_ut_get_type_name (node->type)));
+		if (!acpi_ev_is_notify_object(node)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Unexpected notify object type [%s]\n",
+					  acpi_ut_get_type_name(node->type)));
 
 			status = AE_AML_OPERAND_TYPE;
 			break;
 		}
-
 #ifdef ACPI_GPE_NOTIFY_CHECK
 		/*
 		 * GPE method wake/notify check.  Here, we want to ensure that we
@@ -144,12 +133,14 @@ acpi_ex_opcode_2A_0T_0R (
 		 * If all three cases are true, this is a wake-only GPE that should
 		 * be disabled at runtime.
 		 */
-		if (value == 2)     /* device_wake */ {
-			status = acpi_ev_check_for_wake_only_gpe (walk_state->gpe_event_info);
-			if (ACPI_FAILURE (status)) {
+		if (value == 2) {	/* device_wake */
+			status =
+			    acpi_ev_check_for_wake_only_gpe(walk_state->
+							    gpe_event_info);
+			if (ACPI_FAILURE(status)) {
 				/* AE_WAKE_ONLY_GPE only error, means ignore this notify */
 
-				return_ACPI_STATUS (AE_OK)
+				return_ACPI_STATUS(AE_OK)
 			}
 		}
 #endif
@@ -161,21 +152,18 @@ acpi_ex_opcode_2A_0T_0R (
 		 * from this thread -- because handlers may in turn run other
 		 * control methods.
 		 */
-		status = acpi_ev_queue_notify_request (node, value);
+		status = acpi_ev_queue_notify_request(node, value);
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n",
-				walk_state->opcode));
+		ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
 		status = AE_AML_BAD_OPCODE;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_2T_1R
@@ -189,19 +177,15 @@ acpi_ex_opcode_2A_0T_0R (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_2A_2T_1R (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *return_desc1 = NULL;
-	union acpi_operand_object       *return_desc2 = NULL;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R",
-		acpi_ps_get_opcode_name (walk_state->opcode));
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *return_desc1 = NULL;
+	union acpi_operand_object *return_desc2 = NULL;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R",
+				acpi_ps_get_opcode_name(walk_state->opcode));
 
 	/* Execute the opcode */
 
@@ -210,13 +194,15 @@ acpi_ex_opcode_2A_2T_1R (
 
 		/* Divide (Dividend, Divisor, remainder_result quotient_result) */
 
-		return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		return_desc1 =
+		    acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 		if (!return_desc1) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		return_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		return_desc2 =
+		    acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 		if (!return_desc2) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
@@ -224,33 +210,31 @@ acpi_ex_opcode_2A_2T_1R (
 
 		/* Quotient to return_desc1, remainder to return_desc2 */
 
-		status = acpi_ut_divide (operand[0]->integer.value,
-				   operand[1]->integer.value,
-				   &return_desc1->integer.value,
-				   &return_desc2->integer.value);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ut_divide(operand[0]->integer.value,
+					operand[1]->integer.value,
+					&return_desc1->integer.value,
+					&return_desc2->integer.value);
+		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n",
-				walk_state->opcode));
+		ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode));
 		status = AE_AML_BAD_OPCODE;
 		goto cleanup;
 	}
 
 	/* Store the results to the target reference operands */
 
-	status = acpi_ex_store (return_desc2, operand[2], walk_state);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ex_store(return_desc2, operand[2], walk_state);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
-	status = acpi_ex_store (return_desc1, operand[3], walk_state);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ex_store(return_desc1, operand[3], walk_state);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
@@ -258,24 +242,22 @@ acpi_ex_opcode_2A_2T_1R (
 
 	walk_state->result_obj = return_desc1;
 
-
-cleanup:
+      cleanup:
 	/*
 	 * Since the remainder is not returned indirectly, remove a reference to
 	 * it. Only the quotient is returned indirectly.
 	 */
-	acpi_ut_remove_reference (return_desc2);
+	acpi_ut_remove_reference(return_desc2);
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		/* Delete the return object */
 
-		acpi_ut_remove_reference (return_desc1);
+		acpi_ut_remove_reference(return_desc1);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_1T_1R
@@ -289,42 +271,39 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_2A_1T_1R (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *return_desc = NULL;
-	acpi_integer                    index;
-	acpi_status                     status = AE_OK;
-	acpi_size                       length;
-
-
-	ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R",
-		acpi_ps_get_opcode_name (walk_state->opcode));
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *return_desc = NULL;
+	acpi_integer index;
+	acpi_status status = AE_OK;
+	acpi_size length;
 
+	ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R",
+				acpi_ps_get_opcode_name(walk_state->opcode));
 
 	/* Execute the opcode */
 
 	if (walk_state->op_info->flags & AML_MATH) {
 		/* All simple math opcodes (add, etc.) */
 
-		return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode,
-				  operand[0]->integer.value,
-				  operand[1]->integer.value);
+		return_desc->integer.value =
+		    acpi_ex_do_math_op(walk_state->opcode,
+				       operand[0]->integer.value,
+				       operand[1]->integer.value);
 		goto store_result_to_target;
 	}
 
 	switch (walk_state->opcode) {
-	case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
+	case AML_MOD_OP:	/* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
 
-		return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
@@ -332,21 +311,18 @@ acpi_ex_opcode_2A_1T_1R (
 
 		/* return_desc will contain the remainder */
 
-		status = acpi_ut_divide (operand[0]->integer.value,
-				   operand[1]->integer.value,
-				   NULL,
-				   &return_desc->integer.value);
+		status = acpi_ut_divide(operand[0]->integer.value,
+					operand[1]->integer.value,
+					NULL, &return_desc->integer.value);
 		break;
 
+	case AML_CONCAT_OP:	/* Concatenate (Data1, Data2, Result) */
 
-	case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
-
-		status = acpi_ex_do_concatenate (operand[0], operand[1],
-				 &return_desc, walk_state);
+		status = acpi_ex_do_concatenate(operand[0], operand[1],
+						&return_desc, walk_state);
 		break;
 
-
-	case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
+	case AML_TO_STRING_OP:	/* to_string (Buffer, Length, Result) (ACPI 2.0) */
 
 		/*
 		 * Input object is guaranteed to be a buffer at this point (it may have
@@ -365,8 +341,8 @@ acpi_ex_opcode_2A_1T_1R (
 		 */
 		length = 0;
 		while ((length < operand[0]->buffer.length) &&
-			   (length < operand[1]->integer.value) &&
-			   (operand[0]->buffer.pointer[length])) {
+		       (length < operand[1]->integer.value) &&
+		       (operand[0]->buffer.pointer[length])) {
 			length++;
 			if (length > ACPI_MAX_STRING_CONVERSION) {
 				status = AE_AML_STRING_LIMIT;
@@ -376,33 +352,32 @@ acpi_ex_opcode_2A_1T_1R (
 
 		/* Allocate a new string object */
 
-		return_desc = acpi_ut_create_string_object (length);
+		return_desc = acpi_ut_create_string_object(length);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		/* Copy the raw buffer data with no transform. NULL terminated already*/
+		/* Copy the raw buffer data with no transform. NULL terminated already */
 
-		ACPI_MEMCPY (return_desc->string.pointer,
-			operand[0]->buffer.pointer, length);
+		ACPI_MEMCPY(return_desc->string.pointer,
+			    operand[0]->buffer.pointer, length);
 		break;
 
-
 	case AML_CONCAT_RES_OP:
 
 		/* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
 
-		status = acpi_ex_concat_template (operand[0], operand[1],
-				 &return_desc, walk_state);
+		status = acpi_ex_concat_template(operand[0], operand[1],
+						 &return_desc, walk_state);
 		break;
 
-
-	case AML_INDEX_OP:              /* Index (Source Index Result) */
+	case AML_INDEX_OP:	/* Index (Source Index Result) */
 
 		/* Create the internal return object */
 
-		return_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
+		return_desc =
+		    acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
@@ -412,76 +387,75 @@ acpi_ex_opcode_2A_1T_1R (
 
 		/* At this point, the Source operand is a Package, Buffer, or String */
 
-		if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
+		if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) {
 			/* Object to be indexed is a Package */
 
 			if (index >= operand[0]->package.count) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Index value (%X%8.8X) beyond package end (%X)\n",
-					ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Index value (%X%8.8X) beyond package end (%X)\n",
+						  ACPI_FORMAT_UINT64(index),
+						  operand[0]->package.count));
 				status = AE_AML_PACKAGE_LIMIT;
 				goto cleanup;
 			}
 
 			return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
-			return_desc->reference.object    = operand[0];
-			return_desc->reference.where     = &operand[0]->package.elements [
-					  index];
-		}
-		else {
+			return_desc->reference.object = operand[0];
+			return_desc->reference.where =
+			    &operand[0]->package.elements[index];
+		} else {
 			/* Object to be indexed is a Buffer/String */
 
 			if (index >= operand[0]->buffer.length) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Index value (%X%8.8X) beyond end of buffer (%X)\n",
-					ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Index value (%X%8.8X) beyond end of buffer (%X)\n",
+						  ACPI_FORMAT_UINT64(index),
+						  operand[0]->buffer.length));
 				status = AE_AML_BUFFER_LIMIT;
 				goto cleanup;
 			}
 
-			return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
-			return_desc->reference.object    = operand[0];
+			return_desc->reference.target_type =
+			    ACPI_TYPE_BUFFER_FIELD;
+			return_desc->reference.object = operand[0];
 		}
 
 		/*
 		 * Add a reference to the target package/buffer/string for the life
 		 * of the index.
 		 */
-		acpi_ut_add_reference (operand[0]);
+		acpi_ut_add_reference(operand[0]);
 
 		/* Complete the Index reference object */
 
-		return_desc->reference.opcode    = AML_INDEX_OP;
-		return_desc->reference.offset    = (u32) index;
+		return_desc->reference.opcode = AML_INDEX_OP;
+		return_desc->reference.offset = (u32) index;
 
 		/* Store the reference to the Target */
 
-		status = acpi_ex_store (return_desc, operand[2], walk_state);
+		status = acpi_ex_store(return_desc, operand[2], walk_state);
 
 		/* Return the reference */
 
 		walk_state->result_obj = return_desc;
 		goto cleanup;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n",
-				walk_state->opcode));
+		ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
 		status = AE_AML_BAD_OPCODE;
 		break;
 	}
 
+      store_result_to_target:
 
-store_result_to_target:
-
-	if (ACPI_SUCCESS (status)) {
+	if (ACPI_SUCCESS(status)) {
 		/*
 		 * Store the result of the operation (which is now in return_desc) into
 		 * the Target descriptor.
 		 */
-		status = acpi_ex_store (return_desc, operand[2], walk_state);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ex_store(return_desc, operand[2], walk_state);
+		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
 
@@ -490,19 +464,17 @@ store_result_to_target:
 		}
 	}
 
-
-cleanup:
+      cleanup:
 
 	/* Delete return object on error */
 
-	if (ACPI_FAILURE (status)) {
-		acpi_ut_remove_reference (return_desc);
+	if (ACPI_FAILURE(status)) {
+		acpi_ut_remove_reference(return_desc);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_0T_1R
@@ -515,23 +487,19 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_2A_0T_1R (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *return_desc = NULL;
-	acpi_status                     status = AE_OK;
-	u8                              logical_result = FALSE;
-
-
-	ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R",
-		acpi_ps_get_opcode_name (walk_state->opcode));
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *return_desc = NULL;
+	acpi_status status = AE_OK;
+	u8 logical_result = FALSE;
 
+	ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R",
+				acpi_ps_get_opcode_name(walk_state->opcode));
 
 	/* Create the internal return object */
 
-	return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+	return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 	if (!return_desc) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
@@ -542,50 +510,48 @@ acpi_ex_opcode_2A_0T_1R (
 	if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
 		/* logical_op (Operand0, Operand1) */
 
-		status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
-				  operand[0]->integer.value, operand[1]->integer.value,
-				  &logical_result);
+		status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
+						       operand[0]->integer.
+						       value,
+						       operand[1]->integer.
+						       value, &logical_result);
 		goto store_logical_result;
-	}
-	else if (walk_state->op_info->flags & AML_LOGICAL) {
+	} else if (walk_state->op_info->flags & AML_LOGICAL) {
 		/* logical_op (Operand0, Operand1) */
 
-		status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
-				 operand[1], &logical_result);
+		status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
+					       operand[1], &logical_result);
 		goto store_logical_result;
 	}
 
 	switch (walk_state->opcode) {
-	case AML_ACQUIRE_OP:            /* Acquire (mutex_object, Timeout) */
+	case AML_ACQUIRE_OP:	/* Acquire (mutex_object, Timeout) */
 
-		status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state);
+		status =
+		    acpi_ex_acquire_mutex(operand[1], operand[0], walk_state);
 		if (status == AE_TIME) {
-			logical_result = TRUE;      /* TRUE = Acquire timed out */
+			logical_result = TRUE;	/* TRUE = Acquire timed out */
 			status = AE_OK;
 		}
 		break;
 
+	case AML_WAIT_OP:	/* Wait (event_object, Timeout) */
 
-	case AML_WAIT_OP:               /* Wait (event_object, Timeout) */
-
-		status = acpi_ex_system_wait_event (operand[1], operand[0]);
+		status = acpi_ex_system_wait_event(operand[1], operand[0]);
 		if (status == AE_TIME) {
-			logical_result = TRUE;      /* TRUE, Wait timed out */
+			logical_result = TRUE;	/* TRUE, Wait timed out */
 			status = AE_OK;
 		}
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n",
-			walk_state->opcode));
+		ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
 		status = AE_AML_BAD_OPCODE;
 		goto cleanup;
 	}
 
-
-store_logical_result:
+      store_logical_result:
 	/*
 	 * Set return value to according to logical_result. logical TRUE (all ones)
 	 * Default is FALSE (zero)
@@ -596,16 +562,13 @@ store_logical_result:
 
 	walk_state->result_obj = return_desc;
 
-
-cleanup:
+      cleanup:
 
 	/* Delete return object on error */
 
-	if (ACPI_FAILURE (status)) {
-		acpi_ut_remove_reference (return_desc);
+	if (ACPI_FAILURE(status)) {
+		acpi_ut_remove_reference(return_desc);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 48 - 68
drivers/acpi/executer/exoparg3.c

@@ -42,16 +42,13 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exoparg3")
-
+ACPI_MODULE_NAME("exoparg3")
 
 /*!
  * Naming convention for AML interpreter execution routines.
@@ -74,8 +71,6 @@
  * The AcpiExOpcode* functions are called via the Dispatcher component with
  * fully resolved operands.
 !*/
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_3A_0T_0R
@@ -87,61 +82,53 @@
  * DESCRIPTION: Execute Triadic operator (3 operands)
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_opcode_3A_0T_0R (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	struct acpi_signal_fatal_info   *fatal;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R",
-		acpi_ps_get_opcode_name (walk_state->opcode));
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	struct acpi_signal_fatal_info *fatal;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R",
+				acpi_ps_get_opcode_name(walk_state->opcode));
 
 	switch (walk_state->opcode) {
-	case AML_FATAL_OP:          /* Fatal (fatal_type fatal_code fatal_arg) */
+	case AML_FATAL_OP:	/* Fatal (fatal_type fatal_code fatal_arg) */
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
-			(u32) operand[0]->integer.value,
-			(u32) operand[1]->integer.value,
-			(u32) operand[2]->integer.value));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
+				  (u32) operand[0]->integer.value,
+				  (u32) operand[1]->integer.value,
+				  (u32) operand[2]->integer.value));
 
-		fatal = ACPI_MEM_ALLOCATE (sizeof (struct acpi_signal_fatal_info));
+		fatal =
+		    ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
 		if (fatal) {
-			fatal->type     = (u32) operand[0]->integer.value;
-			fatal->code     = (u32) operand[1]->integer.value;
+			fatal->type = (u32) operand[0]->integer.value;
+			fatal->code = (u32) operand[1]->integer.value;
 			fatal->argument = (u32) operand[2]->integer.value;
 		}
 
 		/* Always signal the OS! */
 
-		status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
+		status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal);
 
 		/* Might return while OS is shutting down, just continue */
 
-		ACPI_MEM_FREE (fatal);
+		ACPI_MEM_FREE(fatal);
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
-				walk_state->opcode));
+		ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
 		status = AE_AML_BAD_OPCODE;
 		goto cleanup;
 	}
 
+      cleanup:
 
-cleanup:
-
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_3A_1T_1R
@@ -154,31 +141,28 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_3A_1T_1R (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *return_desc = NULL;
-	char                            *buffer = NULL;
-	acpi_status                     status = AE_OK;
-	acpi_integer                    index;
-	acpi_size                       length;
-
-
-	ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R",
-		acpi_ps_get_opcode_name (walk_state->opcode));
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *return_desc = NULL;
+	char *buffer = NULL;
+	acpi_status status = AE_OK;
+	acpi_integer index;
+	acpi_size length;
 
+	ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R",
+				acpi_ps_get_opcode_name(walk_state->opcode));
 
 	switch (walk_state->opcode) {
-	case AML_MID_OP:    /* Mid (Source[0], Index[1], Length[2], Result[3]) */
+	case AML_MID_OP:	/* Mid (Source[0], Index[1], Length[2], Result[3]) */
 
 		/*
 		 * Create the return object.  The Source operand is guaranteed to be
 		 * either a String or a Buffer, so just use its type.
 		 */
-		return_desc = acpi_ut_create_internal_object (
-				  ACPI_GET_OBJECT_TYPE (operand[0]));
+		return_desc =
+		    acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE
+						   (operand[0]));
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
@@ -201,17 +185,17 @@ acpi_ex_opcode_3A_1T_1R (
 
 		else if ((index + length) > operand[0]->string.length) {
 			length = (acpi_size) operand[0]->string.length -
-					 (acpi_size) index;
+			    (acpi_size) index;
 		}
 
 		/* Strings always have a sub-pointer, not so for buffers */
 
-		switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
+		switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
 		case ACPI_TYPE_STRING:
 
 			/* Always allocate a new buffer for the String */
 
-			buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1);
+			buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1);
 			if (!buffer) {
 				status = AE_NO_MEMORY;
 				goto cleanup;
@@ -225,7 +209,7 @@ acpi_ex_opcode_3A_1T_1R (
 			if (length > 0) {
 				/* Allocate a new buffer for the Buffer */
 
-				buffer = ACPI_MEM_CALLOCATE (length);
+				buffer = ACPI_MEM_CALLOCATE(length);
 				if (!buffer) {
 					status = AE_NO_MEMORY;
 					goto cleanup;
@@ -233,7 +217,7 @@ acpi_ex_opcode_3A_1T_1R (
 			}
 			break;
 
-		default:                        /* Should not happen */
+		default:	/* Should not happen */
 
 			status = AE_AML_OPERAND_TYPE;
 			goto cleanup;
@@ -242,8 +226,8 @@ acpi_ex_opcode_3A_1T_1R (
 		if (length > 0) {
 			/* Copy the portion requested */
 
-			ACPI_MEMCPY (buffer, operand[0]->string.pointer + index,
-					  length);
+			ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
+				    length);
 		}
 
 		/* Set the length of the new String/Buffer */
@@ -256,25 +240,23 @@ acpi_ex_opcode_3A_1T_1R (
 		return_desc->buffer.flags |= AOPOBJ_DATA_VALID;
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
-				walk_state->opcode));
+		ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
 		status = AE_AML_BAD_OPCODE;
 		goto cleanup;
 	}
 
 	/* Store the result in the target */
 
-	status = acpi_ex_store (return_desc, operand[3], walk_state);
+	status = acpi_ex_store(return_desc, operand[3], walk_state);
 
-cleanup:
+      cleanup:
 
 	/* Delete return object on error */
 
-	if (ACPI_FAILURE (status) || walk_state->result_obj) {
-		acpi_ut_remove_reference (return_desc);
+	if (ACPI_FAILURE(status) || walk_state->result_obj) {
+		acpi_ut_remove_reference(return_desc);
 	}
 
 	/* Set the return object and exit */
@@ -282,7 +264,5 @@ cleanup:
 	else {
 		walk_state->result_obj = return_desc;
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 58 - 69
drivers/acpi/executer/exoparg6.c

@@ -42,16 +42,13 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exoparg6")
-
+ACPI_MODULE_NAME("exoparg6")
 
 /*!
  * Naming convention for AML interpreter execution routines.
@@ -74,15 +71,11 @@
  * The AcpiExOpcode* functions are called via the Dispatcher component with
  * fully resolved operands.
 !*/
-
 /* Local prototypes */
-
 static u8
-acpi_ex_do_match (
-	u32                             match_op,
-	union acpi_operand_object       *package_obj,
-	union acpi_operand_object       *match_obj);
-
+acpi_ex_do_match(u32 match_op,
+		 union acpi_operand_object *package_obj,
+		 union acpi_operand_object *match_obj);
 
 /*******************************************************************************
  *
@@ -101,14 +94,12 @@ acpi_ex_do_match (
  ******************************************************************************/
 
 static u8
-acpi_ex_do_match (
-	u32                             match_op,
-	union acpi_operand_object       *package_obj,
-	union acpi_operand_object       *match_obj)
+acpi_ex_do_match(u32 match_op,
+		 union acpi_operand_object *package_obj,
+		 union acpi_operand_object *match_obj)
 {
-	u8                              logical_result = TRUE;
-	acpi_status                     status;
-
+	u8 logical_result = TRUE;
+	acpi_status status;
 
 	/*
 	 * Note: Since the package_obj/match_obj ordering is opposite to that of
@@ -133,9 +124,10 @@ acpi_ex_do_match (
 		 * True if equal: (P[i] == M)
 		 * Change to:     (M == P[i])
 		 */
-		status = acpi_ex_do_logical_op (AML_LEQUAL_OP, match_obj, package_obj,
-				 &logical_result);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj,
+					  &logical_result);
+		if (ACPI_FAILURE(status)) {
 			return (FALSE);
 		}
 		break;
@@ -146,12 +138,13 @@ acpi_ex_do_match (
 		 * True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
 		 * Change to:                  (M >= P[i]) (M not_less than P[i])
 		 */
-		status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj,
-				 &logical_result);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
+					  &logical_result);
+		if (ACPI_FAILURE(status)) {
 			return (FALSE);
 		}
-		logical_result = (u8) !logical_result;
+		logical_result = (u8) ! logical_result;
 		break;
 
 	case MATCH_MLT:
@@ -160,9 +153,10 @@ acpi_ex_do_match (
 		 * True if less than: (P[i] < M)
 		 * Change to:         (M > P[i])
 		 */
-		status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
-				 &logical_result);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
+					  package_obj, &logical_result);
+		if (ACPI_FAILURE(status)) {
 			return (FALSE);
 		}
 		break;
@@ -173,12 +167,13 @@ acpi_ex_do_match (
 		 * True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
 		 * Change to:                     (M <= P[i]) (M not_greater than P[i])
 		 */
-		status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
-				 &logical_result);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
+					  package_obj, &logical_result);
+		if (ACPI_FAILURE(status)) {
 			return (FALSE);
 		}
-		logical_result = (u8)!logical_result;
+		logical_result = (u8) ! logical_result;
 		break;
 
 	case MATCH_MGT:
@@ -187,9 +182,10 @@ acpi_ex_do_match (
 		 * True if greater than: (P[i] > M)
 		 * Change to:            (M < P[i])
 		 */
-		status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj,
-				 &logical_result);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
+					  &logical_result);
+		if (ACPI_FAILURE(status)) {
 			return (FALSE);
 		}
 		break;
@@ -204,7 +200,6 @@ acpi_ex_do_match (
 	return logical_result;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_6A_0T_1R
@@ -217,20 +212,16 @@ acpi_ex_do_match (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_6A_0T_1R (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
 {
-	union acpi_operand_object       **operand = &walk_state->operands[0];
-	union acpi_operand_object       *return_desc = NULL;
-	acpi_status                     status = AE_OK;
-	acpi_integer                    index;
-	union acpi_operand_object       *this_element;
-
-
-	ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R",
-		acpi_ps_get_opcode_name (walk_state->opcode));
+	union acpi_operand_object **operand = &walk_state->operands[0];
+	union acpi_operand_object *return_desc = NULL;
+	acpi_status status = AE_OK;
+	acpi_integer index;
+	union acpi_operand_object *this_element;
 
+	ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R",
+				acpi_ps_get_opcode_name(walk_state->opcode));
 
 	switch (walk_state->opcode) {
 	case AML_MATCH_OP:
@@ -242,8 +233,9 @@ acpi_ex_opcode_6A_0T_1R (
 		/* Validate both Match Term Operators (MTR, MEQ, etc.) */
 
 		if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
-			(operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n"));
+		    (operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Match operator out of range\n"));
 			status = AE_AML_OPERAND_VALUE;
 			goto cleanup;
 		}
@@ -252,16 +244,17 @@ acpi_ex_opcode_6A_0T_1R (
 
 		index = operand[5]->integer.value;
 		if (index >= operand[0]->package.count) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Index (%X%8.8X) beyond package end (%X)\n",
-				ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Index (%X%8.8X) beyond package end (%X)\n",
+					  ACPI_FORMAT_UINT64(index),
+					  operand[0]->package.count));
 			status = AE_AML_PACKAGE_LIMIT;
 			goto cleanup;
 		}
 
 		/* Create an integer for the return value */
 
-		return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
@@ -283,7 +276,7 @@ acpi_ex_opcode_6A_0T_1R (
 		 * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
 		 * match was found.
 		 */
-		for ( ; index < operand[0]->package.count; index++) {
+		for (; index < operand[0]->package.count; index++) {
 			/* Get the current package element */
 
 			this_element = operand[0]->package.elements[index];
@@ -299,13 +292,13 @@ acpi_ex_opcode_6A_0T_1R (
 			 * (proceed to next iteration of enclosing for loop) signifies a
 			 * non-match.
 			 */
-			if (!acpi_ex_do_match ((u32) operand[1]->integer.value,
-					   this_element, operand[2])) {
+			if (!acpi_ex_do_match((u32) operand[1]->integer.value,
+					      this_element, operand[2])) {
 				continue;
 			}
 
-			if (!acpi_ex_do_match ((u32) operand[3]->integer.value,
-					   this_element, operand[4])) {
+			if (!acpi_ex_do_match((u32) operand[3]->integer.value,
+					      this_element, operand[4])) {
 				continue;
 			}
 
@@ -316,31 +309,27 @@ acpi_ex_opcode_6A_0T_1R (
 		}
 		break;
 
-
 	case AML_LOAD_TABLE_OP:
 
-		status = acpi_ex_load_table_op (walk_state, &return_desc);
+		status = acpi_ex_load_table_op(walk_state, &return_desc);
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
-				walk_state->opcode));
+		ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
 		status = AE_AML_BAD_OPCODE;
 		goto cleanup;
 	}
 
 	walk_state->result_obj = return_desc;
 
-
-cleanup:
+      cleanup:
 
 	/* Delete return object on error */
 
-	if (ACPI_FAILURE (status)) {
-		acpi_ut_remove_reference (return_desc);
+	if (ACPI_FAILURE(status)) {
+		acpi_ut_remove_reference(return_desc);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }

+ 185 - 196
drivers/acpi/executer/exprep.c

@@ -42,32 +42,24 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exprep")
+ACPI_MODULE_NAME("exprep")
 
 /* Local prototypes */
-
 static u32
-acpi_ex_decode_field_access (
-	union acpi_operand_object       *obj_desc,
-	u8                              field_flags,
-	u32                             *return_byte_alignment);
-
+acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
+			    u8 field_flags, u32 * return_byte_alignment);
 
 #ifdef ACPI_UNDER_DEVELOPMENT
 
 static u32
-acpi_ex_generate_access (
-	u32                             field_bit_offset,
-	u32                             field_bit_length,
-	u32                             region_length);
+acpi_ex_generate_access(u32 field_bit_offset,
+			u32 field_bit_length, u32 region_length);
 
 /*******************************************************************************
  *
@@ -92,39 +84,36 @@ acpi_ex_generate_access (
  ******************************************************************************/
 
 static u32
-acpi_ex_generate_access (
-	u32                             field_bit_offset,
-	u32                             field_bit_length,
-	u32                             region_length)
+acpi_ex_generate_access(u32 field_bit_offset,
+			u32 field_bit_length, u32 region_length)
 {
-	u32                             field_byte_length;
-	u32                             field_byte_offset;
-	u32                             field_byte_end_offset;
-	u32                             access_byte_width;
-	u32                             field_start_offset;
-	u32                             field_end_offset;
-	u32                             minimum_access_width = 0xFFFFFFFF;
-	u32                             minimum_accesses = 0xFFFFFFFF;
-	u32                             accesses;
-
-
-	ACPI_FUNCTION_TRACE ("ex_generate_access");
-
+	u32 field_byte_length;
+	u32 field_byte_offset;
+	u32 field_byte_end_offset;
+	u32 access_byte_width;
+	u32 field_start_offset;
+	u32 field_end_offset;
+	u32 minimum_access_width = 0xFFFFFFFF;
+	u32 minimum_accesses = 0xFFFFFFFF;
+	u32 accesses;
+
+	ACPI_FUNCTION_TRACE("ex_generate_access");
 
 	/* Round Field start offset and length to "minimal" byte boundaries */
 
-	field_byte_offset  = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8));
-	field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length +
-			   field_bit_offset, 8));
-	field_byte_length  = field_byte_end_offset - field_byte_offset;
+	field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8));
+	field_byte_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length +
+							 field_bit_offset, 8));
+	field_byte_length = field_byte_end_offset - field_byte_offset;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-			"Bit length %d, Bit offset %d\n",
-			field_bit_length, field_bit_offset));
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "Bit length %d, Bit offset %d\n",
+			  field_bit_length, field_bit_offset));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-			"Byte Length %d, Byte Offset %d, End Offset %d\n",
-			field_byte_length, field_byte_offset, field_byte_end_offset));
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "Byte Length %d, Byte Offset %d, End Offset %d\n",
+			  field_byte_length, field_byte_offset,
+			  field_byte_end_offset));
 
 	/*
 	 * Iterative search for the maximum access width that is both aligned
@@ -132,7 +121,8 @@ acpi_ex_generate_access (
 	 *
 	 * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes)
 	 */
-	for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) {
+	for (access_byte_width = 1; access_byte_width <= 8;
+	     access_byte_width <<= 1) {
 		/*
 		 * 1) Round end offset up to next access boundary and make sure that
 		 *    this does not go beyond the end of the parent region.
@@ -140,31 +130,37 @@ acpi_ex_generate_access (
 		 *    are done. (This does not optimize for the perfectly aligned
 		 *    case yet).
 		 */
-		if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) {
+		if (ACPI_ROUND_UP(field_byte_end_offset, access_byte_width) <=
+		    region_length) {
 			field_start_offset =
-				ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
-				access_byte_width;
+			    ACPI_ROUND_DOWN(field_byte_offset,
+					    access_byte_width) /
+			    access_byte_width;
 
 			field_end_offset =
-				ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
-					access_byte_width) / access_byte_width;
+			    ACPI_ROUND_UP((field_byte_length +
+					   field_byte_offset),
+					  access_byte_width) /
+			    access_byte_width;
 
 			accesses = field_end_offset - field_start_offset;
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-					"access_width %d end is within region\n", access_byte_width));
+			ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+					  "access_width %d end is within region\n",
+					  access_byte_width));
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-					"Field Start %d, Field End %d -- requires %d accesses\n",
-					field_start_offset, field_end_offset, accesses));
+			ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+					  "Field Start %d, Field End %d -- requires %d accesses\n",
+					  field_start_offset, field_end_offset,
+					  accesses));
 
 			/* Single access is optimal */
 
 			if (accesses <= 1) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-					"Entire field can be accessed with one operation of size %d\n",
-					access_byte_width));
-				return_VALUE (access_byte_width);
+				ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+						  "Entire field can be accessed with one operation of size %d\n",
+						  access_byte_width));
+				return_VALUE(access_byte_width);
 			}
 
 			/*
@@ -172,30 +168,30 @@ acpi_ex_generate_access (
 			 * try the next wider access on next iteration
 			 */
 			if (accesses < minimum_accesses) {
-				minimum_accesses   = accesses;
+				minimum_accesses = accesses;
 				minimum_access_width = access_byte_width;
 			}
-		}
-		else {
-			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-				"access_width %d end is NOT within region\n", access_byte_width));
+		} else {
+			ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+					  "access_width %d end is NOT within region\n",
+					  access_byte_width));
 			if (access_byte_width == 1) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-						"Field goes beyond end-of-region!\n"));
+				ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+						  "Field goes beyond end-of-region!\n"));
 
 				/* Field does not fit in the region at all */
 
-				return_VALUE (0);
+				return_VALUE(0);
 			}
 
 			/*
 			 * This width goes beyond the end-of-region, back off to
 			 * previous access
 			 */
-			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-					"Backing off to previous optimal access width of %d\n",
-					minimum_access_width));
-			return_VALUE (minimum_access_width);
+			ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+					  "Backing off to previous optimal access width of %d\n",
+					  minimum_access_width));
+			return_VALUE(minimum_access_width);
 		}
 	}
 
@@ -203,12 +199,11 @@ acpi_ex_generate_access (
 	 * Could not read/write field with one operation,
 	 * just use max access width
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-			"Cannot access field in one operation, using width 8\n"));
-	return_VALUE (8);
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "Cannot access field in one operation, using width 8\n"));
+	return_VALUE(8);
 }
-#endif /* ACPI_UNDER_DEVELOPMENT */
-
+#endif				/* ACPI_UNDER_DEVELOPMENT */
 
 /*******************************************************************************
  *
@@ -226,18 +221,14 @@ acpi_ex_generate_access (
  ******************************************************************************/
 
 static u32
-acpi_ex_decode_field_access (
-	union acpi_operand_object       *obj_desc,
-	u8                              field_flags,
-	u32                             *return_byte_alignment)
+acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
+			    u8 field_flags, u32 * return_byte_alignment)
 {
-	u32                             access;
-	u32                             byte_alignment;
-	u32                             bit_length;
-
-
-	ACPI_FUNCTION_TRACE ("ex_decode_field_access");
+	u32 access;
+	u32 byte_alignment;
+	u32 bit_length;
 
+	ACPI_FUNCTION_TRACE("ex_decode_field_access");
 
 	access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
 
@@ -246,9 +237,12 @@ acpi_ex_decode_field_access (
 
 #ifdef ACPI_UNDER_DEVELOPMENT
 		byte_alignment =
-			acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
-				obj_desc->common_field.bit_length,
-				0xFFFFFFFF /* Temp until we pass region_length as parameter */);
+		    acpi_ex_generate_access(obj_desc->common_field.
+					    start_field_bit_offset,
+					    obj_desc->common_field.bit_length,
+					    0xFFFFFFFF
+					    /* Temp until we pass region_length as parameter */
+					    );
 		bit_length = byte_alignment * 8;
 #endif
 
@@ -257,36 +251,35 @@ acpi_ex_decode_field_access (
 		break;
 
 	case AML_FIELD_ACCESS_BYTE:
-	case AML_FIELD_ACCESS_BUFFER:   /* ACPI 2.0 (SMBus Buffer) */
+	case AML_FIELD_ACCESS_BUFFER:	/* ACPI 2.0 (SMBus Buffer) */
 		byte_alignment = 1;
-		bit_length    = 8;
+		bit_length = 8;
 		break;
 
 	case AML_FIELD_ACCESS_WORD:
 		byte_alignment = 2;
-		bit_length    = 16;
+		bit_length = 16;
 		break;
 
 	case AML_FIELD_ACCESS_DWORD:
 		byte_alignment = 4;
-		bit_length    = 32;
+		bit_length = 32;
 		break;
 
-	case AML_FIELD_ACCESS_QWORD:    /* ACPI 2.0 */
+	case AML_FIELD_ACCESS_QWORD:	/* ACPI 2.0 */
 		byte_alignment = 8;
-		bit_length    = 64;
+		bit_length = 64;
 		break;
 
 	default:
 		/* Invalid field access type */
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Unknown field access type %X\n",
-			access));
-		return_VALUE (0);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unknown field access type %X\n", access));
+		return_VALUE(0);
 	}
 
-	if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
+	if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
 		/*
 		 * buffer_field access can be on any byte boundary, so the
 		 * byte_alignment is always 1 byte -- regardless of any byte_alignment
@@ -296,10 +289,9 @@ acpi_ex_decode_field_access (
 	}
 
 	*return_byte_alignment = byte_alignment;
-	return_VALUE (bit_length);
+	return_VALUE(bit_length);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_prep_common_field_object
@@ -322,20 +314,16 @@ acpi_ex_decode_field_access (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_prep_common_field_object (
-	union acpi_operand_object       *obj_desc,
-	u8                              field_flags,
-	u8                              field_attribute,
-	u32                             field_bit_position,
-	u32                             field_bit_length)
+acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
+				 u8 field_flags,
+				 u8 field_attribute,
+				 u32 field_bit_position, u32 field_bit_length)
 {
-	u32                             access_bit_width;
-	u32                             byte_alignment;
-	u32                             nearest_byte_address;
-
-
-	ACPI_FUNCTION_TRACE ("ex_prep_common_field_object");
+	u32 access_bit_width;
+	u32 byte_alignment;
+	u32 nearest_byte_address;
 
+	ACPI_FUNCTION_TRACE("ex_prep_common_field_object");
 
 	/*
 	 * Note: the structure being initialized is the
@@ -361,16 +349,16 @@ acpi_ex_prep_common_field_object (
 	 * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
 	 * the same (equivalent) as the byte_alignment.
 	 */
-	access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags,
-			  &byte_alignment);
+	access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags,
+						       &byte_alignment);
 	if (!access_bit_width) {
-		return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+		return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
 	}
 
 	/* Setup width (access granularity) fields */
 
 	obj_desc->common_field.access_byte_width = (u8)
-			ACPI_DIV_8 (access_bit_width);          /* 1,  2,  4,  8 */
+	    ACPI_DIV_8(access_bit_width);	/* 1,  2,  4,  8 */
 
 	obj_desc->common_field.access_bit_width = (u8) access_bit_width;
 
@@ -385,30 +373,30 @@ acpi_ex_prep_common_field_object (
 	 * region or buffer.
 	 */
 	nearest_byte_address =
-			ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
+	    ACPI_ROUND_BITS_DOWN_TO_BYTES(field_bit_position);
 	obj_desc->common_field.base_byte_offset = (u32)
-			ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment);
+	    ACPI_ROUND_DOWN(nearest_byte_address, byte_alignment);
 
 	/*
 	 * start_field_bit_offset is the offset of the first bit of the field within
 	 * a field datum.
 	 */
 	obj_desc->common_field.start_field_bit_offset = (u8)
-		(field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset));
+	    (field_bit_position -
+	     ACPI_MUL_8(obj_desc->common_field.base_byte_offset));
 
 	/*
 	 * Does the entire field fit within a single field access element? (datum)
 	 * (i.e., without crossing a datum boundary)
 	 */
-	if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <=
-			(u16) access_bit_width) {
+	if ((obj_desc->common_field.start_field_bit_offset +
+	     field_bit_length) <= (u16) access_bit_width) {
 		obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_prep_field_value
@@ -422,51 +410,49 @@ acpi_ex_prep_common_field_object (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_prep_field_value (
-	struct acpi_create_field_info   *info)
+acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 {
-	union acpi_operand_object       *obj_desc;
-	u32                             type;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ex_prep_field_value");
+	union acpi_operand_object *obj_desc;
+	u32 type;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ex_prep_field_value");
 
 	/* Parameter validation */
 
 	if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
 		if (!info->region_node) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null region_node\n"));
-			return_ACPI_STATUS (AE_AML_NO_OPERAND);
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n"));
+			return_ACPI_STATUS(AE_AML_NO_OPERAND);
 		}
 
-		type = acpi_ns_get_type (info->region_node);
+		type = acpi_ns_get_type(info->region_node);
 		if (type != ACPI_TYPE_REGION) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Needed Region, found type %X (%s)\n",
-				type, acpi_ut_get_type_name (type)));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Needed Region, found type %X (%s)\n",
+					  type, acpi_ut_get_type_name(type)));
 
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 	}
 
 	/* Allocate a new field object */
 
-	obj_desc = acpi_ut_create_internal_object (info->field_type);
+	obj_desc = acpi_ut_create_internal_object(info->field_type);
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Initialize areas of the object that are common to all fields */
 
 	obj_desc->common_field.node = info->field_node;
-	status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags,
-			 info->attribute, info->field_bit_position, info->field_bit_length);
-	if (ACPI_FAILURE (status)) {
-		acpi_ut_delete_object_desc (obj_desc);
-		return_ACPI_STATUS (status);
+	status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags,
+						  info->attribute,
+						  info->field_bit_position,
+						  info->field_bit_length);
+	if (ACPI_FAILURE(status)) {
+		acpi_ut_delete_object_desc(obj_desc);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Initialize areas of the object that are specific to the field type */
@@ -474,71 +460,73 @@ acpi_ex_prep_field_value (
 	switch (info->field_type) {
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 
-		obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
+		obj_desc->field.region_obj =
+		    acpi_ns_get_attached_object(info->region_node);
 
 		/* An additional reference for the container */
 
-		acpi_ut_add_reference (obj_desc->field.region_obj);
+		acpi_ut_add_reference(obj_desc->field.region_obj);
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-			"region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
-			obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
-			obj_desc->field.access_byte_width, obj_desc->field.region_obj));
+		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+				  "region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
+				  obj_desc->field.start_field_bit_offset,
+				  obj_desc->field.base_byte_offset,
+				  obj_desc->field.access_byte_width,
+				  obj_desc->field.region_obj));
 		break;
 
-
 	case ACPI_TYPE_LOCAL_BANK_FIELD:
 
-		obj_desc->bank_field.value   = info->bank_value;
-		obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (
-				 info->region_node);
-		obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (
-				 info->register_node);
+		obj_desc->bank_field.value = info->bank_value;
+		obj_desc->bank_field.region_obj =
+		    acpi_ns_get_attached_object(info->region_node);
+		obj_desc->bank_field.bank_obj =
+		    acpi_ns_get_attached_object(info->register_node);
 
 		/* An additional reference for the attached objects */
 
-		acpi_ut_add_reference (obj_desc->bank_field.region_obj);
-		acpi_ut_add_reference (obj_desc->bank_field.bank_obj);
+		acpi_ut_add_reference(obj_desc->bank_field.region_obj);
+		acpi_ut_add_reference(obj_desc->bank_field.bank_obj);
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-			"Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
-			obj_desc->bank_field.start_field_bit_offset,
-			obj_desc->bank_field.base_byte_offset,
-			obj_desc->field.access_byte_width,
-			obj_desc->bank_field.region_obj,
-			obj_desc->bank_field.bank_obj));
+		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+				  "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
+				  obj_desc->bank_field.start_field_bit_offset,
+				  obj_desc->bank_field.base_byte_offset,
+				  obj_desc->field.access_byte_width,
+				  obj_desc->bank_field.region_obj,
+				  obj_desc->bank_field.bank_obj));
 		break;
 
-
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-		obj_desc->index_field.index_obj = acpi_ns_get_attached_object (
-				 info->register_node);
-		obj_desc->index_field.data_obj = acpi_ns_get_attached_object (
-				 info->data_register_node);
-		obj_desc->index_field.value  = (u32)
-			(info->field_bit_position / ACPI_MUL_8 (
-					  obj_desc->field.access_byte_width));
-
-		if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
-			ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
-			acpi_ut_delete_object_desc (obj_desc);
-			return_ACPI_STATUS (AE_AML_INTERNAL);
+		obj_desc->index_field.index_obj =
+		    acpi_ns_get_attached_object(info->register_node);
+		obj_desc->index_field.data_obj =
+		    acpi_ns_get_attached_object(info->data_register_node);
+		obj_desc->index_field.value = (u32)
+		    (info->field_bit_position /
+		     ACPI_MUL_8(obj_desc->field.access_byte_width));
+
+		if (!obj_desc->index_field.data_obj
+		    || !obj_desc->index_field.index_obj) {
+			ACPI_REPORT_ERROR(("Null Index Object during field prep\n"));
+			acpi_ut_delete_object_desc(obj_desc);
+			return_ACPI_STATUS(AE_AML_INTERNAL);
 		}
 
 		/* An additional reference for the attached objects */
 
-		acpi_ut_add_reference (obj_desc->index_field.data_obj);
-		acpi_ut_add_reference (obj_desc->index_field.index_obj);
-
-		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-			"index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
-			obj_desc->index_field.start_field_bit_offset,
-			obj_desc->index_field.base_byte_offset,
-			obj_desc->index_field.value,
-			obj_desc->field.access_byte_width,
-			obj_desc->index_field.index_obj,
-			obj_desc->index_field.data_obj));
+		acpi_ut_add_reference(obj_desc->index_field.data_obj);
+		acpi_ut_add_reference(obj_desc->index_field.index_obj);
+
+		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+				  "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
+				  obj_desc->index_field.start_field_bit_offset,
+				  obj_desc->index_field.base_byte_offset,
+				  obj_desc->index_field.value,
+				  obj_desc->field.access_byte_width,
+				  obj_desc->index_field.index_obj,
+				  obj_desc->index_field.data_obj));
 		break;
 
 	default:
@@ -550,15 +538,16 @@ acpi_ex_prep_field_value (
 	 * Store the constructed descriptor (obj_desc) into the parent Node,
 	 * preserving the current type of that named_obj.
 	 */
-	status = acpi_ns_attach_object (info->field_node, obj_desc,
-			  acpi_ns_get_type (info->field_node));
+	status = acpi_ns_attach_object(info->field_node, obj_desc,
+				       acpi_ns_get_type(info->field_node));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n",
-			info->field_node, acpi_ut_get_node_name (info->field_node), obj_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+			  "Set named_obj %p [%4.4s], obj_desc %p\n",
+			  info->field_node,
+			  acpi_ut_get_node_name(info->field_node), obj_desc));
 
 	/* Remove local reference to the object */
 
-	acpi_ut_remove_reference (obj_desc);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(obj_desc);
+	return_ACPI_STATUS(status);
 }
-

+ 125 - 155
drivers/acpi/executer/exregion.c

@@ -42,14 +42,11 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exregion")
-
+ACPI_MODULE_NAME("exregion")
 
 /*******************************************************************************
  *
@@ -68,27 +65,23 @@
  * DESCRIPTION: Handler for the System Memory address space (Op Region)
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_system_memory_space_handler (
-	u32                             function,
-	acpi_physical_address           address,
-	u32                             bit_width,
-	acpi_integer                    *value,
-	void                            *handler_context,
-	void                            *region_context)
+acpi_ex_system_memory_space_handler(u32 function,
+				    acpi_physical_address address,
+				    u32 bit_width,
+				    acpi_integer * value,
+				    void *handler_context, void *region_context)
 {
-	acpi_status                     status = AE_OK;
-	void                            *logical_addr_ptr = NULL;
-	struct acpi_mem_space_context   *mem_info = region_context;
-	u32                             length;
-	acpi_size                       window_size;
+	acpi_status status = AE_OK;
+	void *logical_addr_ptr = NULL;
+	struct acpi_mem_space_context *mem_info = region_context;
+	u32 length;
+	acpi_size window_size;
 #ifndef ACPI_MISALIGNED_TRANSFERS
-	u32                             remainder;
+	u32 remainder;
 #endif
 
-	ACPI_FUNCTION_TRACE ("ex_system_memory_space_handler");
-
+	ACPI_FUNCTION_TRACE("ex_system_memory_space_handler");
 
 	/* Validate and translate the bit width */
 
@@ -110,9 +103,10 @@ acpi_ex_system_memory_space_handler (
 		break;
 
 	default:
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid system_memory width %d\n",
-			bit_width));
-		return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Invalid system_memory width %d\n",
+				  bit_width));
+		return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
 	}
 
 #ifndef ACPI_MISALIGNED_TRANSFERS
@@ -120,9 +114,10 @@ acpi_ex_system_memory_space_handler (
 	 * Hardware does not support non-aligned data transfers, we must verify
 	 * the request.
 	 */
-	(void) acpi_ut_short_divide ((acpi_integer) address, length, NULL, &remainder);
+	(void)acpi_ut_short_divide((acpi_integer) address, length, NULL,
+				   &remainder);
 	if (remainder != 0) {
-		return_ACPI_STATUS (AE_AML_ALIGNMENT);
+		return_ACPI_STATUS(AE_AML_ALIGNMENT);
 	}
 #endif
 
@@ -132,9 +127,10 @@ acpi_ex_system_memory_space_handler (
 	 *    2) Address beyond the current mapping?
 	 */
 	if ((address < mem_info->mapped_physical_address) ||
-		(((acpi_integer) address + length) >
-			((acpi_integer)
-			mem_info->mapped_physical_address + mem_info->mapped_length))) {
+	    (((acpi_integer) address + length) > ((acpi_integer)
+						  mem_info->
+						  mapped_physical_address +
+						  mem_info->mapped_length))) {
 		/*
 		 * The request cannot be resolved by the current memory mapping;
 		 * Delete the existing mapping and create a new one.
@@ -142,8 +138,8 @@ acpi_ex_system_memory_space_handler (
 		if (mem_info->mapped_length) {
 			/* Valid mapping, delete it */
 
-			acpi_os_unmap_memory (mem_info->mapped_logical_address,
-					   mem_info->mapped_length);
+			acpi_os_unmap_memory(mem_info->mapped_logical_address,
+					     mem_info->mapped_length);
 		}
 
 		/*
@@ -151,7 +147,7 @@ acpi_ex_system_memory_space_handler (
 		 * constrain the maximum mapping size to something reasonable.
 		 */
 		window_size = (acpi_size)
-			((mem_info->address + mem_info->length) - address);
+		    ((mem_info->address + mem_info->length) - address);
 
 		if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
 			window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
@@ -159,14 +155,16 @@ acpi_ex_system_memory_space_handler (
 
 		/* Create a new mapping starting at the address given */
 
-		status = acpi_os_map_memory (address, window_size,
-				  (void **) &mem_info->mapped_logical_address);
-		if (ACPI_FAILURE (status)) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Could not map memory at %8.8X%8.8X, size %X\n",
-				ACPI_FORMAT_UINT64 (address), (u32) window_size));
+		status = acpi_os_map_memory(address, window_size,
+					    (void **)&mem_info->
+					    mapped_logical_address);
+		if (ACPI_FAILURE(status)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Could not map memory at %8.8X%8.8X, size %X\n",
+					  ACPI_FORMAT_UINT64(address),
+					  (u32) window_size));
 			mem_info->mapped_length = 0;
-			return_ACPI_STATUS (status);
+			return_ACPI_STATUS(status);
 		}
 
 		/* Save the physical address and mapping size */
@@ -180,42 +178,41 @@ acpi_ex_system_memory_space_handler (
 	 * access
 	 */
 	logical_addr_ptr = mem_info->mapped_logical_address +
-			   ((acpi_integer) address -
-					  (acpi_integer) mem_info->mapped_physical_address);
-
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"system_memory %d (%d width) Address=%8.8X%8.8X\n",
-			function, bit_width,
-			ACPI_FORMAT_UINT64 (address)));
-
-   /*
-	* Perform the memory read or write
-	*
-	* Note: For machines that do not support non-aligned transfers, the target
-	* address was checked for alignment above.  We do not attempt to break the
-	* transfer up into smaller (byte-size) chunks because the AML specifically
-	* asked for a transfer width that the hardware may require.
-	*/
+	    ((acpi_integer) address -
+	     (acpi_integer) mem_info->mapped_physical_address);
+
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "system_memory %d (%d width) Address=%8.8X%8.8X\n",
+			  function, bit_width, ACPI_FORMAT_UINT64(address)));
+
+	/*
+	 * Perform the memory read or write
+	 *
+	 * Note: For machines that do not support non-aligned transfers, the target
+	 * address was checked for alignment above.  We do not attempt to break the
+	 * transfer up into smaller (byte-size) chunks because the AML specifically
+	 * asked for a transfer width that the hardware may require.
+	 */
 	switch (function) {
 	case ACPI_READ:
 
 		*value = 0;
 		switch (bit_width) {
 		case 8:
-			*value = (acpi_integer) *((u8 *) logical_addr_ptr);
+			*value = (acpi_integer) * ((u8 *) logical_addr_ptr);
 			break;
 
 		case 16:
-			*value = (acpi_integer) *((u16 *) logical_addr_ptr);
+			*value = (acpi_integer) * ((u16 *) logical_addr_ptr);
 			break;
 
 		case 32:
-			*value = (acpi_integer) *((u32 *) logical_addr_ptr);
+			*value = (acpi_integer) * ((u32 *) logical_addr_ptr);
 			break;
 
 #if ACPI_MACHINE_WIDTH != 16
 		case 64:
-			*value = (acpi_integer) *((u64 *) logical_addr_ptr);
+			*value = (acpi_integer) * ((u64 *) logical_addr_ptr);
 			break;
 #endif
 		default:
@@ -228,20 +225,20 @@ acpi_ex_system_memory_space_handler (
 
 		switch (bit_width) {
 		case 8:
-			*(u8 *) logical_addr_ptr = (u8) *value;
+			*(u8 *) logical_addr_ptr = (u8) * value;
 			break;
 
 		case 16:
-			*(u16 *) logical_addr_ptr = (u16) *value;
+			*(u16 *) logical_addr_ptr = (u16) * value;
 			break;
 
 		case 32:
-			*(u32 *) logical_addr_ptr = (u32) *value;
+			*(u32 *) logical_addr_ptr = (u32) * value;
 			break;
 
 #if ACPI_MACHINE_WIDTH != 16
 		case 64:
-			*(u64 *) logical_addr_ptr = (u64) *value;
+			*(u64 *) logical_addr_ptr = (u64) * value;
 			break;
 #endif
 
@@ -256,10 +253,9 @@ acpi_ex_system_memory_space_handler (
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_io_space_handler
@@ -279,39 +275,35 @@ acpi_ex_system_memory_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_system_io_space_handler (
-	u32                             function,
-	acpi_physical_address           address,
-	u32                             bit_width,
-	acpi_integer                    *value,
-	void                            *handler_context,
-	void                            *region_context)
+acpi_ex_system_io_space_handler(u32 function,
+				acpi_physical_address address,
+				u32 bit_width,
+				acpi_integer * value,
+				void *handler_context, void *region_context)
 {
-	acpi_status                     status = AE_OK;
-	u32                             value32;
+	acpi_status status = AE_OK;
+	u32 value32;
 
+	ACPI_FUNCTION_TRACE("ex_system_io_space_handler");
 
-	ACPI_FUNCTION_TRACE ("ex_system_io_space_handler");
-
-
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"system_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
-			ACPI_FORMAT_UINT64 (address)));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "system_iO %d (%d width) Address=%8.8X%8.8X\n",
+			  function, bit_width, ACPI_FORMAT_UINT64(address)));
 
 	/* Decode the function parameter */
 
 	switch (function) {
 	case ACPI_READ:
 
-		status = acpi_os_read_port ((acpi_io_address) address,
-				 &value32, bit_width);
+		status = acpi_os_read_port((acpi_io_address) address,
+					   &value32, bit_width);
 		*value = value32;
 		break;
 
 	case ACPI_WRITE:
 
-		status = acpi_os_write_port ((acpi_io_address) address,
-				 (u32) *value, bit_width);
+		status = acpi_os_write_port((acpi_io_address) address,
+					    (u32) * value, bit_width);
 		break;
 
 	default:
@@ -319,10 +311,9 @@ acpi_ex_system_io_space_handler (
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_pci_config_space_handler
@@ -342,21 +333,17 @@ acpi_ex_system_io_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_pci_config_space_handler (
-	u32                             function,
-	acpi_physical_address           address,
-	u32                             bit_width,
-	acpi_integer                    *value,
-	void                            *handler_context,
-	void                            *region_context)
+acpi_ex_pci_config_space_handler(u32 function,
+				 acpi_physical_address address,
+				 u32 bit_width,
+				 acpi_integer * value,
+				 void *handler_context, void *region_context)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_pci_id              *pci_id;
-	u16                             pci_register;
-
-
-	ACPI_FUNCTION_TRACE ("ex_pci_config_space_handler");
+	acpi_status status = AE_OK;
+	struct acpi_pci_id *pci_id;
+	u16 pci_register;
 
+	ACPI_FUNCTION_TRACE("ex_pci_config_space_handler");
 
 	/*
 	 *  The arguments to acpi_os(Read|Write)pci_configuration are:
@@ -370,26 +357,26 @@ acpi_ex_pci_config_space_handler (
 	 *  Value - input value for write, output address for read
 	 *
 	 */
-	pci_id      = (struct acpi_pci_id *) region_context;
+	pci_id = (struct acpi_pci_id *)region_context;
 	pci_register = (u16) (u32) address;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-		"pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
-		function, bit_width, pci_id->segment, pci_id->bus, pci_id->device,
-		pci_id->function, pci_register));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+			  function, bit_width, pci_id->segment, pci_id->bus,
+			  pci_id->device, pci_id->function, pci_register));
 
 	switch (function) {
 	case ACPI_READ:
 
 		*value = 0;
-		status = acpi_os_read_pci_configuration (pci_id, pci_register,
-				 value, bit_width);
+		status = acpi_os_read_pci_configuration(pci_id, pci_register,
+							value, bit_width);
 		break;
 
 	case ACPI_WRITE:
 
-		status = acpi_os_write_pci_configuration (pci_id, pci_register,
-				 *value, bit_width);
+		status = acpi_os_write_pci_configuration(pci_id, pci_register,
+							 *value, bit_width);
 		break;
 
 	default:
@@ -398,10 +385,9 @@ acpi_ex_pci_config_space_handler (
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_cmos_space_handler
@@ -421,24 +407,19 @@ acpi_ex_pci_config_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_cmos_space_handler (
-	u32                             function,
-	acpi_physical_address           address,
-	u32                             bit_width,
-	acpi_integer                    *value,
-	void                            *handler_context,
-	void                            *region_context)
+acpi_ex_cmos_space_handler(u32 function,
+			   acpi_physical_address address,
+			   u32 bit_width,
+			   acpi_integer * value,
+			   void *handler_context, void *region_context)
 {
-	acpi_status                     status = AE_OK;
-
+	acpi_status status = AE_OK;
 
-	ACPI_FUNCTION_TRACE ("ex_cmos_space_handler");
+	ACPI_FUNCTION_TRACE("ex_cmos_space_handler");
 
-
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_pci_bar_space_handler
@@ -458,24 +439,19 @@ acpi_ex_cmos_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_pci_bar_space_handler (
-	u32                             function,
-	acpi_physical_address           address,
-	u32                             bit_width,
-	acpi_integer                    *value,
-	void                            *handler_context,
-	void                            *region_context)
+acpi_ex_pci_bar_space_handler(u32 function,
+			      acpi_physical_address address,
+			      u32 bit_width,
+			      acpi_integer * value,
+			      void *handler_context, void *region_context)
 {
-	acpi_status                     status = AE_OK;
-
+	acpi_status status = AE_OK;
 
-	ACPI_FUNCTION_TRACE ("ex_pci_bar_space_handler");
+	ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler");
 
-
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_data_table_space_handler
@@ -495,24 +471,20 @@ acpi_ex_pci_bar_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_data_table_space_handler (
-	u32                             function,
-	acpi_physical_address           address,
-	u32                             bit_width,
-	acpi_integer                    *value,
-	void                            *handler_context,
-	void                            *region_context)
+acpi_ex_data_table_space_handler(u32 function,
+				 acpi_physical_address address,
+				 u32 bit_width,
+				 acpi_integer * value,
+				 void *handler_context, void *region_context)
 {
-	acpi_status                     status = AE_OK;
-	u32                             byte_width = ACPI_DIV_8 (bit_width);
-	u32                             i;
-	char                            *logical_addr_ptr;
-
+	acpi_status status = AE_OK;
+	u32 byte_width = ACPI_DIV_8(bit_width);
+	u32 i;
+	char *logical_addr_ptr;
 
-	ACPI_FUNCTION_TRACE ("ex_data_table_space_handler");
+	ACPI_FUNCTION_TRACE("ex_data_table_space_handler");
 
-
-	logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address);
+	logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
 
 	/* Perform the memory read or write */
 
@@ -520,17 +492,15 @@ acpi_ex_data_table_space_handler (
 	case ACPI_READ:
 
 		for (i = 0; i < byte_width; i++) {
-			((char *) value) [i] = logical_addr_ptr[i];
+			((char *)value)[i] = logical_addr_ptr[i];
 		}
 		break;
 
 	case ACPI_WRITE:
 	default:
 
-		return_ACPI_STATUS (AE_SUPPORT);
+		return_ACPI_STATUS(AE_SUPPORT);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 84 - 88
drivers/acpi/executer/exresnte.c

@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
@@ -50,10 +49,8 @@
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exresnte")
-
+ACPI_MODULE_NAME("exresnte")
 
 /*******************************************************************************
  *
@@ -80,41 +77,37 @@
  *      ACPI_TYPE_PACKAGE
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_resolve_node_to_value (
-	struct acpi_namespace_node      **object_ptr,
-	struct acpi_walk_state          *walk_state)
-
+acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
+			      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *source_desc;
-	union acpi_operand_object       *obj_desc = NULL;
-	struct acpi_namespace_node      *node;
-	acpi_object_type                entry_type;
-
-
-	ACPI_FUNCTION_TRACE ("ex_resolve_node_to_value");
+	acpi_status status = AE_OK;
+	union acpi_operand_object *source_desc;
+	union acpi_operand_object *obj_desc = NULL;
+	struct acpi_namespace_node *node;
+	acpi_object_type entry_type;
 
+	ACPI_FUNCTION_TRACE("ex_resolve_node_to_value");
 
 	/*
 	 * The stack pointer points to a struct acpi_namespace_node (Node).  Get the
 	 * object that is attached to the Node.
 	 */
-	node       = *object_ptr;
-	source_desc = acpi_ns_get_attached_object (node);
-	entry_type = acpi_ns_get_type ((acpi_handle) node);
+	node = *object_ptr;
+	source_desc = acpi_ns_get_attached_object(node);
+	entry_type = acpi_ns_get_type((acpi_handle) node);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
-		 node, source_desc, acpi_ut_get_type_name (entry_type)));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
+			  node, source_desc,
+			  acpi_ut_get_type_name(entry_type)));
 
 	if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
-		(entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
+	    (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
 		/* There is always exactly one level of indirection */
 
-		node       = ACPI_CAST_PTR (struct acpi_namespace_node, node->object);
-		source_desc = acpi_ns_get_attached_object (node);
-		entry_type = acpi_ns_get_type ((acpi_handle) node);
+		node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
+		source_desc = acpi_ns_get_attached_object(node);
+		entry_type = acpi_ns_get_type((acpi_handle) node);
 		*object_ptr = node;
 	}
 
@@ -124,14 +117,14 @@ acpi_ex_resolve_node_to_value (
 	 * 2) Method locals and arguments have a pseudo-Node
 	 */
 	if (entry_type == ACPI_TYPE_DEVICE ||
-		(node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
-		return_ACPI_STATUS (AE_OK);
+	    (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	if (!source_desc) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
-			node));
-		return_ACPI_STATUS (AE_AML_NO_OPERAND);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "No object attached to node %p\n", node));
+		return_ACPI_STATUS(AE_AML_NO_OPERAND);
 	}
 
 	/*
@@ -141,83 +134,89 @@ acpi_ex_resolve_node_to_value (
 	switch (entry_type) {
 	case ACPI_TYPE_PACKAGE:
 
-		if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_PACKAGE) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
-				acpi_ut_get_object_type_name (source_desc)));
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Object not a Package, type %s\n",
+					  acpi_ut_get_object_type_name
+					  (source_desc)));
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
-		status = acpi_ds_get_package_arguments (source_desc);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ds_get_package_arguments(source_desc);
+		if (ACPI_SUCCESS(status)) {
 			/* Return an additional reference to the object */
 
 			obj_desc = source_desc;
-			acpi_ut_add_reference (obj_desc);
+			acpi_ut_add_reference(obj_desc);
 		}
 		break;
 
-
 	case ACPI_TYPE_BUFFER:
 
-		if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
-				acpi_ut_get_object_type_name (source_desc)));
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Object not a Buffer, type %s\n",
+					  acpi_ut_get_object_type_name
+					  (source_desc)));
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
-		status = acpi_ds_get_buffer_arguments (source_desc);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ds_get_buffer_arguments(source_desc);
+		if (ACPI_SUCCESS(status)) {
 			/* Return an additional reference to the object */
 
 			obj_desc = source_desc;
-			acpi_ut_add_reference (obj_desc);
+			acpi_ut_add_reference(obj_desc);
 		}
 		break;
 
-
 	case ACPI_TYPE_STRING:
 
-		if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
-				acpi_ut_get_object_type_name (source_desc)));
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Object not a String, type %s\n",
+					  acpi_ut_get_object_type_name
+					  (source_desc)));
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		/* Return an additional reference to the object */
 
 		obj_desc = source_desc;
-		acpi_ut_add_reference (obj_desc);
+		acpi_ut_add_reference(obj_desc);
 		break;
 
-
 	case ACPI_TYPE_INTEGER:
 
-		if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
-				acpi_ut_get_object_type_name (source_desc)));
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Object not a Integer, type %s\n",
+					  acpi_ut_get_object_type_name
+					  (source_desc)));
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		/* Return an additional reference to the object */
 
 		obj_desc = source_desc;
-		acpi_ut_add_reference (obj_desc);
+		acpi_ut_add_reference(obj_desc);
 		break;
 
-
 	case ACPI_TYPE_BUFFER_FIELD:
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 	case ACPI_TYPE_LOCAL_BANK_FIELD:
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"field_read Node=%p source_desc=%p Type=%X\n",
-			node, source_desc, entry_type));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "field_read Node=%p source_desc=%p Type=%X\n",
+				  node, source_desc, entry_type));
 
-		status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
+		status =
+		    acpi_ex_read_data_from_field(walk_state, source_desc,
+						 &obj_desc);
 		break;
 
-	/* For these objects, just return the object attached to the Node */
+		/* For these objects, just return the object attached to the Node */
 
 	case ACPI_TYPE_MUTEX:
 	case ACPI_TYPE_METHOD:
@@ -230,19 +229,18 @@ acpi_ex_resolve_node_to_value (
 		/* Return an additional reference to the object */
 
 		obj_desc = source_desc;
-		acpi_ut_add_reference (obj_desc);
+		acpi_ut_add_reference(obj_desc);
 		break;
 
-	/* TYPE_ANY is untyped, and thus there is no object associated with it */
+		/* TYPE_ANY is untyped, and thus there is no object associated with it */
 
 	case ACPI_TYPE_ANY:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Untyped entry %p, no attached object!\n",
-			node));
-
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Untyped entry %p, no attached object!\n",
+				  node));
 
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);	/* Cannot be AE_TYPE */
 
 	case ACPI_TYPE_LOCAL_REFERENCE:
 
@@ -253,39 +251,37 @@ acpi_ex_resolve_node_to_value (
 			/* Return an additional reference to the object */
 
 			obj_desc = source_desc;
-			acpi_ut_add_reference (obj_desc);
+			acpi_ut_add_reference(obj_desc);
 			break;
 
 		default:
 			/* No named references are allowed here */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Unsupported Reference opcode %X (%s)\n",
-				source_desc->reference.opcode,
-				acpi_ps_get_opcode_name (source_desc->reference.opcode)));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Unsupported Reference opcode %X (%s)\n",
+					  source_desc->reference.opcode,
+					  acpi_ps_get_opcode_name(source_desc->
+								  reference.
+								  opcode)));
 
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 		break;
 
-
 	default:
 
 		/* Default case is for unknown types */
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Node %p - Unknown object type %X\n",
-			node, entry_type));
-
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Node %p - Unknown object type %X\n",
+				  node, entry_type));
 
-	} /* switch (entry_type) */
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 
+	}			/* switch (entry_type) */
 
 	/* Return the object descriptor */
 
-	*object_ptr = (void *) obj_desc;
-	return_ACPI_STATUS (status);
+	*object_ptr = (void *)obj_desc;
+	return_ACPI_STATUS(status);
 }
-
-

+ 136 - 148
drivers/acpi/executer/exresolv.c

@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acdispat.h>
@@ -50,17 +49,13 @@
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exresolv")
+ACPI_MODULE_NAME("exresolv")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_resolve_object_to_value (
-	union acpi_operand_object       **stack_ptr,
-	struct acpi_walk_state          *walk_state);
-
+acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
+				struct acpi_walk_state *walk_state);
 
 /*******************************************************************************
  *
@@ -78,19 +73,16 @@ acpi_ex_resolve_object_to_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_resolve_to_value (
-	union acpi_operand_object       **stack_ptr,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
+			 struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_resolve_to_value", stack_ptr);
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr);
 
 	if (!stack_ptr || !*stack_ptr) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
-		return_ACPI_STATUS (AE_AML_NO_OPERAND);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n"));
+		return_ACPI_STATUS(AE_AML_NO_OPERAND);
 	}
 
 	/*
@@ -98,15 +90,16 @@ acpi_ex_resolve_to_value (
 	 * 1) A valid union acpi_operand_object, or
 	 * 2) A struct acpi_namespace_node (named_obj)
 	 */
-	if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
-		status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+	if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
+		status = acpi_ex_resolve_object_to_value(stack_ptr, walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		if (!*stack_ptr) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
-			return_ACPI_STATUS (AE_AML_NO_OPERAND);
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Internal - null pointer\n"));
+			return_ACPI_STATUS(AE_AML_NO_OPERAND);
 		}
 	}
 
@@ -114,20 +107,20 @@ acpi_ex_resolve_to_value (
 	 * Object on the stack may have changed if acpi_ex_resolve_object_to_value()
 	 * was called (i.e., we can't use an _else_ here.)
 	 */
-	if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
-		status = acpi_ex_resolve_node_to_value (
-				  ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, stack_ptr),
-				  walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+	if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
+		status =
+		    acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
+						  (struct acpi_namespace_node,
+						   stack_ptr), walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
-	return_ACPI_STATUS (AE_OK);
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_resolve_object_to_value
@@ -143,25 +136,22 @@ acpi_ex_resolve_to_value (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_resolve_object_to_value (
-	union acpi_operand_object       **stack_ptr,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
+				struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *stack_desc;
-	void                            *temp_node;
-	union acpi_operand_object       *obj_desc;
-	u16                             opcode;
-
-
-	ACPI_FUNCTION_TRACE ("ex_resolve_object_to_value");
+	acpi_status status = AE_OK;
+	union acpi_operand_object *stack_desc;
+	void *temp_node;
+	union acpi_operand_object *obj_desc;
+	u16 opcode;
 
+	ACPI_FUNCTION_TRACE("ex_resolve_object_to_value");
 
 	stack_desc = *stack_ptr;
 
 	/* This is an union acpi_operand_object    */
 
-	switch (ACPI_GET_OBJECT_TYPE (stack_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(stack_desc)) {
 	case ACPI_TYPE_LOCAL_REFERENCE:
 
 		opcode = stack_desc->reference.opcode;
@@ -177,14 +167,13 @@ acpi_ex_resolve_object_to_value (
 
 			/* Delete the Reference Object */
 
-			acpi_ut_remove_reference (stack_desc);
+			acpi_ut_remove_reference(stack_desc);
 
 			/* Return the namespace node */
 
 			(*stack_ptr) = temp_node;
 			break;
 
-
 		case AML_LOCAL_OP:
 		case AML_ARG_OP:
 
@@ -192,24 +181,28 @@ acpi_ex_resolve_object_to_value (
 			 * Get the local from the method's state info
 			 * Note: this increments the local's object reference count
 			 */
-			status = acpi_ds_method_data_get_value (opcode,
-					  stack_desc->reference.offset, walk_state, &obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status = acpi_ds_method_data_get_value(opcode,
+							       stack_desc->
+							       reference.offset,
+							       walk_state,
+							       &obj_desc);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] value_obj is %p\n",
-				stack_desc->reference.offset, obj_desc));
+			ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+					  "[Arg/Local %X] value_obj is %p\n",
+					  stack_desc->reference.offset,
+					  obj_desc));
 
 			/*
 			 * Now we can delete the original Reference Object and
 			 * replace it with the resolved value
 			 */
-			acpi_ut_remove_reference (stack_desc);
+			acpi_ut_remove_reference(stack_desc);
 			*stack_ptr = obj_desc;
 			break;
 
-
 		case AML_INDEX_OP:
 
 			switch (stack_desc->reference.target_type) {
@@ -218,7 +211,6 @@ acpi_ex_resolve_object_to_value (
 				/* Just return - leave the Reference on the stack */
 				break;
 
-
 			case ACPI_TYPE_PACKAGE:
 
 				obj_desc = *stack_desc->reference.where;
@@ -228,36 +220,31 @@ acpi_ex_resolve_object_to_value (
 					 * (i.e., dereference the package index)
 					 * Delete the ref object, increment the returned object
 					 */
-					acpi_ut_remove_reference (stack_desc);
-					acpi_ut_add_reference (obj_desc);
+					acpi_ut_remove_reference(stack_desc);
+					acpi_ut_add_reference(obj_desc);
 					*stack_ptr = obj_desc;
-				}
-				else {
+				} else {
 					/*
 					 * A NULL object descriptor means an unitialized element of
 					 * the package, can't dereference it
 					 */
-					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-						"Attempt to deref an Index to NULL pkg element Idx=%p\n",
-						stack_desc));
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "Attempt to deref an Index to NULL pkg element Idx=%p\n",
+							  stack_desc));
 					status = AE_AML_UNINITIALIZED_ELEMENT;
 				}
 				break;
 
-
 			default:
 
 				/* Invalid reference object */
 
-				ACPI_REPORT_ERROR ((
-					"During resolve, Unknown target_type %X in Index/Reference obj %p\n",
-					stack_desc->reference.target_type, stack_desc));
+				ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc));
 				status = AE_AML_INTERNAL;
 				break;
 			}
 			break;
 
-
 		case AML_REF_OF_OP:
 		case AML_DEBUG_OP:
 		case AML_LOAD_OP:
@@ -266,60 +253,58 @@ acpi_ex_resolve_object_to_value (
 
 			break;
 
-		case AML_INT_NAMEPATH_OP:   /* Reference to a named object */
+		case AML_INT_NAMEPATH_OP:	/* Reference to a named object */
 
 			/* Get the object pointed to by the namespace node */
 
 			*stack_ptr = (stack_desc->reference.node)->object;
-			acpi_ut_add_reference (*stack_ptr);
-			acpi_ut_remove_reference (stack_desc);
+			acpi_ut_add_reference(*stack_ptr);
+			acpi_ut_remove_reference(stack_desc);
 			break;
 
 		default:
 
-			ACPI_REPORT_ERROR ((
-				"During resolve, Unknown Reference opcode %X (%s) in %p\n",
-				opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
+			ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc));
 			status = AE_AML_INTERNAL;
 			break;
 		}
 		break;
 
-
 	case ACPI_TYPE_BUFFER:
 
-		status = acpi_ds_get_buffer_arguments (stack_desc);
+		status = acpi_ds_get_buffer_arguments(stack_desc);
 		break;
 
-
 	case ACPI_TYPE_PACKAGE:
 
-		status = acpi_ds_get_package_arguments (stack_desc);
+		status = acpi_ds_get_package_arguments(stack_desc);
 		break;
 
-
-	/* These cases may never happen here, but just in case.. */
+		/* These cases may never happen here, but just in case.. */
 
 	case ACPI_TYPE_BUFFER_FIELD:
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 	case ACPI_TYPE_LOCAL_BANK_FIELD:
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read source_desc=%p Type=%X\n",
-			stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc)));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "field_read source_desc=%p Type=%X\n",
+				  stack_desc,
+				  ACPI_GET_OBJECT_TYPE(stack_desc)));
 
-		status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc);
-		*stack_ptr = (void *) obj_desc;
+		status =
+		    acpi_ex_read_data_from_field(walk_state, stack_desc,
+						 &obj_desc);
+		*stack_ptr = (void *)obj_desc;
 		break;
 
 	default:
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_resolve_multiple
@@ -337,42 +322,44 @@ acpi_ex_resolve_object_to_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_resolve_multiple (
-	struct acpi_walk_state          *walk_state,
-	union acpi_operand_object       *operand,
-	acpi_object_type                *return_type,
-	union acpi_operand_object       **return_desc)
+acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
+			 union acpi_operand_object *operand,
+			 acpi_object_type * return_type,
+			 union acpi_operand_object **return_desc)
 {
-	union acpi_operand_object       *obj_desc = (void *) operand;
-	struct acpi_namespace_node      *node;
-	acpi_object_type                type;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple");
+	union acpi_operand_object *obj_desc = (void *)operand;
+	struct acpi_namespace_node *node;
+	acpi_object_type type;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple");
 
 	/* Operand can be either a namespace node or an operand descriptor */
 
-	switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+	switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
 	case ACPI_DESC_TYPE_OPERAND:
 		type = obj_desc->common.type;
 		break;
 
 	case ACPI_DESC_TYPE_NAMED:
-		type = ((struct acpi_namespace_node *) obj_desc)->type;
-		obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc);
+		type = ((struct acpi_namespace_node *)obj_desc)->type;
+		obj_desc =
+		    acpi_ns_get_attached_object((struct acpi_namespace_node *)
+						obj_desc);
 
 		/* If we had an Alias node, use the attached object for type info */
 
 		if (type == ACPI_TYPE_LOCAL_ALIAS) {
-			type = ((struct acpi_namespace_node *) obj_desc)->type;
-			obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc);
+			type = ((struct acpi_namespace_node *)obj_desc)->type;
+			obj_desc =
+			    acpi_ns_get_attached_object((struct
+							 acpi_namespace_node *)
+							obj_desc);
 		}
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 	}
 
 	/* If type is anything other than a reference, we are done */
@@ -387,7 +374,7 @@ acpi_ex_resolve_multiple (
 	 * of the object_type and size_of operators). This means traversing
 	 * the list of possibly many nested references.
 	 */
-	while (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
+	while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
 		switch (obj_desc->reference.opcode) {
 		case AML_REF_OF_OP:
 
@@ -397,31 +384,29 @@ acpi_ex_resolve_multiple (
 
 			/* All "References" point to a NS node */
 
-			if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
-				ACPI_REPORT_ERROR ((
-					"acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
-					node, acpi_ut_get_descriptor_name (node)));
-				return_ACPI_STATUS (AE_AML_INTERNAL);
+			if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
+			    ACPI_DESC_TYPE_NAMED) {
+				ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
+				return_ACPI_STATUS(AE_AML_INTERNAL);
 			}
 
 			/* Get the attached object */
 
-			obj_desc = acpi_ns_get_attached_object (node);
+			obj_desc = acpi_ns_get_attached_object(node);
 			if (!obj_desc) {
 				/* No object, use the NS node type */
 
-				type = acpi_ns_get_type (node);
+				type = acpi_ns_get_type(node);
 				goto exit;
 			}
 
 			/* Check for circular references */
 
 			if (obj_desc == operand) {
-				return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
+				return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
 			}
 			break;
 
-
 		case AML_INDEX_OP:
 
 			/* Get the type of this reference (index into another object) */
@@ -442,12 +427,11 @@ acpi_ex_resolve_multiple (
 			if (!obj_desc) {
 				/* NULL package elements are allowed */
 
-				type = 0; /* Uninitialized */
+				type = 0;	/* Uninitialized */
 				goto exit;
 			}
 			break;
 
-
 		case AML_INT_NAMEPATH_OP:
 
 			/* Dereference the reference pointer */
@@ -456,50 +440,61 @@ acpi_ex_resolve_multiple (
 
 			/* All "References" point to a NS node */
 
-			if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
-				ACPI_REPORT_ERROR ((
-					"acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
-					node, acpi_ut_get_descriptor_name (node)));
-			   return_ACPI_STATUS (AE_AML_INTERNAL);
+			if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
+			    ACPI_DESC_TYPE_NAMED) {
+				ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
+				return_ACPI_STATUS(AE_AML_INTERNAL);
 			}
 
 			/* Get the attached object */
 
-			obj_desc = acpi_ns_get_attached_object (node);
+			obj_desc = acpi_ns_get_attached_object(node);
 			if (!obj_desc) {
 				/* No object, use the NS node type */
 
-				type = acpi_ns_get_type (node);
+				type = acpi_ns_get_type(node);
 				goto exit;
 			}
 
 			/* Check for circular references */
 
 			if (obj_desc == operand) {
-				return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
+				return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
 			}
 			break;
 
-
 		case AML_LOCAL_OP:
 		case AML_ARG_OP:
 
 			if (return_desc) {
-				status = acpi_ds_method_data_get_value (obj_desc->reference.opcode,
-						 obj_desc->reference.offset, walk_state, &obj_desc);
-				if (ACPI_FAILURE (status)) {
-					return_ACPI_STATUS (status);
+				status =
+				    acpi_ds_method_data_get_value(obj_desc->
+								  reference.
+								  opcode,
+								  obj_desc->
+								  reference.
+								  offset,
+								  walk_state,
+								  &obj_desc);
+				if (ACPI_FAILURE(status)) {
+					return_ACPI_STATUS(status);
 				}
-				acpi_ut_remove_reference (obj_desc);
-			}
-			else {
-				status = acpi_ds_method_data_get_node (obj_desc->reference.opcode,
-						 obj_desc->reference.offset, walk_state, &node);
-				if (ACPI_FAILURE (status)) {
-					return_ACPI_STATUS (status);
+				acpi_ut_remove_reference(obj_desc);
+			} else {
+				status =
+				    acpi_ds_method_data_get_node(obj_desc->
+								 reference.
+								 opcode,
+								 obj_desc->
+								 reference.
+								 offset,
+								 walk_state,
+								 &node);
+				if (ACPI_FAILURE(status)) {
+					return_ACPI_STATUS(status);
 				}
 
-				obj_desc = acpi_ns_get_attached_object (node);
+				obj_desc = acpi_ns_get_attached_object(node);
 				if (!obj_desc) {
 					type = ACPI_TYPE_ANY;
 					goto exit;
@@ -507,7 +502,6 @@ acpi_ex_resolve_multiple (
 			}
 			break;
 
-
 		case AML_DEBUG_OP:
 
 			/* The Debug Object is of type "debug_object" */
@@ -515,13 +509,10 @@ acpi_ex_resolve_multiple (
 			type = ACPI_TYPE_DEBUG_OBJECT;
 			goto exit;
 
-
 		default:
 
-			ACPI_REPORT_ERROR ((
-				"acpi_ex_resolve_multiple: Unknown Reference subtype %X\n",
-				obj_desc->reference.opcode));
-			return_ACPI_STATUS (AE_AML_INTERNAL);
+			ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode));
+			return_ACPI_STATUS(AE_AML_INTERNAL);
 		}
 	}
 
@@ -529,10 +520,9 @@ acpi_ex_resolve_multiple (
 	 * Now we are guaranteed to have an object that has not been created
 	 * via the ref_of or Index operators.
 	 */
-	type = ACPI_GET_OBJECT_TYPE (obj_desc);
+	type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
-
-exit:
+      exit:
 	/* Convert internal types to external types */
 
 	switch (type) {
@@ -559,7 +549,5 @@ exit:
 	if (return_desc) {
 		*return_desc = obj_desc;
 	}
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-
-

+ 197 - 193
drivers/acpi/executer/exresop.c

@@ -42,24 +42,18 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acparser.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exresop")
+ACPI_MODULE_NAME("exresop")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_check_object_type (
-	acpi_object_type                type_needed,
-	acpi_object_type                this_type,
-	void                            *object);
-
+acpi_ex_check_object_type(acpi_object_type type_needed,
+			  acpi_object_type this_type, void *object);
 
 /*******************************************************************************
  *
@@ -76,13 +70,10 @@ acpi_ex_check_object_type (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_check_object_type (
-	acpi_object_type                type_needed,
-	acpi_object_type                this_type,
-	void                            *object)
+acpi_ex_check_object_type(acpi_object_type type_needed,
+			  acpi_object_type this_type, void *object)
 {
-	ACPI_FUNCTION_NAME ("ex_check_object_type");
-
+	ACPI_FUNCTION_NAME("ex_check_object_type");
 
 	if (type_needed == ACPI_TYPE_ANY) {
 		/* All types OK, so we don't perform any typechecks */
@@ -97,16 +88,17 @@ acpi_ex_check_object_type (
 		 * specification, a store to a constant is a noop.)
 		 */
 		if ((this_type == ACPI_TYPE_INTEGER) &&
-			(((union acpi_operand_object *) object)->common.flags & AOPOBJ_AML_CONSTANT)) {
+		    (((union acpi_operand_object *)object)->common.
+		     flags & AOPOBJ_AML_CONSTANT)) {
 			return (AE_OK);
 		}
 	}
 
 	if (type_needed != this_type) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Needed [%s], found [%s] %p\n",
-			acpi_ut_get_type_name (type_needed),
-			acpi_ut_get_type_name (this_type), object));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Needed [%s], found [%s] %p\n",
+				  acpi_ut_get_type_name(type_needed),
+				  acpi_ut_get_type_name(this_type), object));
 
 		return (AE_AML_OPERAND_TYPE);
 	}
@@ -114,7 +106,6 @@ acpi_ex_check_object_type (
 	return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_resolve_operands
@@ -137,41 +128,37 @@ acpi_ex_check_object_type (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_resolve_operands (
-	u16                             opcode,
-	union acpi_operand_object       **stack_ptr,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_operands(u16 opcode,
+			 union acpi_operand_object ** stack_ptr,
+			 struct acpi_walk_state * walk_state)
 {
-	union acpi_operand_object       *obj_desc;
-	acpi_status                     status = AE_OK;
-	u8                              object_type;
-	void                            *temp_node;
-	u32                             arg_types;
-	const struct acpi_opcode_info   *op_info;
-	u32                             this_arg_type;
-	acpi_object_type                type_needed;
-	u16                             target_op = 0;
-
-
-	ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode);
-
-
-	op_info = acpi_ps_get_opcode_info (opcode);
+	union acpi_operand_object *obj_desc;
+	acpi_status status = AE_OK;
+	u8 object_type;
+	void *temp_node;
+	u32 arg_types;
+	const struct acpi_opcode_info *op_info;
+	u32 this_arg_type;
+	acpi_object_type type_needed;
+	u16 target_op = 0;
+
+	ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode);
+
+	op_info = acpi_ps_get_opcode_info(opcode);
 	if (op_info->class == AML_CLASS_UNKNOWN) {
-		return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+		return_ACPI_STATUS(AE_AML_BAD_OPCODE);
 	}
 
 	arg_types = op_info->runtime_args;
 	if (arg_types == ARGI_INVALID_OPCODE) {
-		ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n",
-			opcode));
+		ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode));
 
-		return_ACPI_STATUS (AE_AML_INTERNAL);
+		return_ACPI_STATUS(AE_AML_INTERNAL);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-		"Opcode %X [%s] required_operand_types=%8.8X \n",
-		opcode, op_info->name, arg_types));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "Opcode %X [%s] required_operand_types=%8.8X \n",
+			  opcode, op_info->name, arg_types));
 
 	/*
 	 * Normal exit is with (arg_types == 0) at end of argument list.
@@ -180,12 +167,11 @@ acpi_ex_resolve_operands (
 	 * to) the required type; if stack underflows; or upon
 	 * finding a NULL stack entry (which should not happen).
 	 */
-	while (GET_CURRENT_ARG_TYPE (arg_types)) {
+	while (GET_CURRENT_ARG_TYPE(arg_types)) {
 		if (!stack_ptr || !*stack_ptr) {
-			ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n",
-				stack_ptr));
+			ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr));
 
-			return_ACPI_STATUS (AE_AML_INTERNAL);
+			return_ACPI_STATUS(AE_AML_INTERNAL);
 		}
 
 		/* Extract useful items */
@@ -194,37 +180,37 @@ acpi_ex_resolve_operands (
 
 		/* Decode the descriptor type */
 
-		switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+		switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
 		case ACPI_DESC_TYPE_NAMED:
 
 			/* Namespace Node */
 
-			object_type = ((struct acpi_namespace_node *) obj_desc)->type;
+			object_type =
+			    ((struct acpi_namespace_node *)obj_desc)->type;
 			break;
 
-
 		case ACPI_DESC_TYPE_OPERAND:
 
 			/* ACPI internal object */
 
-			object_type = ACPI_GET_OBJECT_TYPE (obj_desc);
+			object_type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
 			/* Check for bad acpi_object_type */
 
-			if (!acpi_ut_valid_object_type (object_type)) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Bad operand object type [%X]\n",
-					object_type));
+			if (!acpi_ut_valid_object_type(object_type)) {
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Bad operand object type [%X]\n",
+						  object_type));
 
-				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 			}
 
 			if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
 				/* Decode the Reference */
 
-				op_info = acpi_ps_get_opcode_info (opcode);
+				op_info = acpi_ps_get_opcode_info(opcode);
 				if (op_info->class == AML_CLASS_UNKNOWN) {
-					return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+					return_ACPI_STATUS(AE_AML_BAD_OPCODE);
 				}
 
 				switch (obj_desc->reference.opcode) {
@@ -238,51 +224,62 @@ acpi_ex_resolve_operands (
 				case AML_REF_OF_OP:
 				case AML_ARG_OP:
 				case AML_LOCAL_OP:
-				case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
-				case AML_INT_NAMEPATH_OP: /* Reference to a named object */
-
-					ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-						"Operand is a Reference, ref_opcode [%s]\n",
-						(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)));
+				case AML_LOAD_OP:	/* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
+				case AML_INT_NAMEPATH_OP:	/* Reference to a named object */
+
+					ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
+								((ACPI_DB_EXEC,
+								  "Operand is a Reference, ref_opcode [%s]\n",
+								  (acpi_ps_get_opcode_info
+								   (obj_desc->
+								    reference.
+								    opcode))->
+								  name)));
 					break;
 
 				default:
-					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-						"Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
-						obj_desc->reference.opcode,
-						(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name));
-
-					return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
+							  obj_desc->reference.
+							  opcode,
+							  (acpi_ps_get_opcode_info
+							   (obj_desc->reference.
+							    opcode))->name));
+
+					return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 				}
 			}
 			break;
 
-
 		default:
 
 			/* Invalid descriptor */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Invalid descriptor %p [%s]\n",
-					obj_desc, acpi_ut_get_descriptor_name (obj_desc)));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Invalid descriptor %p [%s]\n",
+					  obj_desc,
+					  acpi_ut_get_descriptor_name
+					  (obj_desc)));
 
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		/* Get one argument type, point to the next */
 
-		this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
-		INCREMENT_ARG_LIST (arg_types);
+		this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
+		INCREMENT_ARG_LIST(arg_types);
 
 		/*
 		 * Handle cases where the object does not need to be
 		 * resolved to a value
 		 */
 		switch (this_arg_type) {
-		case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
+		case ARGI_REF_OR_STRING:	/* Can be a String or Reference */
 
-			if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
-				(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
+			if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
+			     ACPI_DESC_TYPE_OPERAND)
+			    && (ACPI_GET_OBJECT_TYPE(obj_desc) ==
+				ACPI_TYPE_STRING)) {
 				/*
 				 * String found - the string references a named object and
 				 * must be resolved to a node
@@ -296,39 +293,40 @@ acpi_ex_resolve_operands (
 			 */
 			/*lint -fallthrough */
 
-		case ARGI_REFERENCE:            /* References: */
+		case ARGI_REFERENCE:	/* References: */
 		case ARGI_INTEGER_REF:
 		case ARGI_OBJECT_REF:
 		case ARGI_DEVICE_REF:
-		case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
-		case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
-		case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
+		case ARGI_TARGETREF:	/* Allows implicit conversion rules before store */
+		case ARGI_FIXED_TARGET:	/* No implicit conversion before store to target */
+		case ARGI_SIMPLE_TARGET:	/* Name, Local, or Arg - no implicit conversion  */
 
 			/*
 			 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
 			 * A Namespace Node is OK as-is
 			 */
-			if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
+			if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
+			    ACPI_DESC_TYPE_NAMED) {
 				goto next_operand;
 			}
 
-			status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE,
-					  object_type, obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status =
+			    acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
+						      object_type, obj_desc);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 
 			if (obj_desc->reference.opcode == AML_NAME_OP) {
 				/* Convert a named reference to the actual named object */
 
 				temp_node = obj_desc->reference.object;
-				acpi_ut_remove_reference (obj_desc);
+				acpi_ut_remove_reference(obj_desc);
 				(*stack_ptr) = temp_node;
 			}
 			goto next_operand;
 
-
-		case ARGI_DATAREFOBJ:  /* Store operator only */
+		case ARGI_DATAREFOBJ:	/* Store operator only */
 
 			/*
 			 * We don't want to resolve index_op reference objects during
@@ -337,8 +335,10 @@ acpi_ex_resolve_operands (
 			 * -- All others must be resolved below.
 			 */
 			if ((opcode == AML_STORE_OP) &&
-				(ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) &&
-				((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
+			    (ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
+			     ACPI_TYPE_LOCAL_REFERENCE)
+			    && ((*stack_ptr)->reference.opcode ==
+				AML_INDEX_OP)) {
 				goto next_operand;
 			}
 			break;
@@ -351,9 +351,9 @@ acpi_ex_resolve_operands (
 		/*
 		 * Resolve this object to a value
 		 */
-		status = acpi_ex_resolve_to_value (stack_ptr, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/* Get the resolved object */
@@ -364,10 +364,10 @@ acpi_ex_resolve_operands (
 		 * Check the resulting object (value) type
 		 */
 		switch (this_arg_type) {
-		/*
-		 * For the simple cases, only one type of resolved object
-		 * is allowed
-		 */
+			/*
+			 * For the simple cases, only one type of resolved object
+			 * is allowed
+			 */
 		case ARGI_MUTEX:
 
 			/* Need an operand of type ACPI_TYPE_MUTEX */
@@ -382,7 +382,7 @@ acpi_ex_resolve_operands (
 			type_needed = ACPI_TYPE_EVENT;
 			break;
 
-		case ARGI_PACKAGE:   /* Package */
+		case ARGI_PACKAGE:	/* Package */
 
 			/* Need an operand of type ACPI_TYPE_PACKAGE */
 
@@ -403,10 +403,9 @@ acpi_ex_resolve_operands (
 			type_needed = ACPI_TYPE_LOCAL_REFERENCE;
 			break;
 
-
-		/*
-		 * The more complex cases allow multiple resolved object types
-		 */
+			/*
+			 * The more complex cases allow multiple resolved object types
+			 */
 		case ARGI_INTEGER:
 
 			/*
@@ -414,25 +413,27 @@ acpi_ex_resolve_operands (
 			 * But we can implicitly convert from a STRING or BUFFER
 			 * Aka - "Implicit Source Operand Conversion"
 			 */
-			status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16);
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
+			if (ACPI_FAILURE(status)) {
 				if (status == AE_TYPE) {
-					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-						"Needed [Integer/String/Buffer], found [%s] %p\n",
-						acpi_ut_get_object_type_name (obj_desc), obj_desc));
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "Needed [Integer/String/Buffer], found [%s] %p\n",
+							  acpi_ut_get_object_type_name
+							  (obj_desc),
+							  obj_desc));
 
-					return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+					return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 				}
 
-				return_ACPI_STATUS (status);
+				return_ACPI_STATUS(status);
 			}
 
 			if (obj_desc != *stack_ptr) {
-				acpi_ut_remove_reference (obj_desc);
+				acpi_ut_remove_reference(obj_desc);
 			}
 			goto next_operand;
 
-
 		case ARGI_BUFFER:
 
 			/*
@@ -440,25 +441,26 @@ acpi_ex_resolve_operands (
 			 * But we can implicitly convert from a STRING or INTEGER
 			 * Aka - "Implicit Source Operand Conversion"
 			 */
-			status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
+			if (ACPI_FAILURE(status)) {
 				if (status == AE_TYPE) {
-					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-						"Needed [Integer/String/Buffer], found [%s] %p\n",
-						acpi_ut_get_object_type_name (obj_desc), obj_desc));
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "Needed [Integer/String/Buffer], found [%s] %p\n",
+							  acpi_ut_get_object_type_name
+							  (obj_desc),
+							  obj_desc));
 
-					return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+					return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 				}
 
-				return_ACPI_STATUS (status);
+				return_ACPI_STATUS(status);
 			}
 
 			if (obj_desc != *stack_ptr) {
-				acpi_ut_remove_reference (obj_desc);
+				acpi_ut_remove_reference(obj_desc);
 			}
 			goto next_operand;
 
-
 		case ARGI_STRING:
 
 			/*
@@ -466,83 +468,86 @@ acpi_ex_resolve_operands (
 			 * But we can implicitly convert from a BUFFER or INTEGER
 			 * Aka - "Implicit Source Operand Conversion"
 			 */
-			status = acpi_ex_convert_to_string (obj_desc, stack_ptr,
-					 ACPI_IMPLICIT_CONVERT_HEX);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ex_convert_to_string(obj_desc, stack_ptr,
+							   ACPI_IMPLICIT_CONVERT_HEX);
+			if (ACPI_FAILURE(status)) {
 				if (status == AE_TYPE) {
-					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-						"Needed [Integer/String/Buffer], found [%s] %p\n",
-						acpi_ut_get_object_type_name (obj_desc), obj_desc));
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "Needed [Integer/String/Buffer], found [%s] %p\n",
+							  acpi_ut_get_object_type_name
+							  (obj_desc),
+							  obj_desc));
 
-					return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+					return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 				}
 
-				return_ACPI_STATUS (status);
+				return_ACPI_STATUS(status);
 			}
 
 			if (obj_desc != *stack_ptr) {
-				acpi_ut_remove_reference (obj_desc);
+				acpi_ut_remove_reference(obj_desc);
 			}
 			goto next_operand;
 
-
 		case ARGI_COMPUTEDATA:
 
 			/* Need an operand of type INTEGER, STRING or BUFFER */
 
-			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 			case ACPI_TYPE_INTEGER:
 			case ACPI_TYPE_STRING:
 			case ACPI_TYPE_BUFFER:
 
 				/* Valid operand */
-			   break;
+				break;
 
 			default:
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed [Integer/String/Buffer], found [%s] %p\n",
-					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Needed [Integer/String/Buffer], found [%s] %p\n",
+						  acpi_ut_get_object_type_name
+						  (obj_desc), obj_desc));
 
-				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 			}
 			goto next_operand;
 
-
 		case ARGI_BUFFER_OR_STRING:
 
 			/* Need an operand of type STRING or BUFFER */
 
-			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 			case ACPI_TYPE_STRING:
 			case ACPI_TYPE_BUFFER:
 
 				/* Valid operand */
-			   break;
+				break;
 
 			case ACPI_TYPE_INTEGER:
 
 				/* Highest priority conversion is to type Buffer */
 
-				status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
-				if (ACPI_FAILURE (status)) {
-					return_ACPI_STATUS (status);
+				status =
+				    acpi_ex_convert_to_buffer(obj_desc,
+							      stack_ptr);
+				if (ACPI_FAILURE(status)) {
+					return_ACPI_STATUS(status);
 				}
 
 				if (obj_desc != *stack_ptr) {
-					acpi_ut_remove_reference (obj_desc);
+					acpi_ut_remove_reference(obj_desc);
 				}
 				break;
 
 			default:
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed [Integer/String/Buffer], found [%s] %p\n",
-					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Needed [Integer/String/Buffer], found [%s] %p\n",
+						  acpi_ut_get_object_type_name
+						  (obj_desc), obj_desc));
 
-				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 			}
 			goto next_operand;
 
-
 		case ARGI_DATAOBJECT:
 			/*
 			 * ARGI_DATAOBJECT is only used by the size_of operator.
@@ -551,7 +556,7 @@ acpi_ex_resolve_operands (
 			 * The only reference allowed here is a direct reference to
 			 * a namespace node.
 			 */
-			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 			case ACPI_TYPE_PACKAGE:
 			case ACPI_TYPE_STRING:
 			case ACPI_TYPE_BUFFER:
@@ -561,20 +566,20 @@ acpi_ex_resolve_operands (
 				break;
 
 			default:
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed [Buffer/String/Package/Reference], found [%s] %p\n",
-					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
+						  acpi_ut_get_object_type_name
+						  (obj_desc), obj_desc));
 
-				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 			}
 			goto next_operand;
 
-
 		case ARGI_COMPLEXOBJ:
 
 			/* Need a buffer or package or (ACPI 2.0) String */
 
-			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 			case ACPI_TYPE_PACKAGE:
 			case ACPI_TYPE_STRING:
 			case ACPI_TYPE_BUFFER:
@@ -583,20 +588,20 @@ acpi_ex_resolve_operands (
 				break;
 
 			default:
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed [Buffer/String/Package], found [%s] %p\n",
-					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Needed [Buffer/String/Package], found [%s] %p\n",
+						  acpi_ut_get_object_type_name
+						  (obj_desc), obj_desc));
 
-				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 			}
 			goto next_operand;
 
-
 		case ARGI_REGION_OR_FIELD:
 
 			/* Need an operand of type REGION or a FIELD in a region */
 
-			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 			case ACPI_TYPE_REGION:
 			case ACPI_TYPE_LOCAL_REGION_FIELD:
 			case ACPI_TYPE_LOCAL_BANK_FIELD:
@@ -606,20 +611,20 @@ acpi_ex_resolve_operands (
 				break;
 
 			default:
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed [Region/region_field], found [%s] %p\n",
-					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Needed [Region/region_field], found [%s] %p\n",
+						  acpi_ut_get_object_type_name
+						  (obj_desc), obj_desc));
 
-				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 			}
 			goto next_operand;
 
-
 		case ARGI_DATAREFOBJ:
 
 			/* Used by the Store() operator only */
 
-			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 			case ACPI_TYPE_INTEGER:
 			case ACPI_TYPE_PACKAGE:
 			case ACPI_TYPE_STRING:
@@ -651,47 +656,46 @@ acpi_ex_resolve_operands (
 					break;
 				}
 
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
-					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
+						  acpi_ut_get_object_type_name
+						  (obj_desc), obj_desc));
 
-				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 			}
 			goto next_operand;
 
-
 		default:
 
 			/* Unknown type */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Internal - Unknown ARGI (required operand) type %X\n",
-				this_arg_type));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Internal - Unknown ARGI (required operand) type %X\n",
+					  this_arg_type));
 
-			return_ACPI_STATUS (AE_BAD_PARAMETER);
+			return_ACPI_STATUS(AE_BAD_PARAMETER);
 		}
 
 		/*
 		 * Make sure that the original object was resolved to the
 		 * required object type (Simple cases only).
 		 */
-		status = acpi_ex_check_object_type (type_needed,
-				  ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ex_check_object_type(type_needed,
+						   ACPI_GET_OBJECT_TYPE
+						   (*stack_ptr), *stack_ptr);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
-next_operand:
+	      next_operand:
 		/*
 		 * If more operands needed, decrement stack_ptr to point
 		 * to next operand on stack
 		 */
-		if (GET_CURRENT_ARG_TYPE (arg_types)) {
+		if (GET_CURRENT_ARG_TYPE(arg_types)) {
 			stack_ptr--;
 		}
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 208 - 207
drivers/acpi/executer/exstore.c

@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
@@ -50,24 +49,18 @@
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exstore")
+ACPI_MODULE_NAME("exstore")
 
 /* Local prototypes */
-
 static void
-acpi_ex_do_debug_object (
-	union acpi_operand_object       *source_desc,
-	u32                             level,
-	u32                             index);
+acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
+			u32 level, u32 index);
 
 static acpi_status
-acpi_ex_store_object_to_index (
-	union acpi_operand_object       *val_desc,
-	union acpi_operand_object       *dest_desc,
-	struct acpi_walk_state          *walk_state);
-
+acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
+			      union acpi_operand_object *dest_desc,
+			      struct acpi_walk_state *walk_state);
 
 /*******************************************************************************
  *
@@ -84,136 +77,146 @@ acpi_ex_store_object_to_index (
  ******************************************************************************/
 
 static void
-acpi_ex_do_debug_object (
-	union acpi_operand_object       *source_desc,
-	u32                             level,
-	u32                             index)
+acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
+			u32 level, u32 index)
 {
-	u32                             i;
-
+	u32 i;
 
-	ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc);
+	ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc);
 
-
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
-		level, " "));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
+			      level, " "));
 
 	/* Display index for package output only */
 
 	if (index > 0) {
-	   ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
-		   "(%.2u) ", index -1));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+				      "(%.2u) ", index - 1));
 	}
 
 	if (!source_desc) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
 		return_VOID;
 	}
 
-	if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
-			acpi_ut_get_object_type_name (source_desc)));
+	if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ",
+				      acpi_ut_get_object_type_name
+				      (source_desc)));
 
-		if (!acpi_ut_valid_internal_object (source_desc)) {
-		   ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
-			   "%p, Invalid Internal Object!\n", source_desc));
-		   return_VOID;
+		if (!acpi_ut_valid_internal_object(source_desc)) {
+			ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+					      "%p, Invalid Internal Object!\n",
+					      source_desc));
+			return_VOID;
 		}
-	}
-	else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
-			acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type),
-			source_desc));
+	} else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
+		   ACPI_DESC_TYPE_NAMED) {
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
+				      acpi_ut_get_type_name(((struct
+							      acpi_namespace_node
+							      *)source_desc)->
+							    type),
+				      source_desc));
 		return_VOID;
-	}
-	else {
+	} else {
 		return_VOID;
 	}
 
-	switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
 	case ACPI_TYPE_INTEGER:
 
 		/* Output correct integer width */
 
 		if (acpi_gbl_integer_byte_width == 4) {
-			ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
-				(u32) source_desc->integer.value));
-		}
-		else {
-			ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
-				ACPI_FORMAT_UINT64 (source_desc->integer.value)));
+			ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
+					      (u32) source_desc->integer.
+					      value));
+		} else {
+			ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+					      "0x%8.8X%8.8X\n",
+					      ACPI_FORMAT_UINT64(source_desc->
+								 integer.
+								 value)));
 		}
 		break;
 
 	case ACPI_TYPE_BUFFER:
 
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
-			(u32) source_desc->buffer.length));
-		ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
-			(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
+				      (u32) source_desc->buffer.length));
+		ACPI_DUMP_BUFFER(source_desc->buffer.pointer,
+				 (source_desc->buffer.length <
+				  32) ? source_desc->buffer.length : 32);
 		break;
 
 	case ACPI_TYPE_STRING:
 
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
-			source_desc->string.length, source_desc->string.pointer));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
+				      source_desc->string.length,
+				      source_desc->string.pointer));
 		break;
 
 	case ACPI_TYPE_PACKAGE:
 
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
-			source_desc->package.count));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+				      "[0x%.2X Elements]\n",
+				      source_desc->package.count));
 
 		/* Output the entire contents of the package */
 
 		for (i = 0; i < source_desc->package.count; i++) {
-			acpi_ex_do_debug_object (source_desc->package.elements[i],
-				level+4, i+1);
+			acpi_ex_do_debug_object(source_desc->package.
+						elements[i], level + 4, i + 1);
 		}
 		break;
 
 	case ACPI_TYPE_LOCAL_REFERENCE:
 
 		if (source_desc->reference.opcode == AML_INDEX_OP) {
-			ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
-				acpi_ps_get_opcode_name (source_desc->reference.opcode),
-				source_desc->reference.offset));
+			ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+					      "[%s, 0x%X]\n",
+					      acpi_ps_get_opcode_name
+					      (source_desc->reference.opcode),
+					      source_desc->reference.offset));
+		} else {
+			ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
+					      acpi_ps_get_opcode_name
+					      (source_desc->reference.opcode)));
 		}
-		else {
-			ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
-				acpi_ps_get_opcode_name (source_desc->reference.opcode)));
-		}
-
 
 		if (source_desc->reference.object) {
-			if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) ==
-					ACPI_DESC_TYPE_NAMED) {
-				acpi_ex_do_debug_object (((struct acpi_namespace_node *)
-					source_desc->reference.object)->object,
-					level+4, 0);
+			if (ACPI_GET_DESCRIPTOR_TYPE
+			    (source_desc->reference.object) ==
+			    ACPI_DESC_TYPE_NAMED) {
+				acpi_ex_do_debug_object(((struct
+							  acpi_namespace_node *)
+							 source_desc->reference.
+							 object)->object,
+							level + 4, 0);
+			} else {
+				acpi_ex_do_debug_object(source_desc->reference.
+							object, level + 4, 0);
 			}
-			else {
-				acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0);
-			}
-		}
-		else if (source_desc->reference.node) {
-			acpi_ex_do_debug_object ((source_desc->reference.node)->object,
-				level+4, 0);
+		} else if (source_desc->reference.node) {
+			acpi_ex_do_debug_object((source_desc->reference.node)->
+						object, level + 4, 0);
 		}
 		break;
 
 	default:
 
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
-			source_desc, acpi_ut_get_object_type_name (source_desc)));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
+				      source_desc,
+				      acpi_ut_get_object_type_name
+				      (source_desc)));
 		break;
 	}
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n"));
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store
@@ -235,42 +238,41 @@ acpi_ex_do_debug_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store (
-	union acpi_operand_object       *source_desc,
-	union acpi_operand_object       *dest_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_store(union acpi_operand_object *source_desc,
+	      union acpi_operand_object *dest_desc,
+	      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *ref_desc = dest_desc;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_store", dest_desc);
+	acpi_status status = AE_OK;
+	union acpi_operand_object *ref_desc = dest_desc;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc);
 
 	/* Validate parameters */
 
 	if (!source_desc || !dest_desc) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
-		return_ACPI_STATUS (AE_AML_NO_OPERAND);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n"));
+		return_ACPI_STATUS(AE_AML_NO_OPERAND);
 	}
 
 	/* dest_desc can be either a namespace node or an ACPI object */
 
-	if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) {
+	if (ACPI_GET_DESCRIPTOR_TYPE(dest_desc) == ACPI_DESC_TYPE_NAMED) {
 		/*
 		 * Dest is a namespace node,
 		 * Storing an object into a Named node.
 		 */
-		status = acpi_ex_store_object_to_node (source_desc,
-				 (struct acpi_namespace_node *) dest_desc, walk_state,
-				 ACPI_IMPLICIT_CONVERSION);
+		status = acpi_ex_store_object_to_node(source_desc,
+						      (struct
+						       acpi_namespace_node *)
+						      dest_desc, walk_state,
+						      ACPI_IMPLICIT_CONVERSION);
 
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Destination object must be a Reference or a Constant object */
 
-	switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
 	case ACPI_TYPE_LOCAL_REFERENCE:
 		break;
 
@@ -279,7 +281,7 @@ acpi_ex_store (
 		/* Allow stores to Constants -- a Noop as per ACPI spec */
 
 		if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) {
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 
 		/*lint -fallthrough */
@@ -288,16 +290,18 @@ acpi_ex_store (
 
 		/* Destination is not a Reference object */
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Target is not a Reference or Constant object - %s [%p]\n",
-			acpi_ut_get_object_type_name (dest_desc), dest_desc));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Target is not a Reference or Constant object - %s [%p]\n",
+				  acpi_ut_get_object_type_name(dest_desc),
+				  dest_desc));
 
-		ACPI_DUMP_STACK_ENTRY (source_desc);
-		ACPI_DUMP_STACK_ENTRY (dest_desc);
-		ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
-				  2, "Target is not a Reference or Constant object");
+		ACPI_DUMP_STACK_ENTRY(source_desc);
+		ACPI_DUMP_STACK_ENTRY(dest_desc);
+		ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
+				   2,
+				   "Target is not a Reference or Constant object");
 
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 	}
 
 	/*
@@ -314,58 +318,59 @@ acpi_ex_store (
 
 		/* Storing an object into a Name "container" */
 
-		status = acpi_ex_store_object_to_node (source_desc,
-				 ref_desc->reference.object,
-				 walk_state, ACPI_IMPLICIT_CONVERSION);
+		status = acpi_ex_store_object_to_node(source_desc,
+						      ref_desc->reference.
+						      object, walk_state,
+						      ACPI_IMPLICIT_CONVERSION);
 		break;
 
-
 	case AML_INDEX_OP:
 
 		/* Storing to an Index (pointer into a packager or buffer) */
 
-		status = acpi_ex_store_object_to_index (source_desc, ref_desc, walk_state);
+		status =
+		    acpi_ex_store_object_to_index(source_desc, ref_desc,
+						  walk_state);
 		break;
 
-
 	case AML_LOCAL_OP:
 	case AML_ARG_OP:
 
 		/* Store to a method local/arg  */
 
-		status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
-				 ref_desc->reference.offset, source_desc, walk_state);
+		status =
+		    acpi_ds_store_object_to_local(ref_desc->reference.opcode,
+						  ref_desc->reference.offset,
+						  source_desc, walk_state);
 		break;
 
-
 	case AML_DEBUG_OP:
 
 		/*
 		 * Storing to the Debug object causes the value stored to be
 		 * displayed and otherwise has no effect -- see ACPI Specification
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"**** Write to Debug Object: Object %p %s ****:\n\n",
-			source_desc, acpi_ut_get_object_type_name (source_desc)));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "**** Write to Debug Object: Object %p %s ****:\n\n",
+				  source_desc,
+				  acpi_ut_get_object_type_name(source_desc)));
 
-		acpi_ex_do_debug_object (source_desc, 0, 0);
+		acpi_ex_do_debug_object(source_desc, 0, 0);
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("ex_store: Unknown Reference opcode %X\n",
-			ref_desc->reference.opcode));
-		ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR);
+		ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n",
+				   ref_desc->reference.opcode));
+		ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR);
 
 		status = AE_AML_INTERNAL;
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_object_to_index
@@ -381,20 +386,17 @@ acpi_ex_store (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_store_object_to_index (
-	union acpi_operand_object       *source_desc,
-	union acpi_operand_object       *index_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
+			      union acpi_operand_object *index_desc,
+			      struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *new_desc;
-	u8                              value = 0;
-	u32                             i;
-
-
-	ACPI_FUNCTION_TRACE ("ex_store_object_to_index");
+	acpi_status status = AE_OK;
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *new_desc;
+	u8 value = 0;
+	u32 i;
 
+	ACPI_FUNCTION_TRACE("ex_store_object_to_index");
 
 	/*
 	 * Destination must be a reference pointer, and
@@ -413,19 +415,20 @@ acpi_ex_store_object_to_index (
 		 */
 		obj_desc = *(index_desc->reference.where);
 
-		status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
+						    walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		if (obj_desc) {
 			/* Decrement reference count by the ref count of the parent package */
 
-			for (i = 0;
-				 i < ((union acpi_operand_object *)
-						index_desc->reference.object)->common.reference_count;
-				 i++) {
-				acpi_ut_remove_reference (obj_desc);
+			for (i = 0; i < ((union acpi_operand_object *)
+					 index_desc->reference.object)->common.
+			     reference_count; i++) {
+				acpi_ut_remove_reference(obj_desc);
 			}
 		}
 
@@ -433,16 +436,14 @@ acpi_ex_store_object_to_index (
 
 		/* Increment ref count by the ref count of the parent package-1 */
 
-		for (i = 1;
-			 i < ((union acpi_operand_object *)
-					index_desc->reference.object)->common.reference_count;
-			 i++) {
-			acpi_ut_add_reference (new_desc);
+		for (i = 1; i < ((union acpi_operand_object *)
+				 index_desc->reference.object)->common.
+		     reference_count; i++) {
+			acpi_ut_add_reference(new_desc);
 		}
 
 		break;
 
-
 	case ACPI_TYPE_BUFFER_FIELD:
 
 		/*
@@ -460,16 +461,16 @@ acpi_ex_store_object_to_index (
 		 * by the INDEX_OP code.
 		 */
 		obj_desc = index_desc->reference.object;
-		if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) &&
-			(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		if ((ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_BUFFER) &&
+		    (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_STRING)) {
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		/*
 		 * The assignment of the individual elements will be slightly
 		 * different for each source type.
 		 */
-		switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
+		switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
 		case ACPI_TYPE_INTEGER:
 
 			/* Use the least-significant byte of the integer */
@@ -489,10 +490,11 @@ acpi_ex_store_object_to_index (
 
 			/* All other types are invalid */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Source must be Integer/Buffer/String type, not %s\n",
-				acpi_ut_get_object_type_name (source_desc)));
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Source must be Integer/Buffer/String type, not %s\n",
+					  acpi_ut_get_object_type_name
+					  (source_desc)));
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		/* Store the source value into the target buffer byte */
@@ -500,18 +502,16 @@ acpi_ex_store_object_to_index (
 		obj_desc->buffer.pointer[index_desc->reference.offset] = value;
 		break;
 
-
 	default:
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Target is not a Package or buffer_field\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Target is not a Package or buffer_field\n"));
 		status = AE_AML_OPERAND_TYPE;
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_object_to_node
@@ -539,37 +539,35 @@ acpi_ex_store_object_to_index (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store_object_to_node (
-	union acpi_operand_object       *source_desc,
-	struct acpi_namespace_node      *node,
-	struct acpi_walk_state          *walk_state,
-	u8                              implicit_conversion)
+acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
+			     struct acpi_namespace_node *node,
+			     struct acpi_walk_state *walk_state,
+			     u8 implicit_conversion)
 {
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *target_desc;
-	union acpi_operand_object       *new_desc;
-	acpi_object_type                target_type;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc);
+	acpi_status status = AE_OK;
+	union acpi_operand_object *target_desc;
+	union acpi_operand_object *new_desc;
+	acpi_object_type target_type;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc);
 
 	/* Get current type of the node, and object attached to Node */
 
-	target_type = acpi_ns_get_type (node);
-	target_desc = acpi_ns_get_attached_object (node);
+	target_type = acpi_ns_get_type(node);
+	target_desc = acpi_ns_get_attached_object(node);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
-		source_desc, acpi_ut_get_object_type_name (source_desc),
-			  node, acpi_ut_get_type_name (target_type)));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
+			  source_desc,
+			  acpi_ut_get_object_type_name(source_desc), node,
+			  acpi_ut_get_type_name(target_type)));
 
 	/*
 	 * Resolve the source object to an actual value
 	 * (If it is a reference object)
 	 */
-	status = acpi_ex_resolve_object (&source_desc, target_type, walk_state);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ex_resolve_object(&source_desc, target_type, walk_state);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* If no implicit conversion, drop into the default case below */
@@ -590,11 +588,10 @@ acpi_ex_store_object_to_node (
 
 		/* For fields, copy the source data to the target field. */
 
-		status = acpi_ex_write_data_to_field (source_desc, target_desc,
-				 &walk_state->result_obj);
+		status = acpi_ex_write_data_to_field(source_desc, target_desc,
+						     &walk_state->result_obj);
 		break;
 
-
 	case ACPI_TYPE_INTEGER:
 	case ACPI_TYPE_STRING:
 	case ACPI_TYPE_BUFFER:
@@ -605,10 +602,11 @@ acpi_ex_store_object_to_node (
 		 *
 		 * Copy and/or convert the source object to a new target object
 		 */
-		status = acpi_ex_store_object_to_object (source_desc, target_desc,
-				 &new_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ex_store_object_to_object(source_desc, target_desc,
+						   &new_desc, walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		if (new_desc != target_desc) {
@@ -621,30 +619,33 @@ acpi_ex_store_object_to_node (
 			 * has been performed such that the node/object type has been
 			 * changed.
 			 */
-			status = acpi_ns_attach_object (node, new_desc, new_desc->common.type);
-
-			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-				"Store %s into %s via Convert/Attach\n",
-				acpi_ut_get_object_type_name (source_desc),
-				acpi_ut_get_object_type_name (new_desc)));
+			status =
+			    acpi_ns_attach_object(node, new_desc,
+						  new_desc->common.type);
+
+			ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+					  "Store %s into %s via Convert/Attach\n",
+					  acpi_ut_get_object_type_name
+					  (source_desc),
+					  acpi_ut_get_object_type_name
+					  (new_desc)));
 		}
 		break;
 
-
 	default:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"Storing %s (%p) directly into node (%p) with no implicit conversion\n",
-			acpi_ut_get_object_type_name (source_desc), source_desc, node));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
+				  acpi_ut_get_object_type_name(source_desc),
+				  source_desc, node));
 
 		/* No conversions for all other types.  Just attach the source object */
 
-		status = acpi_ns_attach_object (node, source_desc,
-				 ACPI_GET_OBJECT_TYPE (source_desc));
+		status = acpi_ns_attach_object(node, source_desc,
+					       ACPI_GET_OBJECT_TYPE
+					       (source_desc));
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 61 - 60
drivers/acpi/executer/exstoren.c

@@ -43,15 +43,12 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exstoren")
-
+ACPI_MODULE_NAME("exstoren")
 
 /*******************************************************************************
  *
@@ -67,19 +64,15 @@
  *              it and return the actual object in the source_desc_ptr.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_resolve_object (
-	union acpi_operand_object       **source_desc_ptr,
-	acpi_object_type                target_type,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
+		       acpi_object_type target_type,
+		       struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *source_desc = *source_desc_ptr;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ex_resolve_object");
+	union acpi_operand_object *source_desc = *source_desc_ptr;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ex_resolve_object");
 
 	/* Ensure we have a Target that can be stored to */
 
@@ -102,11 +95,14 @@ acpi_ex_resolve_object (
 		 * are all essentially the same.  This case handles the
 		 * "interchangeable" types Integer, String, and Buffer.
 		 */
-		if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
+		if (ACPI_GET_OBJECT_TYPE(source_desc) ==
+		    ACPI_TYPE_LOCAL_REFERENCE) {
 			/* Resolve a reference object first */
 
-			status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
-			if (ACPI_FAILURE (status)) {
+			status =
+			    acpi_ex_resolve_to_value(source_desc_ptr,
+						     walk_state);
+			if (ACPI_FAILURE(status)) {
 				break;
 			}
 		}
@@ -119,31 +115,32 @@ acpi_ex_resolve_object (
 
 		/* Must have a Integer, Buffer, or String */
 
-		if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER)   &&
-			(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER)    &&
-			(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)    &&
-			!((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
+		if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) &&
+		    (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) &&
+		    (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
+		    !((ACPI_GET_OBJECT_TYPE(source_desc) ==
+		       ACPI_TYPE_LOCAL_REFERENCE)
+		      && (source_desc->reference.opcode == AML_LOAD_OP))) {
 			/* Conversion successful but still not a valid type */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
-				acpi_ut_get_object_type_name (source_desc),
-				acpi_ut_get_type_name (target_type)));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+					  acpi_ut_get_object_type_name
+					  (source_desc),
+					  acpi_ut_get_type_name(target_type)));
 			status = AE_AML_OPERAND_TYPE;
 		}
 		break;
 
-
 	case ACPI_TYPE_LOCAL_ALIAS:
 	case ACPI_TYPE_LOCAL_METHOD_ALIAS:
 
 		/* Aliases are resolved by acpi_ex_prep_operands */
 
-		ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
+		ACPI_REPORT_ERROR(("Store into Alias - should never happen\n"));
 		status = AE_AML_INTERNAL;
 		break;
 
-
 	case ACPI_TYPE_PACKAGE:
 	default:
 
@@ -154,10 +151,9 @@ acpi_ex_resolve_object (
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_object_to_object
@@ -194,18 +190,15 @@ acpi_ex_resolve_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store_object_to_object (
-	union acpi_operand_object       *source_desc,
-	union acpi_operand_object       *dest_desc,
-	union acpi_operand_object       **new_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
+			       union acpi_operand_object *dest_desc,
+			       union acpi_operand_object **new_desc,
+			       struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *actual_src_desc;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_object", source_desc);
+	union acpi_operand_object *actual_src_desc;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc);
 
 	actual_src_desc = source_desc;
 	if (!dest_desc) {
@@ -214,11 +207,14 @@ acpi_ex_store_object_to_object (
 		 * package element), so we can simply copy the source object
 		 * creating a new destination object
 		 */
-		status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state);
-		return_ACPI_STATUS (status);
+		status =
+		    acpi_ut_copy_iobject_to_iobject(actual_src_desc, new_desc,
+						    walk_state);
+		return_ACPI_STATUS(status);
 	}
 
-	if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) {
+	if (ACPI_GET_OBJECT_TYPE(source_desc) !=
+	    ACPI_GET_OBJECT_TYPE(dest_desc)) {
 		/*
 		 * The source type does not match the type of the destination.
 		 * Perform the "implicit conversion" of the source to the current type
@@ -228,10 +224,13 @@ acpi_ex_store_object_to_object (
 		 * Otherwise, actual_src_desc is a temporary object to hold the
 		 * converted object.
 		 */
-		status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc),
-				  source_desc, &actual_src_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE
+						   (dest_desc), source_desc,
+						   &actual_src_desc,
+						   walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		if (source_desc == actual_src_desc) {
@@ -240,7 +239,7 @@ acpi_ex_store_object_to_object (
 			 * new object.
 			 */
 			*new_desc = source_desc;
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 	}
 
@@ -248,38 +247,42 @@ acpi_ex_store_object_to_object (
 	 * We now have two objects of identical types, and we can perform a
 	 * copy of the *value* of the source object.
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
+	switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
 	case ACPI_TYPE_INTEGER:
 
 		dest_desc->integer.value = actual_src_desc->integer.value;
 
 		/* Truncate value if we are executing from a 32-bit ACPI table */
 
-		acpi_ex_truncate_for32bit_table (dest_desc);
+		acpi_ex_truncate_for32bit_table(dest_desc);
 		break;
 
 	case ACPI_TYPE_STRING:
 
-		status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc);
+		status =
+		    acpi_ex_store_string_to_string(actual_src_desc, dest_desc);
 		break;
 
 	case ACPI_TYPE_BUFFER:
 
-		status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
+		status =
+		    acpi_ex_store_buffer_to_buffer(actual_src_desc, dest_desc);
 		break;
 
 	case ACPI_TYPE_PACKAGE:
 
-		status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc,
-				 walk_state);
+		status =
+		    acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc,
+						    walk_state);
 		break;
 
 	default:
 		/*
 		 * All other types come here.
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
-			acpi_ut_get_object_type_name (dest_desc)));
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "Store into type %s not implemented\n",
+				  acpi_ut_get_object_type_name(dest_desc)));
 
 		status = AE_NOT_IMPLEMENTED;
 		break;
@@ -288,11 +291,9 @@ acpi_ex_store_object_to_object (
 	if (actual_src_desc != source_desc) {
 		/* Delete the intermediate (temporary) source object */
 
-		acpi_ut_remove_reference (actual_src_desc);
+		acpi_ut_remove_reference(actual_src_desc);
 	}
 
 	*new_desc = dest_desc;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 36 - 50
drivers/acpi/executer/exstorob.c

@@ -42,14 +42,11 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exstorob")
-
+ACPI_MODULE_NAME("exstorob")
 
 /*******************************************************************************
  *
@@ -63,18 +60,14 @@
  * DESCRIPTION: Copy a buffer object to another buffer object.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_store_buffer_to_buffer (
-	union acpi_operand_object       *source_desc,
-	union acpi_operand_object       *target_desc)
+acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
+			       union acpi_operand_object *target_desc)
 {
-	u32                             length;
-	u8                              *buffer;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_store_buffer_to_buffer", source_desc);
+	u32 length;
+	u8 *buffer;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc);
 
 	/* We know that source_desc is a buffer by now */
 
@@ -86,10 +79,10 @@ acpi_ex_store_buffer_to_buffer (
 	 * allocate a new buffer of the proper length
 	 */
 	if ((target_desc->buffer.length == 0) ||
-		(target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
-		target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length);
+	    (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
+		target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length);
 		if (!target_desc->buffer.pointer) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		target_desc->buffer.length = length;
@@ -100,8 +93,9 @@ acpi_ex_store_buffer_to_buffer (
 	if (length <= target_desc->buffer.length) {
 		/* Clear existing buffer and copy in the new one */
 
-		ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length);
-		ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length);
+		ACPI_MEMSET(target_desc->buffer.pointer, 0,
+			    target_desc->buffer.length);
+		ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);
 
 #ifdef ACPI_OBSOLETE_BEHAVIOR
 		/*
@@ -124,26 +118,24 @@ acpi_ex_store_buffer_to_buffer (
 			target_desc->buffer.length = length;
 		}
 #endif
-	}
-	else {
+	} else {
 		/* Truncate the source, copy only what will fit */
 
-		ACPI_MEMCPY (target_desc->buffer.pointer, buffer,
-			target_desc->buffer.length);
+		ACPI_MEMCPY(target_desc->buffer.pointer, buffer,
+			    target_desc->buffer.length);
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-			"Truncating source buffer from %X to %X\n",
-			length, target_desc->buffer.length));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Truncating source buffer from %X to %X\n",
+				  length, target_desc->buffer.length));
 	}
 
 	/* Copy flags */
 
 	target_desc->buffer.flags = source_desc->buffer.flags;
 	target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_string_to_string
@@ -158,16 +150,13 @@ acpi_ex_store_buffer_to_buffer (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store_string_to_string (
-	union acpi_operand_object       *source_desc,
-	union acpi_operand_object       *target_desc)
+acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
+			       union acpi_operand_object *target_desc)
 {
-	u32                             length;
-	u8                              *buffer;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_store_string_to_string", source_desc);
+	u32 length;
+	u8 *buffer;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc);
 
 	/* We know that source_desc is a string by now */
 
@@ -179,41 +168,38 @@ acpi_ex_store_string_to_string (
 	 * pointer is not a static pointer (part of an ACPI table)
 	 */
 	if ((length < target_desc->string.length) &&
-	   (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+	    (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
 		/*
 		 * String will fit in existing non-static buffer.
 		 * Clear old string and copy in the new one
 		 */
-		ACPI_MEMSET (target_desc->string.pointer, 0,
-			(acpi_size) target_desc->string.length + 1);
-		ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
-	}
-	else {
+		ACPI_MEMSET(target_desc->string.pointer, 0,
+			    (acpi_size) target_desc->string.length + 1);
+		ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
+	} else {
 		/*
 		 * Free the current buffer, then allocate a new buffer
 		 * large enough to hold the value
 		 */
 		if (target_desc->string.pointer &&
-		   (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+		    (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
 			/* Only free if not a pointer into the DSDT */
 
-			ACPI_MEM_FREE (target_desc->string.pointer);
+			ACPI_MEM_FREE(target_desc->string.pointer);
 		}
 
-		target_desc->string.pointer = ACPI_MEM_CALLOCATE (
-				   (acpi_size) length + 1);
+		target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size)
+								 length + 1);
 		if (!target_desc->string.pointer) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
-		ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
+		ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
 	}
 
 	/* Set the new target length */
 
 	target_desc->string.length = length;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-
-

+ 72 - 111
drivers/acpi/executer/exsystem.c

@@ -42,14 +42,12 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exsystem")
-
+ACPI_MODULE_NAME("exsystem")
 
 /*******************************************************************************
  *
@@ -65,49 +63,42 @@
  *              interpreter is released.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_system_wait_semaphore (
-	acpi_handle                     semaphore,
-	u16                             timeout)
+acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
 {
-	acpi_status                     status;
-	acpi_status                     status2;
-
+	acpi_status status;
+	acpi_status status2;
 
-	ACPI_FUNCTION_TRACE ("ex_system_wait_semaphore");
+	ACPI_FUNCTION_TRACE("ex_system_wait_semaphore");
 
-
-	status = acpi_os_wait_semaphore (semaphore, 1, 0);
-	if (ACPI_SUCCESS (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_os_wait_semaphore(semaphore, 1, 0);
+	if (ACPI_SUCCESS(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	if (status == AE_TIME) {
 		/* We must wait, so unlock the interpreter */
 
-		acpi_ex_exit_interpreter ();
+		acpi_ex_exit_interpreter();
 
-		status = acpi_os_wait_semaphore (semaphore, 1, timeout);
+		status = acpi_os_wait_semaphore(semaphore, 1, timeout);
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"*** Thread awake after blocking, %s\n",
-			acpi_format_exception (status)));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "*** Thread awake after blocking, %s\n",
+				  acpi_format_exception(status)));
 
 		/* Reacquire the interpreter */
 
-		status2 = acpi_ex_enter_interpreter ();
-		if (ACPI_FAILURE (status2)) {
+		status2 = acpi_ex_enter_interpreter();
+		if (ACPI_FAILURE(status2)) {
 			/* Report fatal error, could not acquire interpreter */
 
-			return_ACPI_STATUS (status2);
+			return_ACPI_STATUS(status2);
 		}
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_do_stall
@@ -125,35 +116,29 @@ acpi_ex_system_wait_semaphore (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_do_stall (
-	u32                             how_long)
+acpi_status acpi_ex_system_do_stall(u32 how_long)
 {
-	acpi_status                     status = AE_OK;
-
+	acpi_status status = AE_OK;
 
-	ACPI_FUNCTION_ENTRY ();
+	ACPI_FUNCTION_ENTRY();
 
-
-	if (how_long > 255) /* 255 microseconds */ {
+	if (how_long > 255) {	/* 255 microseconds */
 		/*
 		 * Longer than 255 usec, this is an error
 		 *
 		 * (ACPI specifies 100 usec as max, but this gives some slack in
 		 * order to support existing BIOSs)
 		 */
-		ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n",
-			how_long));
+		ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n",
+				   how_long));
 		status = AE_AML_OPERAND_VALUE;
-	}
-	else {
-		acpi_os_stall (how_long);
+	} else {
+		acpi_os_stall(how_long);
 	}
 
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_do_suspend
@@ -167,29 +152,24 @@ acpi_ex_system_do_stall (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_do_suspend (
-	acpi_integer                    how_long)
+acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	acpi_status status;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/* Since this thread will sleep, we must release the interpreter */
 
-	acpi_ex_exit_interpreter ();
+	acpi_ex_exit_interpreter();
 
-	acpi_os_sleep (how_long);
+	acpi_os_sleep(how_long);
 
 	/* And now we must get the interpreter again */
 
-	status = acpi_ex_enter_interpreter ();
+	status = acpi_ex_enter_interpreter();
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_acquire_mutex
@@ -206,33 +186,30 @@ acpi_ex_system_do_suspend (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_system_acquire_mutex (
-	union acpi_operand_object       *time_desc,
-	union acpi_operand_object       *obj_desc)
+acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc,
+			     union acpi_operand_object * obj_desc)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_system_acquire_mutex", obj_desc);
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc);
 
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Support for the _GL_ Mutex object -- go get the global lock */
 
 	if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
-		status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
-		return_ACPI_STATUS (status);
+		status =
+		    acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
-			 (u16) time_desc->integer.value);
-	return_ACPI_STATUS (status);
+	status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore,
+					       (u16) time_desc->integer.value);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_release_mutex
@@ -248,32 +225,27 @@ acpi_ex_system_acquire_mutex (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_release_mutex (
-	union acpi_operand_object       *obj_desc)
+acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ex_system_release_mutex");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ex_system_release_mutex");
 
 	if (!obj_desc) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Support for the _GL_ Mutex object -- release the global lock */
 
 	if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
-		status = acpi_ev_release_global_lock ();
-		return_ACPI_STATUS (status);
+		status = acpi_ev_release_global_lock();
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1);
-	return_ACPI_STATUS (status);
+	status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_signal_event
@@ -287,24 +259,19 @@ acpi_ex_system_release_mutex (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_signal_event (
-	union acpi_operand_object       *obj_desc)
+acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ex_system_signal_event");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ex_system_signal_event");
 
 	if (obj_desc) {
-		status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1);
+		status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_wait_event
@@ -321,25 +288,23 @@ acpi_ex_system_signal_event (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_system_wait_event (
-	union acpi_operand_object       *time_desc,
-	union acpi_operand_object       *obj_desc)
+acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
+			  union acpi_operand_object *obj_desc)
 {
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE ("ex_system_wait_event");
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE("ex_system_wait_event");
 
 	if (obj_desc) {
-		status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
-				 (u16) time_desc->integer.value);
+		status =
+		    acpi_ex_system_wait_semaphore(obj_desc->event.semaphore,
+						  (u16) time_desc->integer.
+						  value);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_reset_event
@@ -352,27 +317,23 @@ acpi_ex_system_wait_event (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_reset_event (
-	union acpi_operand_object       *obj_desc)
+acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc)
 {
-	acpi_status                     status = AE_OK;
-	void                            *temp_semaphore;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	acpi_status status = AE_OK;
+	void *temp_semaphore;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * We are going to simply delete the existing semaphore and
 	 * create a new one!
 	 */
-	status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
-	if (ACPI_SUCCESS (status)) {
-		(void) acpi_os_delete_semaphore (obj_desc->event.semaphore);
+	status =
+	    acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
+	if (ACPI_SUCCESS(status)) {
+		(void)acpi_os_delete_semaphore(obj_desc->event.semaphore);
 		obj_desc->event.semaphore = temp_semaphore;
 	}
 
 	return (status);
 }
-

+ 62 - 109
drivers/acpi/executer/exutils.c

@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * DEFINE_AML_GLOBALS is tested in amlcode.h
  * to determine whether certain global names should be "defined" or only
@@ -65,15 +64,10 @@
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exutils")
+ACPI_MODULE_NAME("exutils")
 
 /* Local prototypes */
-
-static u32
-acpi_ex_digits_needed (
-	acpi_integer                    value,
-	u32                             base);
-
+static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
@@ -89,24 +83,20 @@ acpi_ex_digits_needed (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_enter_interpreter (
-	void)
+acpi_status acpi_ex_enter_interpreter(void)
 {
-	acpi_status                     status;
-
-	ACPI_FUNCTION_TRACE ("ex_enter_interpreter");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ex_enter_interpreter");
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE);
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
+	status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n"));
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_exit_interpreter
@@ -129,25 +119,20 @@ acpi_ex_enter_interpreter (
  *
  ******************************************************************************/
 
-void
-acpi_ex_exit_interpreter (
-	void)
+void acpi_ex_exit_interpreter(void)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ex_exit_interpreter");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ex_exit_interpreter");
 
-	status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+	status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_ERROR(("Could not release interpreter mutex\n"));
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_truncate_for32bit_table
@@ -161,20 +146,17 @@ acpi_ex_exit_interpreter (
  *
  ******************************************************************************/
 
-void
-acpi_ex_truncate_for32bit_table (
-	union acpi_operand_object       *obj_desc)
+void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
 {
 
-	ACPI_FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * Object must be a valid number and we must be executing
 	 * a control method
 	 */
 	if ((!obj_desc) ||
-		(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER)) {
+	    (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) {
 		return;
 	}
 
@@ -187,7 +169,6 @@ acpi_ex_truncate_for32bit_table (
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_acquire_global_lock
@@ -203,37 +184,31 @@ acpi_ex_truncate_for32bit_table (
  *
  ******************************************************************************/
 
-u8
-acpi_ex_acquire_global_lock (
-	u32                             field_flags)
+u8 acpi_ex_acquire_global_lock(u32 field_flags)
 {
-	u8                              locked = FALSE;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ex_acquire_global_lock");
+	u8 locked = FALSE;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ex_acquire_global_lock");
 
 	/* Only attempt lock if the always_lock bit is set */
 
 	if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
 		/* We should attempt to get the lock, wait forever */
 
-		status = acpi_ev_acquire_global_lock (ACPI_WAIT_FOREVER);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
+		if (ACPI_SUCCESS(status)) {
 			locked = TRUE;
-		}
-		else {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Could not acquire Global Lock, %s\n",
-				acpi_format_exception (status)));
+		} else {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Could not acquire Global Lock, %s\n",
+					  acpi_format_exception(status)));
 		}
 	}
 
-	return_VALUE (locked);
+	return_VALUE(locked);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_release_global_lock
@@ -247,34 +222,28 @@ acpi_ex_acquire_global_lock (
  *
  ******************************************************************************/
 
-void
-acpi_ex_release_global_lock (
-	u8                              locked_by_me)
+void acpi_ex_release_global_lock(u8 locked_by_me)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ex_release_global_lock");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ex_release_global_lock");
 
 	/* Only attempt unlock if the caller locked it */
 
 	if (locked_by_me) {
 		/* OK, now release the lock */
 
-		status = acpi_ev_release_global_lock ();
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ev_release_global_lock();
+		if (ACPI_FAILURE(status)) {
 			/* Report the error, but there isn't much else we can do */
 
-			ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n",
-				acpi_format_exception (status)));
+			ACPI_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status)));
 		}
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_digits_needed
@@ -289,22 +258,17 @@ acpi_ex_release_global_lock (
  *
  ******************************************************************************/
 
-static u32
-acpi_ex_digits_needed (
-	acpi_integer                    value,
-	u32                             base)
+static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
 {
-	u32                             num_digits;
-	acpi_integer                    current_value;
-
-
-	ACPI_FUNCTION_TRACE ("ex_digits_needed");
+	u32 num_digits;
+	acpi_integer current_value;
 
+	ACPI_FUNCTION_TRACE("ex_digits_needed");
 
 	/* acpi_integer is unsigned, so we don't worry about a '-' prefix */
 
 	if (value == 0) {
-		return_VALUE (1);
+		return_VALUE(1);
 	}
 
 	current_value = value;
@@ -313,14 +277,14 @@ acpi_ex_digits_needed (
 	/* Count the digits in the requested base */
 
 	while (current_value) {
-		(void) acpi_ut_short_divide (current_value, base, &current_value, NULL);
+		(void)acpi_ut_short_divide(current_value, base, &current_value,
+					   NULL);
 		num_digits++;
 	}
 
-	return_VALUE (num_digits);
+	return_VALUE(num_digits);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_eisa_id_to_string
@@ -334,32 +298,26 @@ acpi_ex_digits_needed (
  *
  ******************************************************************************/
 
-void
-acpi_ex_eisa_id_to_string (
-	u32                             numeric_id,
-	char                            *out_string)
+void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string)
 {
-	u32                             eisa_id;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	u32 eisa_id;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/* Swap ID to big-endian to get contiguous bits */
 
-	eisa_id = acpi_ut_dword_byte_swap (numeric_id);
+	eisa_id = acpi_ut_dword_byte_swap(numeric_id);
 
-	out_string[0] = (char) ('@' + (((unsigned long) eisa_id >> 26) & 0x1f));
-	out_string[1] = (char) ('@' + ((eisa_id >> 21) & 0x1f));
-	out_string[2] = (char) ('@' + ((eisa_id >> 16) & 0x1f));
-	out_string[3] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 12);
-	out_string[4] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 8);
-	out_string[5] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 4);
-	out_string[6] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 0);
+	out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f));
+	out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f));
+	out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f));
+	out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12);
+	out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8);
+	out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4);
+	out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0);
 	out_string[7] = 0;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_unsigned_integer_to_string
@@ -374,25 +332,20 @@ acpi_ex_eisa_id_to_string (
  *
  ******************************************************************************/
 
-void
-acpi_ex_unsigned_integer_to_string (
-	acpi_integer                    value,
-	char                            *out_string)
+void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string)
 {
-	u32                             count;
-	u32                             digits_needed;
-	u32                             remainder;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	u32 count;
+	u32 digits_needed;
+	u32 remainder;
 
+	ACPI_FUNCTION_ENTRY();
 
-	digits_needed = acpi_ex_digits_needed (value, 10);
+	digits_needed = acpi_ex_digits_needed(value, 10);
 	out_string[digits_needed] = 0;
 
 	for (count = digits_needed; count > 0; count--) {
-		(void) acpi_ut_short_divide (value, 10, &value, &remainder);
-		out_string[count-1] = (char) ('0' + remainder);\
+		(void)acpi_ut_short_divide(value, 10, &value, &remainder);
+		out_string[count - 1] = (char)('0' + remainder);
 	}
 }
 

+ 54 - 71
drivers/acpi/fan.c

@@ -34,49 +34,45 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_FAN_COMPONENT		0x00200000
 #define ACPI_FAN_CLASS			"fan"
 #define ACPI_FAN_DRIVER_NAME		"ACPI Fan Driver"
 #define ACPI_FAN_FILE_STATE		"state"
 
 #define _COMPONENT		ACPI_FAN_COMPONENT
-ACPI_MODULE_NAME		("acpi_fan")
+ACPI_MODULE_NAME("acpi_fan")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_fan_add (struct acpi_device *device);
-static int acpi_fan_remove (struct acpi_device *device, int type);
+static int acpi_fan_add(struct acpi_device *device);
+static int acpi_fan_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_fan_driver = {
-	.name =		ACPI_FAN_DRIVER_NAME,
-	.class =	ACPI_FAN_CLASS,
-	.ids =		"PNP0C0B",
-	.ops =		{
-				.add =		acpi_fan_add,
-				.remove =	acpi_fan_remove,
-			},
+	.name = ACPI_FAN_DRIVER_NAME,
+	.class = ACPI_FAN_CLASS,
+	.ids = "PNP0C0B",
+	.ops = {
+		.add = acpi_fan_add,
+		.remove = acpi_fan_remove,
+		},
 };
 
 struct acpi_fan {
-	acpi_handle		handle;
+	acpi_handle handle;
 };
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry	*acpi_fan_dir;
-
+static struct proc_dir_entry *acpi_fan_dir;
 
-static int
-acpi_fan_read_state(struct seq_file *seq, void *offset)
+static int acpi_fan_read_state(struct seq_file *seq, void *offset)
 {
-	struct acpi_fan		*fan = seq->private;
-	int			state = 0;
+	struct acpi_fan *fan = seq->private;
+	int state = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_fan_read_state");
 
@@ -85,7 +81,7 @@ acpi_fan_read_state(struct seq_file *seq, void *offset)
 			seq_printf(seq, "status:                  ERROR\n");
 		else
 			seq_printf(seq, "status:                  %s\n",
-				     !state?"on":"off");
+				   !state ? "on" : "off");
 	}
 	return_VALUE(0);
 }
@@ -96,26 +92,26 @@ static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
 }
 
 static ssize_t
-acpi_fan_write_state(struct file *file, const char __user *buffer, 
-		     size_t count, loff_t *ppos)
+acpi_fan_write_state(struct file *file, const char __user * buffer,
+		     size_t count, loff_t * ppos)
 {
-	int			result = 0;
-	struct seq_file		*m = (struct seq_file *)file->private_data;
-	struct acpi_fan		*fan = (struct acpi_fan *) m->private;
-	char			state_string[12] = {'\0'};
+	int result = 0;
+	struct seq_file *m = (struct seq_file *)file->private_data;
+	struct acpi_fan *fan = (struct acpi_fan *)m->private;
+	char state_string[12] = { '\0' };
 
 	ACPI_FUNCTION_TRACE("acpi_fan_write_state");
 
 	if (!fan || (count > sizeof(state_string) - 1))
 		return_VALUE(-EINVAL);
-	
+
 	if (copy_from_user(state_string, buffer, count))
 		return_VALUE(-EFAULT);
-	
+
 	state_string[count] = '\0';
-	
-	result = acpi_bus_set_power(fan->handle, 
-		simple_strtoul(state_string, NULL, 0));
+
+	result = acpi_bus_set_power(fan->handle,
+				    simple_strtoul(state_string, NULL, 0));
 	if (result)
 		return_VALUE(result);
 
@@ -123,18 +119,17 @@ acpi_fan_write_state(struct file *file, const char __user *buffer,
 }
 
 static struct file_operations acpi_fan_state_ops = {
-	.open		= acpi_fan_state_open_fs,
-	.read		= seq_read,
-	.write		= acpi_fan_write_state,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_fan_state_open_fs,
+	.read = seq_read,
+	.write = acpi_fan_write_state,
+	.llseek = seq_lseek,
+	.release = single_release,
 	.owner = THIS_MODULE,
 };
 
-static int
-acpi_fan_add_fs(struct acpi_device *device)
+static int acpi_fan_add_fs(struct acpi_device *device)
 {
-	struct proc_dir_entry	*entry = NULL;
+	struct proc_dir_entry *entry = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_fan_add_fs");
 
@@ -143,7 +138,7 @@ acpi_fan_add_fs(struct acpi_device *device)
 
 	if (!acpi_device_dir(device)) {
 		acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-			acpi_fan_dir);
+						     acpi_fan_dir);
 		if (!acpi_device_dir(device))
 			return_VALUE(-ENODEV);
 		acpi_device_dir(device)->owner = THIS_MODULE;
@@ -151,11 +146,12 @@ acpi_fan_add_fs(struct acpi_device *device)
 
 	/* 'status' [R/W] */
 	entry = create_proc_entry(ACPI_FAN_FILE_STATE,
-		S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+				  S_IFREG | S_IRUGO | S_IWUSR,
+				  acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create '%s' fs entry\n",
-			ACPI_FAN_FILE_STATE));
+				  "Unable to create '%s' fs entry\n",
+				  ACPI_FAN_FILE_STATE));
 	else {
 		entry->proc_fops = &acpi_fan_state_ops;
 		entry->data = acpi_driver_data(device);
@@ -165,15 +161,12 @@ acpi_fan_add_fs(struct acpi_device *device)
 	return_VALUE(0);
 }
 
-
-static int
-acpi_fan_remove_fs(struct acpi_device *device)
+static int acpi_fan_remove_fs(struct acpi_device *device)
 {
 	ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
 
 	if (acpi_device_dir(device)) {
-		remove_proc_entry(ACPI_FAN_FILE_STATE,
-				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
 		acpi_device_dir(device) = NULL;
 	}
@@ -181,17 +174,15 @@ acpi_fan_remove_fs(struct acpi_device *device)
 	return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static int
-acpi_fan_add(struct acpi_device *device)
+static int acpi_fan_add(struct acpi_device *device)
 {
-	int			result = 0;
-	struct acpi_fan		*fan = NULL;
-	int			state = 0;
+	int result = 0;
+	struct acpi_fan *fan = NULL;
+	int state = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_fan_add");
 
@@ -211,7 +202,7 @@ acpi_fan_add(struct acpi_device *device)
 	result = acpi_bus_get_power(fan->handle, &state);
 	if (result) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error reading power state\n"));
+				  "Error reading power state\n"));
 		goto end;
 	}
 
@@ -220,19 +211,17 @@ acpi_fan_add(struct acpi_device *device)
 		goto end;
 
 	printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
-		acpi_device_name(device), acpi_device_bid(device),
-		!device->power.state?"on":"off");
+	       acpi_device_name(device), acpi_device_bid(device),
+	       !device->power.state ? "on" : "off");
 
-end:
+      end:
 	if (result)
 		kfree(fan);
 
 	return_VALUE(result);
 }
 
-
-static int
-acpi_fan_remove(struct acpi_device *device, int type)
+static int acpi_fan_remove(struct acpi_device *device, int type)
 {
 	struct acpi_fan *fan = NULL;
 
@@ -241,7 +230,7 @@ acpi_fan_remove(struct acpi_device *device, int type)
 	if (!device || !acpi_driver_data(device))
 		return_VALUE(-EINVAL);
 
-	fan = (struct acpi_fan *) acpi_driver_data(device);
+	fan = (struct acpi_fan *)acpi_driver_data(device);
 
 	acpi_fan_remove_fs(device);
 
@@ -250,9 +239,7 @@ acpi_fan_remove(struct acpi_device *device, int type)
 	return_VALUE(0);
 }
 
-
-static int __init
-acpi_fan_init(void)
+static int __init acpi_fan_init(void)
 {
 	int result = 0;
 
@@ -272,9 +259,7 @@ acpi_fan_init(void)
 	return_VALUE(0);
 }
 
-
-static void __exit
-acpi_fan_exit(void)
+static void __exit acpi_fan_exit(void)
 {
 	ACPI_FUNCTION_TRACE("acpi_fan_exit");
 
@@ -285,7 +270,5 @@ acpi_fan_exit(void)
 	return_VOID;
 }
 
-
 module_init(acpi_fan_init);
 module_exit(acpi_fan_exit);
-

+ 4 - 2
drivers/acpi/glue.c

@@ -29,7 +29,8 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
 		down_write(&bus_type_sem);
 		list_add_tail(&type->list, &bus_type_list);
 		up_write(&bus_type_sem);
-		printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name);
+		printk(KERN_INFO PREFIX "bus type %s registered\n",
+		       type->bus->name);
 		return 0;
 	}
 	return -ENODEV;
@@ -45,7 +46,8 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
 		down_write(&bus_type_sem);
 		list_del_init(&type->list);
 		up_write(&bus_type_sem);
-		printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name);
+		printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n",
+		       type->bus->name);
 		return 0;
 	}
 	return -ENODEV;

+ 51 - 65
drivers/acpi/hardware/hwacpi.c

@@ -42,13 +42,10 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 
-
 #define _COMPONENT          ACPI_HARDWARE
-	 ACPI_MODULE_NAME    ("hwacpi")
-
+ACPI_MODULE_NAME("hwacpi")
 
 /******************************************************************************
  *
@@ -62,36 +59,30 @@
  *              the FADT.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_hw_initialize (
-	void)
+acpi_status acpi_hw_initialize(void)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("hw_initialize");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("hw_initialize");
 
 	/* We must have the ACPI tables by the time we get here */
 
 	if (!acpi_gbl_FADT) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n"));
 
-		return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+		return_ACPI_STATUS(AE_NO_ACPI_TABLES);
 	}
 
 	/* Sanity check the FADT for valid values */
 
-	status = acpi_ut_validate_fadt ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_validate_fadt();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_set_mode
@@ -104,24 +95,21 @@ acpi_hw_initialize (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_set_mode (
-	u32                             mode)
+acpi_status acpi_hw_set_mode(u32 mode)
 {
 
-	acpi_status                     status;
-	u32                             retry;
-
+	acpi_status status;
+	u32 retry;
 
-	ACPI_FUNCTION_TRACE ("hw_set_mode");
+	ACPI_FUNCTION_TRACE("hw_set_mode");
 
 	/*
 	 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
 	 * system does not support mode transition.
 	 */
 	if (!acpi_gbl_FADT->smi_cmd) {
-		ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n"));
-		return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+		ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n"));
+		return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
 	}
 
 	/*
@@ -132,9 +120,8 @@ acpi_hw_set_mode (
 	 * transitions are not supported.
 	 */
 	if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
-		ACPI_REPORT_ERROR ((
-			"No ACPI mode transition supported in this system (enable/disable both zero)\n"));
-		return_ACPI_STATUS (AE_OK);
+		ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n"));
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	switch (mode) {
@@ -142,9 +129,11 @@ acpi_hw_set_mode (
 
 		/* BIOS should have disabled ALL fixed and GP events */
 
-		status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
-				  (u32) acpi_gbl_FADT->acpi_enable, 8);
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
+		status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
+					    (u32) acpi_gbl_FADT->acpi_enable,
+					    8);
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Attempting to enable ACPI mode\n"));
 		break;
 
 	case ACPI_SYS_MODE_LEGACY:
@@ -153,20 +142,21 @@ acpi_hw_set_mode (
 		 * BIOS should clear all fixed status bits and restore fixed event
 		 * enable bits to default
 		 */
-		status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
-				 (u32) acpi_gbl_FADT->acpi_disable, 8);
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-				 "Attempting to enable Legacy (non-ACPI) mode\n"));
+		status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
+					    (u32) acpi_gbl_FADT->acpi_disable,
+					    8);
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Attempting to enable Legacy (non-ACPI) mode\n"));
 		break;
 
 	default:
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_REPORT_ERROR (("Could not write mode change, %s\n",
-			acpi_format_exception (status)));
-		return_ACPI_STATUS (status);
+	if (ACPI_FAILURE(status)) {
+		ACPI_REPORT_ERROR(("Could not write mode change, %s\n",
+				   acpi_format_exception(status)));
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -176,19 +166,19 @@ acpi_hw_set_mode (
 	retry = 3000;
 	while (retry) {
 		if (acpi_hw_get_mode() == mode) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
-				mode));
-			return_ACPI_STATUS (AE_OK);
+			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+					  "Mode %X successfully enabled\n",
+					  mode));
+			return_ACPI_STATUS(AE_OK);
 		}
 		acpi_os_stall(1000);
 		retry--;
 	}
 
-	ACPI_REPORT_ERROR (("Hardware never changed modes\n"));
-	return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+	ACPI_REPORT_ERROR(("Hardware never changed modes\n"));
+	return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_hw_get_mode
@@ -202,34 +192,30 @@ acpi_hw_set_mode (
  *
  ******************************************************************************/
 
-u32
-acpi_hw_get_mode (
-	void)
+u32 acpi_hw_get_mode(void)
 {
-	acpi_status                     status;
-	u32                             value;
-
-
-	ACPI_FUNCTION_TRACE ("hw_get_mode");
+	acpi_status status;
+	u32 value;
 
+	ACPI_FUNCTION_TRACE("hw_get_mode");
 
 	/*
 	 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
 	 * system does not support mode transition.
 	 */
 	if (!acpi_gbl_FADT->smi_cmd) {
-		return_VALUE (ACPI_SYS_MODE_ACPI);
+		return_VALUE(ACPI_SYS_MODE_ACPI);
 	}
 
-	status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_VALUE (ACPI_SYS_MODE_LEGACY);
+	status =
+	    acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_VALUE(ACPI_SYS_MODE_LEGACY);
 	}
 
 	if (value) {
-		return_VALUE (ACPI_SYS_MODE_ACPI);
-	}
-	else {
-		return_VALUE (ACPI_SYS_MODE_LEGACY);
+		return_VALUE(ACPI_SYS_MODE_ACPI);
+	} else {
+		return_VALUE(ACPI_SYS_MODE_LEGACY);
 	}
 }

+ 82 - 115
drivers/acpi/hardware/hwgpe.c

@@ -46,15 +46,12 @@
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-	 ACPI_MODULE_NAME    ("hwgpe")
+ACPI_MODULE_NAME("hwgpe")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_hw_enable_wakeup_gpe_block (
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-	struct acpi_gpe_block_info      *gpe_block);
-
+acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+				struct acpi_gpe_block_info *gpe_block);
 
 /******************************************************************************
  *
@@ -71,15 +68,12 @@ acpi_hw_enable_wakeup_gpe_block (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_write_gpe_enable_reg (
-	struct acpi_gpe_event_info      *gpe_event_info)
+acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
 {
-	struct acpi_gpe_register_info   *gpe_register_info;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	struct acpi_gpe_register_info *gpe_register_info;
+	acpi_status status;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/* Get the info block for the entire GPE register */
 
@@ -90,13 +84,12 @@ acpi_hw_write_gpe_enable_reg (
 
 	/* Write the entire GPE (runtime) enable register */
 
-	status = acpi_hw_low_level_write (8, gpe_register_info->enable_for_run,
-			  &gpe_register_info->enable_address);
+	status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run,
+					 &gpe_register_info->enable_address);
 
 	return (status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_clear_gpe
@@ -109,27 +102,23 @@ acpi_hw_write_gpe_enable_reg (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_clear_gpe (
-	struct acpi_gpe_event_info      *gpe_event_info)
+acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	acpi_status status;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * Write a one to the appropriate bit in the status register to
 	 * clear this GPE.
 	 */
-	status = acpi_hw_low_level_write (8, gpe_event_info->register_bit,
-			  &gpe_event_info->register_info->status_address);
+	status = acpi_hw_low_level_write(8, gpe_event_info->register_bit,
+					 &gpe_event_info->register_info->
+					 status_address);
 
 	return (status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_get_gpe_status
@@ -145,19 +134,16 @@ acpi_hw_clear_gpe (
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_hw_get_gpe_status (
-	struct acpi_gpe_event_info      *gpe_event_info,
-	acpi_event_status               *event_status)
+acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
+		       acpi_event_status * event_status)
 {
-	u32                             in_byte;
-	u8                              register_bit;
-	struct acpi_gpe_register_info   *gpe_register_info;
-	acpi_status                     status;
-	acpi_event_status               local_event_status = 0;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	u32 in_byte;
+	u8 register_bit;
+	struct acpi_gpe_register_info *gpe_register_info;
+	acpi_status status;
+	acpi_event_status local_event_status = 0;
 
+	ACPI_FUNCTION_ENTRY();
 
 	if (!event_status) {
 		return (AE_BAD_PARAMETER);
@@ -185,8 +171,10 @@ acpi_hw_get_gpe_status (
 
 	/* GPE currently active (status bit == 1)? */
 
-	status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address);
-	if (ACPI_FAILURE (status)) {
+	status =
+	    acpi_hw_low_level_read(8, &in_byte,
+				   &gpe_register_info->status_address);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
@@ -198,12 +186,10 @@ acpi_hw_get_gpe_status (
 
 	(*event_status) = local_event_status;
 
-
-unlock_and_exit:
+      unlock_and_exit:
 	return (status);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif				/*  ACPI_FUTURE_USAGE  */
 
 /******************************************************************************
  *
@@ -219,22 +205,21 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_hw_disable_gpe_block (
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-	struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
+			  struct acpi_gpe_block_info * gpe_block)
 {
-	u32                             i;
-	acpi_status                     status;
-
+	u32 i;
+	acpi_status status;
 
 	/* Examine each GPE Register within the block */
 
 	for (i = 0; i < gpe_block->register_count; i++) {
 		/* Disable all GPEs in this register */
 
-		status = acpi_hw_low_level_write (8, 0x00,
-				 &gpe_block->register_info[i].enable_address);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_hw_low_level_write(8, 0x00,
+						 &gpe_block->register_info[i].
+						 enable_address);
+		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
 	}
@@ -242,7 +227,6 @@ acpi_hw_disable_gpe_block (
 	return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_clear_gpe_block
@@ -257,22 +241,21 @@ acpi_hw_disable_gpe_block (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_clear_gpe_block (
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-	struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
+			struct acpi_gpe_block_info * gpe_block)
 {
-	u32                             i;
-	acpi_status                     status;
-
+	u32 i;
+	acpi_status status;
 
 	/* Examine each GPE Register within the block */
 
 	for (i = 0; i < gpe_block->register_count; i++) {
 		/* Clear status on all GPEs in this register */
 
-		status = acpi_hw_low_level_write (8, 0xFF,
-				 &gpe_block->register_info[i].status_address);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_hw_low_level_write(8, 0xFF,
+						 &gpe_block->register_info[i].
+						 status_address);
+		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
 	}
@@ -280,7 +263,6 @@ acpi_hw_clear_gpe_block (
 	return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_runtime_gpe_block
@@ -296,13 +278,11 @@ acpi_hw_clear_gpe_block (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_enable_runtime_gpe_block (
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-	struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
+				 struct acpi_gpe_block_info * gpe_block)
 {
-	u32                             i;
-	acpi_status                     status;
-
+	u32 i;
+	acpi_status status;
 
 	/* NOTE: assumes that all GPEs are currently disabled */
 
@@ -315,9 +295,13 @@ acpi_hw_enable_runtime_gpe_block (
 
 		/* Enable all "runtime" GPEs in this register */
 
-		status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_run,
-				 &gpe_block->register_info[i].enable_address);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_write(8,
+					    gpe_block->register_info[i].
+					    enable_for_run,
+					    &gpe_block->register_info[i].
+					    enable_address);
+		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
 	}
@@ -325,7 +309,6 @@ acpi_hw_enable_runtime_gpe_block (
 	return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_wakeup_gpe_block
@@ -341,13 +324,11 @@ acpi_hw_enable_runtime_gpe_block (
  ******************************************************************************/
 
 static acpi_status
-acpi_hw_enable_wakeup_gpe_block (
-	struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-	struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+				struct acpi_gpe_block_info *gpe_block)
 {
-	u32                             i;
-	acpi_status                     status;
-
+	u32 i;
+	acpi_status status;
 
 	/* Examine each GPE Register within the block */
 
@@ -358,10 +339,12 @@ acpi_hw_enable_wakeup_gpe_block (
 
 		/* Enable all "wake" GPEs in this register */
 
-		status = acpi_hw_low_level_write (8,
-				 gpe_block->register_info[i].enable_for_wake,
-				 &gpe_block->register_info[i].enable_address);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_hw_low_level_write(8,
+						 gpe_block->register_info[i].
+						 enable_for_wake,
+						 &gpe_block->register_info[i].
+						 enable_address);
+		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
 	}
@@ -369,7 +352,6 @@ acpi_hw_enable_wakeup_gpe_block (
 	return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_disable_all_gpes
@@ -382,22 +364,17 @@ acpi_hw_enable_wakeup_gpe_block (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_disable_all_gpes (
-	void)
+acpi_status acpi_hw_disable_all_gpes(void)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE ("hw_disable_all_gpes");
+	ACPI_FUNCTION_TRACE("hw_disable_all_gpes");
 
-
-	status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
-	status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
-	return_ACPI_STATUS (status);
+	status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
+	status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
+	return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_all_runtime_gpes
@@ -410,21 +387,16 @@ acpi_hw_disable_all_gpes (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_enable_all_runtime_gpes (
-	void)
+acpi_status acpi_hw_enable_all_runtime_gpes(void)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes");
+	ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes");
 
-
-	status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block);
-	return_ACPI_STATUS (status);
+	status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
+	return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_all_wakeup_gpes
@@ -437,17 +409,12 @@ acpi_hw_enable_all_runtime_gpes (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_enable_all_wakeup_gpes (
-	void)
+acpi_status acpi_hw_enable_all_wakeup_gpes(void)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes");
+	ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes");
 
-
-	status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block);
-	return_ACPI_STATUS (status);
+	status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
+	return_ACPI_STATUS(status);
 }
-

+ 290 - 310
drivers/acpi/hardware/hwregs.c

@@ -50,8 +50,7 @@
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-	 ACPI_MODULE_NAME    ("hwregs")
-
+ACPI_MODULE_NAME("hwregs")
 
 /*******************************************************************************
  *
@@ -65,57 +64,52 @@
  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
  ******************************************************************************/
-
-acpi_status
-acpi_hw_clear_acpi_status (
-	u32                             flags)
+acpi_status acpi_hw_clear_acpi_status(u32 flags)
 {
-	acpi_status                     status;
-
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE ("hw_clear_acpi_status");
+	ACPI_FUNCTION_TRACE("hw_clear_acpi_status");
 
-
-	ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
-		ACPI_BITMASK_ALL_FIXED_STATUS,
-		(u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
+	ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
+			  ACPI_BITMASK_ALL_FIXED_STATUS,
+			  (u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
 
 	if (flags & ACPI_MTX_LOCK) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
-	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-			 ACPI_REGISTER_PM1_STATUS,
-			 ACPI_BITMASK_ALL_FIXED_STATUS);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+					ACPI_REGISTER_PM1_STATUS,
+					ACPI_BITMASK_ALL_FIXED_STATUS);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
 	/* Clear the fixed events */
 
 	if (acpi_gbl_FADT->xpm1b_evt_blk.address) {
-		status = acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS,
-				 &acpi_gbl_FADT->xpm1b_evt_blk);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
+					    &acpi_gbl_FADT->xpm1b_evt_blk);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 	}
 
 	/* Clear the GPE Bits in all GPE registers in all GPE blocks */
 
-	status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
+	status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
 
-unlock_and_exit:
+      unlock_and_exit:
 	if (flags & ACPI_MTX_LOCK) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_sleep_type_data
@@ -132,53 +126,48 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_get_sleep_type_data (
-	u8                              sleep_state,
-	u8                              *sleep_type_a,
-	u8                              *sleep_type_b)
+acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_parameter_info      info;
-	char                            *sleep_state_name;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data");
+	acpi_status status = AE_OK;
+	struct acpi_parameter_info info;
+	char *sleep_state_name;
 
+	ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data");
 
 	/* Validate parameters */
 
-	if ((sleep_state > ACPI_S_STATES_MAX) ||
-		!sleep_type_a || !sleep_type_b) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Evaluate the namespace object containing the values for this state */
 
 	info.parameters = NULL;
 	info.return_object = NULL;
-	sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state];
+	sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state];
 
-	status = acpi_ns_evaluate_by_name (sleep_state_name, &info);
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"%s while evaluating sleep_state [%s]\n",
-			acpi_format_exception (status), sleep_state_name));
+	status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "%s while evaluating sleep_state [%s]\n",
+				  acpi_format_exception(status),
+				  sleep_state_name));
 
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Must have a return object */
 
 	if (!info.return_object) {
-		ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
-			sleep_state_name));
+		ACPI_REPORT_ERROR(("No Sleep State object returned from [%s]\n",
+				   sleep_state_name));
 		status = AE_NOT_EXIST;
 	}
 
 	/* It must be of type Package */
 
-	else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) {
-		ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
+	else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) {
+		ACPI_REPORT_ERROR(("Sleep State return object is not a Package\n"));
 		status = AE_AML_OPERAND_TYPE;
 	}
 
@@ -190,45 +179,41 @@ acpi_get_sleep_type_data (
 	 * one per sleep type (A/B).
 	 */
 	else if (info.return_object->package.count < 2) {
-		ACPI_REPORT_ERROR ((
-			"Sleep State return package does not have at least two elements\n"));
+		ACPI_REPORT_ERROR(("Sleep State return package does not have at least two elements\n"));
 		status = AE_AML_NO_OPERAND;
 	}
 
 	/* The first two elements must both be of type Integer */
 
-	else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0])
-			 != ACPI_TYPE_INTEGER) ||
-			 (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1])
-				!= ACPI_TYPE_INTEGER)) {
-		ACPI_REPORT_ERROR ((
-			"Sleep State return package elements are not both Integers (%s, %s)\n",
-			acpi_ut_get_object_type_name (info.return_object->package.elements[0]),
-			acpi_ut_get_object_type_name (info.return_object->package.elements[1])));
+	else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0])
+		  != ACPI_TYPE_INTEGER) ||
+		 (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1])
+		  != ACPI_TYPE_INTEGER)) {
+		ACPI_REPORT_ERROR(("Sleep State return package elements are not both Integers (%s, %s)\n", acpi_ut_get_object_type_name(info.return_object->package.elements[0]), acpi_ut_get_object_type_name(info.return_object->package.elements[1])));
 		status = AE_AML_OPERAND_TYPE;
-	}
-	else {
+	} else {
 		/* Valid _Sx_ package size, type, and value */
 
 		*sleep_type_a = (u8)
-			(info.return_object->package.elements[0])->integer.value;
+		    (info.return_object->package.elements[0])->integer.value;
 		*sleep_type_b = (u8)
-			(info.return_object->package.elements[1])->integer.value;
+		    (info.return_object->package.elements[1])->integer.value;
 	}
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
-			acpi_format_exception (status),
-			sleep_state_name, info.return_object,
-			acpi_ut_get_object_type_name (info.return_object)));
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
+				  acpi_format_exception(status),
+				  sleep_state_name, info.return_object,
+				  acpi_ut_get_object_type_name(info.
+							       return_object)));
 	}
 
-	acpi_ut_remove_reference (info.return_object);
-	return_ACPI_STATUS (status);
+	acpi_ut_remove_reference(info.return_object);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_sleep_type_data);
 
+EXPORT_SYMBOL(acpi_get_sleep_type_data);
 
 /*******************************************************************************
  *
@@ -242,22 +227,20 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data);
  *
  ******************************************************************************/
 
-struct acpi_bit_register_info *
-acpi_hw_get_bit_register_info (
-	u32                             register_id)
+struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
 {
-	ACPI_FUNCTION_NAME ("hw_get_bit_register_info");
-
+	ACPI_FUNCTION_NAME("hw_get_bit_register_info");
 
 	if (register_id > ACPI_BITREG_MAX) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid bit_register ID: %X\n", register_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Invalid bit_register ID: %X\n",
+				  register_id));
 		return (NULL);
 	}
 
 	return (&acpi_gbl_bit_register_info[register_id]);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_register
@@ -273,59 +256,56 @@ acpi_hw_get_bit_register_info (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_register (
-	u32                             register_id,
-	u32                             *return_value,
-	u32                             flags)
+acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
 {
-	u32                             register_value = 0;
-	struct acpi_bit_register_info   *bit_reg_info;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_get_register");
+	u32 register_value = 0;
+	struct acpi_bit_register_info *bit_reg_info;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_get_register");
 
 	/* Get the info structure corresponding to the requested ACPI Register */
 
-	bit_reg_info = acpi_hw_get_bit_register_info (register_id);
+	bit_reg_info = acpi_hw_get_bit_register_info(register_id);
 	if (!bit_reg_info) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	if (flags & ACPI_MTX_LOCK) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Read from the register */
 
-	status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-			  bit_reg_info->parent_register, &register_value);
+	status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+				       bit_reg_info->parent_register,
+				       &register_value);
 
 	if (flags & ACPI_MTX_LOCK) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
 	}
 
-	if (ACPI_SUCCESS (status)) {
+	if (ACPI_SUCCESS(status)) {
 		/* Normalize the value that was read */
 
-		register_value = ((register_value & bit_reg_info->access_bit_mask)
-				   >> bit_reg_info->bit_position);
+		register_value =
+		    ((register_value & bit_reg_info->access_bit_mask)
+		     >> bit_reg_info->bit_position);
 
 		*return_value = register_value;
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
-				register_value, bit_reg_info->parent_register));
+		ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n",
+				  register_value,
+				  bit_reg_info->parent_register));
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_register);
 
+EXPORT_SYMBOL(acpi_get_register);
 
 /*******************************************************************************
  *
@@ -342,40 +322,36 @@ EXPORT_SYMBOL(acpi_get_register);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_set_register (
-	u32                             register_id,
-	u32                             value,
-	u32                             flags)
+acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
 {
-	u32                             register_value = 0;
-	struct acpi_bit_register_info   *bit_reg_info;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE_U32 ("acpi_set_register", register_id);
+	u32 register_value = 0;
+	struct acpi_bit_register_info *bit_reg_info;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id);
 
 	/* Get the info structure corresponding to the requested ACPI Register */
 
-	bit_reg_info = acpi_hw_get_bit_register_info (register_id);
+	bit_reg_info = acpi_hw_get_bit_register_info(register_id);
 	if (!bit_reg_info) {
-		ACPI_REPORT_ERROR (("Bad ACPI HW register_id: %X\n", register_id));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n",
+				   register_id));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	if (flags & ACPI_MTX_LOCK) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Always do a register read first so we can insert the new bits  */
 
-	status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-			 bit_reg_info->parent_register, &register_value);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+				       bit_reg_info->parent_register,
+				       &register_value);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
@@ -395,26 +371,30 @@ acpi_set_register (
 		 * information is the single bit we're interested in, all others should
 		 * be written as 0 so they will be left unchanged.
 		 */
-		value = ACPI_REGISTER_PREPARE_BITS (value,
-				 bit_reg_info->bit_position, bit_reg_info->access_bit_mask);
+		value = ACPI_REGISTER_PREPARE_BITS(value,
+						   bit_reg_info->bit_position,
+						   bit_reg_info->
+						   access_bit_mask);
 		if (value) {
-			status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-					 ACPI_REGISTER_PM1_STATUS, (u16) value);
+			status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+							ACPI_REGISTER_PM1_STATUS,
+							(u16) value);
 			register_value = 0;
 		}
 		break;
 
-
 	case ACPI_REGISTER_PM1_ENABLE:
 
-		ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
-				bit_reg_info->access_bit_mask, value);
+		ACPI_REGISTER_INSERT_VALUE(register_value,
+					   bit_reg_info->bit_position,
+					   bit_reg_info->access_bit_mask,
+					   value);
 
-		status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-				 ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
+		status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+						ACPI_REGISTER_PM1_ENABLE,
+						(u16) register_value);
 		break;
 
-
 	case ACPI_REGISTER_PM1_CONTROL:
 
 		/*
@@ -422,65 +402,73 @@ acpi_set_register (
 		 * Note that at this level, the fact that there are actually TWO
 		 * registers (A and B - and B may not exist) is abstracted.
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value));
+		ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n",
+				  register_value));
 
-		ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
-				bit_reg_info->access_bit_mask, value);
+		ACPI_REGISTER_INSERT_VALUE(register_value,
+					   bit_reg_info->bit_position,
+					   bit_reg_info->access_bit_mask,
+					   value);
 
-		status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-				 ACPI_REGISTER_PM1_CONTROL, (u16) register_value);
+		status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+						ACPI_REGISTER_PM1_CONTROL,
+						(u16) register_value);
 		break;
 
-
 	case ACPI_REGISTER_PM2_CONTROL:
 
-		status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-				 ACPI_REGISTER_PM2_CONTROL, &register_value);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+					       ACPI_REGISTER_PM2_CONTROL,
+					       &register_value);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
-			register_value,
-			ACPI_FORMAT_UINT64 (
-				acpi_gbl_FADT->xpm2_cnt_blk.address)));
-
-		ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
-				bit_reg_info->access_bit_mask, value);
-
-		ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
-			register_value,
-			ACPI_FORMAT_UINT64 (
-				acpi_gbl_FADT->xpm2_cnt_blk.address)));
-
-		status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-				 ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
+		ACPI_DEBUG_PRINT((ACPI_DB_IO,
+				  "PM2 control: Read %X from %8.8X%8.8X\n",
+				  register_value,
+				  ACPI_FORMAT_UINT64(acpi_gbl_FADT->
+						     xpm2_cnt_blk.address)));
+
+		ACPI_REGISTER_INSERT_VALUE(register_value,
+					   bit_reg_info->bit_position,
+					   bit_reg_info->access_bit_mask,
+					   value);
+
+		ACPI_DEBUG_PRINT((ACPI_DB_IO,
+				  "About to write %4.4X to %8.8X%8.8X\n",
+				  register_value,
+				  ACPI_FORMAT_UINT64(acpi_gbl_FADT->
+						     xpm2_cnt_blk.address)));
+
+		status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+						ACPI_REGISTER_PM2_CONTROL,
+						(u8) (register_value));
 		break;
 
-
 	default:
 		break;
 	}
 
-
-unlock_and_exit:
+      unlock_and_exit:
 
 	if (flags & ACPI_MTX_LOCK) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
 	}
 
 	/* Normalize the value that was read */
 
-	ACPI_DEBUG_EXEC (register_value =
-		((register_value & bit_reg_info->access_bit_mask) >>
-			bit_reg_info->bit_position));
+	ACPI_DEBUG_EXEC(register_value =
+			((register_value & bit_reg_info->access_bit_mask) >>
+			 bit_reg_info->bit_position));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
-			value, register_value, bit_reg_info->parent_register));
-	return_ACPI_STATUS (status);
+	ACPI_DEBUG_PRINT((ACPI_DB_IO,
+			  "Set bits: %8.8X actual %8.8X register %X\n", value,
+			  register_value, bit_reg_info->parent_register));
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_set_register);
 
+EXPORT_SYMBOL(acpi_set_register);
 
 /******************************************************************************
  *
@@ -498,103 +486,107 @@ EXPORT_SYMBOL(acpi_set_register);
  ******************************************************************************/
 
 acpi_status
-acpi_hw_register_read (
-	u8                              use_lock,
-	u32                             register_id,
-	u32                             *return_value)
+acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
 {
-	u32                             value1 = 0;
-	u32                             value2 = 0;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("hw_register_read");
+	u32 value1 = 0;
+	u32 value2 = 0;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("hw_register_read");
 
 	if (ACPI_MTX_LOCK == use_lock) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	switch (register_id) {
-	case ACPI_REGISTER_PM1_STATUS:           /* 16-bit access */
+	case ACPI_REGISTER_PM1_STATUS:	/* 16-bit access */
 
-		status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_evt_blk);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_read(16, &value1,
+					   &acpi_gbl_FADT->xpm1a_evt_blk);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 
 		/* PM1B is optional */
 
-		status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_evt_blk);
+		status =
+		    acpi_hw_low_level_read(16, &value2,
+					   &acpi_gbl_FADT->xpm1b_evt_blk);
 		value1 |= value2;
 		break;
 
+	case ACPI_REGISTER_PM1_ENABLE:	/* 16-bit access */
 
-	case ACPI_REGISTER_PM1_ENABLE:           /* 16-bit access */
-
-		status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_xpm1a_enable);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 
 		/* PM1B is optional */
 
-		status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_xpm1b_enable);
+		status =
+		    acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable);
 		value1 |= value2;
 		break;
 
+	case ACPI_REGISTER_PM1_CONTROL:	/* 16-bit access */
 
-	case ACPI_REGISTER_PM1_CONTROL:          /* 16-bit access */
-
-		status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_cnt_blk);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_read(16, &value1,
+					   &acpi_gbl_FADT->xpm1a_cnt_blk);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 
-		status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_cnt_blk);
+		status =
+		    acpi_hw_low_level_read(16, &value2,
+					   &acpi_gbl_FADT->xpm1b_cnt_blk);
 		value1 |= value2;
 		break;
 
+	case ACPI_REGISTER_PM2_CONTROL:	/* 8-bit access */
 
-	case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
-
-		status = acpi_hw_low_level_read (8, &value1, &acpi_gbl_FADT->xpm2_cnt_blk);
+		status =
+		    acpi_hw_low_level_read(8, &value1,
+					   &acpi_gbl_FADT->xpm2_cnt_blk);
 		break;
 
+	case ACPI_REGISTER_PM_TIMER:	/* 32-bit access */
 
-	case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
-
-		status = acpi_hw_low_level_read (32, &value1, &acpi_gbl_FADT->xpm_tmr_blk);
+		status =
+		    acpi_hw_low_level_read(32, &value1,
+					   &acpi_gbl_FADT->xpm_tmr_blk);
 		break;
 
-	case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */
+	case ACPI_REGISTER_SMI_COMMAND_BLOCK:	/* 8-bit access */
 
-		status = acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value1, 8);
+		status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8);
 		break;
 
 	default:
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
-			register_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
+				  register_id));
 		status = AE_BAD_PARAMETER;
 		break;
 	}
 
-unlock_and_exit:
+      unlock_and_exit:
 	if (ACPI_MTX_LOCK == use_lock) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
 	}
 
-	if (ACPI_SUCCESS (status)) {
+	if (ACPI_SUCCESS(status)) {
 		*return_value = value1;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_register_write
@@ -610,109 +602,112 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_register_write (
-	u8                              use_lock,
-	u32                             register_id,
-	u32                             value)
+acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("hw_register_write");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("hw_register_write");
 
 	if (ACPI_MTX_LOCK == use_lock) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	switch (register_id) {
-	case ACPI_REGISTER_PM1_STATUS:           /* 16-bit access */
+	case ACPI_REGISTER_PM1_STATUS:	/* 16-bit access */
 
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_evt_blk);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_write(16, value,
+					    &acpi_gbl_FADT->xpm1a_evt_blk);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 
 		/* PM1B is optional */
 
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_evt_blk);
+		status =
+		    acpi_hw_low_level_write(16, value,
+					    &acpi_gbl_FADT->xpm1b_evt_blk);
 		break;
 
+	case ACPI_REGISTER_PM1_ENABLE:	/* 16-bit access */
 
-	case ACPI_REGISTER_PM1_ENABLE:           /* 16-bit access*/
-
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1a_enable);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 
 		/* PM1B is optional */
 
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1b_enable);
+		status =
+		    acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable);
 		break;
 
+	case ACPI_REGISTER_PM1_CONTROL:	/* 16-bit access */
 
-	case ACPI_REGISTER_PM1_CONTROL:          /* 16-bit access */
-
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_hw_low_level_write(16, value,
+					    &acpi_gbl_FADT->xpm1a_cnt_blk);
+		if (ACPI_FAILURE(status)) {
 			goto unlock_and_exit;
 		}
 
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk);
+		status =
+		    acpi_hw_low_level_write(16, value,
+					    &acpi_gbl_FADT->xpm1b_cnt_blk);
 		break;
 
+	case ACPI_REGISTER_PM1A_CONTROL:	/* 16-bit access */
 
-	case ACPI_REGISTER_PM1A_CONTROL:         /* 16-bit access */
-
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
+		status =
+		    acpi_hw_low_level_write(16, value,
+					    &acpi_gbl_FADT->xpm1a_cnt_blk);
 		break;
 
+	case ACPI_REGISTER_PM1B_CONTROL:	/* 16-bit access */
 
-	case ACPI_REGISTER_PM1B_CONTROL:         /* 16-bit access */
-
-		status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk);
+		status =
+		    acpi_hw_low_level_write(16, value,
+					    &acpi_gbl_FADT->xpm1b_cnt_blk);
 		break;
 
+	case ACPI_REGISTER_PM2_CONTROL:	/* 8-bit access */
 
-	case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
-
-		status = acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->xpm2_cnt_blk);
+		status =
+		    acpi_hw_low_level_write(8, value,
+					    &acpi_gbl_FADT->xpm2_cnt_blk);
 		break;
 
+	case ACPI_REGISTER_PM_TIMER:	/* 32-bit access */
 
-	case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
-
-		status = acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->xpm_tmr_blk);
+		status =
+		    acpi_hw_low_level_write(32, value,
+					    &acpi_gbl_FADT->xpm_tmr_blk);
 		break;
 
-
-	case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */
+	case ACPI_REGISTER_SMI_COMMAND_BLOCK:	/* 8-bit access */
 
 		/* SMI_CMD is currently always in IO space */
 
-		status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8);
+		status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8);
 		break;
 
-
 	default:
 		status = AE_BAD_PARAMETER;
 		break;
 	}
 
-unlock_and_exit:
+      unlock_and_exit:
 	if (ACPI_MTX_LOCK == use_lock) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_low_level_read
@@ -728,17 +723,12 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_hw_low_level_read (
-	u32                             width,
-	u32                             *value,
-	struct acpi_generic_address     *reg)
+acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
 {
-	u64                             address;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_NAME ("hw_low_level_read");
+	u64 address;
+	acpi_status status;
 
+	ACPI_FUNCTION_NAME("hw_low_level_read");
 
 	/*
 	 * Must have a valid pointer to a GAS structure, and
@@ -751,7 +741,7 @@ acpi_hw_low_level_read (
 
 	/* Get a local copy of the address.  Handles possible alignment issues */
 
-	ACPI_MOVE_64_TO_64 (&address, &reg->address);
+	ACPI_MOVE_64_TO_64(&address, &reg->address);
 	if (!address) {
 		return (AE_OK);
 	}
@@ -764,35 +754,32 @@ acpi_hw_low_level_read (
 	switch (reg->address_space_id) {
 	case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
-		status = acpi_os_read_memory (
-				 (acpi_physical_address) address,
-				 value, width);
+		status = acpi_os_read_memory((acpi_physical_address) address,
+					     value, width);
 		break;
 
-
 	case ACPI_ADR_SPACE_SYSTEM_IO:
 
-		status = acpi_os_read_port ((acpi_io_address) address,
-				 value, width);
+		status = acpi_os_read_port((acpi_io_address) address,
+					   value, width);
 		break;
 
-
 	default:
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Unsupported address space: %X\n", reg->address_space_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unsupported address space: %X\n",
+				  reg->address_space_id));
 		return (AE_BAD_PARAMETER);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_IO,
-		"Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-		*value, width,
-		ACPI_FORMAT_UINT64 (address),
-		acpi_ut_get_region_name (reg->address_space_id)));
+	ACPI_DEBUG_PRINT((ACPI_DB_IO,
+			  "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
+			  *value, width,
+			  ACPI_FORMAT_UINT64(address),
+			  acpi_ut_get_region_name(reg->address_space_id)));
 
 	return (status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_low_level_write
@@ -808,17 +795,12 @@ acpi_hw_low_level_read (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_low_level_write (
-	u32                             width,
-	u32                             value,
-	struct acpi_generic_address     *reg)
+acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
 {
-	u64                             address;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_NAME ("hw_low_level_write");
+	u64 address;
+	acpi_status status;
 
+	ACPI_FUNCTION_NAME("hw_low_level_write");
 
 	/*
 	 * Must have a valid pointer to a GAS structure, and
@@ -831,7 +813,7 @@ acpi_hw_low_level_write (
 
 	/* Get a local copy of the address.  Handles possible alignment issues */
 
-	ACPI_MOVE_64_TO_64 (&address, &reg->address);
+	ACPI_MOVE_64_TO_64(&address, &reg->address);
 	if (!address) {
 		return (AE_OK);
 	}
@@ -843,30 +825,28 @@ acpi_hw_low_level_write (
 	switch (reg->address_space_id) {
 	case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
-		status = acpi_os_write_memory (
-				 (acpi_physical_address) address,
-				 value, width);
+		status = acpi_os_write_memory((acpi_physical_address) address,
+					      value, width);
 		break;
 
-
 	case ACPI_ADR_SPACE_SYSTEM_IO:
 
-		status = acpi_os_write_port ((acpi_io_address) address,
-				 value, width);
+		status = acpi_os_write_port((acpi_io_address) address,
+					    value, width);
 		break;
 
-
 	default:
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Unsupported address space: %X\n", reg->address_space_id));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unsupported address space: %X\n",
+				  reg->address_space_id));
 		return (AE_BAD_PARAMETER);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_IO,
-		"Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-		value, width,
-		ACPI_FORMAT_UINT64 (address),
-		acpi_ut_get_region_name (reg->address_space_id)));
+	ACPI_DEBUG_PRINT((ACPI_DB_IO,
+			  "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
+			  value, width,
+			  ACPI_FORMAT_UINT64(address),
+			  acpi_ut_get_region_name(reg->address_space_id)));
 
 	return (status);
 }

+ 208 - 207
drivers/acpi/hardware/hwsleep.c

@@ -46,8 +46,7 @@
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-	 ACPI_MODULE_NAME    ("hwsleep")
-
+ACPI_MODULE_NAME("hwsleep")
 
 /*******************************************************************************
  *
@@ -61,30 +60,25 @@
  * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
  *
  ******************************************************************************/
-
 acpi_status
-acpi_set_firmware_waking_vector (
-	acpi_physical_address physical_address)
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
 {
 
-	ACPI_FUNCTION_TRACE ("acpi_set_firmware_waking_vector");
-
+	ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector");
 
 	/* Set the vector */
 
 	if (acpi_gbl_common_fACS.vector_width == 32) {
-		*(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector))
-				= (u32) physical_address;
-	}
-	else {
-		*acpi_gbl_common_fACS.firmware_waking_vector
-				= physical_address;
+		*(ACPI_CAST_PTR
+		  (u32, acpi_gbl_common_fACS.firmware_waking_vector))
+		    = (u32) physical_address;
+	} else {
+		*acpi_gbl_common_fACS.firmware_waking_vector = physical_address;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_firmware_waking_vector
@@ -101,33 +95,31 @@ acpi_set_firmware_waking_vector (
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_firmware_waking_vector (
-	acpi_physical_address *physical_address)
+acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
 {
 
-	ACPI_FUNCTION_TRACE ("acpi_get_firmware_waking_vector");
-
+	ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector");
 
 	if (!physical_address) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Get the vector */
 
 	if (acpi_gbl_common_fACS.vector_width == 32) {
 		*physical_address = (acpi_physical_address)
-			*(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector));
-	}
-	else {
+		    *
+		    (ACPI_CAST_PTR
+		     (u32, acpi_gbl_common_fACS.firmware_waking_vector));
+	} else {
 		*physical_address =
-			*acpi_gbl_common_fACS.firmware_waking_vector;
+		    *acpi_gbl_common_fACS.firmware_waking_vector;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_prep
@@ -143,25 +135,22 @@ acpi_get_firmware_waking_vector (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_enter_sleep_state_prep (
-	u8                          sleep_state)
+acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
 {
-	acpi_status                 status;
-	struct acpi_object_list     arg_list;
-	union acpi_object           arg;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_prep");
+	acpi_status status;
+	struct acpi_object_list arg_list;
+	union acpi_object arg;
 
+	ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep");
 
 	/*
 	 * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
 	 */
-	status = acpi_get_sleep_type_data (sleep_state,
-			  &acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_get_sleep_type_data(sleep_state,
+					  &acpi_gbl_sleep_type_a,
+					  &acpi_gbl_sleep_type_b);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Setup parameter object */
@@ -174,14 +163,14 @@ acpi_enter_sleep_state_prep (
 
 	/* Run the _PTS and _GTS methods */
 
-	status = acpi_evaluate_object (NULL, METHOD_NAME__PTS, &arg_list, NULL);
-	if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-		return_ACPI_STATUS (status);
+	status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_evaluate_object (NULL, METHOD_NAME__GTS, &arg_list, NULL);
-	if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-		return_ACPI_STATUS (status);
+	status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Setup the argument to _SST */
@@ -202,22 +191,21 @@ acpi_enter_sleep_state_prep (
 		break;
 
 	default:
-		arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
+		arg.integer.value = ACPI_SST_INDICATOR_OFF;	/* Default is off */
 		break;
 	}
 
 	/* Set the system indicators to show the desired sleep state. */
 
-	status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
-	if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-		 ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
-			acpi_format_exception (status)));
+	status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
+				   acpi_format_exception(status)));
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state
@@ -231,80 +219,82 @@ acpi_enter_sleep_state_prep (
  *
  ******************************************************************************/
 
-acpi_status asmlinkage
-acpi_enter_sleep_state (
-	u8                              sleep_state)
+acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
 {
-	u32                             PM1Acontrol;
-	u32                             PM1Bcontrol;
-	struct acpi_bit_register_info   *sleep_type_reg_info;
-	struct acpi_bit_register_info   *sleep_enable_reg_info;
-	u32                             in_value;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state");
+	u32 PM1Acontrol;
+	u32 PM1Bcontrol;
+	struct acpi_bit_register_info *sleep_type_reg_info;
+	struct acpi_bit_register_info *sleep_enable_reg_info;
+	u32 in_value;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_enter_sleep_state");
 
 	if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
-		(acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
-		ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n",
-			acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b));
-		return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+	    (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
+		ACPI_REPORT_ERROR(("Sleep values out of range: A=%X B=%X\n",
+				   acpi_gbl_sleep_type_a,
+				   acpi_gbl_sleep_type_b));
+		return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
 	}
 
-	sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
-	sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
+	sleep_type_reg_info =
+	    acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
+	sleep_enable_reg_info =
+	    acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
 
 	/* Clear wake status */
 
-	status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Clear all fixed and general purpose status bits */
 
-	status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
 	 * 1) Disable/Clear all GPEs
 	 * 2) Enable all wakeup GPEs
 	 */
-	status = acpi_hw_disable_all_gpes ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_disable_all_gpes();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 	acpi_gbl_system_awake_and_running = FALSE;
 
-	status = acpi_hw_enable_all_wakeup_gpes ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_enable_all_wakeup_gpes();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Get current value of PM1A control */
 
-	status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-			 ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+				       ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
-	ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-		"Entering sleep state [S%d]\n", sleep_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+			  "Entering sleep state [S%d]\n", sleep_state));
 
 	/* Clear SLP_EN and SLP_TYP fields */
 
 	PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
-			   sleep_enable_reg_info->access_bit_mask);
+			 sleep_enable_reg_info->access_bit_mask);
 	PM1Bcontrol = PM1Acontrol;
 
 	/* Insert SLP_TYP bits */
 
-	PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
-	PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
+	PM1Acontrol |=
+	    (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
+	PM1Bcontrol |=
+	    (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
 
 	/*
 	 * We split the writes of SLP_TYP and SLP_EN to workaround
@@ -313,16 +303,18 @@ acpi_enter_sleep_state (
 
 	/* Write #1: fill in SLP_TYP data */
 
-	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-			 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+					ACPI_REGISTER_PM1A_CONTROL,
+					PM1Acontrol);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-			 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+					ACPI_REGISTER_PM1B_CONTROL,
+					PM1Bcontrol);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Insert SLP_ENABLE bit */
@@ -332,18 +324,20 @@ acpi_enter_sleep_state (
 
 	/* Write #2: SLP_TYP + SLP_EN */
 
-	ACPI_FLUSH_CPU_CACHE ();
+	ACPI_FLUSH_CPU_CACHE();
 
-	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-			 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+					ACPI_REGISTER_PM1A_CONTROL,
+					PM1Acontrol);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-			 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+					ACPI_REGISTER_PM1B_CONTROL,
+					PM1Bcontrol);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	if (sleep_state > ACPI_STATE_S3) {
@@ -358,33 +352,34 @@ acpi_enter_sleep_state (
 		 * still read the right value. Ideally, this block would go
 		 * away entirely.
 		 */
-		acpi_os_stall (10000000);
-
-		status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-				 ACPI_REGISTER_PM1_CONTROL,
-				 sleep_enable_reg_info->access_bit_mask);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		acpi_os_stall(10000000);
+
+		status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+						ACPI_REGISTER_PM1_CONTROL,
+						sleep_enable_reg_info->
+						access_bit_mask);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Wait until we enter sleep state */
 
 	do {
-		status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
-			ACPI_MTX_DO_NOT_LOCK);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
+					   ACPI_MTX_DO_NOT_LOCK);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/* Spin until we wake */
 
 	} while (!in_value);
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_enter_sleep_state);
 
+EXPORT_SYMBOL(acpi_enter_sleep_state);
 
 /*******************************************************************************
  *
@@ -399,60 +394,57 @@ EXPORT_SYMBOL(acpi_enter_sleep_state);
  *
  ******************************************************************************/
 
-acpi_status asmlinkage
-acpi_enter_sleep_state_s4bios (
-	void)
+acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
 {
-	u32                             in_value;
-	acpi_status                     status;
-
+	u32 in_value;
+	acpi_status status;
 
-	ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_s4bios");
+	ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios");
 
-
-	status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
 	 * 1) Disable/Clear all GPEs
 	 * 2) Enable all wakeup GPEs
 	 */
-	status = acpi_hw_disable_all_gpes ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_disable_all_gpes();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 	acpi_gbl_system_awake_and_running = FALSE;
 
-	status = acpi_hw_enable_all_wakeup_gpes ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_enable_all_wakeup_gpes();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	ACPI_FLUSH_CPU_CACHE ();
+	ACPI_FLUSH_CPU_CACHE();
 
-	status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
-			 (u32) acpi_gbl_FADT->S4bios_req, 8);
+	status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
+				    (u32) acpi_gbl_FADT->S4bios_req, 8);
 
 	do {
 		acpi_os_stall(1000);
-		status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
-			ACPI_MTX_DO_NOT_LOCK);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
+					   ACPI_MTX_DO_NOT_LOCK);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	} while (!in_value);
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
 
+EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
 
 /*******************************************************************************
  *
@@ -467,55 +459,62 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_leave_sleep_state (
-	u8                              sleep_state)
+acpi_status acpi_leave_sleep_state(u8 sleep_state)
 {
-	struct acpi_object_list         arg_list;
-	union acpi_object               arg;
-	acpi_status                     status;
-	struct acpi_bit_register_info   *sleep_type_reg_info;
-	struct acpi_bit_register_info   *sleep_enable_reg_info;
-	u32                             PM1Acontrol;
-	u32                             PM1Bcontrol;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_leave_sleep_state");
+	struct acpi_object_list arg_list;
+	union acpi_object arg;
+	acpi_status status;
+	struct acpi_bit_register_info *sleep_type_reg_info;
+	struct acpi_bit_register_info *sleep_enable_reg_info;
+	u32 PM1Acontrol;
+	u32 PM1Bcontrol;
 
+	ACPI_FUNCTION_TRACE("acpi_leave_sleep_state");
 
 	/*
 	 * Set SLP_TYPE and SLP_EN to state S0.
 	 * This is unclear from the ACPI Spec, but it is required
 	 * by some machines.
 	 */
-	status = acpi_get_sleep_type_data (ACPI_STATE_S0,
-			  &acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
-	if (ACPI_SUCCESS (status)) {
-		sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
-		sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
+	status = acpi_get_sleep_type_data(ACPI_STATE_S0,
+					  &acpi_gbl_sleep_type_a,
+					  &acpi_gbl_sleep_type_b);
+	if (ACPI_SUCCESS(status)) {
+		sleep_type_reg_info =
+		    acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
+		sleep_enable_reg_info =
+		    acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
 
 		/* Get current value of PM1A control */
 
-		status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-				 ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+					       ACPI_REGISTER_PM1_CONTROL,
+					       &PM1Acontrol);
+		if (ACPI_SUCCESS(status)) {
 			/* Clear SLP_EN and SLP_TYP fields */
 
 			PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
-					   sleep_enable_reg_info->access_bit_mask);
+					 sleep_enable_reg_info->
+					 access_bit_mask);
 			PM1Bcontrol = PM1Acontrol;
 
 			/* Insert SLP_TYP bits */
 
-			PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
-			PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
+			PM1Acontrol |=
+			    (acpi_gbl_sleep_type_a << sleep_type_reg_info->
+			     bit_position);
+			PM1Bcontrol |=
+			    (acpi_gbl_sleep_type_b << sleep_type_reg_info->
+			     bit_position);
 
 			/* Just ignore any errors */
 
-			(void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-					  ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
-			(void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-					  ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
+			(void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+						     ACPI_REGISTER_PM1A_CONTROL,
+						     PM1Acontrol);
+			(void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+						     ACPI_REGISTER_PM1B_CONTROL,
+						     PM1Bcontrol);
 		}
 	}
 
@@ -532,23 +531,23 @@ acpi_leave_sleep_state (
 	/* Ignore any errors from these methods */
 
 	arg.integer.value = ACPI_SST_WAKING;
-	status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
-	if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-		ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
-			acpi_format_exception (status)));
+	status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
+				   acpi_format_exception(status)));
 	}
 
 	arg.integer.value = sleep_state;
-	status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL);
-	if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-		ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
-			acpi_format_exception (status)));
+	status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		ACPI_REPORT_ERROR(("Method _BFS failed, %s\n",
+				   acpi_format_exception(status)));
 	}
 
-	status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL);
-	if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-		ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
-			acpi_format_exception (status)));
+	status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		ACPI_REPORT_ERROR(("Method _WAK failed, %s\n",
+				   acpi_format_exception(status)));
 	}
 	/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
 
@@ -557,33 +556,35 @@ acpi_leave_sleep_state (
 	 * 1) Disable/Clear all GPEs
 	 * 2) Enable all runtime GPEs
 	 */
-	status = acpi_hw_disable_all_gpes ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_disable_all_gpes();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 	acpi_gbl_system_awake_and_running = TRUE;
 
-	status = acpi_hw_enable_all_runtime_gpes ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_hw_enable_all_runtime_gpes();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Enable power button */
 
-	(void) acpi_set_register(
-			acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
-			1, ACPI_MTX_DO_NOT_LOCK);
+	(void)
+	    acpi_set_register(acpi_gbl_fixed_event_info
+			      [ACPI_EVENT_POWER_BUTTON].enable_register_id, 1,
+			      ACPI_MTX_DO_NOT_LOCK);
 
-	(void) acpi_set_register(
-			acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
-			1, ACPI_MTX_DO_NOT_LOCK);
+	(void)
+	    acpi_set_register(acpi_gbl_fixed_event_info
+			      [ACPI_EVENT_POWER_BUTTON].status_register_id, 1,
+			      ACPI_MTX_DO_NOT_LOCK);
 
 	arg.integer.value = ACPI_SST_WORKING;
-	status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
-	if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-		ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
-			acpi_format_exception (status)));
+	status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
+				   acpi_format_exception(status)));
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }

+ 30 - 47
drivers/acpi/hardware/hwtimer.c

@@ -46,8 +46,7 @@
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-	 ACPI_MODULE_NAME    ("hwtimer")
-
+ACPI_MODULE_NAME("hwtimer")
 
 /******************************************************************************
  *
@@ -60,29 +59,23 @@
  * DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits).
  *
  ******************************************************************************/
-
-acpi_status
-acpi_get_timer_resolution (
-	u32                             *resolution)
+acpi_status acpi_get_timer_resolution(u32 * resolution)
 {
-	ACPI_FUNCTION_TRACE ("acpi_get_timer_resolution");
-
+	ACPI_FUNCTION_TRACE("acpi_get_timer_resolution");
 
 	if (!resolution) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	if (0 == acpi_gbl_FADT->tmr_val_ext) {
 		*resolution = 24;
-	}
-	else {
+	} else {
 		*resolution = 32;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_get_timer
@@ -95,26 +88,22 @@ acpi_get_timer_resolution (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_timer (
-	u32                             *ticks)
+acpi_status acpi_get_timer(u32 * ticks)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_get_timer");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_get_timer");
 
 	if (!ticks) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
+	status = acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_timer);
 
+EXPORT_SYMBOL(acpi_get_timer);
 
 /******************************************************************************
  *
@@ -146,21 +135,16 @@ EXPORT_SYMBOL(acpi_get_timer);
  ******************************************************************************/
 
 acpi_status
-acpi_get_timer_duration (
-	u32                             start_ticks,
-	u32                             end_ticks,
-	u32                             *time_elapsed)
+acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
 {
-	acpi_status                     status;
-	u32                             delta_ticks;
-	acpi_integer                    quotient;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_get_timer_duration");
+	acpi_status status;
+	u32 delta_ticks;
+	acpi_integer quotient;
 
+	ACPI_FUNCTION_TRACE("acpi_get_timer_duration");
 
 	if (!time_elapsed) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
@@ -169,22 +153,22 @@ acpi_get_timer_duration (
 	 */
 	if (start_ticks < end_ticks) {
 		delta_ticks = end_ticks - start_ticks;
-	}
-	else if (start_ticks > end_ticks) {
+	} else if (start_ticks > end_ticks) {
 		if (0 == acpi_gbl_FADT->tmr_val_ext) {
 			/* 24-bit Timer */
 
-			delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF);
-		}
-		else {
+			delta_ticks =
+			    (((0x00FFFFFF - start_ticks) +
+			      end_ticks) & 0x00FFFFFF);
+		} else {
 			/* 32-bit Timer */
 
 			delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
 		}
-	}
-	else /* start_ticks == end_ticks */ {
+	} else {		/* start_ticks == end_ticks */
+
 		*time_elapsed = 0;
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/*
@@ -192,12 +176,11 @@ acpi_get_timer_duration (
 	 *
 	 * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
 	 */
-	status = acpi_ut_short_divide (((u64) delta_ticks) * 1000000,
-			 PM_TIMER_FREQUENCY, &quotient, NULL);
+	status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000,
+				      PM_TIMER_FREQUENCY, &quotient, NULL);
 
 	*time_elapsed = (u32) quotient;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
 EXPORT_SYMBOL(acpi_get_timer_duration);
-

+ 122 - 111
drivers/acpi/hotkey.c

@@ -62,7 +62,7 @@
 #define _COMPONENT              ACPI_HOTKEY_COMPONENT
 ACPI_MODULE_NAME("acpi_hotkey")
 
-MODULE_AUTHOR("luming.yu@intel.com");
+    MODULE_AUTHOR("luming.yu@intel.com");
 MODULE_DESCRIPTION(ACPI_HOTK_NAME);
 MODULE_LICENSE("GPL");
 
@@ -180,8 +180,8 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset);
 static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset);
 static int hotkey_polling_open_fs(struct inode *inode, struct file *file);
 static union acpi_hotkey *get_hotkey_by_event(struct
-			      acpi_hotkey_list
-			      *hotkey_list, int event);
+					      acpi_hotkey_list
+					      *hotkey_list, int event);
 
 /* event based config */
 static struct file_operations hotkey_config_fops = {
@@ -246,7 +246,7 @@ static int hotkey_info_open_fs(struct inode *inode, struct file *file)
 static char *format_result(union acpi_object *object)
 {
 	char *buf = NULL;
-	
+
 	buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL);
 	if (buf)
 		memset(buf, 0, RESULT_STR_LEN);
@@ -256,7 +256,7 @@ static char *format_result(union acpi_object *object)
 	/* Now, just support integer type */
 	if (object->type == ACPI_TYPE_INTEGER)
 		sprintf(buf, "%d\n", (u32) object->integer.value);
-do_fail:
+      do_fail:
 	return (buf);
 }
 
@@ -268,9 +268,9 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
 
 	ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
 
-	if (poll_hotkey->poll_result){
+	if (poll_hotkey->poll_result) {
 		buf = format_result(poll_hotkey->poll_result);
-		if(buf)
+		if (buf)
 			seq_printf(seq, "%s", buf);
 		kfree(buf);
 	}
@@ -299,7 +299,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
 		union acpi_hotkey *key =
 		    container_of(entries, union acpi_hotkey, entries);
 		if (key->link.hotkey_type == ACPI_HOTKEY_EVENT
-		    && key->event_hotkey.external_hotkey_num == event){
+		    && key->event_hotkey.external_hotkey_num == event) {
 			val = key->link.hotkey_standard_num;
 			break;
 		}
@@ -343,7 +343,7 @@ static int auto_hotkey_remove(struct acpi_device *device, int type)
 static int create_polling_proc(union acpi_hotkey *device)
 {
 	struct proc_dir_entry *proc;
-	char  proc_name[80];
+	char proc_name[80];
 	mode_t mode;
 
 	ACPI_FUNCTION_TRACE("create_polling_proc");
@@ -351,8 +351,8 @@ static int create_polling_proc(union acpi_hotkey *device)
 
 	sprintf(proc_name, "%d", device->link.hotkey_standard_num);
 	/*
-	strcat(proc_name, device->poll_hotkey.poll_method);
-	*/
+	   strcat(proc_name, device->poll_hotkey.poll_method);
+	 */
 	proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
 
 	if (!proc) {
@@ -415,50 +415,50 @@ static int hotkey_remove(union acpi_hotkey *device)
 	return_VALUE(0);
 }
 
-static int  hotkey_update(union acpi_hotkey *key)
+static int hotkey_update(union acpi_hotkey *key)
 {
 	struct list_head *entries;
 
 	ACPI_FUNCTION_TRACE("hotkey_update");
 
 	list_for_each(entries, global_hotkey_list.entries) {
-		union acpi_hotkey *tmp=
+		union acpi_hotkey *tmp =
 		    container_of(entries, union acpi_hotkey, entries);
 		if (tmp->link.hotkey_standard_num ==
 		    key->link.hotkey_standard_num) {
 			if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
 				free_hotkey_buffer(tmp);
 				tmp->event_hotkey.bus_handle =
-			    		key->event_hotkey.bus_handle;
+				    key->event_hotkey.bus_handle;
 				tmp->event_hotkey.external_hotkey_num =
-			    		key->event_hotkey.external_hotkey_num;
+				    key->event_hotkey.external_hotkey_num;
 				tmp->event_hotkey.action_handle =
-			    		key->event_hotkey.action_handle;
+				    key->event_hotkey.action_handle;
 				tmp->event_hotkey.action_method =
-			    		key->event_hotkey.action_method;
+				    key->event_hotkey.action_method;
 				kfree(key);
 			} else {
 				/*
-				char  proc_name[80];
+				   char  proc_name[80];
 
-				sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
-				strcat(proc_name, tmp->poll_hotkey.poll_method);
-				remove_proc_entry(proc_name,hotkey_proc_dir);
-				*/
+				   sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
+				   strcat(proc_name, tmp->poll_hotkey.poll_method);
+				   remove_proc_entry(proc_name,hotkey_proc_dir);
+				 */
 				free_poll_hotkey_buffer(tmp);
 				tmp->poll_hotkey.poll_handle =
-					key->poll_hotkey.poll_handle;
+				    key->poll_hotkey.poll_handle;
 				tmp->poll_hotkey.poll_method =
-					key->poll_hotkey.poll_method;
+				    key->poll_hotkey.poll_method;
 				tmp->poll_hotkey.action_handle =
-					key->poll_hotkey.action_handle;
+				    key->poll_hotkey.action_handle;
 				tmp->poll_hotkey.action_method =
-					key->poll_hotkey.action_method;
+				    key->poll_hotkey.action_method;
 				tmp->poll_hotkey.poll_result =
-					key->poll_hotkey.poll_result;
+				    key->poll_hotkey.poll_result;
 				/*
-				create_polling_proc(tmp);
-				*/
+				   create_polling_proc(tmp);
+				 */
 				kfree(key);
 			}
 			return_VALUE(0);
@@ -483,27 +483,25 @@ static void free_hotkey_device(union acpi_hotkey *key)
 						   acpi_hotkey_notify_handler);
 		free_hotkey_buffer(key);
 	} else {
-		char  proc_name[80];
+		char proc_name[80];
 
 		sprintf(proc_name, "%d", key->link.hotkey_standard_num);
 		/*
-		strcat(proc_name, key->poll_hotkey.poll_method);
-		*/
-		remove_proc_entry(proc_name,hotkey_proc_dir);
+		   strcat(proc_name, key->poll_hotkey.poll_method);
+		 */
+		remove_proc_entry(proc_name, hotkey_proc_dir);
 		free_poll_hotkey_buffer(key);
 	}
 	kfree(key);
 	return_VOID;
 }
 
-static void
-free_hotkey_buffer(union acpi_hotkey *key)
+static void free_hotkey_buffer(union acpi_hotkey *key)
 {
 	kfree(key->event_hotkey.action_method);
 }
 
-static void
-free_poll_hotkey_buffer(union acpi_hotkey *key)
+static void free_poll_hotkey_buffer(union acpi_hotkey *key)
 {
 	kfree(key->poll_hotkey.action_method);
 	kfree(key->poll_hotkey.poll_method);
@@ -513,15 +511,15 @@ static int
 init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
 		   char *method, int std_num, int external_num)
 {
-	acpi_handle	tmp_handle;
+	acpi_handle tmp_handle;
 	acpi_status status = AE_OK;
 
 	ACPI_FUNCTION_TRACE("init_hotkey_device");
 
-	if(std_num < 0 || IS_POLL(std_num) || !key )
+	if (std_num < 0 || IS_POLL(std_num) || !key)
 		goto do_fail;
 
-	if(!bus_str || !action_str || !method)
+	if (!bus_str || !action_str || !method)
 		goto do_fail;
 
 	key->link.hotkey_type = ACPI_HOTKEY_EVENT;
@@ -529,19 +527,22 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
 	key->event_hotkey.flag = 0;
 	key->event_hotkey.action_method = method;
 
-	status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle));
-	if(ACPI_FAILURE(status))
+	status =
+	    acpi_get_handle(NULL, bus_str, &(key->event_hotkey.bus_handle));
+	if (ACPI_FAILURE(status))
 		goto do_fail;
 	key->event_hotkey.external_hotkey_num = external_num;
-	status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle));
-	if(ACPI_FAILURE(status))
+	status =
+	    acpi_get_handle(NULL, action_str,
+			    &(key->event_hotkey.action_handle));
+	if (ACPI_FAILURE(status))
 		goto do_fail;
 	status = acpi_get_handle(key->event_hotkey.action_handle,
-				method, &tmp_handle);
+				 method, &tmp_handle);
 	if (ACPI_FAILURE(status))
 		goto do_fail;
 	return_VALUE(AE_OK);
-do_fail:
+      do_fail:
 	return_VALUE(-ENODEV);
 }
 
@@ -552,14 +553,14 @@ init_poll_hotkey_device(union acpi_hotkey *key,
 			char *action_str, char *action_method, int std_num)
 {
 	acpi_status status = AE_OK;
-	acpi_handle	tmp_handle;
+	acpi_handle tmp_handle;
 
 	ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
 
-	if(std_num < 0 || IS_EVENT(std_num) || !key)
+	if (std_num < 0 || IS_EVENT(std_num) || !key)
 		goto do_fail;
 
-	if(!poll_str || !poll_method || !action_str || !action_method)
+	if (!poll_str || !poll_method || !action_str || !action_method)
 		goto do_fail;
 
 	key->link.hotkey_type = ACPI_HOTKEY_POLLING;
@@ -568,30 +569,32 @@ init_poll_hotkey_device(union acpi_hotkey *key,
 	key->poll_hotkey.poll_method = poll_method;
 	key->poll_hotkey.action_method = action_method;
 
-	status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle));
-	if(ACPI_FAILURE(status))
+	status =
+	    acpi_get_handle(NULL, poll_str, &(key->poll_hotkey.poll_handle));
+	if (ACPI_FAILURE(status))
 		goto do_fail;
 	status = acpi_get_handle(key->poll_hotkey.poll_handle,
-				poll_method, &tmp_handle);
-        if (ACPI_FAILURE(status))
-       		goto do_fail;
-	status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle));
+				 poll_method, &tmp_handle);
+	if (ACPI_FAILURE(status))
+		goto do_fail;
+	status =
+	    acpi_get_handle(NULL, action_str,
+			    &(key->poll_hotkey.action_handle));
 	if (ACPI_FAILURE(status))
 		goto do_fail;
 	status = acpi_get_handle(key->poll_hotkey.action_handle,
-				action_method, &tmp_handle);
+				 action_method, &tmp_handle);
 	if (ACPI_FAILURE(status))
 		goto do_fail;
 	key->poll_hotkey.poll_result =
 	    (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
-	if(!key->poll_hotkey.poll_result)
+	if (!key->poll_hotkey.poll_result)
 		goto do_fail;
 	return_VALUE(AE_OK);
-do_fail:
+      do_fail:
 	return_VALUE(-ENODEV);
 }
 
-
 static int hotkey_open_config(struct inode *inode, struct file *file)
 {
 	ACPI_FUNCTION_TRACE("hotkey_open_config");
@@ -679,8 +682,9 @@ get_parms(char *config_record,
 
 	sscanf(config_record, "%d", cmd);
 
-	if(*cmd == 1){
-		if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2)
+	if (*cmd == 1) {
+		if (sscanf(config_record, "%d:%d", cmd, internal_event_num) !=
+		    2)
 			goto do_fail;
 		else
 			return (6);
@@ -694,8 +698,8 @@ get_parms(char *config_record,
 		goto do_fail;
 
 	count = tmp1 - tmp;
-	*bus_handle = (char *) kmalloc(count+1, GFP_KERNEL);
-	if(!*bus_handle)
+	*bus_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
+	if (!*bus_handle)
 		goto do_fail;
 	strncpy(*bus_handle, tmp, count);
 	*(*bus_handle + count) = 0;
@@ -706,8 +710,8 @@ get_parms(char *config_record,
 	if (!tmp1)
 		goto do_fail;
 	count = tmp1 - tmp;
-	*bus_method = (char *) kmalloc(count+1, GFP_KERNEL);
-	if(!*bus_method)
+	*bus_method = (char *)kmalloc(count + 1, GFP_KERNEL);
+	if (!*bus_method)
 		goto do_fail;
 	strncpy(*bus_method, tmp, count);
 	*(*bus_method + count) = 0;
@@ -718,7 +722,7 @@ get_parms(char *config_record,
 	if (!tmp1)
 		goto do_fail;
 	count = tmp1 - tmp;
-	*action_handle = (char *) kmalloc(count+1, GFP_KERNEL);
+	*action_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
 	strncpy(*action_handle, tmp, count);
 	*(*action_handle + count) = 0;
 
@@ -728,17 +732,18 @@ get_parms(char *config_record,
 	if (!tmp1)
 		goto do_fail;
 	count = tmp1 - tmp;
-	*method = (char *) kmalloc(count+1, GFP_KERNEL);
-	if(!*method)
+	*method = (char *)kmalloc(count + 1, GFP_KERNEL);
+	if (!*method)
 		goto do_fail;
 	strncpy(*method, tmp, count);
 	*(*method + count) = 0;
 
-	if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0)
+	if (sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num) <=
+	    0)
 		goto do_fail;
 
 	return_VALUE(6);
-do_fail:
+      do_fail:
 	return_VALUE(-1);
 }
 
@@ -758,8 +763,8 @@ static ssize_t hotkey_write_config(struct file *file,
 
 	ACPI_FUNCTION_TRACE(("hotkey_write_config"));
 
-	config_record = (char *) kmalloc(count+1, GFP_KERNEL);
-	if(!config_record)
+	config_record = (char *)kmalloc(count + 1, GFP_KERNEL);
+	if (!config_record)
 		return_VALUE(-ENOMEM);
 
 	if (copy_from_user(config_record, buffer, count)) {
@@ -777,10 +782,10 @@ static ssize_t hotkey_write_config(struct file *file,
 			&method, &internal_event_num, &external_event_num);
 
 	kfree(config_record);
-	if(IS_OTHERS(internal_event_num))
+	if (IS_OTHERS(internal_event_num))
 		goto do_fail;
 	if (ret != 6) {
-do_fail:	
+	      do_fail:
 		kfree(bus_handle);
 		kfree(bus_method);
 		kfree(action_handle);
@@ -791,14 +796,14 @@ do_fail:
 	}
 
 	key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
-	if(!key)
+	if (!key)
 		goto do_fail;
 	memset(key, 0, sizeof(union acpi_hotkey));
-	if(cmd == 1) {
+	if (cmd == 1) {
 		union acpi_hotkey *tmp = NULL;
 		tmp = get_hotkey_by_event(&global_hotkey_list,
-				internal_event_num);
-		if(!tmp)
+					  internal_event_num);
+		if (!tmp)
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key"));
 		else
 			memcpy(key, tmp, sizeof(union acpi_hotkey));
@@ -807,15 +812,16 @@ do_fail:
 	if (IS_EVENT(internal_event_num)) {
 		kfree(bus_method);
 		ret = init_hotkey_device(key, bus_handle, action_handle, method,
-				 internal_event_num, external_event_num);
+					 internal_event_num,
+					 external_event_num);
 	} else
 		ret = init_poll_hotkey_device(key, bus_handle, bus_method,
-				      action_handle, method,
-				      internal_event_num);
+					      action_handle, method,
+					      internal_event_num);
 	if (ret) {
 		kfree(bus_handle);
 		kfree(action_handle);
-		if(IS_EVENT(internal_event_num))
+		if (IS_EVENT(internal_event_num))
 			free_hotkey_buffer(key);
 		else
 			free_poll_hotkey_buffer(key);
@@ -824,13 +830,14 @@ do_fail:
 		return_VALUE(-EINVAL);
 	}
 
-cont_cmd:
+      cont_cmd:
 	kfree(bus_handle);
 	kfree(action_handle);
 
 	switch (cmd) {
 	case 0:
-		if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num))
+		if (get_hotkey_by_event
+		    (&global_hotkey_list, key->link.hotkey_standard_num))
 			goto fail_out;
 		else
 			hotkey_add(key);
@@ -839,7 +846,7 @@ cont_cmd:
 		hotkey_remove(key);
 		break;
 	case 2:
-		if(hotkey_update(key))
+		if (hotkey_update(key))
 			goto fail_out;
 		break;
 	default:
@@ -847,8 +854,8 @@ cont_cmd:
 		break;
 	}
 	return_VALUE(count);
-fail_out:
-	if(IS_EVENT(internal_event_num))
+      fail_out:
+	if (IS_EVENT(internal_event_num))
 		free_hotkey_buffer(key);
 	else
 		free_poll_hotkey_buffer(key);
@@ -882,7 +889,8 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
 	return_VALUE(status == AE_OK);
 }
 
-static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val)
+static int read_acpi_int(acpi_handle handle, const char *method,
+			 union acpi_object *val)
 {
 	struct acpi_buffer output;
 	union acpi_object out_obj;
@@ -893,7 +901,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
 	output.pointer = &out_obj;
 
 	status = acpi_evaluate_object(handle, (char *)method, NULL, &output);
-	if(val){
+	if (val) {
 		val->integer.value = out_obj.integer.value;
 		val->type = out_obj.type;
 	} else
@@ -903,8 +911,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
 }
 
 static union acpi_hotkey *get_hotkey_by_event(struct
-			      acpi_hotkey_list
-			      *hotkey_list, int event)
+					      acpi_hotkey_list
+					      *hotkey_list, int event)
 {
 	struct list_head *entries;
 
@@ -912,10 +920,10 @@ static union acpi_hotkey *get_hotkey_by_event(struct
 		union acpi_hotkey *key =
 		    container_of(entries, union acpi_hotkey, entries);
 		if (key->link.hotkey_standard_num == event) {
-			return(key);
+			return (key);
 		}
 	}
-	return(NULL);
+	return (NULL);
 }
 
 /*
@@ -932,15 +940,15 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
 {
 	struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
 	char *arg;
-	int event,method_type,type, value;
+	int event, method_type, type, value;
 	union acpi_hotkey *key;
 
 	ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
 
-	arg = (char *) kmalloc(count+1, GFP_KERNEL);
-	if(!arg)
+	arg = (char *)kmalloc(count + 1, GFP_KERNEL);
+	if (!arg)
 		return_VALUE(-ENOMEM);
-	arg[count]=0;
+	arg[count] = 0;
 
 	if (copy_from_user(arg, buffer, count)) {
 		kfree(arg);
@@ -948,7 +956,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
 		return_VALUE(-EINVAL);
 	}
 
-	if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) {
+	if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) !=
+	    4) {
 		kfree(arg);
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3"));
 		return_VALUE(-EINVAL);
@@ -956,19 +965,21 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
 	kfree(arg);
 	if (type == ACPI_TYPE_INTEGER) {
 		key = get_hotkey_by_event(hotkey_list, event);
-		if(!key)
+		if (!key)
 			goto do_fail;
 		if (IS_EVENT(event))
 			write_acpi_int(key->event_hotkey.action_handle,
-					key->event_hotkey.action_method, value, NULL);
+				       key->event_hotkey.action_method, value,
+				       NULL);
 		else if (IS_POLL(event)) {
-			if ( method_type == POLL_METHOD )
+			if (method_type == POLL_METHOD)
 				read_acpi_int(key->poll_hotkey.poll_handle,
-					key->poll_hotkey.poll_method,
-					key->poll_hotkey.poll_result);
-			else if ( method_type == ACTION_METHOD )
+					      key->poll_hotkey.poll_method,
+					      key->poll_hotkey.poll_result);
+			else if (method_type == ACTION_METHOD)
 				write_acpi_int(key->poll_hotkey.action_handle,
-					key->poll_hotkey.action_method, value, NULL);
+					       key->poll_hotkey.action_method,
+					       value, NULL);
 			else
 				goto do_fail;
 
@@ -978,7 +989,7 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
 		return_VALUE(-EINVAL);
 	}
 	return_VALUE(count);
-do_fail:
+      do_fail:
 	return_VALUE(-EINVAL);
 
 }
@@ -1074,15 +1085,15 @@ static int __init hotkey_init(void)
 
 	return (0);
 
-do_fail5:
+      do_fail5:
 	remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir);
-do_fail4:
+      do_fail4:
 	remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir);
-do_fail3:
+      do_fail3:
 	remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir);
-do_fail2:
+      do_fail2:
 	remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir);
-do_fail1:
+      do_fail1:
 	remove_proc_entry(HOTKEY_PROC, acpi_root_dir);
 	return (-ENODEV);
 }

+ 156 - 166
drivers/acpi/ibm_acpi.c

@@ -86,52 +86,46 @@ static acpi_handle root_handle = NULL;
 	static acpi_handle *object##_parent = &parent##_handle;	\
 	static char        *object##_paths[] = { paths }
 
-IBM_HANDLE(ec, root,
-	   "\\_SB.PCI0.ISA.EC",    /* A21e, A22p, T20, T21, X20 */
-	   "\\_SB.PCI0.LPC.EC",    /* all others */
-);
-
-IBM_HANDLE(vid, root, 
-	   "\\_SB.PCI0.VID",       /* A21e, G40, X30, X40 */
-	   "\\_SB.PCI0.AGP.VID",   /* all others */
-);
-
-IBM_HANDLE(cmos, root,
-	   "\\UCMS",               /* R50, R50p, R51, T4x, X31, X40 */
-	   "\\CMOS",               /* A3x, G40, R32, T23, T30, X22, X24, X30 */
-	   "\\CMS",                /* R40, R40e */
-);                                 /* A21e, A22p, T20, T21, X20 */
-
-IBM_HANDLE(dock, root,
-	   "\\_SB.GDCK",           /* X30, X31, X40 */
-	   "\\_SB.PCI0.DOCK",      /* A22p, T20, T21, X20 */
-	   "\\_SB.PCI0.PCI1.DOCK", /* all others */
-);                                 /* A21e, G40, R32, R40, R40e */
-
-IBM_HANDLE(bay, root,
-	   "\\_SB.PCI0.IDE0.SCND.MSTR");      /* all except A21e */
-IBM_HANDLE(bayej, root,
-	   "\\_SB.PCI0.IDE0.SCND.MSTR._EJ0"); /* all except A2x, A3x */
-
-IBM_HANDLE(lght, root, "\\LGHT");  /* A21e, A22p, T20, T21, X20 */
-IBM_HANDLE(hkey, ec,   "HKEY");    /* all */
-IBM_HANDLE(led,  ec,   "LED");     /* all except A21e, A22p, T20, T21, X20 */
-IBM_HANDLE(sysl, ec,   "SYSL");    /* A21e, A22p, T20, T21, X20 */
-IBM_HANDLE(bled, ec,   "BLED");    /* A22p, T20, T21, X20 */
-IBM_HANDLE(beep, ec,   "BEEP");    /* all models */
+IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC",	/* A21e, A22p, T20, T21, X20 */
+	   "\\_SB.PCI0.LPC.EC",	/* all others */
+    );
+
+IBM_HANDLE(vid, root, "\\_SB.PCI0.VID",	/* A21e, G40, X30, X40 */
+	   "\\_SB.PCI0.AGP.VID",	/* all others */
+    );
+
+IBM_HANDLE(cmos, root, "\\UCMS",	/* R50, R50p, R51, T4x, X31, X40 */
+	   "\\CMOS",		/* A3x, G40, R32, T23, T30, X22, X24, X30 */
+	   "\\CMS",		/* R40, R40e */
+    );				/* A21e, A22p, T20, T21, X20 */
+
+IBM_HANDLE(dock, root, "\\_SB.GDCK",	/* X30, X31, X40 */
+	   "\\_SB.PCI0.DOCK",	/* A22p, T20, T21, X20 */
+	   "\\_SB.PCI0.PCI1.DOCK",	/* all others */
+    );				/* A21e, G40, R32, R40, R40e */
+
+IBM_HANDLE(bay, root, "\\_SB.PCI0.IDE0.SCND.MSTR");	/* all except A21e */
+IBM_HANDLE(bayej, root, "\\_SB.PCI0.IDE0.SCND.MSTR._EJ0");	/* all except A2x, A3x */
+
+IBM_HANDLE(lght, root, "\\LGHT");	/* A21e, A22p, T20, T21, X20 */
+IBM_HANDLE(hkey, ec, "HKEY");	/* all */
+IBM_HANDLE(led, ec, "LED");	/* all except A21e, A22p, T20, T21, X20 */
+IBM_HANDLE(sysl, ec, "SYSL");	/* A21e, A22p, T20, T21, X20 */
+IBM_HANDLE(bled, ec, "BLED");	/* A22p, T20, T21, X20 */
+IBM_HANDLE(beep, ec, "BEEP");	/* all models */
 
 struct ibm_struct {
 	char *name;
 
 	char *hid;
 	struct acpi_driver *driver;
-	
-	int  (*init)   (struct ibm_struct *);
-	int  (*read)   (struct ibm_struct *, char *);
-	int  (*write)  (struct ibm_struct *, char *);
-	void (*exit)   (struct ibm_struct *);
 
-	void (*notify) (struct ibm_struct *, u32);	
+	int (*init) (struct ibm_struct *);
+	int (*read) (struct ibm_struct *, char *);
+	int (*write) (struct ibm_struct *, char *);
+	void (*exit) (struct ibm_struct *);
+
+	void (*notify) (struct ibm_struct *, u32);
 	acpi_handle *handle;
 	int type;
 	struct acpi_device *device;
@@ -165,15 +159,15 @@ static int acpi_evalf(acpi_handle handle,
 		      void *res, char *method, char *fmt, ...)
 {
 	char *fmt0 = fmt;
-        struct acpi_object_list	params;
-        union acpi_object	in_objs[IBM_MAX_ACPI_ARGS];
-        struct acpi_buffer	result;
-        union acpi_object	out_obj;
-        acpi_status		status;
-	va_list			ap;
-	char			res_type;
-	int			success;
-	int			quiet;
+	struct acpi_object_list params;
+	union acpi_object in_objs[IBM_MAX_ACPI_ARGS];
+	struct acpi_buffer result;
+	union acpi_object out_obj;
+	acpi_status status;
+	va_list ap;
+	char res_type;
+	int success;
+	int quiet;
 
 	if (!*fmt) {
 		printk(IBM_ERR "acpi_evalf() called with empty format\n");
@@ -199,7 +193,7 @@ static int acpi_evalf(acpi_handle handle,
 			in_objs[params.count].integer.value = va_arg(ap, int);
 			in_objs[params.count++].type = ACPI_TYPE_INTEGER;
 			break;
-		/* add more types as needed */
+			/* add more types as needed */
 		default:
 			printk(IBM_ERR "acpi_evalf() called "
 			       "with invalid format character '%c'\n", c);
@@ -214,15 +208,15 @@ static int acpi_evalf(acpi_handle handle,
 	status = acpi_evaluate_object(handle, method, &params, &result);
 
 	switch (res_type) {
-	case 'd':	/* int */
+	case 'd':		/* int */
 		if (res)
 			*(int *)res = out_obj.integer.value;
 		success = status == AE_OK && out_obj.type == ACPI_TYPE_INTEGER;
 		break;
-	case 'v':	/* void */
+	case 'v':		/* void */
 		success = status == AE_OK;
 		break;
-	/* add more types as needed */
+		/* add more types as needed */
 	default:
 		printk(IBM_ERR "acpi_evalf() called "
 		       "with invalid format character '%c'\n", res_type);
@@ -303,9 +297,9 @@ static int hotkey_set(struct ibm_struct *ibm, int status, int mask)
 	if (!ibm->supported)
 		return 0;
 
-	for (i=0; i<32; i++) {
+	for (i = 0; i < 32; i++) {
 		int bit = ((1 << i) & mask) != 0;
-		if (!acpi_evalf(hkey_handle, NULL, "MHKM", "vdd", i+1, bit))
+		if (!acpi_evalf(hkey_handle, NULL, "MHKM", "vdd", i + 1, bit))
 			return -EIO;
 	}
 
@@ -318,8 +312,7 @@ static int hotkey_init(struct ibm_struct *ibm)
 
 	ibm->supported = 1;
 	ret = hotkey_get(ibm,
-			 &ibm->state.hotkey.status,
-			 &ibm->state.hotkey.mask);
+			 &ibm->state.hotkey.status, &ibm->state.hotkey.mask);
 	if (ret < 0) {
 		/* mask not supported on A21e, A22p, T20, T21, X20, X22, X24 */
 		ibm->supported = 0;
@@ -329,7 +322,7 @@ static int hotkey_init(struct ibm_struct *ibm)
 	}
 
 	return ret;
-}	
+}
 
 static int hotkey_read(struct ibm_struct *ibm, char *p)
 {
@@ -368,7 +361,7 @@ static int hotkey_write(struct ibm_struct *ibm, char *buf)
 			status = 0;
 		} else if (strlencmp(cmd, "reset") == 0) {
 			status = ibm->state.hotkey.status;
-			mask   = ibm->state.hotkey.mask;
+			mask = ibm->state.hotkey.mask;
 		} else if (sscanf(cmd, "0x%x", &mask) == 1) {
 			/* mask set */
 		} else if (sscanf(cmd, "%x", &mask) == 1) {
@@ -382,7 +375,7 @@ static int hotkey_write(struct ibm_struct *ibm, char *buf)
 		return -EIO;
 
 	return 0;
-}	
+}
 
 static void hotkey_exit(struct ibm_struct *ibm)
 {
@@ -398,7 +391,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
 	else {
 		printk(IBM_ERR "unknown hotkey event %d\n", event);
 		acpi_bus_generate_event(ibm->device, event, 0);
-	}	
+	}
 }
 
 static int bluetooth_init(struct ibm_struct *ibm)
@@ -456,15 +449,14 @@ static int bluetooth_write(struct ibm_struct *ibm, char *buf)
 	}
 
 	if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
-	    return -EIO;
+		return -EIO;
 
 	return 0;
 }
 
 static int video_init(struct ibm_struct *ibm)
 {
-	if (!acpi_evalf(vid_handle,
-			&ibm->state.video.autoswitch, "^VDEE", "d"))
+	if (!acpi_evalf(vid_handle, &ibm->state.video.autoswitch, "^VDEE", "d"))
 		return -ENODEV;
 
 	return 0;
@@ -566,8 +558,7 @@ static int video_write(struct ibm_struct *ibm, char *buf)
 
 static void video_exit(struct ibm_struct *ibm)
 {
-	acpi_evalf(vid_handle, NULL, "_DOS", "vd",
-		   ibm->state.video.autoswitch);
+	acpi_evalf(vid_handle, NULL, "_DOS", "vd", ibm->state.video.autoswitch);
 }
 
 static int light_init(struct ibm_struct *ibm)
@@ -600,7 +591,7 @@ static int light_write(struct ibm_struct *ibm, char *buf)
 	int cmos_cmd, lght_cmd;
 	char *cmd;
 	int success;
-	
+
 	while ((cmd = next_cmd(&buf))) {
 		if (strlencmp(cmd, "on") == 0) {
 			cmos_cmd = 0x0c;
@@ -610,10 +601,10 @@ static int light_write(struct ibm_struct *ibm, char *buf)
 			lght_cmd = 0;
 		} else
 			return -EINVAL;
-		
+
 		success = cmos_handle ?
-			acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) :
-			acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd);
+		    acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) :
+		    acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd);
 		if (!success)
 			return -EIO;
 	}
@@ -671,22 +662,22 @@ static int dock_write(struct ibm_struct *ibm, char *buf)
 	}
 
 	return 0;
-}	
+}
 
 static void dock_notify(struct ibm_struct *ibm, u32 event)
 {
 	int docked = dock_docked();
 
 	if (event == 3 && docked)
-		acpi_bus_generate_event(ibm->device, event, 1); /* button */
+		acpi_bus_generate_event(ibm->device, event, 1);	/* button */
 	else if (event == 3 && !docked)
-		acpi_bus_generate_event(ibm->device, event, 2); /* undock */
+		acpi_bus_generate_event(ibm->device, event, 2);	/* undock */
 	else if (event == 0 && docked)
-		acpi_bus_generate_event(ibm->device, event, 3); /* dock */
+		acpi_bus_generate_event(ibm->device, event, 3);	/* dock */
 	else {
 		printk(IBM_ERR "unknown dock event %d, status %d\n",
 		       event, _sta(dock_handle));
-		acpi_bus_generate_event(ibm->device, event, 0); /* unknown */
+		acpi_bus_generate_event(ibm->device, event, 0);	/* unknown */
 	}
 }
 
@@ -696,7 +687,7 @@ static int bay_init(struct ibm_struct *ibm)
 {
 	/* bay not supported on A21e, A22p, A31, A31p, G40, R32, R40e */
 	ibm->supported = bay_handle && bayej_handle &&
-		acpi_evalf(bay_handle, NULL, "_STA", "qv");
+	    acpi_evalf(bay_handle, NULL, "_STA", "qv");
 
 	return 0;
 }
@@ -705,7 +696,7 @@ static int bay_read(struct ibm_struct *ibm, char *p)
 {
 	int len = 0;
 	int occupied = bay_occupied();
-	
+
 	if (!ibm->supported)
 		len += sprintf(p + len, "status:\t\tnot supported\n");
 	else if (!occupied)
@@ -732,7 +723,7 @@ static int bay_write(struct ibm_struct *ibm, char *buf)
 	}
 
 	return 0;
-}	
+}
 
 static void bay_notify(struct ibm_struct *ibm, u32 event)
 {
@@ -773,8 +764,8 @@ static int cmos_write(struct ibm_struct *ibm, char *buf)
 	}
 
 	return 0;
-}	
-		
+}
+
 static int led_read(struct ibm_struct *ibm, char *p)
 {
 	int len = 0;
@@ -809,7 +800,7 @@ static int led_write(struct ibm_struct *ibm, char *buf)
 			led_cmd = sysl_cmd = bled_a = bled_b = 0;
 		} else
 			return -EINVAL;
-		
+
 		if (led_handle) {
 			if (!acpi_evalf(led_handle, NULL, NULL, "vdd",
 					led, led_cmd))
@@ -827,8 +818,8 @@ static int led_write(struct ibm_struct *ibm, char *buf)
 	}
 
 	return 0;
-}	
-		
+}
+
 static int beep_read(struct ibm_struct *ibm, char *p)
 {
 	int len = 0;
@@ -854,80 +845,81 @@ static int beep_write(struct ibm_struct *ibm, char *buf)
 	}
 
 	return 0;
-}	
-		
+}
+
 static struct ibm_struct ibms[] = {
 	{
-		.name	= "driver",
-		.init	= driver_init,
-		.read	= driver_read,
-	},
+	 .name = "driver",
+	 .init = driver_init,
+	 .read = driver_read,
+	 },
 	{
-		.name	= "hotkey",
-		.hid	= "IBM0068",
-		.init	= hotkey_init,
-		.read	= hotkey_read,
-		.write	= hotkey_write,
-		.exit	= hotkey_exit,
-		.notify	= hotkey_notify,
-		.handle	= &hkey_handle,
-		.type	= ACPI_DEVICE_NOTIFY,
-	},
+	 .name = "hotkey",
+	 .hid = "IBM0068",
+	 .init = hotkey_init,
+	 .read = hotkey_read,
+	 .write = hotkey_write,
+	 .exit = hotkey_exit,
+	 .notify = hotkey_notify,
+	 .handle = &hkey_handle,
+	 .type = ACPI_DEVICE_NOTIFY,
+	 },
 	{
-		.name	= "bluetooth",
-		.init	= bluetooth_init,
-		.read	= bluetooth_read,
-		.write	= bluetooth_write,
-	},
+	 .name = "bluetooth",
+	 .init = bluetooth_init,
+	 .read = bluetooth_read,
+	 .write = bluetooth_write,
+	 },
 	{
-		.name	= "video",
-		.init	= video_init,
-		.read	= video_read,
-		.write	= video_write,
-		.exit	= video_exit,
-	},
+	 .name = "video",
+	 .init = video_init,
+	 .read = video_read,
+	 .write = video_write,
+	 .exit = video_exit,
+	 },
 	{
-		.name	= "light",
-		.init	= light_init,
-		.read	= light_read,
-		.write	= light_write,
-	},
+	 .name = "light",
+	 .init = light_init,
+	 .read = light_read,
+	 .write = light_write,
+	 },
 	{
-		.name	= "dock",
-		.read	= dock_read,
-		.write	= dock_write,
-		.notify	= dock_notify,
-		.handle	= &dock_handle,
-		.type	= ACPI_SYSTEM_NOTIFY,
-	},
+	 .name = "dock",
+	 .read = dock_read,
+	 .write = dock_write,
+	 .notify = dock_notify,
+	 .handle = &dock_handle,
+	 .type = ACPI_SYSTEM_NOTIFY,
+	 },
 	{
-		.name	= "bay",
-		.init	= bay_init,
-		.read	= bay_read,
-		.write	= bay_write,
-		.notify	= bay_notify,
-		.handle	= &bay_handle,
-		.type	= ACPI_SYSTEM_NOTIFY,
-	},
+	 .name = "bay",
+	 .init = bay_init,
+	 .read = bay_read,
+	 .write = bay_write,
+	 .notify = bay_notify,
+	 .handle = &bay_handle,
+	 .type = ACPI_SYSTEM_NOTIFY,
+	 },
 	{
-		.name	= "cmos",
-		.read	= cmos_read,
-		.write	= cmos_write,
-		.experimental = 1,
-	},
+	 .name = "cmos",
+	 .read = cmos_read,
+	 .write = cmos_write,
+	 .experimental = 1,
+	 },
 	{
-		.name	= "led",
-		.read	= led_read,
-		.write	= led_write,
-		.experimental = 1,
-	},
+	 .name = "led",
+	 .read = led_read,
+	 .write = led_write,
+	 .experimental = 1,
+	 },
 	{
-		.name	= "beep",
-		.read	= beep_read,
-		.write	= beep_write,
-		.experimental = 1,
-	},
+	 .name = "beep",
+	 .read = beep_read,
+	 .write = beep_write,
+	 .experimental = 1,
+	 },
 };
+
 #define NUM_IBMS (sizeof(ibms)/sizeof(ibms[0]))
 
 static int dispatch_read(char *page, char **start, off_t off, int count,
@@ -935,7 +927,7 @@ static int dispatch_read(char *page, char **start, off_t off, int count,
 {
 	struct ibm_struct *ibm = (struct ibm_struct *)data;
 	int len;
-	
+
 	if (!ibm || !ibm->read)
 		return -EINVAL;
 
@@ -955,7 +947,7 @@ static int dispatch_read(char *page, char **start, off_t off, int count,
 	return len;
 }
 
-static int dispatch_write(struct file *file, const char __user *userbuf,
+static int dispatch_write(struct file *file, const char __user * userbuf,
 			  unsigned long count, void *data)
 {
 	struct ibm_struct *ibm = (struct ibm_struct *)data;
@@ -969,9 +961,9 @@ static int dispatch_write(struct file *file, const char __user *userbuf,
 	if (!kernbuf)
 		return -ENOMEM;
 
-        if (copy_from_user(kernbuf, userbuf, count)) {
+	if (copy_from_user(kernbuf, userbuf, count)) {
 		kfree(kernbuf);
-                return -EFAULT;
+		return -EFAULT;
 	}
 
 	kernbuf[count] = 0;
@@ -982,7 +974,7 @@ static int dispatch_write(struct file *file, const char __user *userbuf,
 
 	kfree(kernbuf);
 
-        return ret;
+	return ret;
 }
 
 static void dispatch_notify(acpi_handle handle, u32 event, void *data)
@@ -1085,7 +1077,7 @@ static int ibm_init(struct ibm_struct *ibm)
 	}
 	entry->owner = THIS_MODULE;
 	ibm->proc_created = 1;
-	
+
 	entry->data = ibm;
 	if (ibm->read)
 		entry->read_proc = &dispatch_read;
@@ -1120,18 +1112,18 @@ static void ibm_exit(struct ibm_struct *ibm)
 }
 
 static int ibm_handle_init(char *name,
-			   acpi_handle *handle, acpi_handle parent,
+			   acpi_handle * handle, acpi_handle parent,
 			   char **paths, int num_paths, int required)
 {
 	int i;
 	acpi_status status;
 
-	for (i=0; i<num_paths; i++) {
+	for (i = 0; i < num_paths; i++) {
 		status = acpi_get_handle(parent, paths[i], handle);
 		if (ACPI_SUCCESS(status))
 			return 0;
 	}
-	
+
 	*handle = NULL;
 
 	if (required) {
@@ -1146,7 +1138,6 @@ static int ibm_handle_init(char *name,
 	ibm_handle_init(#object, &object##_handle, *object##_parent,	\
 		object##_paths, sizeof(object##_paths)/sizeof(char*), required)
 
-
 static int set_ibm_param(const char *val, struct kernel_param *kp)
 {
 	unsigned int i;
@@ -1158,7 +1149,7 @@ static int set_ibm_param(const char *val, struct kernel_param *kp)
 	strcpy(arg_with_comma, val);
 	strcat(arg_with_comma, ",");
 
-	for (i=0; i<NUM_IBMS; i++)
+	for (i = 0; i < NUM_IBMS; i++)
 		if (strcmp(ibms[i].name, kp->name) == 0)
 			return ibms[i].write(&ibms[i], arg_with_comma);
 	BUG();
@@ -1172,7 +1163,7 @@ static void acpi_ibm_exit(void)
 {
 	int i;
 
-	for (i=NUM_IBMS-1; i>=0; i--)
+	for (i = NUM_IBMS - 1; i >= 0; i--)
 		ibm_exit(&ibms[i]);
 
 	remove_proc_entry(IBM_DIR, acpi_root_dir);
@@ -1185,15 +1176,14 @@ static int __init acpi_ibm_init(void)
 	if (acpi_disabled)
 		return -ENODEV;
 
-	if (!acpi_specific_hotkey_enabled){
+	if (!acpi_specific_hotkey_enabled) {
 		printk(IBM_ERR "Using generic hotkey driver\n");
-		return -ENODEV;	
+		return -ENODEV;
 	}
 	/* these handles are required */
-	if (IBM_HANDLE_INIT(ec,	  1) < 0 ||
+	if (IBM_HANDLE_INIT(ec, 1) < 0 ||
 	    IBM_HANDLE_INIT(hkey, 1) < 0 ||
-	    IBM_HANDLE_INIT(vid,  1) < 0 ||
-	    IBM_HANDLE_INIT(beep, 1) < 0)
+	    IBM_HANDLE_INIT(vid, 1) < 0 || IBM_HANDLE_INIT(beep, 1) < 0)
 		return -ENODEV;
 
 	/* these handles have alternatives */
@@ -1205,10 +1195,10 @@ static int __init acpi_ibm_init(void)
 		return -ENODEV;
 
 	/* these handles are not required */
-	IBM_HANDLE_INIT(dock,  0);
-	IBM_HANDLE_INIT(bay,   0);
+	IBM_HANDLE_INIT(dock, 0);
+	IBM_HANDLE_INIT(bay, 0);
 	IBM_HANDLE_INIT(bayej, 0);
-	IBM_HANDLE_INIT(bled,  0);
+	IBM_HANDLE_INIT(bled, 0);
 
 	proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
 	if (!proc_dir) {
@@ -1216,8 +1206,8 @@ static int __init acpi_ibm_init(void)
 		return -ENODEV;
 	}
 	proc_dir->owner = THIS_MODULE;
-	
-	for (i=0; i<NUM_IBMS; i++) {
+
+	for (i = 0; i < NUM_IBMS; i++) {
 		ret = ibm_init(&ibms[i]);
 		if (ret < 0) {
 			acpi_ibm_exit();

+ 56 - 52
drivers/acpi/motherboard.c

@@ -30,12 +30,11 @@
 #include <acpi/acpi_drivers.h>
 
 #define _COMPONENT		ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME		("acpi_motherboard")
+ACPI_MODULE_NAME("acpi_motherboard")
 
 /* Dell use PNP0C01 instead of PNP0C02 */
 #define ACPI_MB_HID1			"PNP0C01"
 #define ACPI_MB_HID2			"PNP0C02"
-
 /**
  * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
  * Doesn't care about the failure of 'request_region', since other may reserve 
@@ -44,15 +43,12 @@ ACPI_MODULE_NAME		("acpi_motherboard")
 #define IS_RESERVED_ADDR(base, len) \
 	(((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
 	&& ((base) + (len) > 0x1000))
-
 /*
  * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
  * the io ports if they really know they can use it, while
  * still preventing hotplug PCI devices from using it. 
  */
-
-static acpi_status
-acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
+static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
 {
 	struct resource *requested_res = NULL;
 
@@ -63,22 +59,32 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
 
 		if (io_res->min_base_address != io_res->max_base_address)
 			return_VALUE(AE_OK);
-		if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) {
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
-				io_res->min_base_address, 
-				io_res->min_base_address + io_res->range_length));
-			requested_res = request_region(io_res->min_base_address, 
-				io_res->range_length, "motherboard");
+		if (IS_RESERVED_ADDR
+		    (io_res->min_base_address, io_res->range_length)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+					  "Motherboard resources 0x%08x - 0x%08x\n",
+					  io_res->min_base_address,
+					  io_res->min_base_address +
+					  io_res->range_length));
+			requested_res =
+			    request_region(io_res->min_base_address,
+					   io_res->range_length, "motherboard");
 		}
 	} else if (res->id == ACPI_RSTYPE_FIXED_IO) {
-		struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io;
-
-		if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) {
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
-				fixed_io_res->base_address, 
-				fixed_io_res->base_address + fixed_io_res->range_length));
-			requested_res = request_region(fixed_io_res->base_address, 
-				fixed_io_res->range_length, "motherboard");
+		struct acpi_resource_fixed_io *fixed_io_res =
+		    &res->data.fixed_io;
+
+		if (IS_RESERVED_ADDR
+		    (fixed_io_res->base_address, fixed_io_res->range_length)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+					  "Motherboard resources 0x%08x - 0x%08x\n",
+					  fixed_io_res->base_address,
+					  fixed_io_res->base_address +
+					  fixed_io_res->range_length));
+			requested_res =
+			    request_region(fixed_io_res->base_address,
+					   fixed_io_res->range_length,
+					   "motherboard");
 		}
 	} else {
 		/* Memory mapped IO? */
@@ -89,72 +95,70 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
 	return_VALUE(AE_OK);
 }
 
-static int acpi_motherboard_add (struct acpi_device *device)
+static int acpi_motherboard_add(struct acpi_device *device)
 {
 	if (!device)
 		return -EINVAL;
-	acpi_walk_resources(device->handle, METHOD_NAME__CRS, 
-		acpi_reserve_io_ranges, NULL);
+	acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+			    acpi_reserve_io_ranges, NULL);
 
 	return 0;
 }
 
 static struct acpi_driver acpi_motherboard_driver1 = {
-	.name =		"motherboard",
-	.class =	"",
-	.ids =		ACPI_MB_HID1,
-	.ops =	{
-		.add =		acpi_motherboard_add,
-	},
+	.name = "motherboard",
+	.class = "",
+	.ids = ACPI_MB_HID1,
+	.ops = {
+		.add = acpi_motherboard_add,
+		},
 };
 
 static struct acpi_driver acpi_motherboard_driver2 = {
-	.name =		"motherboard",
-	.class =	"",
-	.ids =		ACPI_MB_HID2,
-	.ops =	{
-		.add =		acpi_motherboard_add,
-	},
+	.name = "motherboard",
+	.class = "",
+	.ids = ACPI_MB_HID2,
+	.ops = {
+		.add = acpi_motherboard_add,
+		},
 };
 
-static void __init
-acpi_reserve_resources (void)
+static void __init acpi_reserve_resources(void)
 {
 	if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
-		request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, 
-			acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
+		request_region(acpi_gbl_FADT->xpm1a_evt_blk.address,
+			       acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
 
 	if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
 		request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
-			acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
+			       acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
 
 	if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-		request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, 
-			acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
+		request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address,
+			       acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
 
 	if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-		request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, 
-			acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
+		request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address,
+			       acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
 
 	if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
-		request_region(acpi_gbl_FADT->xpm_tmr_blk.address,
-			4, "PM_TMR");
+		request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR");
 
 	if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
 		request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
-			acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
+			       acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
 
 	/* Length of GPE blocks must be a non-negative multiple of 2 */
 
 	if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
-			!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
+	    !(acpi_gbl_FADT->gpe0_blk_len & 0x1))
 		request_region(acpi_gbl_FADT->xgpe0_blk.address,
-			acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
+			       acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
 
 	if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
-			!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
+	    !(acpi_gbl_FADT->gpe1_blk_len & 0x1))
 		request_region(acpi_gbl_FADT->xgpe1_blk.address,
-			acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
+			       acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
 }
 
 static int __init acpi_motherboard_init(void)
@@ -166,7 +170,7 @@ static int __init acpi_motherboard_init(void)
 	 * This module must run after scan.c
 	 */
 	if (!acpi_disabled)
-		acpi_reserve_resources ();
+		acpi_reserve_resources();
 	return 0;
 }
 

+ 172 - 170
drivers/acpi/namespace/nsaccess.c

@@ -41,16 +41,13 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsaccess")
-
+ACPI_MODULE_NAME("nsaccess")
 
 /*******************************************************************************
  *
@@ -65,24 +62,19 @@
  * MUTEX:       Locks namespace for entire execution
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ns_root_initialize (
-	void)
+acpi_status acpi_ns_root_initialize(void)
 {
-	acpi_status                         status;
+	acpi_status status;
 	const struct acpi_predefined_names *init_val = NULL;
-	struct acpi_namespace_node          *new_node;
-	union acpi_operand_object           *obj_desc;
-	acpi_string                         val = NULL;
-
+	struct acpi_namespace_node *new_node;
+	union acpi_operand_object *obj_desc;
+	acpi_string val = NULL;
 
-	ACPI_FUNCTION_TRACE ("ns_root_initialize");
+	ACPI_FUNCTION_TRACE("ns_root_initialize");
 
-
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -102,24 +94,26 @@ acpi_ns_root_initialize (
 
 	/* Enter the pre-defined names in the name table */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-		"Entering predefined entries into namespace\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "Entering predefined entries into namespace\n"));
 
 	for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
 		/* _OSI is optional for now, will be permanent later */
 
-		if (!ACPI_STRCMP (init_val->name, "_OSI") && !acpi_gbl_create_osi_method) {
+		if (!ACPI_STRCMP(init_val->name, "_OSI")
+		    && !acpi_gbl_create_osi_method) {
 			continue;
 		}
 
-		status = acpi_ns_lookup (NULL, init_val->name, init_val->type,
-				  ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
-				  NULL, &new_node);
+		status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
+					ACPI_IMODE_LOAD_PASS2,
+					ACPI_NS_NO_UPSEARCH, NULL, &new_node);
 
-		if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Could not create predefined name %s, %s\n",
-				init_val->name, acpi_format_exception (status)));
+		if (ACPI_FAILURE(status) || (!new_node)) {	/* Must be on same line for code converter */
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Could not create predefined name %s, %s\n",
+					  init_val->name,
+					  acpi_format_exception(status)));
 		}
 
 		/*
@@ -128,11 +122,11 @@ acpi_ns_root_initialize (
 		 * initial value, create the initial value.
 		 */
 		if (init_val->val) {
-			status = acpi_os_predefined_override (init_val, &val);
-			if (ACPI_FAILURE (status)) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Could not override predefined %s\n",
-					init_val->name));
+			status = acpi_os_predefined_override(init_val, &val);
+			if (ACPI_FAILURE(status)) {
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Could not override predefined %s\n",
+						  init_val->name));
 			}
 
 			if (!val) {
@@ -143,7 +137,8 @@ acpi_ns_root_initialize (
 			 * Entry requests an initial value, allocate a
 			 * descriptor for it.
 			 */
-			obj_desc = acpi_ut_create_internal_object (init_val->type);
+			obj_desc =
+			    acpi_ut_create_internal_object(init_val->type);
 			if (!obj_desc) {
 				status = AE_NO_MEMORY;
 				goto unlock_and_exit;
@@ -156,7 +151,8 @@ acpi_ns_root_initialize (
 			 */
 			switch (init_val->type) {
 			case ACPI_TYPE_METHOD:
-				obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val);
+				obj_desc->method.param_count =
+				    (u8) ACPI_TO_INTEGER(val);
 				obj_desc->common.flags |= AOPOBJ_DATA_VALID;
 
 #if defined (ACPI_ASL_COMPILER)
@@ -167,45 +163,50 @@ acpi_ns_root_initialize (
 #else
 				/* Mark this as a very SPECIAL method */
 
-				obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY;
+				obj_desc->method.method_flags =
+				    AML_METHOD_INTERNAL_ONLY;
 
 #ifndef ACPI_DUMP_APP
-				obj_desc->method.implementation = acpi_ut_osi_implementation;
+				obj_desc->method.implementation =
+				    acpi_ut_osi_implementation;
 #endif
 #endif
 				break;
 
 			case ACPI_TYPE_INTEGER:
 
-				obj_desc->integer.value = ACPI_TO_INTEGER (val);
+				obj_desc->integer.value = ACPI_TO_INTEGER(val);
 				break;
 
-
 			case ACPI_TYPE_STRING:
 
 				/*
 				 * Build an object around the static string
 				 */
-				obj_desc->string.length = (u32) ACPI_STRLEN (val);
+				obj_desc->string.length =
+				    (u32) ACPI_STRLEN(val);
 				obj_desc->string.pointer = val;
 				obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
 				break;
 
-
 			case ACPI_TYPE_MUTEX:
 
 				obj_desc->mutex.node = new_node;
-				obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) - 1);
+				obj_desc->mutex.sync_level =
+				    (u8) (ACPI_TO_INTEGER(val) - 1);
 
-				if (ACPI_STRCMP (init_val->name, "_GL_") == 0) {
+				if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
 					/*
 					 * Create a counting semaphore for the
 					 * global lock
 					 */
-					status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT,
-							 1, &obj_desc->mutex.semaphore);
-					if (ACPI_FAILURE (status)) {
-						acpi_ut_remove_reference (obj_desc);
+					status =
+					    acpi_os_create_semaphore
+					    (ACPI_NO_UNIT_LIMIT, 1,
+					     &obj_desc->mutex.semaphore);
+					if (ACPI_FAILURE(status)) {
+						acpi_ut_remove_reference
+						    (obj_desc);
 						goto unlock_and_exit;
 					}
 
@@ -213,56 +214,58 @@ acpi_ns_root_initialize (
 					 * We just created the mutex for the
 					 * global lock, save it
 					 */
-					acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore;
-				}
-				else {
+					acpi_gbl_global_lock_semaphore =
+					    obj_desc->mutex.semaphore;
+				} else {
 					/* Create a mutex */
 
-					status = acpi_os_create_semaphore (1, 1,
-							   &obj_desc->mutex.semaphore);
-					if (ACPI_FAILURE (status)) {
-						acpi_ut_remove_reference (obj_desc);
+					status = acpi_os_create_semaphore(1, 1,
+									  &obj_desc->
+									  mutex.
+									  semaphore);
+					if (ACPI_FAILURE(status)) {
+						acpi_ut_remove_reference
+						    (obj_desc);
 						goto unlock_and_exit;
 					}
 				}
 				break;
 
-
 			default:
 
-				ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
-					init_val->type));
-				acpi_ut_remove_reference (obj_desc);
+				ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type));
+				acpi_ut_remove_reference(obj_desc);
 				obj_desc = NULL;
 				continue;
 			}
 
 			/* Store pointer to value descriptor in the Node */
 
-			status = acpi_ns_attach_object (new_node, obj_desc,
-					 ACPI_GET_OBJECT_TYPE (obj_desc));
+			status = acpi_ns_attach_object(new_node, obj_desc,
+						       ACPI_GET_OBJECT_TYPE
+						       (obj_desc));
 
 			/* Remove local reference to the object */
 
-			acpi_ut_remove_reference (obj_desc);
+			acpi_ut_remove_reference(obj_desc);
 		}
 	}
 
-
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
 	/* Save a handle to "_GPE", it is always present */
 
-	if (ACPI_SUCCESS (status)) {
-		status = acpi_ns_get_node_by_path ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH,
-				  &acpi_gbl_fadt_gpe_device);
+	if (ACPI_SUCCESS(status)) {
+		status =
+		    acpi_ns_get_node_by_path("\\_GPE", NULL,
+					     ACPI_NS_NO_UPSEARCH,
+					     &acpi_gbl_fadt_gpe_device);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_lookup
@@ -287,62 +290,57 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_ns_lookup (
-	union acpi_generic_state        *scope_info,
-	char                            *pathname,
-	acpi_object_type                type,
-	acpi_interpreter_mode           interpreter_mode,
-	u32                             flags,
-	struct acpi_walk_state          *walk_state,
-	struct acpi_namespace_node      **return_node)
+acpi_ns_lookup(union acpi_generic_state *scope_info,
+	       char *pathname,
+	       acpi_object_type type,
+	       acpi_interpreter_mode interpreter_mode,
+	       u32 flags,
+	       struct acpi_walk_state *walk_state,
+	       struct acpi_namespace_node **return_node)
 {
-	acpi_status                     status;
-	char                            *path = pathname;
-	struct acpi_namespace_node      *prefix_node;
-	struct acpi_namespace_node      *current_node = NULL;
-	struct acpi_namespace_node      *this_node = NULL;
-	u32                             num_segments;
-	u32                             num_carats;
-	acpi_name                       simple_name;
-	acpi_object_type                type_to_check_for;
-	acpi_object_type                this_search_type;
-	u32                             search_parent_flag = ACPI_NS_SEARCH_PARENT;
-	u32                             local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
-			   ACPI_NS_SEARCH_PARENT);
-
-
-	ACPI_FUNCTION_TRACE ("ns_lookup");
-
+	acpi_status status;
+	char *path = pathname;
+	struct acpi_namespace_node *prefix_node;
+	struct acpi_namespace_node *current_node = NULL;
+	struct acpi_namespace_node *this_node = NULL;
+	u32 num_segments;
+	u32 num_carats;
+	acpi_name simple_name;
+	acpi_object_type type_to_check_for;
+	acpi_object_type this_search_type;
+	u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
+	u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
+				    ACPI_NS_SEARCH_PARENT);
+
+	ACPI_FUNCTION_TRACE("ns_lookup");
 
 	if (!return_node) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	acpi_gbl_ns_lookup_count++;
 	*return_node = ACPI_ENTRY_NOT_FOUND;
 
 	if (!acpi_gbl_root_node) {
-		return_ACPI_STATUS (AE_NO_NAMESPACE);
+		return_ACPI_STATUS(AE_NO_NAMESPACE);
 	}
 
 	/*
 	 * Get the prefix scope.
 	 * A null scope means use the root scope
 	 */
-	if ((!scope_info) ||
-		(!scope_info->scope.node)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-			"Null scope prefix, using root node (%p)\n",
-			acpi_gbl_root_node));
+	if ((!scope_info) || (!scope_info->scope.node)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+				  "Null scope prefix, using root node (%p)\n",
+				  acpi_gbl_root_node));
 
 		prefix_node = acpi_gbl_root_node;
-	}
-	else {
+	} else {
 		prefix_node = scope_info->scope.node;
-		if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != ACPI_DESC_TYPE_NAMED) {
-			ACPI_REPORT_ERROR (("ns_lookup: %p is not a namespace node [%s]\n",
-					prefix_node, acpi_ut_get_descriptor_name (prefix_node)));
-			return_ACPI_STATUS (AE_AML_INTERNAL);
+		if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
+		    ACPI_DESC_TYPE_NAMED) {
+			ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node)));
+			return_ACPI_STATUS(AE_AML_INTERNAL);
 		}
 
 		/*
@@ -350,9 +348,9 @@ acpi_ns_lookup (
 		 * Device/Method, etc.)  It could be a Package or other object node.
 		 * Backup up the tree to find the containing scope node.
 		 */
-		while (!acpi_ns_opens_scope (prefix_node->type) &&
-				prefix_node->type != ACPI_TYPE_ANY) {
-			prefix_node = acpi_ns_get_parent_node (prefix_node);
+		while (!acpi_ns_opens_scope(prefix_node->type) &&
+		       prefix_node->type != ACPI_TYPE_ANY) {
+			prefix_node = acpi_ns_get_parent_node(prefix_node);
 		}
 	}
 
@@ -367,13 +365,13 @@ acpi_ns_lookup (
 		/* A Null name_path is allowed and refers to the root */
 
 		num_segments = 0;
-		this_node    = acpi_gbl_root_node;
-		path     = "";
+		this_node = acpi_gbl_root_node;
+		path = "";
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-			"Null Pathname (Zero segments), Flags=%X\n", flags));
-	}
-	else {
+		ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+				  "Null Pathname (Zero segments), Flags=%X\n",
+				  flags));
+	} else {
 		/*
 		 * Name pointer is valid (and must be in internal name format)
 		 *
@@ -397,15 +395,16 @@ acpi_ns_lookup (
 
 			path++;
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Path is absolute from root [%p]\n", this_node));
-		}
-		else {
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Path is absolute from root [%p]\n",
+					  this_node));
+		} else {
 			/* Pathname is relative to current scope, start there */
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Searching relative to prefix scope [%4.4s] (%p)\n",
-				acpi_ut_get_node_name (prefix_node), prefix_node));
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Searching relative to prefix scope [%4.4s] (%p)\n",
+					  acpi_ut_get_node_name(prefix_node),
+					  prefix_node));
 
 			/*
 			 * Handle multiple Parent Prefixes (carat) by just getting
@@ -426,20 +425,20 @@ acpi_ns_lookup (
 				/* Backup to the parent node */
 
 				num_carats++;
-				this_node = acpi_ns_get_parent_node (this_node);
+				this_node = acpi_ns_get_parent_node(this_node);
 				if (!this_node) {
 					/* Current scope has no parent scope */
 
-					ACPI_REPORT_ERROR (
-						("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
-					return_ACPI_STATUS (AE_NOT_FOUND);
+					ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
+					return_ACPI_STATUS(AE_NOT_FOUND);
 				}
 			}
 
 			if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-					"Search scope is [%4.4s], path has %d carat(s)\n",
-					acpi_ut_get_node_name (this_node), num_carats));
+				ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+						  "Search scope is [%4.4s], path has %d carat(s)\n",
+						  acpi_ut_get_node_name
+						  (this_node), num_carats));
 			}
 		}
 
@@ -465,9 +464,9 @@ acpi_ns_lookup (
 			num_segments = 0;
 			type = this_node->type;
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Prefix-only Pathname (Zero name segments), Flags=%X\n",
-				flags));
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Prefix-only Pathname (Zero name segments), Flags=%X\n",
+					  flags));
 			break;
 
 		case AML_DUAL_NAME_PREFIX:
@@ -481,8 +480,9 @@ acpi_ns_lookup (
 			num_segments = 2;
 			path++;
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Dual Pathname (2 segments, Flags=%X)\n", flags));
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Dual Pathname (2 segments, Flags=%X)\n",
+					  flags));
 			break;
 
 		case AML_MULTI_NAME_PREFIX_OP:
@@ -494,12 +494,12 @@ acpi_ns_lookup (
 			/* Extract segment count, point to first name segment */
 
 			path++;
-			num_segments = (u32) (u8) *path;
+			num_segments = (u32) (u8) * path;
 			path++;
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Multi Pathname (%d Segments, Flags=%X) \n",
-				num_segments, flags));
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Multi Pathname (%d Segments, Flags=%X) \n",
+					  num_segments, flags));
 			break;
 
 		default:
@@ -509,15 +509,15 @@ acpi_ns_lookup (
 			 */
 			num_segments = 1;
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Simple Pathname (1 segment, Flags=%X)\n", flags));
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Simple Pathname (1 segment, Flags=%X)\n",
+					  flags));
 			break;
 		}
 
-		ACPI_DEBUG_EXEC (acpi_ns_print_pathname (num_segments, path));
+		ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path));
 	}
 
-
 	/*
 	 * Search namespace for each segment of the name.  Loop through and
 	 * verify (or add to the namespace) each name segment.
@@ -541,7 +541,7 @@ acpi_ns_lookup (
 			 * requested it AND we have a single, non-fully-qualified name_seg
 			 */
 			if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) &&
-				(flags & ACPI_NS_SEARCH_PARENT)) {
+			    (flags & ACPI_NS_SEARCH_PARENT)) {
 				local_flags |= ACPI_NS_SEARCH_PARENT;
 			}
 
@@ -554,24 +554,28 @@ acpi_ns_lookup (
 
 		/* Extract one ACPI name from the front of the pathname */
 
-		ACPI_MOVE_32_TO_32 (&simple_name, path);
+		ACPI_MOVE_32_TO_32(&simple_name, path);
 
 		/* Try to find the single (4 character) ACPI name */
 
-		status = acpi_ns_search_and_enter (simple_name, walk_state, current_node,
-				 interpreter_mode, this_search_type, local_flags, &this_node);
-		if (ACPI_FAILURE (status)) {
+		status =
+		    acpi_ns_search_and_enter(simple_name, walk_state,
+					     current_node, interpreter_mode,
+					     this_search_type, local_flags,
+					     &this_node);
+		if (ACPI_FAILURE(status)) {
 			if (status == AE_NOT_FOUND) {
 				/* Name not found in ACPI namespace */
 
-				ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-					"Name [%4.4s] not found in scope [%4.4s] %p\n",
-					(char *) &simple_name, (char *) &current_node->name,
-					current_node));
+				ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+						  "Name [%4.4s] not found in scope [%4.4s] %p\n",
+						  (char *)&simple_name,
+						  (char *)&current_node->name,
+						  current_node));
 			}
 
 			*return_node = this_node;
-			return_ACPI_STATUS (status);
+			return_ACPI_STATUS(status);
 		}
 
 		/*
@@ -587,19 +591,16 @@ acpi_ns_lookup (
 		 *
 		 * Then we have a type mismatch.  Just warn and ignore it.
 		 */
-		if ((num_segments       == 0)                               &&
-			(type_to_check_for  != ACPI_TYPE_ANY)                   &&
-			(type_to_check_for  != ACPI_TYPE_LOCAL_ALIAS)           &&
-			(type_to_check_for  != ACPI_TYPE_LOCAL_METHOD_ALIAS)    &&
-			(type_to_check_for  != ACPI_TYPE_LOCAL_SCOPE)           &&
-			(this_node->type    != ACPI_TYPE_ANY)                   &&
-			(this_node->type    != type_to_check_for)) {
+		if ((num_segments == 0) &&
+		    (type_to_check_for != ACPI_TYPE_ANY) &&
+		    (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
+		    (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
+		    (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
+		    (this_node->type != ACPI_TYPE_ANY) &&
+		    (this_node->type != type_to_check_for)) {
 			/* Complain about a type mismatch */
 
-			ACPI_REPORT_WARNING (
-				("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n",
-				(char *) &simple_name, acpi_ut_get_type_name (this_node->type),
-				acpi_ut_get_type_name (type_to_check_for)));
+			ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for)));
 		}
 
 		/*
@@ -625,15 +626,16 @@ acpi_ns_lookup (
 		 * If entry is a type which opens a scope, push the new scope on the
 		 * scope stack.
 		 */
-		if (acpi_ns_opens_scope (type)) {
-			status = acpi_ds_scope_stack_push (this_node, type, walk_state);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+		if (acpi_ns_opens_scope(type)) {
+			status =
+			    acpi_ds_scope_stack_push(this_node, type,
+						     walk_state);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
 	}
 
 	*return_node = this_node;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-

+ 94 - 138
drivers/acpi/namespace/nsalloc.c

@@ -41,20 +41,14 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsalloc")
+ACPI_MODULE_NAME("nsalloc")
 
 /* Local prototypes */
-
-static void
-acpi_ns_remove_reference (
-	struct acpi_namespace_node      *node);
-
+static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
 
 /*******************************************************************************
  *
@@ -68,31 +62,26 @@ acpi_ns_remove_reference (
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_create_node (
-	u32                             name)
+struct acpi_namespace_node *acpi_ns_create_node(u32 name)
 {
-	struct acpi_namespace_node      *node;
-
+	struct acpi_namespace_node *node;
 
-	ACPI_FUNCTION_TRACE ("ns_create_node");
+	ACPI_FUNCTION_TRACE("ns_create_node");
 
-
-	node = ACPI_MEM_CALLOCATE (sizeof (struct acpi_namespace_node));
+	node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node));
 	if (!node) {
-		return_PTR (NULL);
+		return_PTR(NULL);
 	}
 
-	ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++);
+	ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
 
-	node->name.integer   = name;
+	node->name.integer = name;
 	node->reference_count = 1;
-	ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED);
+	ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
 
-	return_PTR (node);
+	return_PTR(node);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_node
@@ -105,19 +94,15 @@ acpi_ns_create_node (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_node (
-	struct acpi_namespace_node      *node)
+void acpi_ns_delete_node(struct acpi_namespace_node *node)
 {
-	struct acpi_namespace_node      *parent_node;
-	struct acpi_namespace_node      *prev_node;
-	struct acpi_namespace_node      *next_node;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node);
+	struct acpi_namespace_node *parent_node;
+	struct acpi_namespace_node *prev_node;
+	struct acpi_namespace_node *next_node;
 
+	ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node);
 
-	parent_node = acpi_ns_get_parent_node (node);
+	parent_node = acpi_ns_get_parent_node(node);
 
 	prev_node = NULL;
 	next_node = parent_node->child;
@@ -136,32 +121,29 @@ acpi_ns_delete_node (
 		if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
 			prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
 		}
-	}
-	else {
+	} else {
 		/* Node is first child (has no previous peer) */
 
 		if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
 			/* No peers at all */
 
 			parent_node->child = NULL;
-		}
-		else {   /* Link peer list to parent */
+		} else {	/* Link peer list to parent */
 
 			parent_node->child = next_node->peer;
 		}
 	}
 
-	ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
+	ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
 
 	/*
 	 * Detach an object if there is one then delete the node
 	 */
-	acpi_ns_detach_object (node);
-	ACPI_MEM_FREE (node);
+	acpi_ns_detach_object(node);
+	ACPI_MEM_FREE(node);
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_install_node
@@ -182,19 +164,14 @@ acpi_ns_delete_node (
  *
  ******************************************************************************/
 
-void
-acpi_ns_install_node (
-	struct acpi_walk_state          *walk_state,
-	struct acpi_namespace_node      *parent_node,   /* Parent */
-	struct acpi_namespace_node      *node,          /* New Child*/
-	acpi_object_type                type)
+void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parent_node,	/* Parent */
+			  struct acpi_namespace_node *node,	/* New Child */
+			  acpi_object_type type)
 {
-	acpi_owner_id                   owner_id = 0;
-	struct acpi_namespace_node      *child_node;
-
-
-	ACPI_FUNCTION_TRACE ("ns_install_node");
+	acpi_owner_id owner_id = 0;
+	struct acpi_namespace_node *child_node;
 
+	ACPI_FUNCTION_TRACE("ns_install_node");
 
 	/*
 	 * Get the owner ID from the Walk state
@@ -212,8 +189,7 @@ acpi_ns_install_node (
 		parent_node->child = node;
 		node->flags |= ANOBJ_END_OF_PEER_LIST;
 		node->peer = parent_node;
-	}
-	else {
+	} else {
 		while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
 			child_node = child_node->peer;
 		}
@@ -232,24 +208,25 @@ acpi_ns_install_node (
 	node->owner_id = owner_id;
 	node->type = (u8) type;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-		"%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
-		acpi_ut_get_node_name (node), acpi_ut_get_type_name (node->type), node, owner_id,
-		acpi_ut_get_node_name (parent_node), acpi_ut_get_type_name (parent_node->type),
-		parent_node));
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+			  "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
+			  acpi_ut_get_node_name(node),
+			  acpi_ut_get_type_name(node->type), node, owner_id,
+			  acpi_ut_get_node_name(parent_node),
+			  acpi_ut_get_type_name(parent_node->type),
+			  parent_node));
 
 	/*
 	 * Increment the reference count(s) of all parents up to
 	 * the root!
 	 */
-	while ((node = acpi_ns_get_parent_node (node)) != NULL) {
+	while ((node = acpi_ns_get_parent_node(node)) != NULL) {
 		node->reference_count++;
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_children
@@ -263,18 +240,14 @@ acpi_ns_install_node (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_children (
-	struct acpi_namespace_node      *parent_node)
+void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
 {
-	struct acpi_namespace_node      *child_node;
-	struct acpi_namespace_node      *next_node;
-	struct acpi_namespace_node      *node;
-	u8                              flags;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ns_delete_children", parent_node);
+	struct acpi_namespace_node *child_node;
+	struct acpi_namespace_node *next_node;
+	struct acpi_namespace_node *node;
+	u8 flags;
 
+	ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node);
 
 	if (!parent_node) {
 		return_VOID;
@@ -293,48 +266,48 @@ acpi_ns_delete_children (
 	do {
 		/* Get the things we need */
 
-		next_node   = child_node->peer;
-		flags       = child_node->flags;
+		next_node = child_node->peer;
+		flags = child_node->flags;
 
 		/* Grandchildren should have all been deleted already */
 
 		if (child_node->child) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
-				parent_node, child_node));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Found a grandchild! P=%p C=%p\n",
+					  parent_node, child_node));
 		}
 
 		/* Now we can free this child object */
 
-		ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
+		ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
-			child_node, acpi_gbl_current_node_count));
+		ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+				  "Object %p, Remaining %X\n", child_node,
+				  acpi_gbl_current_node_count));
 
 		/*
 		 * Detach an object if there is one, then free the child node
 		 */
-		acpi_ns_detach_object (child_node);
+		acpi_ns_detach_object(child_node);
 
 		/*
 		 * Decrement the reference count(s) of all parents up to
 		 * the root! (counts were incremented when the node was created)
 		 */
 		node = child_node;
-		while ((node = acpi_ns_get_parent_node (node)) != NULL) {
+		while ((node = acpi_ns_get_parent_node(node)) != NULL) {
 			node->reference_count--;
 		}
 
 		/* There should be only one reference remaining on this node */
 
 		if (child_node->reference_count != 1) {
-			ACPI_REPORT_WARNING ((
-				"Existing references (%d) on node being deleted (%p)\n",
-				child_node->reference_count, child_node));
+			ACPI_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node));
 		}
 
 		/* Now we can delete the node */
 
-		ACPI_MEM_FREE (child_node);
+		ACPI_MEM_FREE(child_node);
 
 		/* And move on to the next child in the list */
 
@@ -342,7 +315,6 @@ acpi_ns_delete_children (
 
 	} while (!(flags & ANOBJ_END_OF_PEER_LIST));
 
-
 	/* Clear the parent's child pointer */
 
 	parent_node->child = NULL;
@@ -350,7 +322,6 @@ acpi_ns_delete_children (
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_namespace_subtree
@@ -364,16 +335,12 @@ acpi_ns_delete_children (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_namespace_subtree (
-	struct acpi_namespace_node      *parent_node)
+void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
 {
-	struct acpi_namespace_node      *child_node = NULL;
-	u32                             level = 1;
-
-
-	ACPI_FUNCTION_TRACE ("ns_delete_namespace_subtree");
+	struct acpi_namespace_node *child_node = NULL;
+	u32 level = 1;
 
+	ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree");
 
 	if (!parent_node) {
 		return_VOID;
@@ -386,16 +353,17 @@ acpi_ns_delete_namespace_subtree (
 	while (level > 0) {
 		/* Get the next node in this scope (NULL if none) */
 
-		child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node,
-				 child_node);
+		child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+						   child_node);
 		if (child_node) {
 			/* Found a child node - detach any attached object */
 
-			acpi_ns_detach_object (child_node);
+			acpi_ns_detach_object(child_node);
 
 			/* Check if this node has any children */
 
-			if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+			if (acpi_ns_get_next_node
+			    (ACPI_TYPE_ANY, child_node, NULL)) {
 				/*
 				 * There is at least one child of this node,
 				 * visit the node
@@ -404,8 +372,7 @@ acpi_ns_delete_namespace_subtree (
 				parent_node = child_node;
 				child_node = NULL;
 			}
-		}
-		else {
+		} else {
 			/*
 			 * No more children of this parent node.
 			 * Move up to the grandparent.
@@ -416,7 +383,7 @@ acpi_ns_delete_namespace_subtree (
 			 * Now delete all of the children of this parent
 			 * all at the same time.
 			 */
-			acpi_ns_delete_children (parent_node);
+			acpi_ns_delete_children(parent_node);
 
 			/* New "last child" is this parent node */
 
@@ -424,14 +391,13 @@ acpi_ns_delete_namespace_subtree (
 
 			/* Move up the tree to the grandparent */
 
-			parent_node = acpi_ns_get_parent_node (parent_node);
+			parent_node = acpi_ns_get_parent_node(parent_node);
 		}
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_remove_reference
@@ -447,16 +413,12 @@ acpi_ns_delete_namespace_subtree (
  *
  ******************************************************************************/
 
-static void
-acpi_ns_remove_reference (
-	struct acpi_namespace_node      *node)
+static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
 {
-	struct acpi_namespace_node      *parent_node;
-	struct acpi_namespace_node      *this_node;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	struct acpi_namespace_node *parent_node;
+	struct acpi_namespace_node *this_node;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * Decrement the reference count(s) of this node and all
@@ -466,7 +428,7 @@ acpi_ns_remove_reference (
 	while (this_node) {
 		/* Prepare to move up to parent */
 
-		parent_node = acpi_ns_get_parent_node (this_node);
+		parent_node = acpi_ns_get_parent_node(this_node);
 
 		/* Decrement the reference count on this node */
 
@@ -477,15 +439,14 @@ acpi_ns_remove_reference (
 		if (!this_node->reference_count) {
 			/* Delete all children and delete the node */
 
-			acpi_ns_delete_children (this_node);
-			acpi_ns_delete_node (this_node);
+			acpi_ns_delete_children(this_node);
+			acpi_ns_delete_node(this_node);
 		}
 
 		this_node = parent_node;
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_namespace_by_owner
@@ -500,27 +461,23 @@ acpi_ns_remove_reference (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_namespace_by_owner (
-	acpi_owner_id                    owner_id)
+void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
 {
-	struct acpi_namespace_node      *child_node;
-	struct acpi_namespace_node      *deletion_node;
-	u32                             level;
-	struct acpi_namespace_node      *parent_node;
-
-
-	ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id);
+	struct acpi_namespace_node *child_node;
+	struct acpi_namespace_node *deletion_node;
+	u32 level;
+	struct acpi_namespace_node *parent_node;
 
+	ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id);
 
 	if (owner_id == 0) {
 		return_VOID;
 	}
 
-	parent_node   = acpi_gbl_root_node;
-	child_node    = NULL;
+	parent_node = acpi_gbl_root_node;
+	child_node = NULL;
 	deletion_node = NULL;
-	level         = 1;
+	level = 1;
 
 	/*
 	 * Traverse the tree of nodes until we bubble back up
@@ -531,10 +488,12 @@ acpi_ns_delete_namespace_by_owner (
 		 * Get the next child of this parent node. When child_node is NULL,
 		 * the first child of the parent is returned
 		 */
-		child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
+		child_node =
+		    acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+					  child_node);
 
 		if (deletion_node) {
-			acpi_ns_remove_reference (deletion_node);
+			acpi_ns_remove_reference(deletion_node);
 			deletion_node = NULL;
 		}
 
@@ -542,12 +501,13 @@ acpi_ns_delete_namespace_by_owner (
 			if (child_node->owner_id == owner_id) {
 				/* Found a matching child node - detach any attached object */
 
-				acpi_ns_detach_object (child_node);
+				acpi_ns_detach_object(child_node);
 			}
 
 			/* Check if this node has any children */
 
-			if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+			if (acpi_ns_get_next_node
+			    (ACPI_TYPE_ANY, child_node, NULL)) {
 				/*
 				 * There is at least one child of this node,
 				 * visit the node
@@ -555,12 +515,10 @@ acpi_ns_delete_namespace_by_owner (
 				level++;
 				parent_node = child_node;
 				child_node = NULL;
-			}
-			else if (child_node->owner_id == owner_id) {
+			} else if (child_node->owner_id == owner_id) {
 				deletion_node = child_node;
 			}
-		}
-		else {
+		} else {
 			/*
 			 * No more children of this parent node.
 			 * Move up to the grandparent.
@@ -578,11 +536,9 @@ acpi_ns_delete_namespace_by_owner (
 
 			/* Move up the tree to the grandparent */
 
-			parent_node = acpi_ns_get_parent_node (parent_node);
+			parent_node = acpi_ns_get_parent_node(parent_node);
 		}
 	}
 
 	return_VOID;
 }
-
-

+ 207 - 222
drivers/acpi/namespace/nsdump.c

@@ -41,31 +41,22 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsdump")
+ACPI_MODULE_NAME("nsdump")
 
 /* Local prototypes */
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
-void
-acpi_ns_dump_root_devices (
-	void);
+void acpi_ns_dump_root_devices(void);
 
 static acpi_status
-acpi_ns_dump_one_device (
-	acpi_handle                     obj_handle,
-	u32                             level,
-	void                            *context,
-	void                            **return_value);
+acpi_ns_dump_one_device(acpi_handle obj_handle,
+			u32 level, void *context, void **return_value);
 #endif
 
-
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /*******************************************************************************
  *
@@ -80,43 +71,38 @@ acpi_ns_dump_one_device (
  *
  ******************************************************************************/
 
-void
-acpi_ns_print_pathname (
-	u32                             num_segments,
-	char                            *pathname)
+void acpi_ns_print_pathname(u32 num_segments, char *pathname)
 {
-	acpi_native_uint                i;
+	acpi_native_uint i;
 
+	ACPI_FUNCTION_NAME("ns_print_pathname");
 
-	ACPI_FUNCTION_NAME ("ns_print_pathname");
-
-
-	if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
+	if (!(acpi_dbg_level & ACPI_LV_NAMES)
+	    || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
 		return;
 	}
 
 	/* Print the entire name */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "["));
 
 	while (num_segments) {
 		for (i = 0; i < 4; i++) {
-			ACPI_IS_PRINT (pathname[i]) ?
-				acpi_os_printf ("%c", pathname[i]) :
-				acpi_os_printf ("?");
+			ACPI_IS_PRINT(pathname[i]) ?
+			    acpi_os_printf("%c", pathname[i]) :
+			    acpi_os_printf("?");
 		}
 
 		pathname += ACPI_NAME_SIZE;
 		num_segments--;
 		if (num_segments) {
-			acpi_os_printf (".");
+			acpi_os_printf(".");
 		}
 	}
 
-	acpi_os_printf ("]\n");
+	acpi_os_printf("]\n");
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_pathname
@@ -134,15 +120,10 @@ acpi_ns_print_pathname (
  ******************************************************************************/
 
 void
-acpi_ns_dump_pathname (
-	acpi_handle                     handle,
-	char                            *msg,
-	u32                             level,
-	u32                             component)
+acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
 {
 
-	ACPI_FUNCTION_TRACE ("ns_dump_pathname");
-
+	ACPI_FUNCTION_TRACE("ns_dump_pathname");
 
 	/* Do this only if the requested debug level and component are enabled */
 
@@ -152,12 +133,11 @@ acpi_ns_dump_pathname (
 
 	/* Convert handle to a full pathname and print it (with supplied message) */
 
-	acpi_ns_print_node_pathname (handle, msg);
-	acpi_os_printf ("\n");
+	acpi_ns_print_node_pathname(handle, msg);
+	acpi_os_printf("\n");
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_one_object
@@ -175,24 +155,19 @@ acpi_ns_dump_pathname (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_dump_one_object (
-	acpi_handle                     obj_handle,
-	u32                             level,
-	void                            *context,
-	void                            **return_value)
+acpi_ns_dump_one_object(acpi_handle obj_handle,
+			u32 level, void *context, void **return_value)
 {
-	struct acpi_walk_info           *info = (struct acpi_walk_info *) context;
-	struct acpi_namespace_node      *this_node;
-	union acpi_operand_object       *obj_desc = NULL;
-	acpi_object_type                obj_type;
-	acpi_object_type                type;
-	u32                             bytes_to_dump;
-	u32                             dbg_level;
-	u32                             i;
-
-
-	ACPI_FUNCTION_NAME ("ns_dump_one_object");
+	struct acpi_walk_info *info = (struct acpi_walk_info *)context;
+	struct acpi_namespace_node *this_node;
+	union acpi_operand_object *obj_desc = NULL;
+	acpi_object_type obj_type;
+	acpi_object_type type;
+	u32 bytes_to_dump;
+	u32 dbg_level;
+	u32 i;
 
+	ACPI_FUNCTION_NAME("ns_dump_one_object");
 
 	/* Is output enabled? */
 
@@ -201,48 +176,47 @@ acpi_ns_dump_one_object (
 	}
 
 	if (!obj_handle) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n"));
 		return (AE_OK);
 	}
 
-	this_node = acpi_ns_map_handle_to_node (obj_handle);
+	this_node = acpi_ns_map_handle_to_node(obj_handle);
 	type = this_node->type;
 
 	/* Check if the owner matches */
 
 	if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
-		(info->owner_id != this_node->owner_id)) {
+	    (info->owner_id != this_node->owner_id)) {
 		return (AE_OK);
 	}
 
 	if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
 		/* Indent the object according to the level */
 
-		acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
+		acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
 
 		/* Check the node type and name */
 
 		if (type > ACPI_TYPE_LOCAL_MAX) {
-			ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
+			ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type));
 		}
 
-		if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
-			ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
-				this_node->name.integer));
+		if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
+			ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n",
+					     this_node->name.integer));
 		}
 
-		acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node));
+		acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
 	}
 
 	/*
 	 * Now we can print out the pertinent information
 	 */
-	acpi_os_printf (" %-12s %p ",
-			acpi_ut_get_type_name (type), this_node);
+	acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node);
 
 	dbg_level = acpi_dbg_level;
 	acpi_dbg_level = 0;
-	obj_desc = acpi_ns_get_attached_object (this_node);
+	obj_desc = acpi_ns_get_attached_object(this_node);
 	acpi_dbg_level = dbg_level;
 
 	switch (info->display_type & ACPI_DISPLAY_MASK) {
@@ -251,147 +225,166 @@ acpi_ns_dump_one_object (
 		if (!obj_desc) {
 			/* No attached object, we are done */
 
-			acpi_os_printf ("\n");
+			acpi_os_printf("\n");
 			return (AE_OK);
 		}
 
 		switch (type) {
 		case ACPI_TYPE_PROCESSOR:
 
-			acpi_os_printf ("ID %X Len %.4X Addr %p\n",
-				obj_desc->processor.proc_id, obj_desc->processor.length,
-				(char *) obj_desc->processor.address);
+			acpi_os_printf("ID %X Len %.4X Addr %p\n",
+				       obj_desc->processor.proc_id,
+				       obj_desc->processor.length,
+				       (char *)obj_desc->processor.address);
 			break;
 
-
 		case ACPI_TYPE_DEVICE:
 
-			acpi_os_printf ("Notify Object: %p\n", obj_desc);
+			acpi_os_printf("Notify Object: %p\n", obj_desc);
 			break;
 
-
 		case ACPI_TYPE_METHOD:
 
-			acpi_os_printf ("Args %X Len %.4X Aml %p\n",
-				(u32) obj_desc->method.param_count,
-				obj_desc->method.aml_length, obj_desc->method.aml_start);
+			acpi_os_printf("Args %X Len %.4X Aml %p\n",
+				       (u32) obj_desc->method.param_count,
+				       obj_desc->method.aml_length,
+				       obj_desc->method.aml_start);
 			break;
 
-
 		case ACPI_TYPE_INTEGER:
 
-			acpi_os_printf ("= %8.8X%8.8X\n",
-				ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+			acpi_os_printf("= %8.8X%8.8X\n",
+				       ACPI_FORMAT_UINT64(obj_desc->integer.
+							  value));
 			break;
 
-
 		case ACPI_TYPE_PACKAGE:
 
 			if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-				acpi_os_printf ("Elements %.2X\n",
-					obj_desc->package.count);
-			}
-			else {
-				acpi_os_printf ("[Length not yet evaluated]\n");
+				acpi_os_printf("Elements %.2X\n",
+					       obj_desc->package.count);
+			} else {
+				acpi_os_printf("[Length not yet evaluated]\n");
 			}
 			break;
 
-
 		case ACPI_TYPE_BUFFER:
 
 			if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-				acpi_os_printf ("Len %.2X",
-						 obj_desc->buffer.length);
+				acpi_os_printf("Len %.2X",
+					       obj_desc->buffer.length);
 
 				/* Dump some of the buffer */
 
 				if (obj_desc->buffer.length > 0) {
-					acpi_os_printf (" =");
-					for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
-						acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]);
+					acpi_os_printf(" =");
+					for (i = 0;
+					     (i < obj_desc->buffer.length
+					      && i < 12); i++) {
+						acpi_os_printf(" %.2hX",
+							       obj_desc->buffer.
+							       pointer[i]);
 					}
 				}
-				acpi_os_printf ("\n");
-			}
-			else {
-				acpi_os_printf ("[Length not yet evaluated]\n");
+				acpi_os_printf("\n");
+			} else {
+				acpi_os_printf("[Length not yet evaluated]\n");
 			}
 			break;
 
-
 		case ACPI_TYPE_STRING:
 
-			acpi_os_printf ("Len %.2X ", obj_desc->string.length);
-			acpi_ut_print_string (obj_desc->string.pointer, 32);
-			acpi_os_printf ("\n");
+			acpi_os_printf("Len %.2X ", obj_desc->string.length);
+			acpi_ut_print_string(obj_desc->string.pointer, 32);
+			acpi_os_printf("\n");
 			break;
 
-
 		case ACPI_TYPE_REGION:
 
-			acpi_os_printf ("[%s]",
-				acpi_ut_get_region_name (obj_desc->region.space_id));
+			acpi_os_printf("[%s]",
+				       acpi_ut_get_region_name(obj_desc->region.
+							       space_id));
 			if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
-				acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
-					ACPI_FORMAT_UINT64 (obj_desc->region.address),
-					obj_desc->region.length);
-			}
-			else {
-				acpi_os_printf (" [Address/Length not yet evaluated]\n");
+				acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
+					       ACPI_FORMAT_UINT64(obj_desc->
+								  region.
+								  address),
+					       obj_desc->region.length);
+			} else {
+				acpi_os_printf
+				    (" [Address/Length not yet evaluated]\n");
 			}
 			break;
 
-
 		case ACPI_TYPE_LOCAL_REFERENCE:
 
-			acpi_os_printf ("[%s]\n",
-				acpi_ps_get_opcode_name (obj_desc->reference.opcode));
+			acpi_os_printf("[%s]\n",
+				       acpi_ps_get_opcode_name(obj_desc->
+							       reference.
+							       opcode));
 			break;
 
-
 		case ACPI_TYPE_BUFFER_FIELD:
 
 			if (obj_desc->buffer_field.buffer_obj &&
-				obj_desc->buffer_field.buffer_obj->buffer.node) {
-				acpi_os_printf ("Buf [%4.4s]",
-					acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node));
+			    obj_desc->buffer_field.buffer_obj->buffer.node) {
+				acpi_os_printf("Buf [%4.4s]",
+					       acpi_ut_get_node_name(obj_desc->
+								     buffer_field.
+								     buffer_obj->
+								     buffer.
+								     node));
 			}
 			break;
 
-
 		case ACPI_TYPE_LOCAL_REGION_FIELD:
 
-			acpi_os_printf ("Rgn [%4.4s]",
-				acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node));
+			acpi_os_printf("Rgn [%4.4s]",
+				       acpi_ut_get_node_name(obj_desc->
+							     common_field.
+							     region_obj->region.
+							     node));
 			break;
 
-
 		case ACPI_TYPE_LOCAL_BANK_FIELD:
 
-			acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]",
-				acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node),
-				acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node));
+			acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]",
+				       acpi_ut_get_node_name(obj_desc->
+							     common_field.
+							     region_obj->region.
+							     node),
+				       acpi_ut_get_node_name(obj_desc->
+							     bank_field.
+							     bank_obj->
+							     common_field.
+							     node));
 			break;
 
-
 		case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-			acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]",
-				acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node),
-				acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node));
+			acpi_os_printf("Idx [%4.4s] Dat [%4.4s]",
+				       acpi_ut_get_node_name(obj_desc->
+							     index_field.
+							     index_obj->
+							     common_field.node),
+				       acpi_ut_get_node_name(obj_desc->
+							     index_field.
+							     data_obj->
+							     common_field.
+							     node));
 			break;
 
-
 		case ACPI_TYPE_LOCAL_ALIAS:
 		case ACPI_TYPE_LOCAL_METHOD_ALIAS:
 
-			acpi_os_printf ("Target %4.4s (%p)\n",
-				acpi_ut_get_node_name (obj_desc), obj_desc);
+			acpi_os_printf("Target %4.4s (%p)\n",
+				       acpi_ut_get_node_name(obj_desc),
+				       obj_desc);
 			break;
 
 		default:
 
-			acpi_os_printf ("Object %p\n", obj_desc);
+			acpi_os_printf("Object %p\n", obj_desc);
 			break;
 		}
 
@@ -403,11 +396,15 @@ acpi_ns_dump_one_object (
 		case ACPI_TYPE_LOCAL_BANK_FIELD:
 		case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-			acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n",
-				(obj_desc->common_field.base_byte_offset * 8)
-					+ obj_desc->common_field.start_field_bit_offset,
-				obj_desc->common_field.bit_length,
-				obj_desc->common_field.access_byte_width);
+			acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n",
+				       (obj_desc->common_field.
+					base_byte_offset * 8)
+				       +
+				       obj_desc->common_field.
+				       start_field_bit_offset,
+				       obj_desc->common_field.bit_length,
+				       obj_desc->common_field.
+				       access_byte_width);
 			break;
 
 		default:
@@ -415,56 +412,55 @@ acpi_ns_dump_one_object (
 		}
 		break;
 
-
 	case ACPI_DISPLAY_OBJECTS:
 
-		acpi_os_printf ("O:%p", obj_desc);
+		acpi_os_printf("O:%p", obj_desc);
 		if (!obj_desc) {
 			/* No attached object, we are done */
 
-			acpi_os_printf ("\n");
+			acpi_os_printf("\n");
 			return (AE_OK);
 		}
 
-		acpi_os_printf ("(R%d)", obj_desc->common.reference_count);
+		acpi_os_printf("(R%d)", obj_desc->common.reference_count);
 
 		switch (type) {
 		case ACPI_TYPE_METHOD:
 
 			/* Name is a Method and its AML offset/length are set */
 
-			acpi_os_printf (" M:%p-%X\n", obj_desc->method.aml_start,
-					  obj_desc->method.aml_length);
+			acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start,
+				       obj_desc->method.aml_length);
 			break;
 
 		case ACPI_TYPE_INTEGER:
 
-			acpi_os_printf (" I:%8.8X8.8%X\n",
-					ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+			acpi_os_printf(" I:%8.8X8.8%X\n",
+				       ACPI_FORMAT_UINT64(obj_desc->integer.
+							  value));
 			break;
 
 		case ACPI_TYPE_STRING:
 
-			acpi_os_printf (" S:%p-%X\n", obj_desc->string.pointer,
-					  obj_desc->string.length);
+			acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer,
+				       obj_desc->string.length);
 			break;
 
 		case ACPI_TYPE_BUFFER:
 
-			acpi_os_printf (" B:%p-%X\n", obj_desc->buffer.pointer,
-					  obj_desc->buffer.length);
+			acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer,
+				       obj_desc->buffer.length);
 			break;
 
 		default:
 
-			acpi_os_printf ("\n");
+			acpi_os_printf("\n");
 			break;
 		}
 		break;
 
-
 	default:
-		acpi_os_printf ("\n");
+		acpi_os_printf("\n");
 		break;
 	}
 
@@ -474,46 +470,47 @@ acpi_ns_dump_one_object (
 		return (AE_OK);
 	}
 
-
 	/* If there is an attached object, display it */
 
-	dbg_level    = acpi_dbg_level;
+	dbg_level = acpi_dbg_level;
 	acpi_dbg_level = 0;
-	obj_desc     = acpi_ns_get_attached_object (this_node);
+	obj_desc = acpi_ns_get_attached_object(this_node);
 	acpi_dbg_level = dbg_level;
 
 	/* Dump attached objects */
 
 	while (obj_desc) {
 		obj_type = ACPI_TYPE_INVALID;
-		acpi_os_printf ("Attached Object %p: ", obj_desc);
+		acpi_os_printf("Attached Object %p: ", obj_desc);
 
 		/* Decode the type of attached object and dump the contents */
 
-		switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+		switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
 		case ACPI_DESC_TYPE_NAMED:
 
-			acpi_os_printf ("(Ptr to Node)\n");
-			bytes_to_dump = sizeof (struct acpi_namespace_node);
-			ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
+			acpi_os_printf("(Ptr to Node)\n");
+			bytes_to_dump = sizeof(struct acpi_namespace_node);
+			ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
 			break;
 
 		case ACPI_DESC_TYPE_OPERAND:
 
-			obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
+			obj_type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
 			if (obj_type > ACPI_TYPE_LOCAL_MAX) {
-				acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
-					obj_type);
+				acpi_os_printf
+				    ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
+				     obj_type);
 				bytes_to_dump = 32;
-			}
-			else {
-				acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n",
-					obj_type, acpi_ut_get_type_name (obj_type));
-				bytes_to_dump = sizeof (union acpi_operand_object);
+			} else {
+				acpi_os_printf
+				    ("(Ptr to ACPI Object type %X [%s])\n",
+				     obj_type, acpi_ut_get_type_name(obj_type));
+				bytes_to_dump =
+				    sizeof(union acpi_operand_object);
 			}
 
-			ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
+			ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
 			break;
 
 		default:
@@ -523,7 +520,8 @@ acpi_ns_dump_one_object (
 
 		/* If value is NOT an internal object, we are done */
 
-		if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
+		if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
+		    ACPI_DESC_TYPE_OPERAND) {
 			goto cleanup;
 		}
 
@@ -537,49 +535,50 @@ acpi_ns_dump_one_object (
 			 * NOTE: takes advantage of common fields between string/buffer
 			 */
 			bytes_to_dump = obj_desc->string.length;
-			obj_desc = (void *) obj_desc->string.pointer;
-			acpi_os_printf ( "(Buffer/String pointer %p length %X)\n",
-				obj_desc, bytes_to_dump);
-			ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
+			obj_desc = (void *)obj_desc->string.pointer;
+			acpi_os_printf("(Buffer/String pointer %p length %X)\n",
+				       obj_desc, bytes_to_dump);
+			ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
 			goto cleanup;
 
 		case ACPI_TYPE_BUFFER_FIELD:
-			obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
+			obj_desc =
+			    (union acpi_operand_object *)obj_desc->buffer_field.
+			    buffer_obj;
 			break;
 
 		case ACPI_TYPE_PACKAGE:
-			obj_desc = (void *) obj_desc->package.elements;
+			obj_desc = (void *)obj_desc->package.elements;
 			break;
 
 		case ACPI_TYPE_METHOD:
-			obj_desc = (void *) obj_desc->method.aml_start;
+			obj_desc = (void *)obj_desc->method.aml_start;
 			break;
 
 		case ACPI_TYPE_LOCAL_REGION_FIELD:
-			obj_desc = (void *) obj_desc->field.region_obj;
+			obj_desc = (void *)obj_desc->field.region_obj;
 			break;
 
 		case ACPI_TYPE_LOCAL_BANK_FIELD:
-			obj_desc = (void *) obj_desc->bank_field.region_obj;
+			obj_desc = (void *)obj_desc->bank_field.region_obj;
 			break;
 
 		case ACPI_TYPE_LOCAL_INDEX_FIELD:
-			obj_desc = (void *) obj_desc->index_field.index_obj;
+			obj_desc = (void *)obj_desc->index_field.index_obj;
 			break;
 
 		default:
 			goto cleanup;
 		}
 
-		obj_type = ACPI_TYPE_INVALID;  /* Terminate loop after next pass */
+		obj_type = ACPI_TYPE_INVALID;	/* Terminate loop after next pass */
 	}
 
-cleanup:
-	acpi_os_printf ("\n");
+      cleanup:
+	acpi_os_printf("\n");
 	return (AE_OK);
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -601,29 +600,25 @@ cleanup:
  ******************************************************************************/
 
 void
-acpi_ns_dump_objects (
-	acpi_object_type                type,
-	u8                              display_type,
-	u32                             max_depth,
-	acpi_owner_id                   owner_id,
-	acpi_handle                     start_handle)
+acpi_ns_dump_objects(acpi_object_type type,
+		     u8 display_type,
+		     u32 max_depth,
+		     acpi_owner_id owner_id, acpi_handle start_handle)
 {
-	struct acpi_walk_info           info;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	struct acpi_walk_info info;
 
+	ACPI_FUNCTION_ENTRY();
 
 	info.debug_level = ACPI_LV_TABLES;
 	info.owner_id = owner_id;
 	info.display_type = display_type;
 
-	(void) acpi_ns_walk_namespace (type, start_handle, max_depth,
-			 ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
-			 (void *) &info, NULL);
+	(void)acpi_ns_walk_namespace(type, start_handle, max_depth,
+				     ACPI_NS_WALK_NO_UNLOCK,
+				     acpi_ns_dump_one_object, (void *)&info,
+				     NULL);
 }
-#endif	/* ACPI_FUTURE_USAGE */
-
+#endif				/* ACPI_FUTURE_USAGE */
 
 /*******************************************************************************
  *
@@ -638,25 +633,19 @@ acpi_ns_dump_objects (
  *
  ******************************************************************************/
 
-void
-acpi_ns_dump_entry (
-	acpi_handle                     handle,
-	u32                             debug_level)
+void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level)
 {
-	struct acpi_walk_info           info;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	struct acpi_walk_info info;
 
+	ACPI_FUNCTION_ENTRY();
 
 	info.debug_level = debug_level;
 	info.owner_id = ACPI_OWNER_ID_MAX;
 	info.display_type = ACPI_DISPLAY_SUMMARY;
 
-	(void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
+	(void)acpi_ns_dump_one_object(handle, 1, &info, NULL);
 }
 
-
 #ifdef ACPI_ASL_COMPILER
 /*******************************************************************************
  *
@@ -673,23 +662,19 @@ acpi_ns_dump_entry (
  *
  ******************************************************************************/
 
-void
-acpi_ns_dump_tables (
-	acpi_handle                     search_base,
-	u32                             max_depth)
+void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
 {
-	acpi_handle                     search_handle = search_base;
-
-
-	ACPI_FUNCTION_TRACE ("ns_dump_tables");
+	acpi_handle search_handle = search_base;
 
+	ACPI_FUNCTION_TRACE("ns_dump_tables");
 
 	if (!acpi_gbl_root_node) {
 		/*
 		 * If the name space has not been initialized,
 		 * there is nothing to dump.
 		 */
-		ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+				  "namespace not initialized!\n"));
 		return_VOID;
 	}
 
@@ -697,12 +682,12 @@ acpi_ns_dump_tables (
 		/* Entire namespace */
 
 		search_handle = acpi_gbl_root_node;
-		ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n"));
 	}
 
-	acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
-			ACPI_OWNER_ID_MAX, search_handle);
+	acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
+			     ACPI_OWNER_ID_MAX, search_handle);
 	return_VOID;
 }
-#endif	/* _ACPI_ASL_COMPILER */
-#endif	/* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
+#endif				/* _ACPI_ASL_COMPILER */
+#endif				/* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */

+ 29 - 45
drivers/acpi/namespace/nsdumpdv.c

@@ -41,20 +41,15 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 
-
 /* TBD: This entire module is apparently obsolete and should be removed */
 
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsdumpdv")
-
+ACPI_MODULE_NAME("nsdumpdv")
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-
 #include <acpi/acnamesp.h>
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_one_device
@@ -70,44 +65,39 @@
  *              This procedure is a user_function called by acpi_ns_walk_namespace.
  *
  ******************************************************************************/
-
 static acpi_status
-acpi_ns_dump_one_device (
-	acpi_handle                     obj_handle,
-	u32                             level,
-	void                            *context,
-	void                            **return_value)
+acpi_ns_dump_one_device(acpi_handle obj_handle,
+			u32 level, void *context, void **return_value)
 {
-	struct acpi_buffer              buffer;
-	struct acpi_device_info         *info;
-	acpi_status                     status;
-	u32                             i;
-
+	struct acpi_buffer buffer;
+	struct acpi_device_info *info;
+	acpi_status status;
+	u32 i;
 
-	ACPI_FUNCTION_NAME ("ns_dump_one_device");
+	ACPI_FUNCTION_NAME("ns_dump_one_device");
 
-
-	status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
+	status =
+	    acpi_ns_dump_one_object(obj_handle, level, context, return_value);
 
 	buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-	status = acpi_get_object_info (obj_handle, &buffer);
-	if (ACPI_SUCCESS (status)) {
+	status = acpi_get_object_info(obj_handle, &buffer);
+	if (ACPI_SUCCESS(status)) {
 		info = buffer.pointer;
 		for (i = 0; i < level; i++) {
-			ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+			ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
 		}
 
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
-			"    HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
-			info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address),
-			info->current_status));
-		ACPI_MEM_FREE (info);
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
+				      "    HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
+				      info->hardware_id.value,
+				      ACPI_FORMAT_UINT64(info->address),
+				      info->current_status));
+		ACPI_MEM_FREE(info);
 	}
 
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_root_devices
@@ -120,16 +110,12 @@ acpi_ns_dump_one_device (
  *
  ******************************************************************************/
 
-void
-acpi_ns_dump_root_devices (
-	void)
+void acpi_ns_dump_root_devices(void)
 {
-	acpi_handle                     sys_bus_handle;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_NAME ("ns_dump_root_devices");
+	acpi_handle sys_bus_handle;
+	acpi_status status;
 
+	ACPI_FUNCTION_NAME("ns_dump_root_devices");
 
 	/* Only dump the table if tracing is enabled */
 
@@ -138,19 +124,17 @@ acpi_ns_dump_root_devices (
 	}
 
 	status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		return;
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
-		"Display of all devices in the namespace:\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+			  "Display of all devices in the namespace:\n"));
 
-	status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
-			 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
-			 acpi_ns_dump_one_device, NULL, NULL);
+	status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
+					ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+					acpi_ns_dump_one_device, NULL, NULL);
 }
 
 #endif
 #endif
-
-

+ 122 - 148
drivers/acpi/namespace/nseval.c

@@ -42,26 +42,19 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nseval")
+ACPI_MODULE_NAME("nseval")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ns_execute_control_method (
-	struct acpi_parameter_info      *info);
-
-static acpi_status
-acpi_ns_get_object_value (
-	struct acpi_parameter_info      *info);
+acpi_ns_execute_control_method(struct acpi_parameter_info *info);
 
+static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info);
 
 /*******************************************************************************
  *
@@ -85,48 +78,44 @@ acpi_ns_get_object_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_evaluate_relative (
-	char                            *pathname,
-	struct acpi_parameter_info      *info)
+acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node = NULL;
-	union acpi_generic_state        *scope_info;
-	char                            *internal_path = NULL;
-
-
-	ACPI_FUNCTION_TRACE ("ns_evaluate_relative");
+	acpi_status status;
+	struct acpi_namespace_node *node = NULL;
+	union acpi_generic_state *scope_info;
+	char *internal_path = NULL;
 
+	ACPI_FUNCTION_TRACE("ns_evaluate_relative");
 
 	/*
 	 * Must have a valid object handle
 	 */
 	if (!info || !info->node) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Build an internal name string for the method */
 
-	status = acpi_ns_internalize_name (pathname, &internal_path);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ns_internalize_name(pathname, &internal_path);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	scope_info = acpi_ut_create_generic_state ();
+	scope_info = acpi_ut_create_generic_state();
 	if (!scope_info) {
 		goto cleanup1;
 	}
 
 	/* Get the prefix handle and Node */
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
-	info->node = acpi_ns_map_handle_to_node (info->node);
+	info->node = acpi_ns_map_handle_to_node(info->node);
 	if (!info->node) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 		status = AE_BAD_PARAMETER;
 		goto cleanup;
 	}
@@ -134,39 +123,38 @@ acpi_ns_evaluate_relative (
 	/* Lookup the name in the namespace */
 
 	scope_info->scope.node = info->node;
-	status = acpi_ns_lookup (scope_info, internal_path, ACPI_TYPE_ANY,
-			 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
-			 &node);
+	status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY,
+				ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+				&node);
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
-			pathname, acpi_format_exception (status)));
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
+				  pathname, acpi_format_exception(status)));
 		goto cleanup;
 	}
 
 	/*
 	 * Now that we have a handle to the object, we can attempt to evaluate it.
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
-		pathname, node, acpi_ns_get_attached_object (node)));
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+			  pathname, node, acpi_ns_get_attached_object(node)));
 
 	info->node = node;
-	status = acpi_ns_evaluate_by_handle (info);
+	status = acpi_ns_evaluate_by_handle(info);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
-		pathname));
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+			  "*** Completed eval of object %s ***\n", pathname));
 
-cleanup:
-	acpi_ut_delete_generic_state (scope_info);
+      cleanup:
+	acpi_ut_delete_generic_state(scope_info);
 
-cleanup1:
-	ACPI_MEM_FREE (internal_path);
-	return_ACPI_STATUS (status);
+      cleanup1:
+	ACPI_MEM_FREE(internal_path);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_evaluate_by_name
@@ -189,68 +177,63 @@ cleanup1:
  ******************************************************************************/
 
 acpi_status
-acpi_ns_evaluate_by_name (
-	char                            *pathname,
-	struct acpi_parameter_info      *info)
+acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info)
 {
-	acpi_status                     status;
-	char                            *internal_path = NULL;
-
-
-	ACPI_FUNCTION_TRACE ("ns_evaluate_by_name");
+	acpi_status status;
+	char *internal_path = NULL;
 
+	ACPI_FUNCTION_TRACE("ns_evaluate_by_name");
 
 	/* Build an internal name string for the method */
 
-	status = acpi_ns_internalize_name (pathname, &internal_path);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ns_internalize_name(pathname, &internal_path);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/* Lookup the name in the namespace */
 
-	status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY,
-			 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
-			 &info->node);
+	status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY,
+				ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+				&info->node);
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-			"Object at [%s] was not found, status=%.4X\n",
-			pathname, status));
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+				  "Object at [%s] was not found, status=%.4X\n",
+				  pathname, status));
 		goto cleanup;
 	}
 
 	/*
 	 * Now that we have a handle to the object, we can attempt to evaluate it.
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
-		pathname, info->node, acpi_ns_get_attached_object (info->node)));
-
-	status = acpi_ns_evaluate_by_handle (info);
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+			  pathname, info->node,
+			  acpi_ns_get_attached_object(info->node)));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
-		pathname));
+	status = acpi_ns_evaluate_by_handle(info);
 
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+			  "*** Completed eval of object %s ***\n", pathname));
 
-cleanup:
+      cleanup:
 
 	/* Cleanup */
 
 	if (internal_path) {
-		ACPI_MEM_FREE (internal_path);
+		ACPI_MEM_FREE(internal_path);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_evaluate_by_handle
@@ -275,26 +258,22 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_evaluate_by_handle (
-	struct acpi_parameter_info      *info)
+acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ns_evaluate_by_handle");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ns_evaluate_by_handle");
 
 	/* Check if namespace has been initialized */
 
 	if (!acpi_gbl_root_node) {
-		return_ACPI_STATUS (AE_NO_NAMESPACE);
+		return_ACPI_STATUS(AE_NO_NAMESPACE);
 	}
 
 	/* Parameter Validation */
 
 	if (!info) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Initialize the return value to an invalid object */
@@ -303,23 +282,25 @@ acpi_ns_evaluate_by_handle (
 
 	/* Get the prefix handle and Node */
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	info->node = acpi_ns_map_handle_to_node (info->node);
+	info->node = acpi_ns_map_handle_to_node(info->node);
 	if (!info->node) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
 	 * For a method alias, we must grab the actual method node so that proper
 	 * scoping context will be established before execution.
 	 */
-	if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
-		info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object);
+	if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+		info->node =
+		    ACPI_CAST_PTR(struct acpi_namespace_node,
+				  info->node->object);
 	}
 
 	/*
@@ -329,17 +310,16 @@ acpi_ns_evaluate_by_handle (
 	 *
 	 * In both cases, the namespace is unlocked by the acpi_ns* procedure
 	 */
-	if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) {
+	if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) {
 		/*
 		 * Case 1) We have an actual control method to execute
 		 */
-		status = acpi_ns_execute_control_method (info);
-	}
-	else {
+		status = acpi_ns_execute_control_method(info);
+	} else {
 		/*
 		 * Case 2) Object is NOT a method, just return its current value
 		 */
-		status = acpi_ns_get_object_value (info);
+		status = acpi_ns_get_object_value(info);
 	}
 
 	/*
@@ -355,10 +335,9 @@ acpi_ns_evaluate_by_handle (
 	 * Namespace was unlocked by the handling acpi_ns* function, so we
 	 * just return
 	 */
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_execute_control_method
@@ -384,30 +363,29 @@ acpi_ns_evaluate_by_handle (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_execute_control_method (
-	struct acpi_parameter_info      *info)
+acpi_ns_execute_control_method(struct acpi_parameter_info *info)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ns_execute_control_method");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ns_execute_control_method");
 
 	/* Verify that there is a method associated with this object */
 
-	info->obj_desc = acpi_ns_get_attached_object (info->node);
+	info->obj_desc = acpi_ns_get_attached_object(info->node);
 	if (!info->obj_desc) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "No attached method object\n"));
 
-		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-		return_ACPI_STATUS (AE_NULL_OBJECT);
+		(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+		return_ACPI_STATUS(AE_NULL_OBJECT);
 	}
 
-	ACPI_DUMP_PATHNAME (info->node, "Execute Method:",
-		ACPI_LV_INFO, _COMPONENT);
+	ACPI_DUMP_PATHNAME(info->node, "Execute Method:",
+			   ACPI_LV_INFO, _COMPONENT);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
-		info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
+			  info->obj_desc->method.aml_start + 1,
+			  info->obj_desc->method.aml_length - 1));
 
 	/*
 	 * Unlock the namespace before execution.  This allows namespace access
@@ -416,27 +394,26 @@ acpi_ns_execute_control_method (
 	 * interpreter locks to ensure that no thread is using the portion of the
 	 * namespace that is being deleted.
 	 */
-	status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
 	 * Execute the method via the interpreter.  The interpreter is locked
 	 * here before calling into the AML parser
 	 */
-	status = acpi_ex_enter_interpreter ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ex_enter_interpreter();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ps_execute_method (info);
-	acpi_ex_exit_interpreter ();
+	status = acpi_ps_execute_method(info);
+	acpi_ex_exit_interpreter();
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_object_value
@@ -454,16 +431,12 @@ acpi_ns_execute_control_method (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ns_get_object_value (
-	struct acpi_parameter_info      *info)
+static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info)
 {
-	acpi_status                     status = AE_OK;
-	struct acpi_namespace_node      *resolved_node = info->node;
-
-
-	ACPI_FUNCTION_TRACE ("ns_get_object_value");
+	acpi_status status = AE_OK;
+	struct acpi_namespace_node *resolved_node = info->node;
 
+	ACPI_FUNCTION_TRACE("ns_get_object_value");
 
 	/*
 	 * Objects require additional resolution steps (e.g., the Node may be a
@@ -486,32 +459,33 @@ acpi_ns_get_object_value (
 	 *
 	 * We must release the namespace lock before entering the intepreter.
 	 */
-	status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ex_enter_interpreter ();
-	if (ACPI_SUCCESS (status)) {
-		status = acpi_ex_resolve_node_to_value (&resolved_node, NULL);
+	status = acpi_ex_enter_interpreter();
+	if (ACPI_SUCCESS(status)) {
+		status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
 		/*
 		 * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
 		 * in resolved_node.
 		 */
-		acpi_ex_exit_interpreter ();
+		acpi_ex_exit_interpreter();
 
-		if (ACPI_SUCCESS (status)) {
+		if (ACPI_SUCCESS(status)) {
 			status = AE_CTRL_RETURN_VALUE;
 			info->return_object = ACPI_CAST_PTR
-					 (union acpi_operand_object, resolved_node);
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
-				info->return_object,
-				acpi_ut_get_object_type_name (info->return_object)));
+			    (union acpi_operand_object, resolved_node);
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Returning object %p [%s]\n",
+					  info->return_object,
+					  acpi_ut_get_object_type_name(info->
+								       return_object)));
 		}
 	}
 
 	/* Namespace is unlocked */
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-

+ 118 - 139
drivers/acpi/namespace/nsinit.c

@@ -41,31 +41,22 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsinit")
+ACPI_MODULE_NAME("nsinit")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ns_init_one_object (
-	acpi_handle                     obj_handle,
-	u32                             level,
-	void                            *context,
-	void                            **return_value);
+acpi_ns_init_one_object(acpi_handle obj_handle,
+			u32 level, void *context, void **return_value);
 
 static acpi_status
-acpi_ns_init_one_device (
-	acpi_handle                     obj_handle,
-	u32                             nesting_level,
-	void                            *context,
-	void                            **return_value);
-
+acpi_ns_init_one_device(acpi_handle obj_handle,
+			u32 nesting_level, void *context, void **return_value);
 
 /*******************************************************************************
  *
@@ -80,52 +71,48 @@ acpi_ns_init_one_device (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_initialize_objects (
-	void)
+acpi_status acpi_ns_initialize_objects(void)
 {
-	acpi_status                     status;
-	struct acpi_init_walk_info      info;
-
+	acpi_status status;
+	struct acpi_init_walk_info info;
 
-	ACPI_FUNCTION_TRACE ("ns_initialize_objects");
+	ACPI_FUNCTION_TRACE("ns_initialize_objects");
 
-
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"**** Starting initialization of namespace objects ****\n"));
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-		"Completing Region/Field/Buffer/Package initialization:"));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "**** Starting initialization of namespace objects ****\n"));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "Completing Region/Field/Buffer/Package initialization:"));
 
 	/* Set all init info to zero */
 
-	ACPI_MEMSET (&info, 0, sizeof (struct acpi_init_walk_info));
+	ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
 
 	/* Walk entire namespace from the supplied root */
 
-	status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-			  ACPI_UINT32_MAX, acpi_ns_init_one_object,
-			  &info, NULL);
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
-			acpi_format_exception (status)));
+	status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+				     ACPI_UINT32_MAX, acpi_ns_init_one_object,
+				     &info, NULL);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
+				  acpi_format_exception(status)));
 	}
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-		"\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
-		info.op_region_init, info.op_region_count,
-		info.field_init,    info.field_count,
-		info.buffer_init,   info.buffer_count,
-		info.package_init,  info.package_count, info.object_count));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
+			      info.op_region_init, info.op_region_count,
+			      info.field_init, info.field_count,
+			      info.buffer_init, info.buffer_count,
+			      info.package_init, info.package_count,
+			      info.object_count));
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"%hd Control Methods found\n", info.method_count));
-	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-		"%hd Op Regions found\n", info.op_region_count));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "%hd Control Methods found\n", info.method_count));
+	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+			  "%hd Op Regions found\n", info.op_region_count));
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_initialize_devices
@@ -142,16 +129,12 @@ acpi_ns_initialize_objects (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_initialize_devices (
-	void)
+acpi_status acpi_ns_initialize_devices(void)
 {
-	acpi_status                     status;
-	struct acpi_device_walk_info    info;
-
-
-	ACPI_FUNCTION_TRACE ("ns_initialize_devices");
+	acpi_status status;
+	struct acpi_device_walk_info info;
 
+	ACPI_FUNCTION_TRACE("ns_initialize_devices");
 
 	/* Init counters */
 
@@ -159,34 +142,34 @@ acpi_ns_initialize_devices (
 	info.num_STA = 0;
 	info.num_INI = 0;
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-		"Executing all Device _STA and_INI methods:"));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "Executing all Device _STA and_INI methods:"));
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Walk namespace for all objects */
 
-	status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-			  ACPI_UINT32_MAX, TRUE, acpi_ns_init_one_device, &info, NULL);
+	status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+					ACPI_UINT32_MAX, TRUE,
+					acpi_ns_init_one_device, &info, NULL);
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
-			acpi_format_exception (status)));
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
+				  acpi_format_exception(status)));
 	}
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-		"\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
-		info.device_count, info.num_STA, info.num_INI));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
+			      info.device_count, info.num_STA, info.num_INI));
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_init_one_object
@@ -208,28 +191,25 @@ acpi_ns_initialize_devices (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_init_one_object (
-	acpi_handle                     obj_handle,
-	u32                             level,
-	void                            *context,
-	void                            **return_value)
+acpi_ns_init_one_object(acpi_handle obj_handle,
+			u32 level, void *context, void **return_value)
 {
-	acpi_object_type                type;
-	acpi_status                     status;
-	struct acpi_init_walk_info      *info = (struct acpi_init_walk_info *) context;
-	struct acpi_namespace_node      *node = (struct acpi_namespace_node *) obj_handle;
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_NAME ("ns_init_one_object");
+	acpi_object_type type;
+	acpi_status status;
+	struct acpi_init_walk_info *info =
+	    (struct acpi_init_walk_info *)context;
+	struct acpi_namespace_node *node =
+	    (struct acpi_namespace_node *)obj_handle;
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_NAME("ns_init_one_object");
 
 	info->object_count++;
 
 	/* And even then, we are only interested in a few object types */
 
-	type = acpi_ns_get_type (obj_handle);
-	obj_desc = acpi_ns_get_attached_object (node);
+	type = acpi_ns_get_type(obj_handle);
+	obj_desc = acpi_ns_get_attached_object(node);
 	if (!obj_desc) {
 		return (AE_OK);
 	}
@@ -269,8 +249,8 @@ acpi_ns_init_one_object (
 	/*
 	 * Must lock the interpreter before executing AML code
 	 */
-	status = acpi_ex_enter_interpreter ();
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ex_enter_interpreter();
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
@@ -282,25 +262,25 @@ acpi_ns_init_one_object (
 	case ACPI_TYPE_REGION:
 
 		info->op_region_init++;
-		status = acpi_ds_get_region_arguments (obj_desc);
+		status = acpi_ds_get_region_arguments(obj_desc);
 		break;
 
 	case ACPI_TYPE_BUFFER_FIELD:
 
 		info->field_init++;
-		status = acpi_ds_get_buffer_field_arguments (obj_desc);
+		status = acpi_ds_get_buffer_field_arguments(obj_desc);
 		break;
 
 	case ACPI_TYPE_BUFFER:
 
 		info->buffer_init++;
-		status = acpi_ds_get_buffer_arguments (obj_desc);
+		status = acpi_ds_get_buffer_arguments(obj_desc);
 		break;
 
 	case ACPI_TYPE_PACKAGE:
 
 		info->package_init++;
-		status = acpi_ds_get_package_arguments (obj_desc);
+		status = acpi_ds_get_package_arguments(obj_desc);
 		break;
 
 	default:
@@ -308,12 +288,13 @@ acpi_ns_init_one_object (
 		break;
 	}
 
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Could not execute arguments for [%4.4s] (%s), %s\n",
-				acpi_ut_get_node_name (node), acpi_ut_get_type_name (type),
-				acpi_format_exception (status)));
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Could not execute arguments for [%4.4s] (%s), %s\n",
+				  acpi_ut_get_node_name(node),
+				  acpi_ut_get_type_name(type),
+				  acpi_format_exception(status)));
 	}
 
 	/*
@@ -321,18 +302,17 @@ acpi_ns_init_one_object (
 	 * pathname
 	 */
 	if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
 	}
 
 	/*
 	 * We ignore errors from above, and always return OK, since we don't want
 	 * to abort the walk on any single error.
 	 */
-	acpi_ex_exit_interpreter ();
+	acpi_ex_exit_interpreter();
 	return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_init_one_device
@@ -348,41 +328,37 @@ acpi_ns_init_one_object (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_init_one_device (
-	acpi_handle                     obj_handle,
-	u32                             nesting_level,
-	void                            *context,
-	void                            **return_value)
+acpi_ns_init_one_device(acpi_handle obj_handle,
+			u32 nesting_level, void *context, void **return_value)
 {
-	struct acpi_device_walk_info   *info = (struct acpi_device_walk_info *) context;
-	struct acpi_parameter_info      pinfo;
-	u32                             flags;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ns_init_one_device");
+	struct acpi_device_walk_info *info =
+	    (struct acpi_device_walk_info *)context;
+	struct acpi_parameter_info pinfo;
+	u32 flags;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ns_init_one_device");
 
 	pinfo.parameters = NULL;
 	pinfo.parameter_type = ACPI_PARAM_ARGS;
 
-	pinfo.node = acpi_ns_map_handle_to_node (obj_handle);
+	pinfo.node = acpi_ns_map_handle_to_node(obj_handle);
 	if (!pinfo.node) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
 	 * We will run _STA/_INI on Devices, Processors and thermal_zones only
 	 */
-	if ((pinfo.node->type != ACPI_TYPE_DEVICE)      &&
-		(pinfo.node->type != ACPI_TYPE_PROCESSOR)   &&
-		(pinfo.node->type != ACPI_TYPE_THERMAL)) {
-		return_ACPI_STATUS (AE_OK);
+	if ((pinfo.node->type != ACPI_TYPE_DEVICE) &&
+	    (pinfo.node->type != ACPI_TYPE_PROCESSOR) &&
+	    (pinfo.node->type != ACPI_TYPE_THERMAL)) {
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
-		(!(acpi_dbg_level & ACPI_LV_INFO))) {
-		ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+	    (!(acpi_dbg_level & ACPI_LV_INFO))) {
+		ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
 	}
 
 	info->device_count++;
@@ -390,20 +366,20 @@ acpi_ns_init_one_device (
 	/*
 	 * Run _STA to determine if we can run _INI on the device.
 	 */
-	ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
-			   pinfo.node, METHOD_NAME__STA));
-	status = acpi_ut_execute_STA (pinfo.node, &flags);
+	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
+						      pinfo.node,
+						      METHOD_NAME__STA));
+	status = acpi_ut_execute_STA(pinfo.node, &flags);
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		if (pinfo.node->type == ACPI_TYPE_DEVICE) {
 			/* Ignore error and move on to next device */
 
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 
 		/* _STA is not required for Processor or thermal_zone objects */
-	}
-	else {
+	} else {
 		info->num_STA++;
 
 		if (!(flags & 0x01)) {
@@ -416,32 +392,34 @@ acpi_ns_init_one_device (
 	/*
 	 * The device is present. Run _INI.
 	 */
-	ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
-			   pinfo.node, METHOD_NAME__INI));
-	status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo);
-	if (ACPI_FAILURE (status)) {
+	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
+						      pinfo.node,
+						      METHOD_NAME__INI));
+	status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo);
+	if (ACPI_FAILURE(status)) {
 		/* No _INI (AE_NOT_FOUND) means device requires no initialization */
 
 		if (status != AE_NOT_FOUND) {
 			/* Ignore error and move on to next device */
 
 #ifdef ACPI_DEBUG_OUTPUT
-			char                *scope_name = acpi_ns_get_external_pathname (pinfo.node);
+			char *scope_name =
+			    acpi_ns_get_external_pathname(pinfo.node);
 
-			ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
-					scope_name, acpi_format_exception (status)));
+			ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n",
+					  scope_name,
+					  acpi_format_exception(status)));
 
-			ACPI_MEM_FREE (scope_name);
+			ACPI_MEM_FREE(scope_name);
 #endif
 		}
 
 		status = AE_OK;
-	}
-	else {
+	} else {
 		/* Delete any return object (especially if implicit_return is enabled) */
 
 		if (pinfo.return_object) {
-			acpi_ut_remove_reference (pinfo.return_object);
+			acpi_ut_remove_reference(pinfo.return_object);
 		}
 
 		/* Count of successful INIs */
@@ -452,8 +430,9 @@ acpi_ns_init_one_device (
 	if (acpi_gbl_init_handler) {
 		/* External initialization handler is present, call it */
 
-		status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI);
+		status =
+		    acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }

+ 98 - 130
drivers/acpi/namespace/nsload.c

@@ -41,32 +41,22 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsload")
+ACPI_MODULE_NAME("nsload")
 
 /* Local prototypes */
-
-static acpi_status
-acpi_ns_load_table_by_type (
-	acpi_table_type                 table_type);
+static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type);
 
 #ifdef ACPI_FUTURE_IMPLEMENTATION
-acpi_status
-acpi_ns_unload_namespace (
-	acpi_handle                     handle);
+acpi_status acpi_ns_unload_namespace(acpi_handle handle);
 
-static acpi_status
-acpi_ns_delete_subtree (
-	acpi_handle                     start_handle);
+static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
 #endif
 
-
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
  *
@@ -82,40 +72,39 @@ acpi_ns_delete_subtree (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_load_table (
-	struct acpi_table_desc          *table_desc,
-	struct acpi_namespace_node      *node)
+acpi_ns_load_table(struct acpi_table_desc *table_desc,
+		   struct acpi_namespace_node *node)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ns_load_table");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ns_load_table");
 
 	/* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
 
-	if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) {
+	if (!
+	    (acpi_gbl_table_data[table_desc->type].
+	     flags & ACPI_TABLE_EXECUTABLE)) {
 		/* Just ignore this table */
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Check validity of the AML start and length */
 
 	if (!table_desc->aml_start) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n"));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n",
-		table_desc->aml_start));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n",
+			  table_desc->aml_start));
 
 	/* Ignore table if there is no AML contained within */
 
 	if (!table_desc->aml_length) {
-		ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n",
-			table_desc->pointer->signature));
-		return_ACPI_STATUS (AE_OK);
+		ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n",
+				     table_desc->pointer->signature));
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/*
@@ -127,19 +116,19 @@ acpi_ns_load_table (
 	 * to another control method, we can't continue parsing
 	 * because we don't know how many arguments to parse next!
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-		"**** Loading table into namespace ****\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "**** Loading table into namespace ****\n"));
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ns_parse_table (table_desc, node->child);
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	status = acpi_ns_parse_table(table_desc, node->child);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -148,18 +137,17 @@ acpi_ns_load_table (
 	 * just-in-time parsing, we delete the control method
 	 * parse trees.
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-		"**** Begin Table Method Parsing and Object Initialization ****\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "**** Begin Table Method Parsing and Object Initialization ****\n"));
 
-	status = acpi_ds_initialize_objects (table_desc, node);
+	status = acpi_ds_initialize_objects(table_desc, node);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-		"**** Completed Table Method Parsing and Object Initialization ****\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "**** Completed Table Method Parsing and Object Initialization ****\n"));
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_load_table_by_type
@@ -174,21 +162,17 @@ acpi_ns_load_table (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ns_load_table_by_type (
-	acpi_table_type                 table_type)
+static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
 {
-	u32                             i;
-	acpi_status                     status;
-	struct acpi_table_desc          *table_desc;
-
-
-	ACPI_FUNCTION_TRACE ("ns_load_table_by_type");
+	u32 i;
+	acpi_status status;
+	struct acpi_table_desc *table_desc;
 
+	ACPI_FUNCTION_TRACE("ns_load_table_by_type");
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -198,7 +182,7 @@ acpi_ns_load_table_by_type (
 	switch (table_type) {
 	case ACPI_TABLE_DSDT:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n"));
 
 		table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
 
@@ -210,18 +194,18 @@ acpi_ns_load_table_by_type (
 
 		/* Now load the single DSDT */
 
-		status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ns_load_table(table_desc, acpi_gbl_root_node);
+		if (ACPI_SUCCESS(status)) {
 			table_desc->loaded_into_namespace = TRUE;
 		}
 		break;
 
-
 	case ACPI_TABLE_SSDT:
 	case ACPI_TABLE_PSDT:
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n",
-			acpi_gbl_table_lists[table_type].count));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Namespace load: %d SSDT or PSDTs\n",
+				  acpi_gbl_table_lists[table_type].count));
 
 		/*
 		 * Traverse list of SSDT or PSDT tables
@@ -233,8 +217,10 @@ acpi_ns_load_table_by_type (
 			 * already loaded!
 			 */
 			if (!table_desc->loaded_into_namespace) {
-				status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
-				if (ACPI_FAILURE (status)) {
+				status =
+				    acpi_ns_load_table(table_desc,
+						       acpi_gbl_root_node);
+				if (ACPI_FAILURE(status)) {
 					break;
 				}
 
@@ -245,19 +231,16 @@ acpi_ns_load_table_by_type (
 		}
 		break;
 
-
 	default:
 		status = AE_SUPPORT;
 		break;
 	}
 
-
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
-	return_ACPI_STATUS (status);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_load_namespace
@@ -271,45 +254,40 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_load_namespace (
-	void)
+acpi_status acpi_ns_load_namespace(void)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_load_name_space");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_load_name_space");
 
 	/* There must be at least a DSDT installed */
 
 	if (acpi_gbl_DSDT == NULL) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
-		return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+		return_ACPI_STATUS(AE_NO_ACPI_TABLES);
 	}
 
 	/*
 	 * Load the namespace.  The DSDT is required,
 	 * but the SSDT and PSDT tables are optional.
 	 */
-	status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Ignore exceptions from these */
 
-	(void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
-	(void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
+	(void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT);
+	(void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT);
 
-	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-		"ACPI Namespace successfully loaded at root %p\n",
-		acpi_gbl_root_node));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "ACPI Namespace successfully loaded at root %p\n",
+			      acpi_gbl_root_node));
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_FUTURE_IMPLEMENTATION
 /*******************************************************************************
  *
@@ -327,24 +305,20 @@ acpi_ns_load_namespace (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ns_delete_subtree (
-	acpi_handle                     start_handle)
+static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
 {
-	acpi_status                     status;
-	acpi_handle                     child_handle;
-	acpi_handle                     parent_handle;
-	acpi_handle                     next_child_handle;
-	acpi_handle                     dummy;
-	u32                             level;
-
-
-	ACPI_FUNCTION_TRACE ("ns_delete_subtree");
+	acpi_status status;
+	acpi_handle child_handle;
+	acpi_handle parent_handle;
+	acpi_handle next_child_handle;
+	acpi_handle dummy;
+	u32 level;
 
+	ACPI_FUNCTION_TRACE("ns_delete_subtree");
 
 	parent_handle = start_handle;
 	child_handle = NULL;
-	level        = 1;
+	level = 1;
 
 	/*
 	 * Traverse the tree of objects until we bubble back up
@@ -353,18 +327,19 @@ acpi_ns_delete_subtree (
 	while (level > 0) {
 		/* Attempt to get the next object in this scope */
 
-		status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle,
-				  child_handle, &next_child_handle);
+		status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
+					      child_handle, &next_child_handle);
 
 		child_handle = next_child_handle;
 
 		/* Did we get a new object? */
 
-		if (ACPI_SUCCESS (status)) {
+		if (ACPI_SUCCESS(status)) {
 			/* Check if this object has any children */
 
-			if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle,
-					 NULL, &dummy))) {
+			if (ACPI_SUCCESS
+			    (acpi_get_next_object
+			     (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) {
 				/*
 				 * There is at least one child of this object,
 				 * visit the object
@@ -373,8 +348,7 @@ acpi_ns_delete_subtree (
 				parent_handle = child_handle;
 				child_handle = NULL;
 			}
-		}
-		else {
+		} else {
 			/*
 			 * No more children in this object, go back up to
 			 * the object's parent
@@ -383,24 +357,23 @@ acpi_ns_delete_subtree (
 
 			/* Delete all children now */
 
-			acpi_ns_delete_children (child_handle);
+			acpi_ns_delete_children(child_handle);
 
 			child_handle = parent_handle;
-			status = acpi_get_parent (parent_handle, &parent_handle);
-			if (ACPI_FAILURE (status)) {
-				return_ACPI_STATUS (status);
+			status = acpi_get_parent(parent_handle, &parent_handle);
+			if (ACPI_FAILURE(status)) {
+				return_ACPI_STATUS(status);
 			}
 		}
 	}
 
 	/* Now delete the starting object, and we are done */
 
-	acpi_ns_delete_node (child_handle);
+	acpi_ns_delete_node(child_handle);
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  *  FUNCTION:       acpi_ns_unload_name_space
@@ -415,32 +388,27 @@ acpi_ns_delete_subtree (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_unload_namespace (
-	acpi_handle                     handle)
+acpi_status acpi_ns_unload_namespace(acpi_handle handle)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ns_unload_name_space");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ns_unload_name_space");
 
 	/* Parameter validation */
 
 	if (!acpi_gbl_root_node) {
-		return_ACPI_STATUS (AE_NO_NAMESPACE);
+		return_ACPI_STATUS(AE_NO_NAMESPACE);
 	}
 
 	if (!handle) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* This function does the real work */
 
-	status = acpi_ns_delete_subtree (handle);
+	status = acpi_ns_delete_subtree(handle);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 #endif
 #endif
-

+ 46 - 72
drivers/acpi/namespace/nsnames.c

@@ -41,23 +41,17 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsnames")
+ACPI_MODULE_NAME("nsnames")
 
 /* Local prototypes */
-
 static void
-acpi_ns_build_external_path (
-	struct acpi_namespace_node      *node,
-	acpi_size                       size,
-	char                            *name_buffer);
-
+acpi_ns_build_external_path(struct acpi_namespace_node *node,
+			    acpi_size size, char *name_buffer);
 
 /*******************************************************************************
  *
@@ -75,17 +69,13 @@ acpi_ns_build_external_path (
  ******************************************************************************/
 
 static void
-acpi_ns_build_external_path (
-	struct acpi_namespace_node      *node,
-	acpi_size                       size,
-	char                            *name_buffer)
+acpi_ns_build_external_path(struct acpi_namespace_node *node,
+			    acpi_size size, char *name_buffer)
 {
-	acpi_size                       index;
-	struct acpi_namespace_node      *parent_node;
-
-
-	ACPI_FUNCTION_NAME ("ns_build_external_path");
+	acpi_size index;
+	struct acpi_namespace_node *parent_node;
 
+	ACPI_FUNCTION_NAME("ns_build_external_path");
 
 	/* Special case for root */
 
@@ -106,8 +96,8 @@ acpi_ns_build_external_path (
 
 		/* Put the name into the buffer */
 
-		ACPI_MOVE_32_TO_32 ((name_buffer + index), &parent_node->name);
-		parent_node = acpi_ns_get_parent_node (parent_node);
+		ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name);
+		parent_node = acpi_ns_get_parent_node(parent_node);
 
 		/* Prefix name with the path separator */
 
@@ -120,15 +110,14 @@ acpi_ns_build_external_path (
 	name_buffer[index] = AML_ROOT_PREFIX;
 
 	if (index != 0) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Could not construct pathname; index=%X, size=%X, Path=%s\n",
-			(u32) index, (u32) size, &name_buffer[size]));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+				  (u32) index, (u32) size, &name_buffer[size]));
 	}
 
 	return;
 }
 
-
 #ifdef ACPI_DEBUG_OUTPUT
 /*******************************************************************************
  *
@@ -144,37 +133,32 @@ acpi_ns_build_external_path (
  *
  ******************************************************************************/
 
-char *
-acpi_ns_get_external_pathname (
-	struct acpi_namespace_node      *node)
+char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 {
-	char                            *name_buffer;
-	acpi_size                       size;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ns_get_external_pathname", node);
+	char *name_buffer;
+	acpi_size size;
 
+	ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node);
 
 	/* Calculate required buffer size based on depth below root */
 
-	size = acpi_ns_get_pathname_length (node);
+	size = acpi_ns_get_pathname_length(node);
 
 	/* Allocate a buffer to be returned to caller */
 
-	name_buffer = ACPI_MEM_CALLOCATE (size);
+	name_buffer = ACPI_MEM_CALLOCATE(size);
 	if (!name_buffer) {
-		ACPI_REPORT_ERROR (("ns_get_table_pathname: allocation failure\n"));
-		return_PTR (NULL);
+		ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n"));
+		return_PTR(NULL);
 	}
 
 	/* Build the path in the allocated buffer */
 
-	acpi_ns_build_external_path (node, size, name_buffer);
-	return_PTR (name_buffer);
+	acpi_ns_build_external_path(node, size, name_buffer);
+	return_PTR(name_buffer);
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_pathname_length
@@ -187,16 +171,12 @@ acpi_ns_get_external_pathname (
  *
  ******************************************************************************/
 
-acpi_size
-acpi_ns_get_pathname_length (
-	struct acpi_namespace_node      *node)
+acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
 {
-	acpi_size                       size;
-	struct acpi_namespace_node      *next_node;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	acpi_size size;
+	struct acpi_namespace_node *next_node;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * Compute length of pathname as 5 * number of name segments.
@@ -207,17 +187,16 @@ acpi_ns_get_pathname_length (
 
 	while (next_node && (next_node != acpi_gbl_root_node)) {
 		size += ACPI_PATH_SEGMENT_LENGTH;
-		next_node = acpi_ns_get_parent_node (next_node);
+		next_node = acpi_ns_get_parent_node(next_node);
 	}
 
 	if (!size) {
-		size = 1;       /* Root node case */
+		size = 1;	/* Root node case */
 	}
 
-	return (size + 1);  /* +1 for null string terminator */
+	return (size + 1);	/* +1 for null string terminator */
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_handle_to_pathname
@@ -233,41 +212,36 @@ acpi_ns_get_pathname_length (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_handle_to_pathname (
-	acpi_handle                     target_handle,
-	struct acpi_buffer              *buffer)
+acpi_ns_handle_to_pathname(acpi_handle target_handle,
+			   struct acpi_buffer * buffer)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	acpi_size                       required_size;
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	acpi_size required_size;
 
+	ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle);
 
-	ACPI_FUNCTION_TRACE_PTR ("ns_handle_to_pathname", target_handle);
-
-
-	node = acpi_ns_map_handle_to_node (target_handle);
+	node = acpi_ns_map_handle_to_node(target_handle);
 	if (!node) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Determine size required for the caller buffer */
 
-	required_size = acpi_ns_get_pathname_length (node);
+	required_size = acpi_ns_get_pathname_length(node);
 
 	/* Validate/Allocate/Clear caller buffer */
 
-	status = acpi_ut_initialize_buffer (buffer, required_size);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_initialize_buffer(buffer, required_size);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Build the path in the caller buffer */
 
-	acpi_ns_build_external_path (node, required_size, buffer->pointer);
+	acpi_ns_build_external_path(node, required_size, buffer->pointer);
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n",
-		(char *) buffer->pointer, (u32) required_size));
-	return_ACPI_STATUS (AE_OK);
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n",
+			  (char *)buffer->pointer, (u32) required_size));
+	return_ACPI_STATUS(AE_OK);
 }
-
-

+ 90 - 119
drivers/acpi/namespace/nsobject.c

@@ -42,14 +42,11 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsobject")
-
+ACPI_MODULE_NAME("nsobject")
 
 /*******************************************************************************
  *
@@ -71,20 +68,15 @@
  * MUTEX:       Assumes namespace is locked
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ns_attach_object (
-	struct acpi_namespace_node      *node,
-	union acpi_operand_object       *object,
-	acpi_object_type                type)
+acpi_ns_attach_object(struct acpi_namespace_node *node,
+		      union acpi_operand_object *object, acpi_object_type type)
 {
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *last_obj_desc;
-	acpi_object_type                object_type = ACPI_TYPE_ANY;
-
-
-	ACPI_FUNCTION_TRACE ("ns_attach_object");
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *last_obj_desc;
+	acpi_object_type object_type = ACPI_TYPE_ANY;
 
+	ACPI_FUNCTION_TRACE("ns_attach_object");
 
 	/*
 	 * Parameter validation
@@ -92,40 +84,39 @@ acpi_ns_attach_object (
 	if (!node) {
 		/* Invalid handle */
 
-		ACPI_REPORT_ERROR (("ns_attach_object: Null named_obj handle\n"));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n"));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	if (!object && (ACPI_TYPE_ANY != type)) {
 		/* Null object */
 
-		ACPI_REPORT_ERROR ((
-			"ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
+	if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
 		/* Not a name handle */
 
-		ACPI_REPORT_ERROR (("ns_attach_object: Invalid handle %p [%s]\n",
-				node, acpi_ut_get_descriptor_name (node)));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n",
+				   node, acpi_ut_get_descriptor_name(node)));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Check if this object is already attached */
 
 	if (node->object == object) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"Obj %p already installed in name_obj %p\n",
-			object, node));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Obj %p already installed in name_obj %p\n",
+				  object, node));
 
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* If null object, we will just install it */
 
 	if (!object) {
-		obj_desc   = NULL;
+		obj_desc = NULL;
 		object_type = ACPI_TYPE_ANY;
 	}
 
@@ -133,14 +124,14 @@ acpi_ns_attach_object (
 	 * If the source object is a namespace Node with an attached object,
 	 * we will use that (attached) object
 	 */
-	else if ((ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) &&
-			((struct acpi_namespace_node *) object)->object) {
+	else if ((ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) &&
+		 ((struct acpi_namespace_node *)object)->object) {
 		/*
 		 * Value passed is a name handle and that name has a
 		 * non-null value.  Use that name's value and type.
 		 */
-		obj_desc   = ((struct acpi_namespace_node *) object)->object;
-		object_type = ((struct acpi_namespace_node *) object)->type;
+		obj_desc = ((struct acpi_namespace_node *)object)->object;
+		object_type = ((struct acpi_namespace_node *)object)->type;
 	}
 
 	/*
@@ -148,20 +139,20 @@ acpi_ns_attach_object (
 	 * it first
 	 */
 	else {
-		obj_desc = (union acpi_operand_object   *) object;
+		obj_desc = (union acpi_operand_object *)object;
 
 		/* Use the given type */
 
 		object_type = type;
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
-		obj_desc, node, acpi_ut_get_node_name (node)));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
+			  obj_desc, node, acpi_ut_get_node_name(node)));
 
 	/* Detach an existing attached object if present */
 
 	if (node->object) {
-		acpi_ns_detach_object (node);
+		acpi_ns_detach_object(node);
 	}
 
 	if (obj_desc) {
@@ -169,7 +160,7 @@ acpi_ns_attach_object (
 		 * Must increment the new value's reference count
 		 * (if it is an internal object)
 		 */
-		acpi_ut_add_reference (obj_desc);
+		acpi_ut_add_reference(obj_desc);
 
 		/*
 		 * Handle objects with multiple descriptors - walk
@@ -185,13 +176,12 @@ acpi_ns_attach_object (
 		last_obj_desc->common.next_object = node->object;
 	}
 
-	node->type     = (u8) object_type;
-	node->object   = obj_desc;
+	node->type = (u8) object_type;
+	node->object = obj_desc;
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_detach_object
@@ -206,30 +196,27 @@ acpi_ns_attach_object (
  *
  ******************************************************************************/
 
-void
-acpi_ns_detach_object (
-	struct acpi_namespace_node      *node)
+void acpi_ns_detach_object(struct acpi_namespace_node *node)
 {
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_TRACE ("ns_detach_object");
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_TRACE("ns_detach_object");
 
 	obj_desc = node->object;
 
 	if (!obj_desc ||
-		(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
+	    (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
 		return_VOID;
 	}
 
 	/* Clear the entry in all cases */
 
 	node->object = NULL;
-	if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
+	if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
 		node->object = obj_desc->common.next_object;
 		if (node->object &&
-		   (ACPI_GET_OBJECT_TYPE (node->object) != ACPI_TYPE_LOCAL_DATA)) {
+		    (ACPI_GET_OBJECT_TYPE(node->object) !=
+		     ACPI_TYPE_LOCAL_DATA)) {
 			node->object = node->object->common.next_object;
 		}
 	}
@@ -238,16 +225,15 @@ acpi_ns_detach_object (
 
 	node->type = ACPI_TYPE_ANY;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
-		node, acpi_ut_get_node_name (node), obj_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
+			  node, acpi_ut_get_node_name(node), obj_desc));
 
 	/* Remove one reference on the object (and all subobjects) */
 
-	acpi_ut_remove_reference (obj_desc);
+	acpi_ut_remove_reference(obj_desc);
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_attached_object
@@ -261,29 +247,28 @@ acpi_ns_detach_object (
  *
  ******************************************************************************/
 
-union acpi_operand_object *
-acpi_ns_get_attached_object (
-	struct acpi_namespace_node      *node)
+union acpi_operand_object *acpi_ns_get_attached_object(struct
+						       acpi_namespace_node
+						       *node)
 {
-	ACPI_FUNCTION_TRACE_PTR ("ns_get_attached_object", node);
-
+	ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node);
 
 	if (!node) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
-		return_PTR (NULL);
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n"));
+		return_PTR(NULL);
 	}
 
 	if (!node->object ||
-			((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
-			 (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED))  ||
-		(ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) {
-		return_PTR (NULL);
+	    ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND)
+	     && (ACPI_GET_DESCRIPTOR_TYPE(node->object) !=
+		 ACPI_DESC_TYPE_NAMED))
+	    || (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) {
+		return_PTR(NULL);
 	}
 
-	return_PTR (node->object);
+	return_PTR(node->object);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_secondary_object
@@ -297,24 +282,23 @@ acpi_ns_get_attached_object (
  *
  ******************************************************************************/
 
-union acpi_operand_object *
-acpi_ns_get_secondary_object (
-	union acpi_operand_object       *obj_desc)
+union acpi_operand_object *acpi_ns_get_secondary_object(union
+							acpi_operand_object
+							*obj_desc)
 {
-	ACPI_FUNCTION_TRACE_PTR ("ns_get_secondary_object", obj_desc);
-
-
-	if ((!obj_desc)                                               ||
-		(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
-		(!obj_desc->common.next_object)                           ||
-		(ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) {
-		return_PTR (NULL);
+	ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc);
+
+	if ((!obj_desc) ||
+	    (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
+	    (!obj_desc->common.next_object) ||
+	    (ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) ==
+	     ACPI_TYPE_LOCAL_DATA)) {
+		return_PTR(NULL);
 	}
 
-	return_PTR (obj_desc->common.next_object);
+	return_PTR(obj_desc->common.next_object);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_attach_data
@@ -330,23 +314,20 @@ acpi_ns_get_secondary_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_attach_data (
-	struct acpi_namespace_node      *node,
-	acpi_object_handler             handler,
-	void                            *data)
+acpi_ns_attach_data(struct acpi_namespace_node *node,
+		    acpi_object_handler handler, void *data)
 {
-	union acpi_operand_object       *prev_obj_desc;
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *data_desc;
-
+	union acpi_operand_object *prev_obj_desc;
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *data_desc;
 
 	/* We only allow one attachment per handler */
 
 	prev_obj_desc = NULL;
 	obj_desc = node->object;
 	while (obj_desc) {
-		if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
-			(obj_desc->data.handler == handler)) {
+		if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+		    (obj_desc->data.handler == handler)) {
 			return (AE_ALREADY_EXISTS);
 		}
 
@@ -356,7 +337,7 @@ acpi_ns_attach_data (
 
 	/* Create an internal object for the data */
 
-	data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA);
+	data_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_DATA);
 	if (!data_desc) {
 		return (AE_NO_MEMORY);
 	}
@@ -368,15 +349,13 @@ acpi_ns_attach_data (
 
 	if (prev_obj_desc) {
 		prev_obj_desc->common.next_object = data_desc;
-	}
-	else {
+	} else {
 		node->object = data_desc;
 	}
 
 	return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_detach_data
@@ -392,27 +371,25 @@ acpi_ns_attach_data (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_detach_data (
-	struct acpi_namespace_node      *node,
-	acpi_object_handler             handler)
+acpi_ns_detach_data(struct acpi_namespace_node * node,
+		    acpi_object_handler handler)
 {
-	union acpi_operand_object       *obj_desc;
-	union acpi_operand_object       *prev_obj_desc;
-
+	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *prev_obj_desc;
 
 	prev_obj_desc = NULL;
 	obj_desc = node->object;
 	while (obj_desc) {
-		if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
-			(obj_desc->data.handler == handler)) {
+		if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+		    (obj_desc->data.handler == handler)) {
 			if (prev_obj_desc) {
-				prev_obj_desc->common.next_object = obj_desc->common.next_object;
-			}
-			else {
+				prev_obj_desc->common.next_object =
+				    obj_desc->common.next_object;
+			} else {
 				node->object = obj_desc->common.next_object;
 			}
 
-			acpi_ut_remove_reference (obj_desc);
+			acpi_ut_remove_reference(obj_desc);
 			return (AE_OK);
 		}
 
@@ -423,7 +400,6 @@ acpi_ns_detach_data (
 	return (AE_NOT_FOUND);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_attached_data
@@ -440,18 +416,15 @@ acpi_ns_detach_data (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_get_attached_data (
-	struct acpi_namespace_node      *node,
-	acpi_object_handler             handler,
-	void                            **data)
+acpi_ns_get_attached_data(struct acpi_namespace_node * node,
+			  acpi_object_handler handler, void **data)
 {
-	union acpi_operand_object       *obj_desc;
-
+	union acpi_operand_object *obj_desc;
 
 	obj_desc = node->object;
 	while (obj_desc) {
-		if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
-			(obj_desc->data.handler == handler)) {
+		if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+		    (obj_desc->data.handler == handler)) {
 			*data = obj_desc->data.pointer;
 			return (AE_OK);
 		}
@@ -461,5 +434,3 @@ acpi_ns_get_attached_data (
 
 	return (AE_NOT_FOUND);
 }
-
-

+ 37 - 49
drivers/acpi/namespace/nsparse.c

@@ -41,16 +41,13 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsparse")
-
+ACPI_MODULE_NAME("nsparse")
 
 /*******************************************************************************
  *
@@ -64,54 +61,50 @@
  * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ns_one_complete_parse (
-	u8                              pass_number,
-	struct acpi_table_desc          *table_desc)
+acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc)
 {
-	union acpi_parse_object         *parse_root;
-	acpi_status                     status;
-	struct acpi_walk_state          *walk_state;
-
-
-	ACPI_FUNCTION_TRACE ("ns_one_complete_parse");
+	union acpi_parse_object *parse_root;
+	acpi_status status;
+	struct acpi_walk_state *walk_state;
 
+	ACPI_FUNCTION_TRACE("ns_one_complete_parse");
 
 	/* Create and init a Root Node */
 
-	parse_root = acpi_ps_create_scope_op ();
+	parse_root = acpi_ps_create_scope_op();
 	if (!parse_root) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Create and initialize a new walk state */
 
-	walk_state = acpi_ds_create_walk_state (table_desc->owner_id,
-			   NULL, NULL, NULL);
+	walk_state = acpi_ds_create_walk_state(table_desc->owner_id,
+					       NULL, NULL, NULL);
 	if (!walk_state) {
-		acpi_ps_free_op (parse_root);
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		acpi_ps_free_op(parse_root);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
-	status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL,
-			  table_desc->aml_start, table_desc->aml_length,
-			  NULL, pass_number);
-	if (ACPI_FAILURE (status)) {
-		acpi_ds_delete_walk_state (walk_state);
-		return_ACPI_STATUS (status);
+	status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
+				       table_desc->aml_start,
+				       table_desc->aml_length, NULL,
+				       pass_number);
+	if (ACPI_FAILURE(status)) {
+		acpi_ds_delete_walk_state(walk_state);
+		return_ACPI_STATUS(status);
 	}
 
 	/* Parse the AML */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
-	status = acpi_ps_parse_aml (walk_state);
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n",
+			  pass_number));
+	status = acpi_ps_parse_aml(walk_state);
 
-	acpi_ps_delete_parse_tree (parse_root);
-	return_ACPI_STATUS (status);
+	acpi_ps_delete_parse_tree(parse_root);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_parse_table
@@ -126,15 +119,12 @@ acpi_ns_one_complete_parse (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_parse_table (
-	struct acpi_table_desc          *table_desc,
-	struct acpi_namespace_node      *start_node)
+acpi_ns_parse_table(struct acpi_table_desc *table_desc,
+		    struct acpi_namespace_node *start_node)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ns_parse_table");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ns_parse_table");
 
 	/*
 	 * AML Parse, pass 1
@@ -146,10 +136,10 @@ acpi_ns_parse_table (
 	 * to service the entire parse.  The second pass of the parse then
 	 * performs another complete parse of the AML..
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
-	status = acpi_ns_one_complete_parse (1, table_desc);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
+	status = acpi_ns_one_complete_parse(1, table_desc);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -161,13 +151,11 @@ acpi_ns_parse_table (
 	 * overhead of this is compensated for by the fact that the
 	 * parse objects are all cached.
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
-	status = acpi_ns_one_complete_parse (2, table_desc);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n"));
+	status = acpi_ns_one_complete_parse(2, table_desc);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 98 - 107
drivers/acpi/namespace/nssearch.c

@@ -41,23 +41,18 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nssearch")
+ACPI_MODULE_NAME("nssearch")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ns_search_parent_tree (
-	u32                             target_name,
-	struct acpi_namespace_node      *node,
-	acpi_object_type                type,
-	struct acpi_namespace_node      **return_node);
-
+acpi_ns_search_parent_tree(u32 target_name,
+			   struct acpi_namespace_node *node,
+			   acpi_object_type type,
+			   struct acpi_namespace_node **return_node);
 
 /*******************************************************************************
  *
@@ -87,30 +82,28 @@ acpi_ns_search_parent_tree (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_search_node (
-	u32                             target_name,
-	struct acpi_namespace_node      *node,
-	acpi_object_type                type,
-	struct acpi_namespace_node      **return_node)
+acpi_ns_search_node(u32 target_name,
+		    struct acpi_namespace_node *node,
+		    acpi_object_type type,
+		    struct acpi_namespace_node **return_node)
 {
-	struct acpi_namespace_node      *next_node;
-
-
-	ACPI_FUNCTION_TRACE ("ns_search_node");
+	struct acpi_namespace_node *next_node;
 
+	ACPI_FUNCTION_TRACE("ns_search_node");
 
 #ifdef ACPI_DEBUG_OUTPUT
 	if (ACPI_LV_NAMES & acpi_dbg_level) {
-		char                        *scope_name;
+		char *scope_name;
 
-		scope_name = acpi_ns_get_external_pathname (node);
+		scope_name = acpi_ns_get_external_pathname(node);
 		if (scope_name) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Searching %s (%p) For [%4.4s] (%s)\n",
-				scope_name, node, (char *) &target_name,
-				acpi_ut_get_type_name (type)));
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Searching %s (%p) For [%4.4s] (%s)\n",
+					  scope_name, node,
+					  (char *)&target_name,
+					  acpi_ut_get_type_name(type)));
 
-			ACPI_MEM_FREE (scope_name);
+			ACPI_MEM_FREE(scope_name);
 		}
 	}
 #endif
@@ -126,20 +119,26 @@ acpi_ns_search_node (
 		if (next_node->name.integer == target_name) {
 			/* Resolve a control method alias if any */
 
-			if (acpi_ns_get_type (next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
-				next_node = ACPI_CAST_PTR (struct acpi_namespace_node, next_node->object);
+			if (acpi_ns_get_type(next_node) ==
+			    ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+				next_node =
+				    ACPI_CAST_PTR(struct acpi_namespace_node,
+						  next_node->object);
 			}
 
 			/*
 			 * Found matching entry.
 			 */
-			ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-				"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
-				(char *) &target_name, acpi_ut_get_type_name (next_node->type),
-				next_node, acpi_ut_get_node_name (node), node));
+			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+					  "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
+					  (char *)&target_name,
+					  acpi_ut_get_type_name(next_node->
+								type),
+					  next_node,
+					  acpi_ut_get_node_name(node), node));
 
 			*return_node = next_node;
-			return_ACPI_STATUS (AE_OK);
+			return_ACPI_STATUS(AE_OK);
 		}
 
 		/*
@@ -159,15 +158,14 @@ acpi_ns_search_node (
 
 	/* Searched entire namespace level, not found */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-		"Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
-		(char *) &target_name, acpi_ut_get_type_name (type),
-		acpi_ut_get_node_name (node), node, node->child));
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+			  "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
+			  (char *)&target_name, acpi_ut_get_type_name(type),
+			  acpi_ut_get_node_name(node), node, node->child));
 
-	return_ACPI_STATUS (AE_NOT_FOUND);
+	return_ACPI_STATUS(AE_NOT_FOUND);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_search_parent_tree
@@ -194,43 +192,42 @@ acpi_ns_search_node (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_search_parent_tree (
-	u32                             target_name,
-	struct acpi_namespace_node      *node,
-	acpi_object_type                type,
-	struct acpi_namespace_node      **return_node)
+acpi_ns_search_parent_tree(u32 target_name,
+			   struct acpi_namespace_node *node,
+			   acpi_object_type type,
+			   struct acpi_namespace_node **return_node)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *parent_node;
+	acpi_status status;
+	struct acpi_namespace_node *parent_node;
 
+	ACPI_FUNCTION_TRACE("ns_search_parent_tree");
 
-	ACPI_FUNCTION_TRACE ("ns_search_parent_tree");
-
-
-	parent_node = acpi_ns_get_parent_node (node);
+	parent_node = acpi_ns_get_parent_node(node);
 
 	/*
 	 * If there is no parent (i.e., we are at the root) or type is "local",
 	 * we won't be searching the parent tree.
 	 */
 	if (!parent_node) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
-			(char *) &target_name));
-		return_ACPI_STATUS (AE_NOT_FOUND);
+		ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
+				  (char *)&target_name));
+		return_ACPI_STATUS(AE_NOT_FOUND);
 	}
 
-	if (acpi_ns_local (type)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-			"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
-			(char *) &target_name, acpi_ut_get_type_name (type)));
-		return_ACPI_STATUS (AE_NOT_FOUND);
+	if (acpi_ns_local(type)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+				  "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
+				  (char *)&target_name,
+				  acpi_ut_get_type_name(type)));
+		return_ACPI_STATUS(AE_NOT_FOUND);
 	}
 
 	/* Search the parent tree */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-		"Searching parent [%4.4s] for [%4.4s]\n",
-		acpi_ut_get_node_name (parent_node), (char *) &target_name));
+	ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+			  "Searching parent [%4.4s] for [%4.4s]\n",
+			  acpi_ut_get_node_name(parent_node),
+			  (char *)&target_name));
 
 	/*
 	 * Search parents until target is found or we have backed up to the root
@@ -241,25 +238,24 @@ acpi_ns_search_parent_tree (
 		 * object type at this point, we only care about the existence of
 		 * the actual name we are searching for.  Typechecking comes later.
 		 */
-		status = acpi_ns_search_node (target_name, parent_node,
-				  ACPI_TYPE_ANY, return_node);
-		if (ACPI_SUCCESS (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ns_search_node(target_name, parent_node,
+					     ACPI_TYPE_ANY, return_node);
+		if (ACPI_SUCCESS(status)) {
+			return_ACPI_STATUS(status);
 		}
 
 		/*
 		 * Not found here, go up another level
 		 * (until we reach the root)
 		 */
-		parent_node = acpi_ns_get_parent_node (parent_node);
+		parent_node = acpi_ns_get_parent_node(parent_node);
 	}
 
 	/* Not found in parent tree */
 
-	return_ACPI_STATUS (AE_NOT_FOUND);
+	return_ACPI_STATUS(AE_NOT_FOUND);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_search_and_enter
@@ -286,52 +282,46 @@ acpi_ns_search_parent_tree (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_search_and_enter (
-	u32                             target_name,
-	struct acpi_walk_state          *walk_state,
-	struct acpi_namespace_node      *node,
-	acpi_interpreter_mode           interpreter_mode,
-	acpi_object_type                type,
-	u32                             flags,
-	struct acpi_namespace_node      **return_node)
+acpi_ns_search_and_enter(u32 target_name,
+			 struct acpi_walk_state *walk_state,
+			 struct acpi_namespace_node *node,
+			 acpi_interpreter_mode interpreter_mode,
+			 acpi_object_type type,
+			 u32 flags, struct acpi_namespace_node **return_node)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *new_node;
-
-
-	ACPI_FUNCTION_TRACE ("ns_search_and_enter");
+	acpi_status status;
+	struct acpi_namespace_node *new_node;
 
+	ACPI_FUNCTION_TRACE("ns_search_and_enter");
 
 	/* Parameter validation */
 
 	if (!node || !target_name || !return_node) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"Null param: Node %p Name %X return_node %p\n",
-			node, target_name, return_node));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Null param: Node %p Name %X return_node %p\n",
+				  node, target_name, return_node));
 
-		ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n"));
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n"));
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Name must consist of printable characters */
 
-	if (!acpi_ut_valid_acpi_name (target_name)) {
-		ACPI_REPORT_ERROR (("ns_search_and_enter: Bad character in ACPI Name: %X\n",
-			target_name));
-		return_ACPI_STATUS (AE_BAD_CHARACTER);
+	if (!acpi_ut_valid_acpi_name(target_name)) {
+		ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name));
+		return_ACPI_STATUS(AE_BAD_CHARACTER);
 	}
 
 	/* Try to find the name in the namespace level specified by the caller */
 
 	*return_node = ACPI_ENTRY_NOT_FOUND;
-	status = acpi_ns_search_node (target_name, node, type, return_node);
+	status = acpi_ns_search_node(target_name, node, type, return_node);
 	if (status != AE_NOT_FOUND) {
 		/*
 		 * If we found it AND the request specifies that a find is an error,
 		 * return the error
 		 */
-		if ((status == AE_OK) &&
-			(flags & ACPI_NS_ERROR_IF_FOUND)) {
+		if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
 			status = AE_ALREADY_EXISTS;
 		}
 
@@ -339,7 +329,7 @@ acpi_ns_search_and_enter (
 		 * Either found it or there was an error
 		 * -- finished either way
 		 */
-		return_ACPI_STATUS (status);
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -351,14 +341,16 @@ acpi_ns_search_and_enter (
 	 * and during the execution phase.
 	 */
 	if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
-		(flags & ACPI_NS_SEARCH_PARENT)) {
+	    (flags & ACPI_NS_SEARCH_PARENT)) {
 		/*
 		 * Not found at this level - search parent tree according to the
 		 * ACPI specification
 		 */
-		status = acpi_ns_search_parent_tree (target_name, node, type, return_node);
-		if (ACPI_SUCCESS (status)) {
-			return_ACPI_STATUS (status);
+		status =
+		    acpi_ns_search_parent_tree(target_name, node, type,
+					       return_node);
+		if (ACPI_SUCCESS(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
@@ -366,25 +358,24 @@ acpi_ns_search_and_enter (
 	 * In execute mode, just search, never add names.  Exit now.
 	 */
 	if (interpreter_mode == ACPI_IMODE_EXECUTE) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-			"%4.4s Not found in %p [Not adding]\n",
-			(char *) &target_name, node));
+		ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+				  "%4.4s Not found in %p [Not adding]\n",
+				  (char *)&target_name, node));
 
-		return_ACPI_STATUS (AE_NOT_FOUND);
+		return_ACPI_STATUS(AE_NOT_FOUND);
 	}
 
 	/* Create the new named object */
 
-	new_node = acpi_ns_create_node (target_name);
+	new_node = acpi_ns_create_node(target_name);
 	if (!new_node) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Install the new object into the parent's list of children */
 
-	acpi_ns_install_node (walk_state, node, new_node, type);
+	acpi_ns_install_node(walk_state, node, new_node, type);
 	*return_node = new_node;
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-

+ 205 - 297
drivers/acpi/namespace/nsutils.c

@@ -42,28 +42,21 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/amlcode.h>
 #include <acpi/actables.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsutils")
+ACPI_MODULE_NAME("nsutils")
 
 /* Local prototypes */
-
-static u8
-acpi_ns_valid_path_separator (
-	char                            sep);
+static u8 acpi_ns_valid_path_separator(char sep);
 
 #ifdef ACPI_OBSOLETE_FUNCTIONS
-acpi_name
-acpi_ns_find_parent_name (
-	struct acpi_namespace_node      *node_to_search);
+acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_report_error
@@ -81,51 +74,45 @@ acpi_ns_find_parent_name (
  ******************************************************************************/
 
 void
-acpi_ns_report_error (
-	char                            *module_name,
-	u32                             line_number,
-	u32                             component_id,
-	char                            *internal_name,
-	acpi_status                     lookup_status)
+acpi_ns_report_error(char *module_name,
+		     u32 line_number,
+		     u32 component_id,
+		     char *internal_name, acpi_status lookup_status)
 {
-	acpi_status                     status;
-	char                            *name = NULL;
-
+	acpi_status status;
+	char *name = NULL;
 
-	acpi_os_printf ("%8s-%04d: *** Error: Looking up ",
-		module_name, line_number);
+	acpi_os_printf("%8s-%04d: *** Error: Looking up ",
+		       module_name, line_number);
 
 	if (lookup_status == AE_BAD_CHARACTER) {
 		/* There is a non-ascii character in the name */
 
-		acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n",
-			*(ACPI_CAST_PTR (u32, internal_name)));
-	}
-	else {
+		acpi_os_printf("[0x%4.4X] (NON-ASCII)\n",
+			       *(ACPI_CAST_PTR(u32, internal_name)));
+	} else {
 		/* Convert path to external format */
 
-		status = acpi_ns_externalize_name (ACPI_UINT32_MAX,
-				 internal_name, NULL, &name);
+		status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
+						  internal_name, NULL, &name);
 
 		/* Print target name */
 
-		if (ACPI_SUCCESS (status)) {
-			acpi_os_printf ("[%s]", name);
-		}
-		else {
-			acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]");
+		if (ACPI_SUCCESS(status)) {
+			acpi_os_printf("[%s]", name);
+		} else {
+			acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
 		}
 
 		if (name) {
-			ACPI_MEM_FREE (name);
+			ACPI_MEM_FREE(name);
 		}
 	}
 
-	acpi_os_printf (" in namespace, %s\n",
-		acpi_format_exception (lookup_status));
+	acpi_os_printf(" in namespace, %s\n",
+		       acpi_format_exception(lookup_status));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_report_method_error
@@ -145,34 +132,31 @@ acpi_ns_report_error (
  ******************************************************************************/
 
 void
-acpi_ns_report_method_error (
-	char                            *module_name,
-	u32                             line_number,
-	u32                             component_id,
-	char                            *message,
-	struct acpi_namespace_node      *prefix_node,
-	char                            *path,
-	acpi_status                     method_status)
+acpi_ns_report_method_error(char *module_name,
+			    u32 line_number,
+			    u32 component_id,
+			    char *message,
+			    struct acpi_namespace_node *prefix_node,
+			    char *path, acpi_status method_status)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node = prefix_node;
-
+	acpi_status status;
+	struct acpi_namespace_node *node = prefix_node;
 
 	if (path) {
-		status = acpi_ns_get_node_by_path (path, prefix_node,
-				 ACPI_NS_NO_UPSEARCH, &node);
-		if (ACPI_FAILURE (status)) {
-			acpi_os_printf ("report_method_error: Could not get node\n");
+		status = acpi_ns_get_node_by_path(path, prefix_node,
+						  ACPI_NS_NO_UPSEARCH, &node);
+		if (ACPI_FAILURE(status)) {
+			acpi_os_printf
+			    ("report_method_error: Could not get node\n");
 			return;
 		}
 	}
 
-	acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
-	acpi_ns_print_node_pathname (node, message);
-	acpi_os_printf (", %s\n", acpi_format_exception (method_status));
+	acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number);
+	acpi_ns_print_node_pathname(node, message);
+	acpi_os_printf(", %s\n", acpi_format_exception(method_status));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_print_node_pathname
@@ -186,16 +170,13 @@ acpi_ns_report_method_error (
  ******************************************************************************/
 
 void
-acpi_ns_print_node_pathname (
-	struct acpi_namespace_node      *node,
-	char                            *message)
+acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message)
 {
-	struct acpi_buffer              buffer;
-	acpi_status                     status;
-
+	struct acpi_buffer buffer;
+	acpi_status status;
 
 	if (!node) {
-		acpi_os_printf ("[NULL NAME]");
+		acpi_os_printf("[NULL NAME]");
 		return;
 	}
 
@@ -203,18 +184,17 @@ acpi_ns_print_node_pathname (
 
 	buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
-	status = acpi_ns_handle_to_pathname (node, &buffer);
-	if (ACPI_SUCCESS (status)) {
+	status = acpi_ns_handle_to_pathname(node, &buffer);
+	if (ACPI_SUCCESS(status)) {
 		if (message) {
-			acpi_os_printf ("%s ", message);
+			acpi_os_printf("%s ", message);
 		}
 
-		acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
-		ACPI_MEM_FREE (buffer.pointer);
+		acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node);
+		ACPI_MEM_FREE(buffer.pointer);
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_valid_root_prefix
@@ -227,15 +207,12 @@ acpi_ns_print_node_pathname (
  *
  ******************************************************************************/
 
-u8
-acpi_ns_valid_root_prefix (
-	char                            prefix)
+u8 acpi_ns_valid_root_prefix(char prefix)
 {
 
 	return ((u8) (prefix == '\\'));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_valid_path_separator
@@ -248,15 +225,12 @@ acpi_ns_valid_root_prefix (
  *
  ******************************************************************************/
 
-static u8
-acpi_ns_valid_path_separator (
-	char                            sep)
+static u8 acpi_ns_valid_path_separator(char sep)
 {
 
 	return ((u8) (sep == '.'));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_type
@@ -269,22 +243,18 @@ acpi_ns_valid_path_separator (
  *
  ******************************************************************************/
 
-acpi_object_type
-acpi_ns_get_type (
-	struct acpi_namespace_node      *node)
+acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
 {
-	ACPI_FUNCTION_TRACE ("ns_get_type");
-
+	ACPI_FUNCTION_TRACE("ns_get_type");
 
 	if (!node) {
-		ACPI_REPORT_WARNING (("ns_get_type: Null Node input pointer\n"));
-		return_VALUE (ACPI_TYPE_ANY);
+		ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n"));
+		return_VALUE(ACPI_TYPE_ANY);
 	}
 
-	return_VALUE ((acpi_object_type) node->type);
+	return_VALUE((acpi_object_type) node->type);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_local
@@ -298,24 +268,20 @@ acpi_ns_get_type (
  *
  ******************************************************************************/
 
-u32
-acpi_ns_local (
-	acpi_object_type                type)
+u32 acpi_ns_local(acpi_object_type type)
 {
-	ACPI_FUNCTION_TRACE ("ns_local");
-
+	ACPI_FUNCTION_TRACE("ns_local");
 
-	if (!acpi_ut_valid_object_type (type)) {
+	if (!acpi_ut_valid_object_type(type)) {
 		/* Type code out of range  */
 
-		ACPI_REPORT_WARNING (("ns_local: Invalid Object Type\n"));
-		return_VALUE (ACPI_NS_NORMAL);
+		ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n"));
+		return_VALUE(ACPI_NS_NORMAL);
 	}
 
-	return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
+	return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_internal_name_length
@@ -330,16 +296,12 @@ acpi_ns_local (
  *
  ******************************************************************************/
 
-void
-acpi_ns_get_internal_name_length (
-	struct acpi_namestring_info     *info)
+void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
 {
-	char                            *next_external_char;
-	u32                             i;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	char *next_external_char;
+	u32 i;
 
+	ACPI_FUNCTION_ENTRY();
 
 	next_external_char = info->external_name;
 	info->num_carats = 0;
@@ -353,11 +315,10 @@ acpi_ns_get_internal_name_length (
 	 *
 	 * strlen() + 1 covers the first name_seg, which has no path separator
 	 */
-	if (acpi_ns_valid_root_prefix (next_external_char[0])) {
+	if (acpi_ns_valid_root_prefix(next_external_char[0])) {
 		info->fully_qualified = TRUE;
 		next_external_char++;
-	}
-	else {
+	} else {
 		/*
 		 * Handle Carat prefixes
 		 */
@@ -375,19 +336,18 @@ acpi_ns_get_internal_name_length (
 	if (*next_external_char) {
 		info->num_segments = 1;
 		for (i = 0; next_external_char[i]; i++) {
-			if (acpi_ns_valid_path_separator (next_external_char[i])) {
+			if (acpi_ns_valid_path_separator(next_external_char[i])) {
 				info->num_segments++;
 			}
 		}
 	}
 
 	info->length = (ACPI_NAME_SIZE * info->num_segments) +
-			  4 + info->num_carats;
+	    4 + info->num_carats;
 
 	info->next_external_char = next_external_char;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_build_internal_name
@@ -401,19 +361,15 @@ acpi_ns_get_internal_name_length (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_build_internal_name (
-	struct acpi_namestring_info     *info)
+acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
 {
-	u32                             num_segments = info->num_segments;
-	char                            *internal_name = info->internal_name;
-	char                            *external_name = info->next_external_char;
-	char                            *result = NULL;
-	acpi_native_uint                i;
-
-
-	ACPI_FUNCTION_TRACE ("ns_build_internal_name");
+	u32 num_segments = info->num_segments;
+	char *internal_name = info->internal_name;
+	char *external_name = info->next_external_char;
+	char *result = NULL;
+	acpi_native_uint i;
 
+	ACPI_FUNCTION_TRACE("ns_build_internal_name");
 
 	/* Setup the correct prefixes, counts, and pointers */
 
@@ -422,18 +378,15 @@ acpi_ns_build_internal_name (
 
 		if (num_segments <= 1) {
 			result = &internal_name[1];
-		}
-		else if (num_segments == 2) {
+		} else if (num_segments == 2) {
 			internal_name[1] = AML_DUAL_NAME_PREFIX;
 			result = &internal_name[2];
-		}
-		else {
+		} else {
 			internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
-			internal_name[2] = (char) num_segments;
+			internal_name[2] = (char)num_segments;
 			result = &internal_name[3];
 		}
-	}
-	else {
+	} else {
 		/*
 		 * Not fully qualified.
 		 * Handle Carats first, then append the name segments
@@ -447,15 +400,14 @@ acpi_ns_build_internal_name (
 
 		if (num_segments <= 1) {
 			result = &internal_name[i];
-		}
-		else if (num_segments == 2) {
+		} else if (num_segments == 2) {
 			internal_name[i] = AML_DUAL_NAME_PREFIX;
-			result = &internal_name[(acpi_native_uint) (i+1)];
-		}
-		else {
+			result = &internal_name[(acpi_native_uint) (i + 1)];
+		} else {
 			internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
-			internal_name[(acpi_native_uint) (i+1)] = (char) num_segments;
-			result = &internal_name[(acpi_native_uint) (i+2)];
+			internal_name[(acpi_native_uint) (i + 1)] =
+			    (char)num_segments;
+			result = &internal_name[(acpi_native_uint) (i + 2)];
 		}
 	}
 
@@ -463,25 +415,25 @@ acpi_ns_build_internal_name (
 
 	for (; num_segments; num_segments--) {
 		for (i = 0; i < ACPI_NAME_SIZE; i++) {
-			if (acpi_ns_valid_path_separator (*external_name) ||
-			   (*external_name == 0)) {
+			if (acpi_ns_valid_path_separator(*external_name) ||
+			    (*external_name == 0)) {
 				/* Pad the segment with underscore(s) if segment is short */
 
 				result[i] = '_';
-			}
-			else {
+			} else {
 				/* Convert the character to uppercase and save it */
 
-				result[i] = (char) ACPI_TOUPPER ((int) *external_name);
+				result[i] =
+				    (char)ACPI_TOUPPER((int)*external_name);
 				external_name++;
 			}
 		}
 
 		/* Now we must have a path separator, or the pathname is bad */
 
-		if (!acpi_ns_valid_path_separator (*external_name) &&
-			(*external_name != 0)) {
-			return_ACPI_STATUS (AE_BAD_PARAMETER);
+		if (!acpi_ns_valid_path_separator(*external_name) &&
+		    (*external_name != 0)) {
+			return_ACPI_STATUS(AE_BAD_PARAMETER);
 		}
 
 		/* Move on the next segment */
@@ -495,18 +447,17 @@ acpi_ns_build_internal_name (
 	*result = 0;
 
 	if (info->fully_qualified) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
-			internal_name, internal_name));
-	}
-	else {
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
-			internal_name, internal_name));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Returning [%p] (abs) \"\\%s\"\n",
+				  internal_name, internal_name));
+	} else {
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
+				  internal_name, internal_name));
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_internalize_name
@@ -522,51 +473,43 @@ acpi_ns_build_internal_name (
  *
  *******************************************************************************/
 
-acpi_status
-acpi_ns_internalize_name (
-	char                            *external_name,
-	char                            **converted_name)
+acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
 {
-	char                            *internal_name;
-	struct acpi_namestring_info     info;
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ns_internalize_name");
+	char *internal_name;
+	struct acpi_namestring_info info;
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ns_internalize_name");
 
-	if ((!external_name)     ||
-		(*external_name == 0) ||
-		(!converted_name)) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	if ((!external_name) || (*external_name == 0) || (!converted_name)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/* Get the length of the new internal name */
 
 	info.external_name = external_name;
-	acpi_ns_get_internal_name_length (&info);
+	acpi_ns_get_internal_name_length(&info);
 
 	/* We need a segment to store the internal  name */
 
-	internal_name = ACPI_MEM_CALLOCATE (info.length);
+	internal_name = ACPI_MEM_CALLOCATE(info.length);
 	if (!internal_name) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Build the name */
 
 	info.internal_name = internal_name;
-	status = acpi_ns_build_internal_name (&info);
-	if (ACPI_FAILURE (status)) {
-		ACPI_MEM_FREE (internal_name);
-		return_ACPI_STATUS (status);
+	status = acpi_ns_build_internal_name(&info);
+	if (ACPI_FAILURE(status)) {
+		ACPI_MEM_FREE(internal_name);
+		return_ACPI_STATUS(status);
 	}
 
 	*converted_name = internal_name;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_externalize_name
@@ -585,27 +528,21 @@ acpi_ns_internalize_name (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_externalize_name (
-	u32                             internal_name_length,
-	char                            *internal_name,
-	u32                             *converted_name_length,
-	char                            **converted_name)
+acpi_ns_externalize_name(u32 internal_name_length,
+			 char *internal_name,
+			 u32 * converted_name_length, char **converted_name)
 {
-	acpi_native_uint                names_index = 0;
-	acpi_native_uint                num_segments = 0;
-	acpi_native_uint                required_length;
-	acpi_native_uint                prefix_length = 0;
-	acpi_native_uint                i = 0;
-	acpi_native_uint                j = 0;
-
+	acpi_native_uint names_index = 0;
+	acpi_native_uint num_segments = 0;
+	acpi_native_uint required_length;
+	acpi_native_uint prefix_length = 0;
+	acpi_native_uint i = 0;
+	acpi_native_uint j = 0;
 
-	ACPI_FUNCTION_TRACE ("ns_externalize_name");
+	ACPI_FUNCTION_TRACE("ns_externalize_name");
 
-
-	if (!internal_name_length   ||
-		!internal_name          ||
-		!converted_name) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	if (!internal_name_length || !internal_name || !converted_name) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
@@ -620,8 +557,7 @@ acpi_ns_externalize_name (
 		for (i = 0; i < internal_name_length; i++) {
 			if (internal_name[i] == '^') {
 				prefix_length = i + 1;
-			}
-			else {
+			} else {
 				break;
 			}
 		}
@@ -648,7 +584,8 @@ acpi_ns_externalize_name (
 
 			names_index = prefix_length + 2;
 			num_segments = (acpi_native_uint) (u8)
-					   internal_name[(acpi_native_uint) (prefix_length + 1)];
+			    internal_name[(acpi_native_uint)
+					  (prefix_length + 1)];
 			break;
 
 		case AML_DUAL_NAME_PREFIX:
@@ -683,23 +620,23 @@ acpi_ns_externalize_name (
 	 * punctuation ('.') between object names, plus the NULL terminator.
 	 */
 	required_length = prefix_length + (4 * num_segments) +
-			   ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
+	    ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
 
 	/*
 	 * Check to see if we're still in bounds.  If not, there's a problem
 	 * with internal_name (invalid format).
 	 */
 	if (required_length > internal_name_length) {
-		ACPI_REPORT_ERROR (("ns_externalize_name: Invalid internal name\n"));
-		return_ACPI_STATUS (AE_BAD_PATHNAME);
+		ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n"));
+		return_ACPI_STATUS(AE_BAD_PATHNAME);
 	}
 
 	/*
 	 * Build converted_name
 	 */
-	*converted_name = ACPI_MEM_CALLOCATE (required_length);
+	*converted_name = ACPI_MEM_CALLOCATE(required_length);
 	if (!(*converted_name)) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	j = 0;
@@ -725,10 +662,9 @@ acpi_ns_externalize_name (
 		*converted_name_length = (u32) required_length;
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_map_handle_to_node
@@ -745,13 +681,10 @@ acpi_ns_externalize_name (
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_map_handle_to_node (
-	acpi_handle                     handle)
+struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
 {
 
-	ACPI_FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * Simple implementation.
@@ -766,14 +699,13 @@ acpi_ns_map_handle_to_node (
 
 	/* We can at least attempt to verify the handle */
 
-	if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) {
+	if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) {
 		return (NULL);
 	}
 
-	return ((struct acpi_namespace_node *) handle);
+	return ((struct acpi_namespace_node *)handle);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_convert_entry_to_handle
@@ -786,18 +718,14 @@ acpi_ns_map_handle_to_node (
  *
  ******************************************************************************/
 
-acpi_handle
-acpi_ns_convert_entry_to_handle (
-	struct acpi_namespace_node          *node)
+acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
 {
 
-
 	/*
 	 * Simple implementation for now;
 	 */
 	return ((acpi_handle) node);
 
-
 /* Example future implementation ---------------------
 
 	if (!Node)
@@ -810,12 +738,10 @@ acpi_ns_convert_entry_to_handle (
 		return (ACPI_ROOT_OBJECT);
 	}
 
-
 	return ((acpi_handle) Node);
 ------------------------------------------------------*/
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_terminate
@@ -828,42 +754,37 @@ acpi_ns_convert_entry_to_handle (
  *
  ******************************************************************************/
 
-void
-acpi_ns_terminate (
-	void)
+void acpi_ns_terminate(void)
 {
-	union acpi_operand_object       *obj_desc;
-
-
-	ACPI_FUNCTION_TRACE ("ns_terminate");
+	union acpi_operand_object *obj_desc;
 
+	ACPI_FUNCTION_TRACE("ns_terminate");
 
 	/*
 	 * 1) Free the entire namespace -- all nodes and objects
 	 *
 	 * Delete all object descriptors attached to namepsace nodes
 	 */
-	acpi_ns_delete_namespace_subtree (acpi_gbl_root_node);
+	acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
 
 	/* Detach any objects attached to the root */
 
-	obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node);
+	obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
 	if (obj_desc) {
-		acpi_ns_detach_object (acpi_gbl_root_node);
+		acpi_ns_detach_object(acpi_gbl_root_node);
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
 
 	/*
 	 * 2) Now we can delete the ACPI tables
 	 */
-	acpi_tb_delete_all_tables ();
-	ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
+	acpi_tb_delete_all_tables();
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_opens_scope
@@ -875,24 +796,21 @@ acpi_ns_terminate (
  *
  ******************************************************************************/
 
-u32
-acpi_ns_opens_scope (
-	acpi_object_type                type)
+u32 acpi_ns_opens_scope(acpi_object_type type)
 {
-	ACPI_FUNCTION_TRACE_STR ("ns_opens_scope", acpi_ut_get_type_name (type));
-
+	ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
 
-	if (!acpi_ut_valid_object_type (type)) {
+	if (!acpi_ut_valid_object_type(type)) {
 		/* type code out of range  */
 
-		ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type));
-		return_VALUE (ACPI_NS_NORMAL);
+		ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
+				     type));
+		return_VALUE(ACPI_NS_NORMAL);
 	}
 
-	return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
+	return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_node_by_path
@@ -916,33 +834,29 @@ acpi_ns_opens_scope (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_get_node_by_path (
-	char                            *pathname,
-	struct acpi_namespace_node      *start_node,
-	u32                             flags,
-	struct acpi_namespace_node      **return_node)
+acpi_ns_get_node_by_path(char *pathname,
+			 struct acpi_namespace_node *start_node,
+			 u32 flags, struct acpi_namespace_node **return_node)
 {
-	union acpi_generic_state        scope_info;
-	acpi_status                     status;
-	char                            *internal_path = NULL;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname);
+	union acpi_generic_state scope_info;
+	acpi_status status;
+	char *internal_path = NULL;
 
+	ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
 
 	if (pathname) {
 		/* Convert path to internal representation */
 
-		status = acpi_ns_internalize_name (pathname, &internal_path);
-		if (ACPI_FAILURE (status)) {
-			return_ACPI_STATUS (status);
+		status = acpi_ns_internalize_name(pathname, &internal_path);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
 		}
 	}
 
 	/* Must lock namespace during lookup */
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
@@ -952,25 +866,25 @@ acpi_ns_get_node_by_path (
 
 	/* Lookup the name in the namespace */
 
-	status = acpi_ns_lookup (&scope_info, internal_path,
-			 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-			 (flags | ACPI_NS_DONT_OPEN_SCOPE),
-			 NULL, return_node);
-	if (ACPI_FAILURE (status)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
-				internal_path, acpi_format_exception (status)));
+	status = acpi_ns_lookup(&scope_info, internal_path,
+				ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+				(flags | ACPI_NS_DONT_OPEN_SCOPE),
+				NULL, return_node);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n",
+				  internal_path,
+				  acpi_format_exception(status)));
 	}
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-cleanup:
+      cleanup:
 	if (internal_path) {
-		ACPI_MEM_FREE (internal_path);
+		ACPI_MEM_FREE(internal_path);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_parent_node
@@ -983,12 +897,10 @@ cleanup:
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_get_parent_node (
-	struct acpi_namespace_node      *node)
+struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
+						    *node)
 {
-	ACPI_FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY();
 
 	if (!node) {
 		return (NULL);
@@ -1006,7 +918,6 @@ acpi_ns_get_parent_node (
 	return (node->peer);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_next_valid_node
@@ -1021,9 +932,9 @@ acpi_ns_get_parent_node (
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_get_next_valid_node (
-	struct acpi_namespace_node      *node)
+struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
+							acpi_namespace_node
+							*node)
 {
 
 	/* If we are at the end of this peer list, return NULL */
@@ -1037,7 +948,6 @@ acpi_ns_get_next_valid_node (
 	return (node->peer);
 }
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
@@ -1053,38 +963,36 @@ acpi_ns_get_next_valid_node (
  *
  ******************************************************************************/
 
-acpi_name
-acpi_ns_find_parent_name (
-	struct acpi_namespace_node      *child_node)
+acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
 {
-	struct acpi_namespace_node      *parent_node;
-
-
-	ACPI_FUNCTION_TRACE ("ns_find_parent_name");
+	struct acpi_namespace_node *parent_node;
 
+	ACPI_FUNCTION_TRACE("ns_find_parent_name");
 
 	if (child_node) {
 		/* Valid entry.  Get the parent Node */
 
-		parent_node = acpi_ns_get_parent_node (child_node);
+		parent_node = acpi_ns_get_parent_node(child_node);
 		if (parent_node) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-				"Parent of %p [%4.4s] is %p [%4.4s]\n",
-				child_node, acpi_ut_get_node_name (child_node),
-				parent_node, acpi_ut_get_node_name (parent_node)));
+			ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+					  "Parent of %p [%4.4s] is %p [%4.4s]\n",
+					  child_node,
+					  acpi_ut_get_node_name(child_node),
+					  parent_node,
+					  acpi_ut_get_node_name(parent_node)));
 
 			if (parent_node->name.integer) {
-				return_VALUE ((acpi_name) parent_node->name.integer);
+				return_VALUE((acpi_name) parent_node->name.
+					     integer);
 			}
 		}
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-			"Unable to find parent of %p (%4.4s)\n",
-			child_node, acpi_ut_get_node_name (child_node)));
+		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+				  "Unable to find parent of %p (%4.4s)\n",
+				  child_node,
+				  acpi_ut_get_node_name(child_node)));
 	}
 
-	return_VALUE (ACPI_UNKNOWN_NAME);
+	return_VALUE(ACPI_UNKNOWN_NAME);
 }
 #endif
-
-

+ 50 - 55
drivers/acpi/namespace/nswalk.c

@@ -41,14 +41,11 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nswalk")
-
+ACPI_MODULE_NAME("nswalk")
 
 /*******************************************************************************
  *
@@ -68,18 +65,15 @@
  *              within Scope is returned.
  *
  ******************************************************************************/
-
-struct acpi_namespace_node *
-acpi_ns_get_next_node (
-	acpi_object_type                type,
-	struct acpi_namespace_node      *parent_node,
-	struct acpi_namespace_node      *child_node)
+struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
+						  struct acpi_namespace_node
+						  *parent_node,
+						  struct acpi_namespace_node
+						  *child_node)
 {
-	struct acpi_namespace_node      *next_node = NULL;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	struct acpi_namespace_node *next_node = NULL;
 
+	ACPI_FUNCTION_ENTRY();
 
 	if (!child_node) {
 		/* It's really the parent's _scope_ that we want */
@@ -92,7 +86,7 @@ acpi_ns_get_next_node (
 	else {
 		/* Start search at the NEXT node */
 
-		next_node = acpi_ns_get_next_valid_node (child_node);
+		next_node = acpi_ns_get_next_valid_node(child_node);
 	}
 
 	/* If any type is OK, we are done */
@@ -114,7 +108,7 @@ acpi_ns_get_next_node (
 
 		/* Otherwise, move on to the next node */
 
-		next_node = acpi_ns_get_next_valid_node (next_node);
+		next_node = acpi_ns_get_next_valid_node(next_node);
 	}
 
 	/* Not found */
@@ -122,7 +116,6 @@ acpi_ns_get_next_node (
 	return (NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_walk_namespace
@@ -154,25 +147,21 @@ acpi_ns_get_next_node (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_walk_namespace (
-	acpi_object_type                type,
-	acpi_handle                     start_node,
-	u32                             max_depth,
-	u8                              unlock_before_callback,
-	acpi_walk_callback              user_function,
-	void                            *context,
-	void                            **return_value)
+acpi_ns_walk_namespace(acpi_object_type type,
+		       acpi_handle start_node,
+		       u32 max_depth,
+		       u8 unlock_before_callback,
+		       acpi_walk_callback user_function,
+		       void *context, void **return_value)
 {
-	acpi_status                     status;
-	acpi_status                     mutex_status;
-	struct acpi_namespace_node      *child_node;
-	struct acpi_namespace_node      *parent_node;
-	acpi_object_type                child_type;
-	u32                             level;
-
-
-	ACPI_FUNCTION_TRACE ("ns_walk_namespace");
+	acpi_status status;
+	acpi_status mutex_status;
+	struct acpi_namespace_node *child_node;
+	struct acpi_namespace_node *parent_node;
+	acpi_object_type child_type;
+	u32 level;
 
+	ACPI_FUNCTION_TRACE("ns_walk_namespace");
 
 	/* Special case for the namespace Root Node */
 
@@ -183,9 +172,9 @@ acpi_ns_walk_namespace (
 	/* Null child means "get first node" */
 
 	parent_node = start_node;
-	child_node  = NULL;
-	child_type  = ACPI_TYPE_ANY;
-	level       = 1;
+	child_node = NULL;
+	child_type = ACPI_TYPE_ANY;
+	level = 1;
 
 	/*
 	 * Traverse the tree of nodes until we bubble back up to where we
@@ -196,7 +185,9 @@ acpi_ns_walk_namespace (
 		/* Get the next node in this scope.  Null if not found */
 
 		status = AE_OK;
-		child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
+		child_node =
+		    acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+					  child_node);
 		if (child_node) {
 			/*
 			 * Found node, Get the type if we are not
@@ -212,19 +203,25 @@ acpi_ns_walk_namespace (
 				 * callback function
 				 */
 				if (unlock_before_callback) {
-					mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-					if (ACPI_FAILURE (mutex_status)) {
-						return_ACPI_STATUS (mutex_status);
+					mutex_status =
+					    acpi_ut_release_mutex
+					    (ACPI_MTX_NAMESPACE);
+					if (ACPI_FAILURE(mutex_status)) {
+						return_ACPI_STATUS
+						    (mutex_status);
 					}
 				}
 
-				status = user_function (child_node, level,
-						 context, return_value);
+				status = user_function(child_node, level,
+						       context, return_value);
 
 				if (unlock_before_callback) {
-					mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-					if (ACPI_FAILURE (mutex_status)) {
-						return_ACPI_STATUS (mutex_status);
+					mutex_status =
+					    acpi_ut_acquire_mutex
+					    (ACPI_MTX_NAMESPACE);
+					if (ACPI_FAILURE(mutex_status)) {
+						return_ACPI_STATUS
+						    (mutex_status);
 					}
 				}
 
@@ -239,13 +236,13 @@ acpi_ns_walk_namespace (
 
 					/* Exit now, with OK status */
 
-					return_ACPI_STATUS (AE_OK);
+					return_ACPI_STATUS(AE_OK);
 
 				default:
 
 					/* All others are valid exceptions */
 
-					return_ACPI_STATUS (status);
+					return_ACPI_STATUS(status);
 				}
 			}
 
@@ -258,7 +255,8 @@ acpi_ns_walk_namespace (
 			 * maximum depth has been reached.
 			 */
 			if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
-				if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+				if (acpi_ns_get_next_node
+				    (ACPI_TYPE_ANY, child_node, NULL)) {
 					/*
 					 * There is at least one child of this
 					 * node, visit the onde
@@ -268,8 +266,7 @@ acpi_ns_walk_namespace (
 					child_node = NULL;
 				}
 			}
-		}
-		else {
+		} else {
 			/*
 			 * No more children of this node (acpi_ns_get_next_node
 			 * failed), go back upwards in the namespace tree to
@@ -277,13 +274,11 @@ acpi_ns_walk_namespace (
 			 */
 			level--;
 			child_node = parent_node;
-			parent_node = acpi_ns_get_parent_node (parent_node);
+			parent_node = acpi_ns_get_parent_node(parent_node);
 		}
 	}
 
 	/* Complete walk, not terminated by user function */
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
-
-

+ 196 - 234
drivers/acpi/namespace/nsxfeval.c

@@ -48,10 +48,8 @@
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsxfeval")
-
+ACPI_MODULE_NAME("nsxfeval")
 
 /*******************************************************************************
  *
@@ -73,27 +71,23 @@
  *              be valid (non-null)
  *
  ******************************************************************************/
-
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_evaluate_object_typed (
-	acpi_handle                     handle,
-	acpi_string                     pathname,
-	struct acpi_object_list         *external_params,
-	struct acpi_buffer              *return_buffer,
-	acpi_object_type                return_type)
+acpi_evaluate_object_typed(acpi_handle handle,
+			   acpi_string pathname,
+			   struct acpi_object_list *external_params,
+			   struct acpi_buffer *return_buffer,
+			   acpi_object_type return_type)
 {
-	acpi_status                     status;
-	u8                              must_free = FALSE;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_evaluate_object_typed");
+	acpi_status status;
+	u8 must_free = FALSE;
 
+	ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed");
 
 	/* Return buffer must be valid */
 
 	if (!return_buffer) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
@@ -102,51 +96,52 @@ acpi_evaluate_object_typed (
 
 	/* Evaluate the object */
 
-	status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_evaluate_object(handle, pathname, external_params,
+				 return_buffer);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/* Type ANY means "don't care" */
 
 	if (return_type == ACPI_TYPE_ANY) {
-		return_ACPI_STATUS (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	if (return_buffer->length == 0) {
 		/* Error because caller specifically asked for a return value */
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-			"No return value\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n"));
 
-		return_ACPI_STATUS (AE_NULL_OBJECT);
+		return_ACPI_STATUS(AE_NULL_OBJECT);
 	}
 
 	/* Examine the object type returned from evaluate_object */
 
-	if (((union acpi_object *) return_buffer->pointer)->type == return_type) {
-		return_ACPI_STATUS (AE_OK);
+	if (((union acpi_object *)return_buffer->pointer)->type == return_type) {
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Return object type does not match requested type */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-		"Incorrect return type [%s] requested [%s]\n",
-		acpi_ut_get_type_name (((union acpi_object *) return_buffer->pointer)->type),
-		acpi_ut_get_type_name (return_type)));
+	ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			  "Incorrect return type [%s] requested [%s]\n",
+			  acpi_ut_get_type_name(((union acpi_object *)
+						 return_buffer->pointer)->type),
+			  acpi_ut_get_type_name(return_type)));
 
 	if (must_free) {
 		/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
 
-		acpi_os_free (return_buffer->pointer);
+		acpi_os_free(return_buffer->pointer);
 		return_buffer->pointer = NULL;
 	}
 
 	return_buffer->length = 0;
-	return_ACPI_STATUS (AE_TYPE);
+	return_ACPI_STATUS(AE_TYPE);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif				/*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -169,21 +164,18 @@ acpi_evaluate_object_typed (
  ******************************************************************************/
 
 acpi_status
-acpi_evaluate_object (
-	acpi_handle                     handle,
-	acpi_string                     pathname,
-	struct acpi_object_list         *external_params,
-	struct acpi_buffer              *return_buffer)
+acpi_evaluate_object(acpi_handle handle,
+		     acpi_string pathname,
+		     struct acpi_object_list *external_params,
+		     struct acpi_buffer *return_buffer)
 {
-	acpi_status                     status;
-	acpi_status                     status2;
-	struct acpi_parameter_info      info;
-	acpi_size                       buffer_space_needed;
-	u32                             i;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_evaluate_object");
+	acpi_status status;
+	acpi_status status2;
+	struct acpi_parameter_info info;
+	acpi_size buffer_space_needed;
+	u32 i;
 
+	ACPI_FUNCTION_TRACE("acpi_evaluate_object");
 
 	info.node = handle;
 	info.parameters = NULL;
@@ -200,11 +192,11 @@ acpi_evaluate_object (
 		 * Allocate a new parameter block for the internal objects
 		 * Add 1 to count to allow for null terminated internal list
 		 */
-		info.parameters = ACPI_MEM_CALLOCATE (
-				 ((acpi_size) external_params->count + 1) *
-				 sizeof (void *));
+		info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
+						      external_params->count +
+						      1) * sizeof(void *));
 		if (!info.parameters) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
 		/*
@@ -212,48 +204,47 @@ acpi_evaluate_object (
 		 * internal object
 		 */
 		for (i = 0; i < external_params->count; i++) {
-			status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
-					  &info.parameters[i]);
-			if (ACPI_FAILURE (status)) {
-				acpi_ut_delete_internal_object_list (info.parameters);
-				return_ACPI_STATUS (status);
+			status =
+			    acpi_ut_copy_eobject_to_iobject(&external_params->
+							    pointer[i],
+							    &info.
+							    parameters[i]);
+			if (ACPI_FAILURE(status)) {
+				acpi_ut_delete_internal_object_list(info.
+								    parameters);
+				return_ACPI_STATUS(status);
 			}
 		}
 		info.parameters[external_params->count] = NULL;
 	}
 
-
 	/*
 	 * Three major cases:
 	 * 1) Fully qualified pathname
 	 * 2) No handle, not fully qualified pathname (error)
 	 * 3) Valid handle
 	 */
-	if ((pathname) &&
-		(acpi_ns_valid_root_prefix (pathname[0]))) {
+	if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
 		/*
 		 *  The path is fully qualified, just evaluate by name
 		 */
-		status = acpi_ns_evaluate_by_name (pathname, &info);
-	}
-	else if (!handle) {
+		status = acpi_ns_evaluate_by_name(pathname, &info);
+	} else if (!handle) {
 		/*
 		 * A handle is optional iff a fully qualified pathname
 		 * is specified.  Since we've already handled fully
 		 * qualified names above, this is an error
 		 */
 		if (!pathname) {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Both Handle and Pathname are NULL\n"));
-		}
-		else {
-			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-				"Handle is NULL and Pathname is relative\n"));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Both Handle and Pathname are NULL\n"));
+		} else {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Handle is NULL and Pathname is relative\n"));
 		}
 
 		status = AE_BAD_PARAMETER;
-	}
-	else {
+	} else {
 		/*
 		 * We get here if we have a handle -- and if we have a
 		 * pathname it is relative.  The handle will be validated
@@ -264,17 +255,15 @@ acpi_evaluate_object (
 			 * The null pathname case means the handle is for
 			 * the actual object to be evaluated
 			 */
-			status = acpi_ns_evaluate_by_handle (&info);
-		}
-		else {
-		   /*
-			* Both a Handle and a relative Pathname
-			*/
-			status = acpi_ns_evaluate_relative (pathname, &info);
+			status = acpi_ns_evaluate_by_handle(&info);
+		} else {
+			/*
+			 * Both a Handle and a relative Pathname
+			 */
+			status = acpi_ns_evaluate_relative(pathname, &info);
 		}
 	}
 
-
 	/*
 	 * If we are expecting a return value, and all went well above,
 	 * copy the return value to an external object.
@@ -282,9 +271,9 @@ acpi_evaluate_object (
 	if (return_buffer) {
 		if (!info.return_object) {
 			return_buffer->length = 0;
-		}
-		else {
-			if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) {
+		} else {
+			if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
+			    ACPI_DESC_TYPE_NAMED) {
 				/*
 				 * If we received a NS Node as a return object, this means that
 				 * the object we are evaluating has nothing interesting to
@@ -294,37 +283,43 @@ acpi_evaluate_object (
 				 * support for various types at a later date if necessary.
 				 */
 				status = AE_TYPE;
-				info.return_object = NULL;  /* No need to delete a NS Node */
+				info.return_object = NULL;	/* No need to delete a NS Node */
 				return_buffer->length = 0;
 			}
 
-			if (ACPI_SUCCESS (status)) {
+			if (ACPI_SUCCESS(status)) {
 				/*
 				 * Find out how large a buffer is needed
 				 * to contain the returned object
 				 */
-				status = acpi_ut_get_object_size (info.return_object,
-						   &buffer_space_needed);
-				if (ACPI_SUCCESS (status)) {
+				status =
+				    acpi_ut_get_object_size(info.return_object,
+							    &buffer_space_needed);
+				if (ACPI_SUCCESS(status)) {
 					/* Validate/Allocate/Clear caller buffer */
 
-					status = acpi_ut_initialize_buffer (return_buffer,
-							  buffer_space_needed);
-					if (ACPI_FAILURE (status)) {
+					status =
+					    acpi_ut_initialize_buffer
+					    (return_buffer,
+					     buffer_space_needed);
+					if (ACPI_FAILURE(status)) {
 						/*
 						 * Caller's buffer is too small or a new one can't be allocated
 						 */
-						ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-							"Needed buffer size %X, %s\n",
-							(u32) buffer_space_needed,
-							acpi_format_exception (status)));
-					}
-					else {
+						ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+								  "Needed buffer size %X, %s\n",
+								  (u32)
+								  buffer_space_needed,
+								  acpi_format_exception
+								  (status)));
+					} else {
 						/*
 						 *  We have enough space for the object, build it
 						 */
-						status = acpi_ut_copy_iobject_to_eobject (info.return_object,
-								  return_buffer);
+						status =
+						    acpi_ut_copy_iobject_to_eobject
+						    (info.return_object,
+						     return_buffer);
 					}
 				}
 			}
@@ -336,14 +331,14 @@ acpi_evaluate_object (
 		 * Delete the internal return object.  NOTE: Interpreter
 		 * must be locked to avoid race condition.
 		 */
-		status2 = acpi_ex_enter_interpreter ();
-		if (ACPI_SUCCESS (status2)) {
+		status2 = acpi_ex_enter_interpreter();
+		if (ACPI_SUCCESS(status2)) {
 			/*
 			 * Delete the internal return object. (Or at least
 			 * decrement the reference count by one)
 			 */
-			acpi_ut_remove_reference (info.return_object);
-			acpi_ex_exit_interpreter ();
+			acpi_ut_remove_reference(info.return_object);
+			acpi_ex_exit_interpreter();
 		}
 	}
 
@@ -353,13 +348,13 @@ acpi_evaluate_object (
 	if (info.parameters) {
 		/* Free the allocated parameter block */
 
-		acpi_ut_delete_internal_object_list (info.parameters);
+		acpi_ut_delete_internal_object_list(info.parameters);
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_evaluate_object);
 
+EXPORT_SYMBOL(acpi_evaluate_object);
 
 /*******************************************************************************
  *
@@ -392,26 +387,20 @@ EXPORT_SYMBOL(acpi_evaluate_object);
  ******************************************************************************/
 
 acpi_status
-acpi_walk_namespace (
-	acpi_object_type                type,
-	acpi_handle                     start_object,
-	u32                             max_depth,
-	acpi_walk_callback              user_function,
-	void                            *context,
-	void                            **return_value)
+acpi_walk_namespace(acpi_object_type type,
+		    acpi_handle start_object,
+		    u32 max_depth,
+		    acpi_walk_callback user_function,
+		    void *context, void **return_value)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_walk_namespace");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("acpi_walk_namespace");
 
 	/* Parameter validation */
 
-	if ((type > ACPI_TYPE_EXTERNAL_MAX) ||
-		(!max_depth)                    ||
-		(!user_function)) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+	if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
@@ -420,20 +409,20 @@ acpi_walk_namespace (
 	 * to the user function - since this function
 	 * must be allowed to make Acpi calls itself.
 	 */
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ns_walk_namespace (type, start_object, max_depth,
-			  ACPI_NS_WALK_UNLOCK,
-			  user_function, context, return_value);
+	status = acpi_ns_walk_namespace(type, start_object, max_depth,
+					ACPI_NS_WALK_UNLOCK,
+					user_function, context, return_value);
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_walk_namespace);
 
+EXPORT_SYMBOL(acpi_walk_namespace);
 
 /*******************************************************************************
  *
@@ -450,29 +439,26 @@ EXPORT_SYMBOL(acpi_walk_namespace);
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_get_device_callback (
-	acpi_handle                     obj_handle,
-	u32                             nesting_level,
-	void                            *context,
-	void                            **return_value)
+acpi_ns_get_device_callback(acpi_handle obj_handle,
+			    u32 nesting_level,
+			    void *context, void **return_value)
 {
-	struct acpi_get_devices_info    *info = context;
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	u32                             flags;
-	struct acpi_device_id           hid;
+	struct acpi_get_devices_info *info = context;
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	u32 flags;
+	struct acpi_device_id hid;
 	struct acpi_compatible_id_list *cid;
-	acpi_native_uint                i;
-
+	acpi_native_uint i;
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
-	node = acpi_ns_map_handle_to_node (obj_handle);
-	status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	node = acpi_ns_map_handle_to_node(obj_handle);
+	status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
@@ -482,8 +468,8 @@ acpi_ns_get_device_callback (
 
 	/* Run _STA to determine if device is present */
 
-	status = acpi_ut_execute_STA (node, &flags);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_execute_STA(node, &flags);
+	if (ACPI_FAILURE(status)) {
 		return (AE_CTRL_DEPTH);
 	}
 
@@ -496,44 +482,43 @@ acpi_ns_get_device_callback (
 	/* Filter based on device HID & CID */
 
 	if (info->hid != NULL) {
-		status = acpi_ut_execute_HID (node, &hid);
+		status = acpi_ut_execute_HID(node, &hid);
 		if (status == AE_NOT_FOUND) {
 			return (AE_OK);
-		}
-		else if (ACPI_FAILURE (status)) {
+		} else if (ACPI_FAILURE(status)) {
 			return (AE_CTRL_DEPTH);
 		}
 
-		if (ACPI_STRNCMP (hid.value, info->hid, sizeof (hid.value)) != 0) {
+		if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
 			/* Get the list of Compatible IDs */
 
-			status = acpi_ut_execute_CID (node, &cid);
+			status = acpi_ut_execute_CID(node, &cid);
 			if (status == AE_NOT_FOUND) {
 				return (AE_OK);
-			}
-			else if (ACPI_FAILURE (status)) {
+			} else if (ACPI_FAILURE(status)) {
 				return (AE_CTRL_DEPTH);
 			}
 
 			/* Walk the CID list */
 
 			for (i = 0; i < cid->count; i++) {
-				if (ACPI_STRNCMP (cid->id[i].value, info->hid,
-						 sizeof (struct acpi_compatible_id)) != 0) {
-					ACPI_MEM_FREE (cid);
+				if (ACPI_STRNCMP(cid->id[i].value, info->hid,
+						 sizeof(struct
+							acpi_compatible_id)) !=
+				    0) {
+					ACPI_MEM_FREE(cid);
 					return (AE_OK);
 				}
 			}
-			ACPI_MEM_FREE (cid);
+			ACPI_MEM_FREE(cid);
 		}
 	}
 
-	status = info->user_function (obj_handle, nesting_level, info->context,
-			 return_value);
+	status = info->user_function(obj_handle, nesting_level, info->context,
+				     return_value);
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_devices
@@ -560,32 +545,28 @@ acpi_ns_get_device_callback (
  ******************************************************************************/
 
 acpi_status
-acpi_get_devices (
-	char                            *HID,
-	acpi_walk_callback              user_function,
-	void                            *context,
-	void                            **return_value)
+acpi_get_devices(char *HID,
+		 acpi_walk_callback user_function,
+		 void *context, void **return_value)
 {
-	acpi_status                     status;
-	struct acpi_get_devices_info    info;
-
-
-	ACPI_FUNCTION_TRACE ("acpi_get_devices");
+	acpi_status status;
+	struct acpi_get_devices_info info;
 
+	ACPI_FUNCTION_TRACE("acpi_get_devices");
 
 	/* Parameter validation */
 
 	if (!user_function) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	/*
 	 * We're going to call their callback from OUR callback, so we need
 	 * to know what it is, and their context parameter.
 	 */
-	info.context      = context;
+	info.context = context;
 	info.user_function = user_function;
-	info.hid          = HID;
+	info.hid = HID;
 
 	/*
 	 * Lock the namespace around the walk.
@@ -593,22 +574,22 @@ acpi_get_devices (
 	 * to the user function - since this function
 	 * must be allowed to make Acpi calls itself.
 	 */
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
-			   ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-			   ACPI_NS_WALK_UNLOCK,
-			   acpi_ns_get_device_callback, &info,
-			   return_value);
+	status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE,
+					ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+					ACPI_NS_WALK_UNLOCK,
+					acpi_ns_get_device_callback, &info,
+					return_value);
 
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	return_ACPI_STATUS (status);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_devices);
 
+EXPORT_SYMBOL(acpi_get_devices);
 
 /*******************************************************************************
  *
@@ -625,44 +606,38 @@ EXPORT_SYMBOL(acpi_get_devices);
  ******************************************************************************/
 
 acpi_status
-acpi_attach_data (
-	acpi_handle                     obj_handle,
-	acpi_object_handler             handler,
-	void                            *data)
+acpi_attach_data(acpi_handle obj_handle,
+		 acpi_object_handler handler, void *data)
 {
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
 	/* Parameter validation */
 
-	if (!obj_handle ||
-		!handler    ||
-		!data) {
+	if (!obj_handle || !handler || !data) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
 	/* Convert and validate the handle */
 
-	node = acpi_ns_map_handle_to_node (obj_handle);
+	node = acpi_ns_map_handle_to_node(obj_handle);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
 
-	status = acpi_ns_attach_data (node, handler, data);
+	status = acpi_ns_attach_data(node, handler, data);
 
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_detach_data
@@ -677,42 +652,37 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_detach_data (
-	acpi_handle                     obj_handle,
-	acpi_object_handler             handler)
+acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
 {
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
 	/* Parameter validation */
 
-	if (!obj_handle ||
-		!handler) {
+	if (!obj_handle || !handler) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
 	/* Convert and validate the handle */
 
-	node = acpi_ns_map_handle_to_node (obj_handle);
+	node = acpi_ns_map_handle_to_node(obj_handle);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
 
-	status = acpi_ns_detach_data (node, handler);
+	status = acpi_ns_detach_data(node, handler);
 
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_data
@@ -728,41 +698,33 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_get_data (
-	acpi_handle                     obj_handle,
-	acpi_object_handler             handler,
-	void                            **data)
+acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
 {
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
 	/* Parameter validation */
 
-	if (!obj_handle ||
-		!handler    ||
-		!data) {
+	if (!obj_handle || !handler || !data) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
 	/* Convert and validate the handle */
 
-	node = acpi_ns_map_handle_to_node (obj_handle);
+	node = acpi_ns_map_handle_to_node(obj_handle);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
 
-	status = acpi_ns_get_attached_data (node, handler, data);
+	status = acpi_ns_get_attached_data(node, handler, data);
 
-unlock_and_exit:
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 	return (status);
 }
-
-

+ 80 - 93
drivers/acpi/namespace/nsxfname.c

@@ -47,10 +47,8 @@
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsxfname")
-
+ACPI_MODULE_NAME("nsxfname")
 
 /******************************************************************************
  *
@@ -69,20 +67,15 @@
  *              namespace handle.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_get_handle (
-	acpi_handle                     parent,
-	acpi_string                     pathname,
-	acpi_handle                     *ret_handle)
+acpi_get_handle(acpi_handle parent,
+		acpi_string pathname, acpi_handle * ret_handle)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node = NULL;
-	struct acpi_namespace_node      *prefix_node = NULL;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	acpi_status status;
+	struct acpi_namespace_node *node = NULL;
+	struct acpi_namespace_node *prefix_node = NULL;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/* Parameter Validation */
 
@@ -93,45 +86,47 @@ acpi_get_handle (
 	/* Convert a parent handle to a prefix node */
 
 	if (parent) {
-		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
 
-		prefix_node = acpi_ns_map_handle_to_node (parent);
+		prefix_node = acpi_ns_map_handle_to_node(parent);
 		if (!prefix_node) {
-			(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+			(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 			return (AE_BAD_PARAMETER);
 		}
 
-		status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-		if (ACPI_FAILURE (status)) {
+		status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
 	}
 
 	/* Special case for root, since we can't search for it */
 
-	if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) {
-		*ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node);
+	if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) {
+		*ret_handle =
+		    acpi_ns_convert_entry_to_handle(acpi_gbl_root_node);
 		return (AE_OK);
 	}
 
 	/*
 	 *  Find the Node and convert to a handle
 	 */
-	status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
-			  &node);
+	status =
+	    acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
+				     &node);
 
 	*ret_handle = NULL;
-	if (ACPI_SUCCESS (status)) {
-		*ret_handle = acpi_ns_convert_entry_to_handle (node);
+	if (ACPI_SUCCESS(status)) {
+		*ret_handle = acpi_ns_convert_entry_to_handle(node);
 	}
 
 	return (status);
 }
-EXPORT_SYMBOL(acpi_get_handle);
 
+EXPORT_SYMBOL(acpi_get_handle);
 
 /******************************************************************************
  *
@@ -150,14 +145,10 @@ EXPORT_SYMBOL(acpi_get_handle);
  ******************************************************************************/
 
 acpi_status
-acpi_get_name (
-	acpi_handle                     handle,
-	u32                             name_type,
-	struct acpi_buffer              *buffer)
+acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-
+	acpi_status status;
+	struct acpi_namespace_node *node;
 
 	/* Parameter validation */
 
@@ -165,15 +156,15 @@ acpi_get_name (
 		return (AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_validate_buffer (buffer);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_validate_buffer(buffer);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
 	if (name_type == ACPI_FULL_PATHNAME) {
 		/* Get the full pathname (From the namespace root) */
 
-		status = acpi_ns_handle_to_pathname (handle, buffer);
+		status = acpi_ns_handle_to_pathname(handle, buffer);
 		return (status);
 	}
 
@@ -181,12 +172,12 @@ acpi_get_name (
 	 * Wants the single segment ACPI name.
 	 * Validate handle and convert to a namespace Node
 	 */
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
-	node = acpi_ns_map_handle_to_node (handle);
+	node = acpi_ns_map_handle_to_node(handle);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -194,26 +185,25 @@ acpi_get_name (
 
 	/* Validate/Allocate/Clear caller buffer */
 
-	status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
+	if (ACPI_FAILURE(status)) {
 		goto unlock_and_exit;
 	}
 
 	/* Just copy the ACPI name from the Node and zero terminate it */
 
-	ACPI_STRNCPY (buffer->pointer, acpi_ut_get_node_name (node),
-			 ACPI_NAME_SIZE);
-	((char *) buffer->pointer) [ACPI_NAME_SIZE] = 0;
+	ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
+		     ACPI_NAME_SIZE);
+	((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
 	status = AE_OK;
 
+      unlock_and_exit:
 
-unlock_and_exit:
-
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 	return (status);
 }
-EXPORT_SYMBOL(acpi_get_name);
 
+EXPORT_SYMBOL(acpi_get_name);
 
 /******************************************************************************
  *
@@ -231,17 +221,14 @@ EXPORT_SYMBOL(acpi_get_name);
  ******************************************************************************/
 
 acpi_status
-acpi_get_object_info (
-	acpi_handle                     handle,
-	struct acpi_buffer              *buffer)
+acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	struct acpi_device_info         *info;
-	struct acpi_device_info         *return_info;
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	struct acpi_device_info *info;
+	struct acpi_device_info *return_info;
 	struct acpi_compatible_id_list *cid_list = NULL;
-	acpi_size                       size;
-
+	acpi_size size;
 
 	/* Parameter validation */
 
@@ -249,37 +236,37 @@ acpi_get_object_info (
 		return (AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_validate_buffer (buffer);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_validate_buffer(buffer);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
-	info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_device_info));
+	info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info));
 	if (!info) {
 		return (AE_NO_MEMORY);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
-	node = acpi_ns_map_handle_to_node (handle);
+	node = acpi_ns_map_handle_to_node(handle);
 	if (!node) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 		goto cleanup;
 	}
 
 	/* Init return structure */
 
-	size = sizeof (struct acpi_device_info);
+	size = sizeof(struct acpi_device_info);
 
-	info->type  = node->type;
-	info->name  = node->name.integer;
+	info->type = node->type;
+	info->name = node->name.integer;
 	info->valid = 0;
 
-	status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
@@ -297,73 +284,73 @@ acpi_get_object_info (
 
 		/* Execute the Device._HID method */
 
-		status = acpi_ut_execute_HID (node, &info->hardware_id);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ut_execute_HID(node, &info->hardware_id);
+		if (ACPI_SUCCESS(status)) {
 			info->valid |= ACPI_VALID_HID;
 		}
 
 		/* Execute the Device._UID method */
 
-		status = acpi_ut_execute_UID (node, &info->unique_id);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ut_execute_UID(node, &info->unique_id);
+		if (ACPI_SUCCESS(status)) {
 			info->valid |= ACPI_VALID_UID;
 		}
 
 		/* Execute the Device._CID method */
 
-		status = acpi_ut_execute_CID (node, &cid_list);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ut_execute_CID(node, &cid_list);
+		if (ACPI_SUCCESS(status)) {
 			size += ((acpi_size) cid_list->count - 1) *
-					 sizeof (struct acpi_compatible_id);
+			    sizeof(struct acpi_compatible_id);
 			info->valid |= ACPI_VALID_CID;
 		}
 
 		/* Execute the Device._STA method */
 
-		status = acpi_ut_execute_STA (node, &info->current_status);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ut_execute_STA(node, &info->current_status);
+		if (ACPI_SUCCESS(status)) {
 			info->valid |= ACPI_VALID_STA;
 		}
 
 		/* Execute the Device._ADR method */
 
-		status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node,
-				  &info->address);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node,
+							 &info->address);
+		if (ACPI_SUCCESS(status)) {
 			info->valid |= ACPI_VALID_ADR;
 		}
 
 		/* Execute the Device._sx_d methods */
 
-		status = acpi_ut_execute_sxds (node, info->highest_dstates);
-		if (ACPI_SUCCESS (status)) {
+		status = acpi_ut_execute_sxds(node, info->highest_dstates);
+		if (ACPI_SUCCESS(status)) {
 			info->valid |= ACPI_VALID_SXDS;
 		}
 	}
 
 	/* Validate/Allocate/Clear caller buffer */
 
-	status = acpi_ut_initialize_buffer (buffer, size);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_initialize_buffer(buffer, size);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/* Populate the return buffer */
 
 	return_info = buffer->pointer;
-	ACPI_MEMCPY (return_info, info, sizeof (struct acpi_device_info));
+	ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info));
 
 	if (cid_list) {
-		ACPI_MEMCPY (&return_info->compatibility_id, cid_list, cid_list->size);
+		ACPI_MEMCPY(&return_info->compatibility_id, cid_list,
+			    cid_list->size);
 	}
 
-
-cleanup:
-	ACPI_MEM_FREE (info);
+      cleanup:
+	ACPI_MEM_FREE(info);
 	if (cid_list) {
-		ACPI_MEM_FREE (cid_list);
+		ACPI_MEM_FREE(cid_list);
 	}
 	return (status);
 }
-EXPORT_SYMBOL(acpi_get_object_info);
 
+EXPORT_SYMBOL(acpi_get_object_info);

+ 37 - 54
drivers/acpi/namespace/nsxfobj.c

@@ -47,9 +47,8 @@
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-	 ACPI_MODULE_NAME    ("nsxfobj")
+ACPI_MODULE_NAME("nsxfobj")
 
 /*******************************************************************************
  *
@@ -63,15 +62,10 @@
  * DESCRIPTION: This routine returns the type associatd with a particular handle
  *
  ******************************************************************************/
-
-acpi_status
-acpi_get_type (
-	acpi_handle                     handle,
-	acpi_object_type                *ret_type)
+acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
 {
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
 	/* Parameter Validation */
 
@@ -88,27 +82,26 @@ acpi_get_type (
 		return (AE_OK);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
 	/* Convert and validate the handle */
 
-	node = acpi_ns_map_handle_to_node (handle);
+	node = acpi_ns_map_handle_to_node(handle);
 	if (!node) {
-		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 		return (AE_BAD_PARAMETER);
 	}
 
 	*ret_type = node->type;
 
-
-	status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 	return (status);
 }
-EXPORT_SYMBOL(acpi_get_type);
 
+EXPORT_SYMBOL(acpi_get_type);
 
 /*******************************************************************************
  *
@@ -124,14 +117,10 @@ EXPORT_SYMBOL(acpi_get_type);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_parent (
-	acpi_handle                     handle,
-	acpi_handle                     *ret_handle)
+acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
 {
-	struct acpi_namespace_node      *node;
-	acpi_status                     status;
-
+	struct acpi_namespace_node *node;
+	acpi_status status;
 
 	if (!ret_handle) {
 		return (AE_BAD_PARAMETER);
@@ -143,14 +132,14 @@ acpi_get_parent (
 		return (AE_NULL_ENTRY);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
 	/* Convert and validate the handle */
 
-	node = acpi_ns_map_handle_to_node (handle);
+	node = acpi_ns_map_handle_to_node(handle);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
@@ -159,22 +148,21 @@ acpi_get_parent (
 	/* Get the parent entry */
 
 	*ret_handle =
-		acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node));
+	    acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node));
 
 	/* Return exception if parent is null */
 
-	if (!acpi_ns_get_parent_node (node)) {
+	if (!acpi_ns_get_parent_node(node)) {
 		status = AE_NULL_ENTRY;
 	}
 
+      unlock_and_exit:
 
-unlock_and_exit:
-
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 	return (status);
 }
-EXPORT_SYMBOL(acpi_get_parent);
 
+EXPORT_SYMBOL(acpi_get_parent);
 
 /*******************************************************************************
  *
@@ -195,17 +183,14 @@ EXPORT_SYMBOL(acpi_get_parent);
  ******************************************************************************/
 
 acpi_status
-acpi_get_next_object (
-	acpi_object_type                type,
-	acpi_handle                     parent,
-	acpi_handle                     child,
-	acpi_handle                     *ret_handle)
+acpi_get_next_object(acpi_object_type type,
+		     acpi_handle parent,
+		     acpi_handle child, acpi_handle * ret_handle)
 {
-	acpi_status                     status;
-	struct acpi_namespace_node      *node;
-	struct acpi_namespace_node      *parent_node = NULL;
-	struct acpi_namespace_node      *child_node = NULL;
-
+	acpi_status status;
+	struct acpi_namespace_node *node;
+	struct acpi_namespace_node *parent_node = NULL;
+	struct acpi_namespace_node *child_node = NULL;
 
 	/* Parameter validation */
 
@@ -213,8 +198,8 @@ acpi_get_next_object (
 		return (AE_BAD_PARAMETER);
 	}
 
-	status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
 		return (status);
 	}
 
@@ -223,17 +208,16 @@ acpi_get_next_object (
 	if (!child) {
 		/* Start search at the beginning of the specified scope */
 
-		parent_node = acpi_ns_map_handle_to_node (parent);
+		parent_node = acpi_ns_map_handle_to_node(parent);
 		if (!parent_node) {
 			status = AE_BAD_PARAMETER;
 			goto unlock_and_exit;
 		}
-	}
-	else {
+	} else {
 		/* Non-null handle, ignore the parent */
 		/* Convert and validate the handle */
 
-		child_node = acpi_ns_map_handle_to_node (child);
+		child_node = acpi_ns_map_handle_to_node(child);
 		if (!child_node) {
 			status = AE_BAD_PARAMETER;
 			goto unlock_and_exit;
@@ -242,20 +226,19 @@ acpi_get_next_object (
 
 	/* Internal function does the real work */
 
-	node = acpi_ns_get_next_node (type, parent_node, child_node);
+	node = acpi_ns_get_next_node(type, parent_node, child_node);
 	if (!node) {
 		status = AE_NOT_FOUND;
 		goto unlock_and_exit;
 	}
 
 	if (ret_handle) {
-		*ret_handle = acpi_ns_convert_entry_to_handle (node);
+		*ret_handle = acpi_ns_convert_entry_to_handle(node);
 	}
 
+      unlock_and_exit:
 
-unlock_and_exit:
-
-	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 	return (status);
 }
 

+ 61 - 64
drivers/acpi/numa.c

@@ -34,16 +34,18 @@
 
 #define ACPI_NUMA	0x80000000
 #define _COMPONENT	ACPI_NUMA
-	ACPI_MODULE_NAME ("numa")
+ACPI_MODULE_NAME("numa")
 
-extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
+extern int __init acpi_table_parse_madt_family(enum acpi_table_id id,
+					       unsigned long madt_size,
+					       int entry_id,
+					       acpi_madt_entry_handler handler,
+					       unsigned int max_entries);
 
-void __init
-acpi_table_print_srat_entry (
-	acpi_table_entry_header	*header)
+void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
 {
 
-	ACPI_FUNCTION_NAME ("acpi_table_print_srat_entry");
+	ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
 
 	if (!header)
 		return;
@@ -52,48 +54,55 @@ acpi_table_print_srat_entry (
 
 	case ACPI_SRAT_PROCESSOR_AFFINITY:
 #ifdef ACPI_DEBUG_OUTPUT
-	{
-		struct acpi_table_processor_affinity *p =
-			(struct acpi_table_processor_affinity*) header;
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
-		       p->apic_id, p->lsapic_eid, p->proximity_domain,
-		       p->flags.enabled?"enabled":"disabled"));
-	}
-#endif /* ACPI_DEBUG_OUTPUT */
+		{
+			struct acpi_table_processor_affinity *p =
+			    (struct acpi_table_processor_affinity *)header;
+			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+					  "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
+					  p->apic_id, p->lsapic_eid,
+					  p->proximity_domain,
+					  p->flags.
+					  enabled ? "enabled" : "disabled"));
+		}
+#endif				/* ACPI_DEBUG_OUTPUT */
 		break;
 
 	case ACPI_SRAT_MEMORY_AFFINITY:
 #ifdef ACPI_DEBUG_OUTPUT
-	{
-		struct acpi_table_memory_affinity *p =
-			(struct acpi_table_memory_affinity*) header;
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
-		       p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
-		       p->memory_type, p->proximity_domain,
-		       p->flags.enabled ? "enabled" : "disabled",
-		       p->flags.hot_pluggable ? " hot-pluggable" : ""));
-	}
-#endif /* ACPI_DEBUG_OUTPUT */
+		{
+			struct acpi_table_memory_affinity *p =
+			    (struct acpi_table_memory_affinity *)header;
+			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+					  "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
+					  p->base_addr_hi, p->base_addr_lo,
+					  p->length_hi, p->length_lo,
+					  p->memory_type, p->proximity_domain,
+					  p->flags.
+					  enabled ? "enabled" : "disabled",
+					  p->flags.
+					  hot_pluggable ? " hot-pluggable" :
+					  ""));
+		}
+#endif				/* ACPI_DEBUG_OUTPUT */
 		break;
 
 	default:
-		printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n",
-			header->type);
+		printk(KERN_WARNING PREFIX
+		       "Found unsupported SRAT entry (type = 0x%x)\n",
+		       header->type);
 		break;
 	}
 }
 
-
-static int __init
-acpi_parse_slit (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_slit(unsigned long phys_addr, unsigned long size)
 {
-	struct acpi_table_slit	*slit;
-	u32			localities;
+	struct acpi_table_slit *slit;
+	u32 localities;
 
 	if (!phys_addr || !size)
 		return -EINVAL;
 
-	slit = (struct acpi_table_slit *) __va(phys_addr);
+	slit = (struct acpi_table_slit *)__va(phys_addr);
 
 	/* downcast just for %llu vs %lu for i386/ia64  */
 	localities = (u32) slit->localities;
@@ -103,15 +112,13 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size)
 	return 0;
 }
 
-
 static int __init
-acpi_parse_processor_affinity (
-	acpi_table_entry_header *header,
-	const unsigned long end)
+acpi_parse_processor_affinity(acpi_table_entry_header * header,
+			      const unsigned long end)
 {
 	struct acpi_table_processor_affinity *processor_affinity;
 
-	processor_affinity = (struct acpi_table_processor_affinity*) header;
+	processor_affinity = (struct acpi_table_processor_affinity *)header;
 	if (!processor_affinity)
 		return -EINVAL;
 
@@ -123,15 +130,13 @@ acpi_parse_processor_affinity (
 	return 0;
 }
 
-
 static int __init
-acpi_parse_memory_affinity (
-	acpi_table_entry_header *header,
-	const unsigned long end)
+acpi_parse_memory_affinity(acpi_table_entry_header * header,
+			   const unsigned long end)
 {
 	struct acpi_table_memory_affinity *memory_affinity;
 
-	memory_affinity = (struct acpi_table_memory_affinity*) header;
+	memory_affinity = (struct acpi_table_memory_affinity *)header;
 	if (!memory_affinity)
 		return -EINVAL;
 
@@ -143,36 +148,30 @@ acpi_parse_memory_affinity (
 	return 0;
 }
 
-
-static int __init
-acpi_parse_srat (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_srat(unsigned long phys_addr, unsigned long size)
 {
-	struct acpi_table_srat	*srat;
+	struct acpi_table_srat *srat;
 
 	if (!phys_addr || !size)
 		return -EINVAL;
 
-	srat = (struct acpi_table_srat *) __va(phys_addr);
+	srat = (struct acpi_table_srat *)__va(phys_addr);
 
 	return 0;
 }
 
-
 int __init
-acpi_table_parse_srat (
-	enum acpi_srat_entry_id	id,
-	acpi_madt_entry_handler	handler,
-	unsigned int max_entries)
+acpi_table_parse_srat(enum acpi_srat_entry_id id,
+		      acpi_madt_entry_handler handler, unsigned int max_entries)
 {
-	return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
-					    id, handler, max_entries);
+	return acpi_table_parse_madt_family(ACPI_SRAT,
+					    sizeof(struct acpi_table_srat), id,
+					    handler, max_entries);
 }
 
-
-int __init
-acpi_numa_init(void)
+int __init acpi_numa_init(void)
 {
-	int			result;
+	int result;
 
 	/* SRAT: Static Resource Affinity Table */
 	result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
@@ -181,9 +180,7 @@ acpi_numa_init(void)
 		result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
 					       acpi_parse_processor_affinity,
 					       NR_CPUS);
-		result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
-					       acpi_parse_memory_affinity,
-					       NR_NODE_MEMBLKS);	// IA64 specific
+		result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS);	// IA64 specific
 	}
 
 	/* SLIT: System Locality Information Table */
@@ -193,8 +190,7 @@ acpi_numa_init(void)
 	return 0;
 }
 
-int
-acpi_get_pxm(acpi_handle h)
+int acpi_get_pxm(acpi_handle h)
 {
 	unsigned long pxm;
 	acpi_status status;
@@ -207,7 +203,8 @@ acpi_get_pxm(acpi_handle h)
 		if (ACPI_SUCCESS(status))
 			return (int)pxm;
 		status = acpi_get_parent(handle, &phandle);
-	} while(ACPI_SUCCESS(status));
+	} while (ACPI_SUCCESS(status));
 	return -1;
 }
+
 EXPORT_SYMBOL(acpi_get_pxm);

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 218 - 253
drivers/acpi/osl.c


+ 167 - 209
drivers/acpi/parser/psargs.c

@@ -41,25 +41,20 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("psargs")
+ACPI_MODULE_NAME("psargs")
 
 /* Local prototypes */
-
 static u32
-acpi_ps_get_next_package_length (
-	struct acpi_parse_state         *parser_state);
-
-static union acpi_parse_object *
-acpi_ps_get_next_field (
-	struct acpi_parse_state         *parser_state);
+acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
 
+static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
+						       *parser_state);
 
 /*******************************************************************************
  *
@@ -75,49 +70,43 @@ acpi_ps_get_next_field (
  ******************************************************************************/
 
 static u32
-acpi_ps_get_next_package_length (
-	struct acpi_parse_state         *parser_state)
+acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
 {
-	u32                             encoded_length;
-	u32                             length = 0;
+	u32 encoded_length;
+	u32 length = 0;
 
+	ACPI_FUNCTION_TRACE("ps_get_next_package_length");
 
-	ACPI_FUNCTION_TRACE ("ps_get_next_package_length");
-
-
-	encoded_length = (u32) ACPI_GET8 (parser_state->aml);
+	encoded_length = (u32) ACPI_GET8(parser_state->aml);
 	parser_state->aml++;
 
-	switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
-	case 0: /* 1-byte encoding (bits 0-5) */
+	switch (encoded_length >> 6) {	/* bits 6-7 contain encoding scheme */
+	case 0:		/* 1-byte encoding (bits 0-5) */
 
 		length = (encoded_length & 0x3F);
 		break;
 
+	case 1:		/* 2-byte encoding (next byte + bits 0-3) */
 
-	case 1: /* 2-byte encoding (next byte + bits 0-3) */
-
-		length = ((ACPI_GET8 (parser_state->aml) << 04) |
-				 (encoded_length & 0x0F));
+		length = ((ACPI_GET8(parser_state->aml) << 04) |
+			  (encoded_length & 0x0F));
 		parser_state->aml++;
 		break;
 
+	case 2:		/* 3-byte encoding (next 2 bytes + bits 0-3) */
 
-	case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
-
-		length = ((ACPI_GET8 (parser_state->aml + 1) << 12) |
-				  (ACPI_GET8 (parser_state->aml)    << 04) |
-				  (encoded_length & 0x0F));
+		length = ((ACPI_GET8(parser_state->aml + 1) << 12) |
+			  (ACPI_GET8(parser_state->aml) << 04) |
+			  (encoded_length & 0x0F));
 		parser_state->aml += 2;
 		break;
 
+	case 3:		/* 4-byte encoding (next 3 bytes + bits 0-3) */
 
-	case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
-
-		length = ((ACPI_GET8 (parser_state->aml + 2) << 20) |
-				  (ACPI_GET8 (parser_state->aml + 1) << 12) |
-				  (ACPI_GET8 (parser_state->aml)    << 04) |
-				  (encoded_length & 0x0F));
+		length = ((ACPI_GET8(parser_state->aml + 2) << 20) |
+			  (ACPI_GET8(parser_state->aml + 1) << 12) |
+			  (ACPI_GET8(parser_state->aml) << 04) |
+			  (encoded_length & 0x0F));
 		parser_state->aml += 3;
 		break;
 
@@ -127,10 +116,9 @@ acpi_ps_get_next_package_length (
 		break;
 	}
 
-	return_VALUE (length);
+	return_VALUE(length);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_package_end
@@ -144,25 +132,21 @@ acpi_ps_get_next_package_length (
  *
  ******************************************************************************/
 
-u8 *
-acpi_ps_get_next_package_end (
-	struct acpi_parse_state         *parser_state)
+u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
 {
-	u8                              *start = parser_state->aml;
-	acpi_native_uint                length;
-
-
-	ACPI_FUNCTION_TRACE ("ps_get_next_package_end");
+	u8 *start = parser_state->aml;
+	acpi_native_uint length;
 
+	ACPI_FUNCTION_TRACE("ps_get_next_package_end");
 
 	/* Function below changes parser_state->Aml */
 
-	length = (acpi_native_uint) acpi_ps_get_next_package_length (parser_state);
+	length =
+	    (acpi_native_uint) acpi_ps_get_next_package_length(parser_state);
 
-	return_PTR (start + length); /* end of package */
+	return_PTR(start + length);	/* end of package */
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_namestring
@@ -178,20 +162,16 @@ acpi_ps_get_next_package_end (
  *
  ******************************************************************************/
 
-char *
-acpi_ps_get_next_namestring (
-	struct acpi_parse_state         *parser_state)
+char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
 {
-	u8                              *start = parser_state->aml;
-	u8                              *end = parser_state->aml;
-
-
-	ACPI_FUNCTION_TRACE ("ps_get_next_namestring");
+	u8 *start = parser_state->aml;
+	u8 *end = parser_state->aml;
 
+	ACPI_FUNCTION_TRACE("ps_get_next_namestring");
 
 	/* Handle multiple prefix characters */
 
-	while (acpi_ps_is_prefix_char (ACPI_GET8 (end))) {
+	while (acpi_ps_is_prefix_char(ACPI_GET8(end))) {
 		/* Include prefix '\\' or '^' */
 
 		end++;
@@ -199,7 +179,7 @@ acpi_ps_get_next_namestring (
 
 	/* Decode the path */
 
-	switch (ACPI_GET8 (end)) {
+	switch (ACPI_GET8(end)) {
 	case 0:
 
 		/* null_name */
@@ -221,7 +201,7 @@ acpi_ps_get_next_namestring (
 
 		/* Multiple name segments, 4 chars each */
 
-		end += 2 + ((acpi_size) ACPI_GET8 (end + 1) * ACPI_NAME_SIZE);
+		end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE);
 		break;
 
 	default:
@@ -232,11 +212,10 @@ acpi_ps_get_next_namestring (
 		break;
 	}
 
-	parser_state->aml = (u8*) end;
-	return_PTR ((char *) start);
+	parser_state->aml = (u8 *) end;
+	return_PTR((char *)start);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_namepath
@@ -259,24 +238,20 @@ acpi_ps_get_next_namestring (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_get_next_namepath (
-	struct acpi_walk_state          *walk_state,
-	struct acpi_parse_state         *parser_state,
-	union acpi_parse_object         *arg,
-	u8                              method_call)
+acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
+			  struct acpi_parse_state *parser_state,
+			  union acpi_parse_object *arg, u8 method_call)
 {
-	char                            *path;
-	union acpi_parse_object         *name_op;
-	acpi_status                     status = AE_OK;
-	union acpi_operand_object       *method_desc;
-	struct acpi_namespace_node      *node;
-	union acpi_generic_state        scope_info;
+	char *path;
+	union acpi_parse_object *name_op;
+	acpi_status status = AE_OK;
+	union acpi_operand_object *method_desc;
+	struct acpi_namespace_node *node;
+	union acpi_generic_state scope_info;
 
+	ACPI_FUNCTION_TRACE("ps_get_next_namepath");
 
-	ACPI_FUNCTION_TRACE ("ps_get_next_namepath");
-
-
-	path = acpi_ps_get_next_namestring (parser_state);
+	path = acpi_ps_get_next_namestring(parser_state);
 
 	/* Null path case is allowed */
 
@@ -296,49 +271,50 @@ acpi_ps_get_next_namepath (
 		 * parent tree, but don't open a new scope -- we just want to lookup the
 		 * object  (MUST BE mode EXECUTE to perform upsearch)
 		 */
-		status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY,
-				 ACPI_IMODE_EXECUTE,
-				 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-				 NULL, &node);
-		if (ACPI_SUCCESS (status) && method_call) {
+		status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY,
+					ACPI_IMODE_EXECUTE,
+					ACPI_NS_SEARCH_PARENT |
+					ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
+		if (ACPI_SUCCESS(status) && method_call) {
 			if (node->type == ACPI_TYPE_METHOD) {
 				/* This name is actually a control method invocation */
 
-				method_desc = acpi_ns_get_attached_object (node);
-				ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-					"Control Method - %p Desc %p Path=%p\n",
-					node, method_desc, path));
+				method_desc = acpi_ns_get_attached_object(node);
+				ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+						  "Control Method - %p Desc %p Path=%p\n",
+						  node, method_desc, path));
 
-				name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
+				name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
 				if (!name_op) {
-					return_ACPI_STATUS (AE_NO_MEMORY);
+					return_ACPI_STATUS(AE_NO_MEMORY);
 				}
 
 				/* Change arg into a METHOD CALL and attach name to it */
 
-				acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
+				acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
 				name_op->common.value.name = path;
 
 				/* Point METHODCALL/NAME to the METHOD Node */
 
 				name_op->common.node = node;
-				acpi_ps_append_arg (arg, name_op);
+				acpi_ps_append_arg(arg, name_op);
 
 				if (!method_desc) {
-					ACPI_REPORT_ERROR ((
-						"ps_get_next_namepath: Control Method %p has no attached object\n",
-						node));
-					return_ACPI_STATUS (AE_AML_INTERNAL);
+					ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node));
+					return_ACPI_STATUS(AE_AML_INTERNAL);
 				}
 
-				ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-					"Control Method - %p Args %X\n",
-					node, method_desc->method.param_count));
+				ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+						  "Control Method - %p Args %X\n",
+						  node,
+						  method_desc->method.
+						  param_count));
 
 				/* Get the number of arguments to expect */
 
-				walk_state->arg_count = method_desc->method.param_count;
-				return_ACPI_STATUS (AE_OK);
+				walk_state->arg_count =
+				    method_desc->method.param_count;
+				return_ACPI_STATUS(AE_OK);
 			}
 
 			/*
@@ -348,25 +324,26 @@ acpi_ps_get_next_namepath (
 			 */
 		}
 
-		if (ACPI_FAILURE (status)) {
+		if (ACPI_FAILURE(status)) {
 			/*
 			 * 1) Any error other than NOT_FOUND is always severe
 			 * 2) NOT_FOUND is only important if we are executing a method.
 			 * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok.
 			 */
-			if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
-				(status == AE_NOT_FOUND)                                                &&
-				(walk_state->op->common.aml_opcode != AML_COND_REF_OF_OP)) ||
-
-				(status != AE_NOT_FOUND)) {
-				ACPI_REPORT_NSERROR (path, status);
-
-				acpi_os_printf ("search_node %p start_node %p return_node %p\n",
-					scope_info.scope.node, parser_state->start_node, node);
-
-
-			}
-			else {
+			if ((((walk_state->
+			       parse_flags & ACPI_PARSE_MODE_MASK) ==
+			      ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND)
+			     && (walk_state->op->common.aml_opcode !=
+				 AML_COND_REF_OF_OP))
+			    || (status != AE_NOT_FOUND)) {
+				ACPI_REPORT_NSERROR(path, status);
+
+				acpi_os_printf
+				    ("search_node %p start_node %p return_node %p\n",
+				     scope_info.scope.node,
+				     parser_state->start_node, node);
+
+			} else {
 				/*
 				 * We got a NOT_FOUND during table load or we encountered
 				 * a cond_ref_of(x) where the target does not exist.
@@ -381,13 +358,12 @@ acpi_ps_get_next_namepath (
 	 * Regardless of success/failure above,
 	 * Just initialize the Op with the pathname.
 	 */
-	acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
+	acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
 	arg->common.value.name = path;
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_simple_arg
@@ -403,87 +379,81 @@ acpi_ps_get_next_namepath (
  ******************************************************************************/
 
 void
-acpi_ps_get_next_simple_arg (
-	struct acpi_parse_state         *parser_state,
-	u32                             arg_type,
-	union acpi_parse_object         *arg)
+acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
+			    u32 arg_type, union acpi_parse_object *arg)
 {
 
-	ACPI_FUNCTION_TRACE_U32 ("ps_get_next_simple_arg", arg_type);
-
+	ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type);
 
 	switch (arg_type) {
 	case ARGP_BYTEDATA:
 
-		acpi_ps_init_op (arg, AML_BYTE_OP);
-		arg->common.value.integer = (u32) ACPI_GET8 (parser_state->aml);
+		acpi_ps_init_op(arg, AML_BYTE_OP);
+		arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml);
 		parser_state->aml++;
 		break;
 
-
 	case ARGP_WORDDATA:
 
-		acpi_ps_init_op (arg, AML_WORD_OP);
+		acpi_ps_init_op(arg, AML_WORD_OP);
 
 		/* Get 2 bytes from the AML stream */
 
-		ACPI_MOVE_16_TO_32 (&arg->common.value.integer, parser_state->aml);
+		ACPI_MOVE_16_TO_32(&arg->common.value.integer,
+				   parser_state->aml);
 		parser_state->aml += 2;
 		break;
 
-
 	case ARGP_DWORDDATA:
 
-		acpi_ps_init_op (arg, AML_DWORD_OP);
+		acpi_ps_init_op(arg, AML_DWORD_OP);
 
 		/* Get 4 bytes from the AML stream */
 
-		ACPI_MOVE_32_TO_32 (&arg->common.value.integer, parser_state->aml);
+		ACPI_MOVE_32_TO_32(&arg->common.value.integer,
+				   parser_state->aml);
 		parser_state->aml += 4;
 		break;
 
-
 	case ARGP_QWORDDATA:
 
-		acpi_ps_init_op (arg, AML_QWORD_OP);
+		acpi_ps_init_op(arg, AML_QWORD_OP);
 
 		/* Get 8 bytes from the AML stream */
 
-		ACPI_MOVE_64_TO_64 (&arg->common.value.integer, parser_state->aml);
+		ACPI_MOVE_64_TO_64(&arg->common.value.integer,
+				   parser_state->aml);
 		parser_state->aml += 8;
 		break;
 
-
 	case ARGP_CHARLIST:
 
-		acpi_ps_init_op (arg, AML_STRING_OP);
-		arg->common.value.string = (char *) parser_state->aml;
+		acpi_ps_init_op(arg, AML_STRING_OP);
+		arg->common.value.string = (char *)parser_state->aml;
 
-		while (ACPI_GET8 (parser_state->aml) != '\0') {
+		while (ACPI_GET8(parser_state->aml) != '\0') {
 			parser_state->aml++;
 		}
 		parser_state->aml++;
 		break;
 
-
 	case ARGP_NAME:
 	case ARGP_NAMESTRING:
 
-		acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
-		arg->common.value.name = acpi_ps_get_next_namestring (parser_state);
+		acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
+		arg->common.value.name =
+		    acpi_ps_get_next_namestring(parser_state);
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("Invalid arg_type %X\n", arg_type));
+		ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type));
 		break;
 	}
 
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_field
@@ -496,24 +466,21 @@ acpi_ps_get_next_simple_arg (
  *
  ******************************************************************************/
 
-static union acpi_parse_object *
-acpi_ps_get_next_field (
-	struct acpi_parse_state         *parser_state)
+static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
+						       *parser_state)
 {
-	u32                             aml_offset = (u32)
-			  ACPI_PTR_DIFF (parser_state->aml,
-					   parser_state->aml_start);
-	union acpi_parse_object         *field;
-	u16                             opcode;
-	u32                             name;
-
-
-	ACPI_FUNCTION_TRACE ("ps_get_next_field");
+	u32 aml_offset = (u32)
+	    ACPI_PTR_DIFF(parser_state->aml,
+			  parser_state->aml_start);
+	union acpi_parse_object *field;
+	u16 opcode;
+	u32 name;
 
+	ACPI_FUNCTION_TRACE("ps_get_next_field");
 
 	/* Determine field type */
 
-	switch (ACPI_GET8 (parser_state->aml)) {
+	switch (ACPI_GET8(parser_state->aml)) {
 	default:
 
 		opcode = AML_INT_NAMEDFIELD_OP;
@@ -534,9 +501,9 @@ acpi_ps_get_next_field (
 
 	/* Allocate a new field op */
 
-	field = acpi_ps_alloc_op (opcode);
+	field = acpi_ps_alloc_op(opcode);
 	if (!field) {
-		return_PTR (NULL);
+		return_PTR(NULL);
 	}
 
 	field->common.aml_offset = aml_offset;
@@ -548,33 +515,34 @@ acpi_ps_get_next_field (
 
 		/* Get the 4-character name */
 
-		ACPI_MOVE_32_TO_32 (&name, parser_state->aml);
-		acpi_ps_set_name (field, name);
+		ACPI_MOVE_32_TO_32(&name, parser_state->aml);
+		acpi_ps_set_name(field, name);
 		parser_state->aml += ACPI_NAME_SIZE;
 
 		/* Get the length which is encoded as a package length */
 
-		field->common.value.size = acpi_ps_get_next_package_length (parser_state);
+		field->common.value.size =
+		    acpi_ps_get_next_package_length(parser_state);
 		break;
 
-
 	case AML_INT_RESERVEDFIELD_OP:
 
 		/* Get the length which is encoded as a package length */
 
-		field->common.value.size = acpi_ps_get_next_package_length (parser_state);
+		field->common.value.size =
+		    acpi_ps_get_next_package_length(parser_state);
 		break;
 
-
 	case AML_INT_ACCESSFIELD_OP:
 
 		/*
 		 * Get access_type and access_attrib and merge into the field Op
 		 * access_type is first operand, access_attribute is second
 		 */
-		field->common.value.integer = (ACPI_GET8 (parser_state->aml) << 8);
+		field->common.value.integer =
+		    (ACPI_GET8(parser_state->aml) << 8);
 		parser_state->aml++;
-		field->common.value.integer |= ACPI_GET8 (parser_state->aml);
+		field->common.value.integer |= ACPI_GET8(parser_state->aml);
 		parser_state->aml++;
 		break;
 
@@ -584,10 +552,9 @@ acpi_ps_get_next_field (
 		break;
 	}
 
-	return_PTR (field);
+	return_PTR(field);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_arg
@@ -605,21 +572,17 @@ acpi_ps_get_next_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_get_next_arg (
-	struct acpi_walk_state          *walk_state,
-	struct acpi_parse_state         *parser_state,
-	u32                             arg_type,
-	union acpi_parse_object         **return_arg)
+acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
+		     struct acpi_parse_state *parser_state,
+		     u32 arg_type, union acpi_parse_object **return_arg)
 {
-	union acpi_parse_object         *arg = NULL;
-	union acpi_parse_object         *prev = NULL;
-	union acpi_parse_object         *field;
-	u32                             subop;
-	acpi_status                     status = AE_OK;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ps_get_next_arg", parser_state);
+	union acpi_parse_object *arg = NULL;
+	union acpi_parse_object *prev = NULL;
+	union acpi_parse_object *field;
+	u32 subop;
+	acpi_status status = AE_OK;
 
+	ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state);
 
 	switch (arg_type) {
 	case ARGP_BYTEDATA:
@@ -631,37 +594,35 @@ acpi_ps_get_next_arg (
 
 		/* Constants, strings, and namestrings are all the same size */
 
-		arg = acpi_ps_alloc_op (AML_BYTE_OP);
+		arg = acpi_ps_alloc_op(AML_BYTE_OP);
 		if (!arg) {
-			return_ACPI_STATUS (AE_NO_MEMORY);
+			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
-		acpi_ps_get_next_simple_arg (parser_state, arg_type, arg);
+		acpi_ps_get_next_simple_arg(parser_state, arg_type, arg);
 		break;
 
-
 	case ARGP_PKGLENGTH:
 
 		/* Package length, nothing returned */
 
-		parser_state->pkg_end = acpi_ps_get_next_package_end (parser_state);
+		parser_state->pkg_end =
+		    acpi_ps_get_next_package_end(parser_state);
 		break;
 
-
 	case ARGP_FIELDLIST:
 
 		if (parser_state->aml < parser_state->pkg_end) {
 			/* Non-empty list */
 
 			while (parser_state->aml < parser_state->pkg_end) {
-				field = acpi_ps_get_next_field (parser_state);
+				field = acpi_ps_get_next_field(parser_state);
 				if (!field) {
-					return_ACPI_STATUS (AE_NO_MEMORY);
+					return_ACPI_STATUS(AE_NO_MEMORY);
 				}
 
 				if (prev) {
 					prev->common.next = field;
-				}
-				else {
+				} else {
 					arg = field;
 				}
 				prev = field;
@@ -673,21 +634,21 @@ acpi_ps_get_next_arg (
 		}
 		break;
 
-
 	case ARGP_BYTELIST:
 
 		if (parser_state->aml < parser_state->pkg_end) {
 			/* Non-empty list */
 
-			arg = acpi_ps_alloc_op (AML_INT_BYTELIST_OP);
+			arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
 			if (!arg) {
-				return_ACPI_STATUS (AE_NO_MEMORY);
+				return_ACPI_STATUS(AE_NO_MEMORY);
 			}
 
 			/* Fill in bytelist data */
 
 			arg->common.value.size = (u32)
-				ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
+			    ACPI_PTR_DIFF(parser_state->pkg_end,
+					  parser_state->aml);
 			arg->named.data = parser_state->aml;
 
 			/* Skip to End of byte data */
@@ -696,32 +657,31 @@ acpi_ps_get_next_arg (
 		}
 		break;
 
-
 	case ARGP_TARGET:
 	case ARGP_SUPERNAME:
 	case ARGP_SIMPLENAME:
 
-		subop = acpi_ps_peek_opcode (parser_state);
-		if (subop == 0                  ||
-			acpi_ps_is_leading_char (subop) ||
-			acpi_ps_is_prefix_char (subop)) {
+		subop = acpi_ps_peek_opcode(parser_state);
+		if (subop == 0 ||
+		    acpi_ps_is_leading_char(subop) ||
+		    acpi_ps_is_prefix_char(subop)) {
 			/* null_name or name_string */
 
-			arg = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
+			arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
 			if (!arg) {
-				return_ACPI_STATUS (AE_NO_MEMORY);
+				return_ACPI_STATUS(AE_NO_MEMORY);
 			}
 
-			status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
-		}
-		else {
+			status =
+			    acpi_ps_get_next_namepath(walk_state, parser_state,
+						      arg, 0);
+		} else {
 			/* Single complex argument, nothing returned */
 
 			walk_state->arg_count = 1;
 		}
 		break;
 
-
 	case ARGP_DATAOBJ:
 	case ARGP_TERMARG:
 
@@ -730,7 +690,6 @@ acpi_ps_get_next_arg (
 		walk_state->arg_count = 1;
 		break;
 
-
 	case ARGP_DATAOBJLIST:
 	case ARGP_TERMLIST:
 	case ARGP_OBJLIST:
@@ -742,14 +701,13 @@ acpi_ps_get_next_arg (
 		}
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("Invalid arg_type: %X\n", arg_type));
+		ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type));
 		status = AE_AML_OPERAND_TYPE;
 		break;
 	}
 
 	*return_arg = arg;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }

+ 302 - 209
drivers/acpi/parser/psloop.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * Parse the AML and build an operation tree as most interpreters,
  * like Perl, do.  Parsing is done by hand rather than with a YACC
@@ -57,10 +56,9 @@
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("psloop")
-
-static u32                          acpi_gbl_depth = 0;
+ACPI_MODULE_NAME("psloop")
 
+static u32 acpi_gbl_depth = 0;
 
 /*******************************************************************************
  *
@@ -75,23 +73,20 @@ static u32                          acpi_gbl_depth = 0;
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ps_parse_loop (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status = AE_OK;
-	acpi_status                     status2;
-	union acpi_parse_object         *op = NULL;     /* current op */
-	union acpi_parse_object         *arg = NULL;
-	union acpi_parse_object         *pre_op = NULL;
-	struct acpi_parse_state         *parser_state;
-	u8                              *aml_op_start = NULL;
-
+	acpi_status status = AE_OK;
+	acpi_status status2;
+	union acpi_parse_object *op = NULL;	/* current op */
+	union acpi_parse_object *arg = NULL;
+	union acpi_parse_object *pre_op = NULL;
+	struct acpi_parse_state *parser_state;
+	u8 *aml_op_start = NULL;
 
-	ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state);
+	ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state);
 
 	if (walk_state->descending_callback == NULL) {
-		return_ACPI_STATUS (AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
 	parser_state = &walk_state->parser_state;
@@ -102,45 +97,56 @@ acpi_ps_parse_loop (
 	if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
 		/* We are restarting a preempted control method */
 
-		if (acpi_ps_has_completed_scope (parser_state)) {
+		if (acpi_ps_has_completed_scope(parser_state)) {
 			/*
 			 * We must check if a predicate to an IF or WHILE statement
 			 * was just completed
 			 */
 			if ((parser_state->scope->parse_scope.op) &&
-			   ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
-				(parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
-				(walk_state->control_state) &&
-				(walk_state->control_state->common.state ==
-					ACPI_CONTROL_PREDICATE_EXECUTING)) {
+			    ((parser_state->scope->parse_scope.op->common.
+			      aml_opcode == AML_IF_OP)
+			     || (parser_state->scope->parse_scope.op->common.
+				 aml_opcode == AML_WHILE_OP))
+			    && (walk_state->control_state)
+			    && (walk_state->control_state->common.state ==
+				ACPI_CONTROL_PREDICATE_EXECUTING)) {
 				/*
 				 * A predicate was just completed, get the value of the
 				 * predicate and branch based on that value
 				 */
 				walk_state->op = NULL;
-				status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
-				if (ACPI_FAILURE (status) &&
-					((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
+				status =
+				    acpi_ds_get_predicate_value(walk_state,
+								ACPI_TO_POINTER
+								(TRUE));
+				if (ACPI_FAILURE(status)
+				    && ((status & AE_CODE_MASK) !=
+					AE_CODE_CONTROL)) {
 					if (status == AE_AML_NO_RETURN_VALUE) {
-						ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-							"Invoked method did not return a value, %s\n",
-							acpi_format_exception (status)));
+						ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+								  "Invoked method did not return a value, %s\n",
+								  acpi_format_exception
+								  (status)));
 
 					}
-					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-						"get_predicate Failed, %s\n",
-						acpi_format_exception (status)));
-					return_ACPI_STATUS (status);
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "get_predicate Failed, %s\n",
+							  acpi_format_exception
+							  (status)));
+					return_ACPI_STATUS(status);
 				}
 
-				status = acpi_ps_next_parse_state (walk_state, op, status);
+				status =
+				    acpi_ps_next_parse_state(walk_state, op,
+							     status);
 			}
 
-			acpi_ps_pop_scope (parser_state, &op,
-				&walk_state->arg_types, &walk_state->arg_count);
-			ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
-		}
-		else if (walk_state->prev_op) {
+			acpi_ps_pop_scope(parser_state, &op,
+					  &walk_state->arg_types,
+					  &walk_state->arg_count);
+			ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+					  "Popped scope, Op=%p\n", op));
+		} else if (walk_state->prev_op) {
 			/* We were in the middle of an op */
 
 			op = walk_state->prev_op;
@@ -156,9 +162,10 @@ acpi_ps_parse_loop (
 		if (!op) {
 			/* Get the next opcode from the AML stream */
 
-			walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
-					  parser_state->aml_start);
-			walk_state->opcode   = acpi_ps_peek_opcode (parser_state);
+			walk_state->aml_offset =
+			    (u32) ACPI_PTR_DIFF(parser_state->aml,
+						parser_state->aml_start);
+			walk_state->opcode = acpi_ps_peek_opcode(parser_state);
 
 			/*
 			 * First cut to determine what we have found:
@@ -166,7 +173,8 @@ acpi_ps_parse_loop (
 			 * 2) A name string
 			 * 3) An unknown/invalid opcode
 			 */
-			walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
+			walk_state->op_info =
+			    acpi_ps_get_opcode_info(walk_state->opcode);
 			switch (walk_state->op_info->class) {
 			case AML_CLASS_ASCII:
 			case AML_CLASS_PREFIX:
@@ -182,11 +190,13 @@ acpi_ps_parse_loop (
 
 				/* The opcode is unrecognized.  Just skip unknown opcodes */
 
-				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Found unknown opcode %X at AML address %p offset %X, ignoring\n",
-					walk_state->opcode, parser_state->aml, walk_state->aml_offset));
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+						  "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
+						  walk_state->opcode,
+						  parser_state->aml,
+						  walk_state->aml_offset));
 
-				ACPI_DUMP_BUFFER (parser_state->aml, 128);
+				ACPI_DUMP_BUFFER(parser_state->aml, 128);
 
 				/* Assume one-byte bad opcode */
 
@@ -197,8 +207,10 @@ acpi_ps_parse_loop (
 
 				/* Found opcode info, this is a normal opcode */
 
-				parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
-				walk_state->arg_types = walk_state->op_info->parse_args;
+				parser_state->aml +=
+				    acpi_ps_get_opcode_size(walk_state->opcode);
+				walk_state->arg_types =
+				    walk_state->op_info->parse_args;
 				break;
 			}
 
@@ -208,7 +220,9 @@ acpi_ps_parse_loop (
 				/* Allocate a new pre_op if necessary */
 
 				if (!pre_op) {
-					pre_op = acpi_ps_alloc_op (walk_state->opcode);
+					pre_op =
+					    acpi_ps_alloc_op(walk_state->
+							     opcode);
 					if (!pre_op) {
 						status = AE_NO_MEMORY;
 						goto close_this_op;
@@ -222,30 +236,40 @@ acpi_ps_parse_loop (
 				 * Get and append arguments until we find the node that contains
 				 * the name (the type ARGP_NAME).
 				 */
-				while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
-					  (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
-					status = acpi_ps_get_next_arg (walk_state, parser_state,
-							 GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
-					if (ACPI_FAILURE (status)) {
+				while (GET_CURRENT_ARG_TYPE
+				       (walk_state->arg_types)
+				       &&
+				       (GET_CURRENT_ARG_TYPE
+					(walk_state->arg_types) != ARGP_NAME)) {
+					status =
+					    acpi_ps_get_next_arg(walk_state,
+								 parser_state,
+								 GET_CURRENT_ARG_TYPE
+								 (walk_state->
+								  arg_types),
+								 &arg);
+					if (ACPI_FAILURE(status)) {
 						goto close_this_op;
 					}
 
-					acpi_ps_append_arg (pre_op, arg);
-					INCREMENT_ARG_LIST (walk_state->arg_types);
+					acpi_ps_append_arg(pre_op, arg);
+					INCREMENT_ARG_LIST(walk_state->
+							   arg_types);
 				}
 
 				/*
 				 * Make sure that we found a NAME and didn't run out of
 				 * arguments
 				 */
-				if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
+				if (!GET_CURRENT_ARG_TYPE
+				    (walk_state->arg_types)) {
 					status = AE_AML_NO_OPERAND;
 					goto close_this_op;
 				}
 
 				/* We know that this arg is a name, move to next arg */
 
-				INCREMENT_ARG_LIST (walk_state->arg_types);
+				INCREMENT_ARG_LIST(walk_state->arg_types);
 
 				/*
 				 * Find the object.  This will either insert the object into
@@ -253,11 +277,14 @@ acpi_ps_parse_loop (
 				 */
 				walk_state->op = NULL;
 
-				status = walk_state->descending_callback (walk_state, &op);
-				if (ACPI_FAILURE (status)) {
-					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-						"During name lookup/catalog, %s\n",
-						acpi_format_exception (status)));
+				status =
+				    walk_state->descending_callback(walk_state,
+								    &op);
+				if (ACPI_FAILURE(status)) {
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "During name lookup/catalog, %s\n",
+							  acpi_format_exception
+							  (status)));
 					goto close_this_op;
 				}
 
@@ -265,17 +292,20 @@ acpi_ps_parse_loop (
 					continue;
 				}
 
-				status = acpi_ps_next_parse_state (walk_state, op, status);
+				status =
+				    acpi_ps_next_parse_state(walk_state, op,
+							     status);
 				if (status == AE_CTRL_PENDING) {
 					status = AE_OK;
 					goto close_this_op;
 				}
 
-				if (ACPI_FAILURE (status)) {
+				if (ACPI_FAILURE(status)) {
 					goto close_this_op;
 				}
 
-				acpi_ps_append_arg (op, pre_op->common.value.arg);
+				acpi_ps_append_arg(op,
+						   pre_op->common.value.arg);
 				acpi_gbl_depth++;
 
 				if (op->common.aml_opcode == AML_REGION_OP) {
@@ -291,15 +321,15 @@ acpi_ps_parse_loop (
 					 *
 					 * (Length is unknown until parse of the body complete)
 					 */
-					op->named.data    = aml_op_start;
-					op->named.length  = 0;
+					op->named.data = aml_op_start;
+					op->named.length = 0;
 				}
-			}
-			else {
+			} else {
 				/* Not a named opcode, just allocate Op and append to parent */
 
-				walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
-				op = acpi_ps_alloc_op (walk_state->opcode);
+				walk_state->op_info =
+				    acpi_ps_get_opcode_info(walk_state->opcode);
+				op = acpi_ps_alloc_op(walk_state->opcode);
 				if (!op) {
 					status = AE_NO_MEMORY;
 					goto close_this_op;
@@ -310,11 +340,12 @@ acpi_ps_parse_loop (
 					 * Backup to beginning of create_xXXfield declaration
 					 * body_length is unknown until we parse the body
 					 */
-					op->named.data    = aml_op_start;
-					op->named.length  = 0;
+					op->named.data = aml_op_start;
+					op->named.length = 0;
 				}
 
-				acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
+				acpi_ps_append_arg(acpi_ps_get_parent_scope
+						   (parser_state), op);
 
 				if ((walk_state->descending_callback != NULL)) {
 					/*
@@ -323,14 +354,20 @@ acpi_ps_parse_loop (
 					 */
 					walk_state->op = op;
 
-					status = walk_state->descending_callback (walk_state, &op);
-					status = acpi_ps_next_parse_state (walk_state, op, status);
+					status =
+					    walk_state->
+					    descending_callback(walk_state,
+								&op);
+					status =
+					    acpi_ps_next_parse_state(walk_state,
+								     op,
+								     status);
 					if (status == AE_CTRL_PENDING) {
 						status = AE_OK;
 						goto close_this_op;
 					}
 
-					if (ACPI_FAILURE (status)) {
+					if (ACPI_FAILURE(status)) {
 						goto close_this_op;
 					}
 				}
@@ -339,14 +376,15 @@ acpi_ps_parse_loop (
 			op->common.aml_offset = walk_state->aml_offset;
 
 			if (walk_state->op_info) {
-				ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-					"Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
-					 (u32) op->common.aml_opcode, walk_state->op_info->name,
-					 op, parser_state->aml, op->common.aml_offset));
+				ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+						  "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
+						  (u32) op->common.aml_opcode,
+						  walk_state->op_info->name, op,
+						  parser_state->aml,
+						  op->common.aml_offset));
 			}
 		}
 
-
 		/*
 		 * Start arg_count at zero because we don't know if there are
 		 * any args yet
@@ -359,22 +397,27 @@ acpi_ps_parse_loop (
 			/* Get arguments */
 
 			switch (op->common.aml_opcode) {
-			case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
-			case AML_WORD_OP:       /* AML_WORDDATA_ARG */
-			case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
-			case AML_QWORD_OP:      /* AML_QWORDATA_ARG */
-			case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */
+			case AML_BYTE_OP:	/* AML_BYTEDATA_ARG */
+			case AML_WORD_OP:	/* AML_WORDDATA_ARG */
+			case AML_DWORD_OP:	/* AML_DWORDATA_ARG */
+			case AML_QWORD_OP:	/* AML_QWORDATA_ARG */
+			case AML_STRING_OP:	/* AML_ASCIICHARLIST_ARG */
 
 				/* Fill in constant or string argument directly */
 
-				acpi_ps_get_next_simple_arg (parser_state,
-					GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
+				acpi_ps_get_next_simple_arg(parser_state,
+							    GET_CURRENT_ARG_TYPE
+							    (walk_state->
+							     arg_types), op);
 				break;
 
-			case AML_INT_NAMEPATH_OP:   /* AML_NAMESTRING_ARG */
+			case AML_INT_NAMEPATH_OP:	/* AML_NAMESTRING_ARG */
 
-				status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
-				if (ACPI_FAILURE (status)) {
+				status =
+				    acpi_ps_get_next_namepath(walk_state,
+							      parser_state, op,
+							      1);
+				if (ACPI_FAILURE(status)) {
 					goto close_this_op;
 				}
 
@@ -386,34 +429,46 @@ acpi_ps_parse_loop (
 				 * Op is not a constant or string, append each argument
 				 * to the Op
 				 */
-				while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
-						!walk_state->arg_count) {
+				while (GET_CURRENT_ARG_TYPE
+				       (walk_state->arg_types)
+				       && !walk_state->arg_count) {
 					walk_state->aml_offset = (u32)
-						ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
-
-					status = acpi_ps_get_next_arg (walk_state, parser_state,
-							 GET_CURRENT_ARG_TYPE (walk_state->arg_types),
-							 &arg);
-					if (ACPI_FAILURE (status)) {
+					    ACPI_PTR_DIFF(parser_state->aml,
+							  parser_state->
+							  aml_start);
+
+					status =
+					    acpi_ps_get_next_arg(walk_state,
+								 parser_state,
+								 GET_CURRENT_ARG_TYPE
+								 (walk_state->
+								  arg_types),
+								 &arg);
+					if (ACPI_FAILURE(status)) {
 						goto close_this_op;
 					}
 
 					if (arg) {
-						arg->common.aml_offset = walk_state->aml_offset;
-						acpi_ps_append_arg (op, arg);
+						arg->common.aml_offset =
+						    walk_state->aml_offset;
+						acpi_ps_append_arg(op, arg);
 					}
-					INCREMENT_ARG_LIST (walk_state->arg_types);
+					INCREMENT_ARG_LIST(walk_state->
+							   arg_types);
 				}
 
-
 				/* Special processing for certain opcodes */
 
-	/* TBD (remove): Temporary mechanism to disable this code if needed */
+				/* TBD (remove): Temporary mechanism to disable this code if needed */
 
 #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
 
-			 if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
-				   ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
+				if ((walk_state->pass_number <=
+				     ACPI_IMODE_LOAD_PASS1)
+				    &&
+				    ((walk_state->
+				      parse_flags & ACPI_PARSE_DISASSEMBLE) ==
+				     0)) {
 					/*
 					 * We want to skip If/Else/While constructs during Pass1
 					 * because we want to actually conditionally execute the
@@ -427,12 +482,13 @@ acpi_ps_parse_loop (
 					case AML_ELSE_OP:
 					case AML_WHILE_OP:
 
-						ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-							"Pass1: Skipping an If/Else/While body\n"));
+						ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+								  "Pass1: Skipping an If/Else/While body\n"));
 
 						/* Skip body of if/else/while in pass 1 */
 
-						parser_state->aml   = parser_state->pkg_end;
+						parser_state->aml =
+						    parser_state->pkg_end;
 						walk_state->arg_count = 0;
 						break;
 
@@ -451,13 +507,15 @@ acpi_ps_parse_loop (
 					 *
 					 * Save the length and address of the body
 					 */
-					op->named.data   = parser_state->aml;
-					op->named.length = (u32) (parser_state->pkg_end -
-							   parser_state->aml);
+					op->named.data = parser_state->aml;
+					op->named.length =
+					    (u32) (parser_state->pkg_end -
+						   parser_state->aml);
 
 					/* Skip body of method */
 
-					parser_state->aml   = parser_state->pkg_end;
+					parser_state->aml =
+					    parser_state->pkg_end;
 					walk_state->arg_count = 0;
 					break;
 
@@ -466,20 +524,25 @@ acpi_ps_parse_loop (
 				case AML_VAR_PACKAGE_OP:
 
 					if ((op->common.parent) &&
-						(op->common.parent->common.aml_opcode == AML_NAME_OP) &&
-						(walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
+					    (op->common.parent->common.
+					     aml_opcode == AML_NAME_OP)
+					    && (walk_state->pass_number <=
+						ACPI_IMODE_LOAD_PASS2)) {
 						/*
 						 * Skip parsing of Buffers and Packages
 						 * because we don't have enough info in the first pass
 						 * to parse them correctly.
 						 */
-						op->named.data   = aml_op_start;
-						op->named.length = (u32) (parser_state->pkg_end -
-								   aml_op_start);
+						op->named.data = aml_op_start;
+						op->named.length =
+						    (u32) (parser_state->
+							   pkg_end -
+							   aml_op_start);
 
 						/* Skip body */
 
-						parser_state->aml   = parser_state->pkg_end;
+						parser_state->aml =
+						    parser_state->pkg_end;
 						walk_state->arg_count = 0;
 					}
 					break;
@@ -487,8 +550,9 @@ acpi_ps_parse_loop (
 				case AML_WHILE_OP:
 
 					if (walk_state->control_state) {
-						walk_state->control_state->control.package_end =
-							parser_state->pkg_end;
+						walk_state->control_state->
+						    control.package_end =
+						    parser_state->pkg_end;
 					}
 					break;
 
@@ -508,9 +572,10 @@ acpi_ps_parse_loop (
 			 * There are arguments (complex ones), push Op and
 			 * prepare for argument
 			 */
-			status = acpi_ps_push_scope (parser_state, op,
-					 walk_state->arg_types, walk_state->arg_count);
-			if (ACPI_FAILURE (status)) {
+			status = acpi_ps_push_scope(parser_state, op,
+						    walk_state->arg_types,
+						    walk_state->arg_count);
+			if (ACPI_FAILURE(status)) {
 				goto close_this_op;
 			}
 			op = NULL;
@@ -521,7 +586,8 @@ acpi_ps_parse_loop (
 		 * All arguments have been processed -- Op is complete,
 		 * prepare for next
 		 */
-		walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+		walk_state->op_info =
+		    acpi_ps_get_opcode_info(op->common.aml_opcode);
 		if (walk_state->op_info->flags & AML_NAMED) {
 			if (acpi_gbl_depth) {
 				acpi_gbl_depth--;
@@ -536,7 +602,8 @@ acpi_ps_parse_loop (
 				 * Completed parsing an op_region declaration, we now
 				 * know the length.
 				 */
-				op->named.length = (u32) (parser_state->aml - op->named.data);
+				op->named.length =
+				    (u32) (parser_state->aml - op->named.data);
 			}
 		}
 
@@ -547,25 +614,26 @@ acpi_ps_parse_loop (
 			 *
 			 * body_length is unknown until we parse the body
 			 */
-			op->named.length = (u32) (parser_state->aml - op->named.data);
+			op->named.length =
+			    (u32) (parser_state->aml - op->named.data);
 		}
 
 		/* This op complete, notify the dispatcher */
 
 		if (walk_state->ascending_callback != NULL) {
-			walk_state->op    = op;
+			walk_state->op = op;
 			walk_state->opcode = op->common.aml_opcode;
 
-			status = walk_state->ascending_callback (walk_state);
-			status = acpi_ps_next_parse_state (walk_state, op, status);
+			status = walk_state->ascending_callback(walk_state);
+			status =
+			    acpi_ps_next_parse_state(walk_state, op, status);
 			if (status == AE_CTRL_PENDING) {
 				status = AE_OK;
 				goto close_this_op;
 			}
 		}
 
-
-close_this_op:
+	      close_this_op:
 		/*
 		 * Finished one argument of the containing scope
 		 */
@@ -574,15 +642,15 @@ close_this_op:
 		/* Finished with pre_op */
 
 		if (pre_op) {
-			acpi_ps_free_op (pre_op);
+			acpi_ps_free_op(pre_op);
 			pre_op = NULL;
 		}
 
 		/* Close this Op (will result in parse subtree deletion) */
 
-		status2 = acpi_ps_complete_this_op (walk_state, op);
-		if (ACPI_FAILURE (status2)) {
-			return_ACPI_STATUS (status2);
+		status2 = acpi_ps_complete_this_op(walk_state, op);
+		if (ACPI_FAILURE(status2)) {
+			return_ACPI_STATUS(status2);
 		}
 		op = NULL;
 
@@ -590,68 +658,74 @@ close_this_op:
 		case AE_OK:
 			break;
 
-
 		case AE_CTRL_TRANSFER:
 
 			/* We are about to transfer to a called method. */
 
 			walk_state->prev_op = op;
 			walk_state->prev_arg_types = walk_state->arg_types;
-			return_ACPI_STATUS (status);
-
+			return_ACPI_STATUS(status);
 
 		case AE_CTRL_END:
 
-			acpi_ps_pop_scope (parser_state, &op,
-				&walk_state->arg_types, &walk_state->arg_count);
+			acpi_ps_pop_scope(parser_state, &op,
+					  &walk_state->arg_types,
+					  &walk_state->arg_count);
 
 			if (op) {
-				walk_state->op    = op;
-				walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+				walk_state->op = op;
+				walk_state->op_info =
+				    acpi_ps_get_opcode_info(op->common.
+							    aml_opcode);
 				walk_state->opcode = op->common.aml_opcode;
 
-				status = walk_state->ascending_callback (walk_state);
-				status = acpi_ps_next_parse_state (walk_state, op, status);
+				status =
+				    walk_state->ascending_callback(walk_state);
+				status =
+				    acpi_ps_next_parse_state(walk_state, op,
+							     status);
 
-				status2 = acpi_ps_complete_this_op (walk_state, op);
-				if (ACPI_FAILURE (status2)) {
-					return_ACPI_STATUS (status2);
+				status2 =
+				    acpi_ps_complete_this_op(walk_state, op);
+				if (ACPI_FAILURE(status2)) {
+					return_ACPI_STATUS(status2);
 				}
 				op = NULL;
 			}
 			status = AE_OK;
 			break;
 
-
 		case AE_CTRL_BREAK:
 		case AE_CTRL_CONTINUE:
 
 			/* Pop off scopes until we find the While */
 
 			while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
-				acpi_ps_pop_scope (parser_state, &op,
-					&walk_state->arg_types, &walk_state->arg_count);
+				acpi_ps_pop_scope(parser_state, &op,
+						  &walk_state->arg_types,
+						  &walk_state->arg_count);
 			}
 
 			/* Close this iteration of the While loop */
 
-			walk_state->op    = op;
-			walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+			walk_state->op = op;
+			walk_state->op_info =
+			    acpi_ps_get_opcode_info(op->common.aml_opcode);
 			walk_state->opcode = op->common.aml_opcode;
 
-			status = walk_state->ascending_callback (walk_state);
-			status = acpi_ps_next_parse_state (walk_state, op, status);
+			status = walk_state->ascending_callback(walk_state);
+			status =
+			    acpi_ps_next_parse_state(walk_state, op, status);
 
-			status2 = acpi_ps_complete_this_op (walk_state, op);
-			if (ACPI_FAILURE (status2)) {
-				return_ACPI_STATUS (status2);
+			status2 = acpi_ps_complete_this_op(walk_state, op);
+			if (ACPI_FAILURE(status2)) {
+				return_ACPI_STATUS(status2);
 			}
 			op = NULL;
 
 			status = AE_OK;
 			break;
 
-
 		case AE_CTRL_TERMINATE:
 
 			status = AE_OK;
@@ -659,61 +733,66 @@ close_this_op:
 			/* Clean up */
 			do {
 				if (op) {
-					status2 = acpi_ps_complete_this_op (walk_state, op);
-					if (ACPI_FAILURE (status2)) {
-						return_ACPI_STATUS (status2);
+					status2 =
+					    acpi_ps_complete_this_op(walk_state,
+								     op);
+					if (ACPI_FAILURE(status2)) {
+						return_ACPI_STATUS(status2);
 					}
 				}
-				acpi_ps_pop_scope (parser_state, &op,
-					&walk_state->arg_types, &walk_state->arg_count);
+				acpi_ps_pop_scope(parser_state, &op,
+						  &walk_state->arg_types,
+						  &walk_state->arg_count);
 
 			} while (op);
 
-			return_ACPI_STATUS (status);
+			return_ACPI_STATUS(status);
 
-
-		default:  /* All other non-AE_OK status */
+		default:	/* All other non-AE_OK status */
 
 			do {
 				if (op) {
-					status2 = acpi_ps_complete_this_op (walk_state, op);
-					if (ACPI_FAILURE (status2)) {
-						return_ACPI_STATUS (status2);
+					status2 =
+					    acpi_ps_complete_this_op(walk_state,
+								     op);
+					if (ACPI_FAILURE(status2)) {
+						return_ACPI_STATUS(status2);
 					}
 				}
-				acpi_ps_pop_scope (parser_state, &op,
-					&walk_state->arg_types, &walk_state->arg_count);
+				acpi_ps_pop_scope(parser_state, &op,
+						  &walk_state->arg_types,
+						  &walk_state->arg_count);
 
 			} while (op);
 
-
 			/*
 			 * TBD: Cleanup parse ops on error
 			 */
 #if 0
 			if (op == NULL) {
-				acpi_ps_pop_scope (parser_state, &op,
-					&walk_state->arg_types, &walk_state->arg_count);
+				acpi_ps_pop_scope(parser_state, &op,
+						  &walk_state->arg_types,
+						  &walk_state->arg_count);
 			}
 #endif
 			walk_state->prev_op = op;
 			walk_state->prev_arg_types = walk_state->arg_types;
-			return_ACPI_STATUS (status);
+			return_ACPI_STATUS(status);
 		}
 
 		/* This scope complete? */
 
-		if (acpi_ps_has_completed_scope (parser_state)) {
-			acpi_ps_pop_scope (parser_state, &op,
-				&walk_state->arg_types, &walk_state->arg_count);
-			ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
-		}
-		else {
+		if (acpi_ps_has_completed_scope(parser_state)) {
+			acpi_ps_pop_scope(parser_state, &op,
+					  &walk_state->arg_types,
+					  &walk_state->arg_count);
+			ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+					  "Popped scope, Op=%p\n", op));
+		} else {
 			op = NULL;
 		}
 
-	} /* while parser_state->Aml */
-
+	}			/* while parser_state->Aml */
 
 	/*
 	 * Complete the last Op (if not completed), and clear the scope stack.
@@ -721,16 +800,22 @@ close_this_op:
 	 * of open scopes (such as when several ASL blocks are closed with
 	 * sequential closing braces).  We want to terminate each one cleanly.
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
+			  op));
 	do {
 		if (op) {
 			if (walk_state->ascending_callback != NULL) {
-				walk_state->op    = op;
-				walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+				walk_state->op = op;
+				walk_state->op_info =
+				    acpi_ps_get_opcode_info(op->common.
+							    aml_opcode);
 				walk_state->opcode = op->common.aml_opcode;
 
-				status = walk_state->ascending_callback (walk_state);
-				status = acpi_ps_next_parse_state (walk_state, op, status);
+				status =
+				    walk_state->ascending_callback(walk_state);
+				status =
+				    acpi_ps_next_parse_state(walk_state, op,
+							     status);
 				if (status == AE_CTRL_PENDING) {
 					status = AE_OK;
 					goto close_this_op;
@@ -742,40 +827,48 @@ close_this_op:
 					/* Clean up */
 					do {
 						if (op) {
-							status2 = acpi_ps_complete_this_op (walk_state, op);
-							if (ACPI_FAILURE (status2)) {
-								return_ACPI_STATUS (status2);
+							status2 =
+							    acpi_ps_complete_this_op
+							    (walk_state, op);
+							if (ACPI_FAILURE
+							    (status2)) {
+								return_ACPI_STATUS
+								    (status2);
 							}
 						}
 
-						acpi_ps_pop_scope (parser_state, &op,
-							&walk_state->arg_types, &walk_state->arg_count);
+						acpi_ps_pop_scope(parser_state,
+								  &op,
+								  &walk_state->
+								  arg_types,
+								  &walk_state->
+								  arg_count);
 
 					} while (op);
 
-					return_ACPI_STATUS (status);
+					return_ACPI_STATUS(status);
 				}
 
-				else if (ACPI_FAILURE (status)) {
+				else if (ACPI_FAILURE(status)) {
 					/* First error is most important */
 
-					(void) acpi_ps_complete_this_op (walk_state, op);
-					return_ACPI_STATUS (status);
+					(void)
+					    acpi_ps_complete_this_op(walk_state,
+								     op);
+					return_ACPI_STATUS(status);
 				}
 			}
 
-			status2 = acpi_ps_complete_this_op (walk_state, op);
-			if (ACPI_FAILURE (status2)) {
-				return_ACPI_STATUS (status2);
+			status2 = acpi_ps_complete_this_op(walk_state, op);
+			if (ACPI_FAILURE(status2)) {
+				return_ACPI_STATUS(status2);
 			}
 		}
 
-		acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
-			&walk_state->arg_count);
+		acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types,
+				  &walk_state->arg_count);
 
 	} while (op);
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 509 - 210
drivers/acpi/parser/psopcode.c

@@ -41,16 +41,13 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acopcode.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("psopcode")
-
+ACPI_MODULE_NAME("psopcode")
 
 /*******************************************************************************
  *
@@ -62,7 +59,6 @@
  *              the operand type.
  *
  ******************************************************************************/
-
 /*
  * Summary of opcode types/flags
  *
@@ -180,156 +176,468 @@
 	AML_CREATE_QWORD_FIELD_OP
 
  ******************************************************************************/
-
-
 /*
  * Master Opcode information table.  A summary of everything we know about each
  * opcode, all in one place.
  */
-const struct acpi_opcode_info     acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
-{
+const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
 /*! [Begin] no source code translation */
 /* Index           Name                 Parser Args               Interpreter Args                ObjectType                    Class                      Type                  Flags */
 
-/* 00 */ ACPI_OP ("Zero",               ARGP_ZERO_OP,              ARGI_ZERO_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
-/* 01 */ ACPI_OP ("One",                ARGP_ONE_OP,               ARGI_ONE_OP,                ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
-/* 02 */ ACPI_OP ("Alias",              ARGP_ALIAS_OP,             ARGI_ALIAS_OP,              ACPI_TYPE_LOCAL_ALIAS,       AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 03 */ ACPI_OP ("Name",               ARGP_NAME_OP,              ARGI_NAME_OP,               ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,   AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 04 */ ACPI_OP ("ByteConst",          ARGP_BYTE_OP,              ARGI_BYTE_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 05 */ ACPI_OP ("WordConst",          ARGP_WORD_OP,              ARGI_WORD_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 06 */ ACPI_OP ("DwordConst",         ARGP_DWORD_OP,             ARGI_DWORD_OP,              ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 07 */ ACPI_OP ("String",             ARGP_STRING_OP,            ARGI_STRING_OP,             ACPI_TYPE_STRING,            AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 08 */ ACPI_OP ("Scope",              ARGP_SCOPE_OP,             ARGI_SCOPE_OP,              ACPI_TYPE_LOCAL_SCOPE,       AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 09 */ ACPI_OP ("Buffer",             ARGP_BUFFER_OP,            ARGI_BUFFER_OP,             ACPI_TYPE_BUFFER,            AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
-/* 0A */ ACPI_OP ("Package",            ARGP_PACKAGE_OP,           ARGI_PACKAGE_OP,            ACPI_TYPE_PACKAGE,           AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
-/* 0B */ ACPI_OP ("Method",             ARGP_METHOD_OP,            ARGI_METHOD_OP,             ACPI_TYPE_METHOD,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,   AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
-/* 0C */ ACPI_OP ("Local0",             ARGP_LOCAL0,               ARGI_LOCAL0,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 0D */ ACPI_OP ("Local1",             ARGP_LOCAL1,               ARGI_LOCAL1,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 0E */ ACPI_OP ("Local2",             ARGP_LOCAL2,               ARGI_LOCAL2,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 0F */ ACPI_OP ("Local3",             ARGP_LOCAL3,               ARGI_LOCAL3,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 10 */ ACPI_OP ("Local4",             ARGP_LOCAL4,               ARGI_LOCAL4,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 11 */ ACPI_OP ("Local5",             ARGP_LOCAL5,               ARGI_LOCAL5,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 12 */ ACPI_OP ("Local6",             ARGP_LOCAL6,               ARGI_LOCAL6,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 13 */ ACPI_OP ("Local7",             ARGP_LOCAL7,               ARGI_LOCAL7,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 14 */ ACPI_OP ("Arg0",               ARGP_ARG0,                 ARGI_ARG0,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 15 */ ACPI_OP ("Arg1",               ARGP_ARG1,                 ARGI_ARG1,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 16 */ ACPI_OP ("Arg2",               ARGP_ARG2,                 ARGI_ARG2,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 17 */ ACPI_OP ("Arg3",               ARGP_ARG3,                 ARGI_ARG3,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 18 */ ACPI_OP ("Arg4",               ARGP_ARG4,                 ARGI_ARG4,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 19 */ ACPI_OP ("Arg5",               ARGP_ARG5,                 ARGI_ARG5,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 1A */ ACPI_OP ("Arg6",               ARGP_ARG6,                 ARGI_ARG6,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 1B */ ACPI_OP ("Store",              ARGP_STORE_OP,             ARGI_STORE_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R),
-/* 1C */ ACPI_OP ("RefOf",              ARGP_REF_OF_OP,            ARGI_REF_OF_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R),
-/* 1D */ ACPI_OP ("Add",                ARGP_ADD_OP,               ARGI_ADD_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 1E */ ACPI_OP ("Concatenate",        ARGP_CONCAT_OP,            ARGI_CONCAT_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 1F */ ACPI_OP ("Subtract",           ARGP_SUBTRACT_OP,          ARGI_SUBTRACT_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 20 */ ACPI_OP ("Increment",          ARGP_INCREMENT_OP,         ARGI_INCREMENT_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
-/* 21 */ ACPI_OP ("Decrement",          ARGP_DECREMENT_OP,         ARGI_DECREMENT_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
-/* 22 */ ACPI_OP ("Multiply",           ARGP_MULTIPLY_OP,          ARGI_MULTIPLY_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 23 */ ACPI_OP ("Divide",             ARGP_DIVIDE_OP,            ARGI_DIVIDE_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_2T_1R,   AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT),
-/* 24 */ ACPI_OP ("ShiftLeft",          ARGP_SHIFT_LEFT_OP,        ARGI_SHIFT_LEFT_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 25 */ ACPI_OP ("ShiftRight",         ARGP_SHIFT_RIGHT_OP,       ARGI_SHIFT_RIGHT_OP,        ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 26 */ ACPI_OP ("And",                ARGP_BIT_AND_OP,           ARGI_BIT_AND_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 27 */ ACPI_OP ("NAnd",               ARGP_BIT_NAND_OP,          ARGI_BIT_NAND_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 28 */ ACPI_OP ("Or",                 ARGP_BIT_OR_OP,            ARGI_BIT_OR_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 29 */ ACPI_OP ("NOr",                ARGP_BIT_NOR_OP,           ARGI_BIT_NOR_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 2A */ ACPI_OP ("XOr",                ARGP_BIT_XOR_OP,           ARGI_BIT_XOR_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 2B */ ACPI_OP ("Not",                ARGP_BIT_NOT_OP,           ARGI_BIT_NOT_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 2C */ ACPI_OP ("FindSetLeftBit",     ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP,  ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 2D */ ACPI_OP ("FindSetRightBit",    ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 2E */ ACPI_OP ("DerefOf",            ARGP_DEREF_OF_OP,          ARGI_DEREF_OF_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R),
-/* 2F */ ACPI_OP ("Notify",             ARGP_NOTIFY_OP,            ARGI_NOTIFY_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_0R,   AML_FLAGS_EXEC_2A_0T_0R),
-/* 30 */ ACPI_OP ("SizeOf",             ARGP_SIZE_OF_OP,           ARGI_SIZE_OF_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
-/* 31 */ ACPI_OP ("Index",              ARGP_INDEX_OP,             ARGI_INDEX_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R),
-/* 32 */ ACPI_OP ("Match",              ARGP_MATCH_OP,             ARGI_MATCH_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_6A_0T_1R,   AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
-/* 33 */ ACPI_OP ("CreateDWordField",   ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 34 */ ACPI_OP ("CreateWordField",    ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP,  ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 35 */ ACPI_OP ("CreateByteField",    ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP,  ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 36 */ ACPI_OP ("CreateBitField",     ARGP_CREATE_BIT_FIELD_OP,  ARGI_CREATE_BIT_FIELD_OP,   ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 37 */ ACPI_OP ("ObjectType",         ARGP_TYPE_OP,              ARGI_TYPE_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
-/* 38 */ ACPI_OP ("LAnd",               ARGP_LAND_OP,              ARGI_LAND_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
-/* 39 */ ACPI_OP ("LOr",                ARGP_LOR_OP,               ARGI_LOR_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
-/* 3A */ ACPI_OP ("LNot",               ARGP_LNOT_OP,              ARGI_LNOT_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
-/* 3B */ ACPI_OP ("LEqual",             ARGP_LEQUAL_OP,            ARGI_LEQUAL_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
-/* 3C */ ACPI_OP ("LGreater",           ARGP_LGREATER_OP,          ARGI_LGREATER_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
-/* 3D */ ACPI_OP ("LLess",              ARGP_LLESS_OP,             ARGI_LLESS_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
-/* 3E */ ACPI_OP ("If",                 ARGP_IF_OP,                ARGI_IF_OP,                 ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 3F */ ACPI_OP ("Else",               ARGP_ELSE_OP,              ARGI_ELSE_OP,               ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 40 */ ACPI_OP ("While",              ARGP_WHILE_OP,             ARGI_WHILE_OP,              ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 41 */ ACPI_OP ("Noop",               ARGP_NOOP_OP,              ARGI_NOOP_OP,               ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 42 */ ACPI_OP ("Return",             ARGP_RETURN_OP,            ARGI_RETURN_OP,             ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 43 */ ACPI_OP ("Break",              ARGP_BREAK_OP,             ARGI_BREAK_OP,              ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 44 */ ACPI_OP ("BreakPoint",         ARGP_BREAK_POINT_OP,       ARGI_BREAK_POINT_OP,        ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 45 */ ACPI_OP ("Ones",               ARGP_ONES_OP,              ARGI_ONES_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
+/* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER,
+			 AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+/* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER,
+			 AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+/* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP,
+			 ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_SIMPLE,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP,
+			 ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LITERAL, AML_CONSTANT),
+/* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP,
+			 ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LITERAL, AML_CONSTANT),
+/* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP,
+			 ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LITERAL, AML_CONSTANT),
+/* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP,
+			 ACPI_TYPE_STRING, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LITERAL, AML_CONSTANT),
+/* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
+			 ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_NO_OBJ,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP,
+			 ACPI_TYPE_BUFFER, AML_CLASS_CREATE,
+			 AML_TYPE_CREATE_OBJECT,
+			 AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
+/* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP,
+			 ACPI_TYPE_PACKAGE, AML_CLASS_CREATE,
+			 AML_TYPE_CREATE_OBJECT,
+			 AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
+/* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP,
+			 ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_COMPLEX,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LOCAL_VARIABLE, 0),
+/* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_METHOD_ARGUMENT, 0),
+/* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_METHOD_ARGUMENT, 0),
+/* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_METHOD_ARGUMENT, 0),
+/* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_METHOD_ARGUMENT, 0),
+/* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_METHOD_ARGUMENT, 0),
+/* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R),
+/* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
+			 AML_FLAGS_EXEC_1A_0T_1R),
+/* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_1R,
+			 AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_1R,
+			 AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_2T_1R,
+			 AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT),
+/* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP,
+			 ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,
+			 ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
+/* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_1R,
+			 AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
+/* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R),
+/* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R,
+			 AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
+/* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,
+			 ARGI_CREATE_DWORD_FIELD_OP,
+			 ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+			 AML_TYPE_CREATE_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+			 AML_DEFER | AML_CREATE),
+/* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP,
+			 ARGI_CREATE_WORD_FIELD_OP,
+			 ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+			 AML_TYPE_CREATE_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+			 AML_DEFER | AML_CREATE),
+/* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP,
+			 ARGI_CREATE_BYTE_FIELD_OP,
+			 ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+			 AML_TYPE_CREATE_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+			 AML_DEFER | AML_CREATE),
+/* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP,
+			 ARGI_CREATE_BIT_FIELD_OP,
+			 ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+			 AML_TYPE_CREATE_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+			 AML_DEFER | AML_CREATE),
+/* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_1R,
+			 AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
+/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+			 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
+			 AML_CONSTANT),
+/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+			 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
+			 AML_CONSTANT),
+/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
+			 AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_0T_1R,
+			 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_0T_1R,
+			 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+			 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_CONTROL,
+			 AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER,
+			 AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
 
 /* Prefixed opcodes (Two-byte opcodes with a prefix op) */
 
-/* 46 */ ACPI_OP ("Mutex",              ARGP_MUTEX_OP,             ARGI_MUTEX_OP,              ACPI_TYPE_MUTEX,             AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 47 */ ACPI_OP ("Event",              ARGP_EVENT_OP,             ARGI_EVENT_OP,              ACPI_TYPE_EVENT,             AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
-/* 48 */ ACPI_OP ("CondRefOf",          ARGP_COND_REF_OF_OP,       ARGI_COND_REF_OF_OP,        ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R),
-/* 49 */ ACPI_OP ("CreateField",        ARGP_CREATE_FIELD_OP,      ARGI_CREATE_FIELD_OP,       ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE),
-/* 4A */ ACPI_OP ("Load",               ARGP_LOAD_OP,              ARGI_LOAD_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_0R,   AML_FLAGS_EXEC_1A_1T_0R),
-/* 4B */ ACPI_OP ("Stall",              ARGP_STALL_OP,             ARGI_STALL_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 4C */ ACPI_OP ("Sleep",              ARGP_SLEEP_OP,             ARGI_SLEEP_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 4D */ ACPI_OP ("Acquire",            ARGP_ACQUIRE_OP,           ARGI_ACQUIRE_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R),
-/* 4E */ ACPI_OP ("Signal",             ARGP_SIGNAL_OP,            ARGI_SIGNAL_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 4F */ ACPI_OP ("Wait",               ARGP_WAIT_OP,              ARGI_WAIT_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R),
-/* 50 */ ACPI_OP ("Reset",              ARGP_RESET_OP,             ARGI_RESET_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 51 */ ACPI_OP ("Release",            ARGP_RELEASE_OP,           ARGI_RELEASE_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 52 */ ACPI_OP ("FromBCD",            ARGP_FROM_BCD_OP,          ARGI_FROM_BCD_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 53 */ ACPI_OP ("ToBCD",              ARGP_TO_BCD_OP,            ARGI_TO_BCD_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 54 */ ACPI_OP ("Unload",             ARGP_UNLOAD_OP,            ARGI_UNLOAD_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 55 */ ACPI_OP ("Revision",           ARGP_REVISION_OP,          ARGI_REVISION_OP,           ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        0),
-/* 56 */ ACPI_OP ("Debug",              ARGP_DEBUG_OP,             ARGI_DEBUG_OP,              ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        0),
-/* 57 */ ACPI_OP ("Fatal",              ARGP_FATAL_OP,             ARGI_FATAL_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_3A_0T_0R,   AML_FLAGS_EXEC_3A_0T_0R),
-/* 58 */ ACPI_OP ("OperationRegion",    ARGP_REGION_OP,            ARGI_REGION_OP,             ACPI_TYPE_REGION,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,   AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
-/* 59 */ ACPI_OP ("Field",              ARGP_FIELD_OP,             ARGI_FIELD_OP,              ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_FIELD,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
-/* 5A */ ACPI_OP ("Device",             ARGP_DEVICE_OP,            ARGI_DEVICE_OP,             ACPI_TYPE_DEVICE,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5B */ ACPI_OP ("Processor",          ARGP_PROCESSOR_OP,         ARGI_PROCESSOR_OP,          ACPI_TYPE_PROCESSOR,         AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5C */ ACPI_OP ("PowerResource",      ARGP_POWER_RES_OP,         ARGI_POWER_RES_OP,          ACPI_TYPE_POWER,             AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5D */ ACPI_OP ("ThermalZone",        ARGP_THERMAL_ZONE_OP,      ARGI_THERMAL_ZONE_OP,       ACPI_TYPE_THERMAL,           AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5E */ ACPI_OP ("IndexField",         ARGP_INDEX_FIELD_OP,       ARGI_INDEX_FIELD_OP,        ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_FIELD,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
-/* 5F */ ACPI_OP ("BankField",          ARGP_BANK_FIELD_OP,        ARGI_BANK_FIELD_OP,         ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_FIELD,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX,
+			 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT,
+			 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
+			 AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP,
+			 ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,
+			 AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+			 AML_DEFER | AML_FIELD | AML_CREATE),
+/* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R,
+			 AML_FLAGS_EXEC_1A_1T_0R),
+/* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
+			 AML_FLAGS_EXEC_1A_0T_0R),
+/* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
+			 AML_FLAGS_EXEC_1A_0T_0R),
+/* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+			 AML_FLAGS_EXEC_2A_0T_1R),
+/* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
+			 AML_FLAGS_EXEC_1A_0T_0R),
+/* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP,
+			 ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+			 AML_TYPE_CONSTANT, 0),
+/* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_CONSTANT, 0),
+/* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R,
+			 AML_FLAGS_EXEC_3A_0T_0R),
+/* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP,
+			 ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_COMPLEX,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_FIELD),
+/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP,
+			 ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_NO_OBJ,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP,
+			 ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_SIMPLE,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP,
+			 ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_SIMPLE,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP,
+			 ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL,
+			 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_FIELD),
+/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_FIELD),
 
 /* Internal opcodes that map to invalid AML opcodes */
 
-/* 60 */ ACPI_OP ("LNotEqual",          ARGP_LNOTEQUAL_OP,         ARGI_LNOTEQUAL_OP,          ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_HAS_ARGS | AML_CONSTANT),
-/* 61 */ ACPI_OP ("LLessEqual",         ARGP_LLESSEQUAL_OP,        ARGI_LLESSEQUAL_OP,         ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_HAS_ARGS | AML_CONSTANT),
-/* 62 */ ACPI_OP ("LGreaterEqual",      ARGP_LGREATEREQUAL_OP,     ARGI_LGREATEREQUAL_OP,      ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_HAS_ARGS | AML_CONSTANT),
-/* 63 */ ACPI_OP ("-NamePath-",         ARGP_NAMEPATH_OP,          ARGI_NAMEPATH_OP,           ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_NSOBJECT | AML_NSNODE ),
-/* 64 */ ACPI_OP ("-MethodCall-",       ARGP_METHODCALL_OP,        ARGI_METHODCALL_OP,         ACPI_TYPE_METHOD,            AML_CLASS_METHOD_CALL,     AML_TYPE_METHOD_CALL,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
-/* 65 */ ACPI_OP ("-ByteList-",         ARGP_BYTELIST_OP,          ARGI_BYTELIST_OP,           ACPI_TYPE_ANY,               AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         0),
-/* 66 */ ACPI_OP ("-ReservedField-",    ARGP_RESERVEDFIELD_OP,     ARGI_RESERVEDFIELD_OP,      ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           0),
-/* 67 */ ACPI_OP ("-NamedField-",       ARGP_NAMEDFIELD_OP,        ARGI_NAMEDFIELD_OP,         ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
-/* 68 */ ACPI_OP ("-AccessField-",      ARGP_ACCESSFIELD_OP,       ARGI_ACCESSFIELD_OP,        ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           0),
-/* 69 */ ACPI_OP ("-StaticString",      ARGP_STATICSTRING_OP,      ARGI_STATICSTRING_OP,       ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           0),
-/* 6A */ ACPI_OP ("-Return Value-",     ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_ANY,               AML_CLASS_RETURN_VALUE,    AML_TYPE_RETURN,          AML_HAS_ARGS | AML_HAS_RETVAL),
-/* 6B */ ACPI_OP ("-UNKNOWN_OP-",       ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_INVALID,           AML_CLASS_UNKNOWN,         AML_TYPE_BOGUS,           AML_HAS_ARGS),
-/* 6C */ ACPI_OP ("-ASCII_ONLY-",       ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_ANY,               AML_CLASS_ASCII,           AML_TYPE_BOGUS,           AML_HAS_ARGS),
-/* 6D */ ACPI_OP ("-PREFIX_ONLY-",      ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_ANY,               AML_CLASS_PREFIX,          AML_TYPE_BOGUS,           AML_HAS_ARGS),
+/* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
+			 AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
+			 AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP,
+			 ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_INTERNAL, AML_TYPE_BOGUS,
+			 AML_HAS_ARGS | AML_CONSTANT),
+/* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP,
+			 ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE),
+/* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP,
+			 ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL,
+			 AML_TYPE_METHOD_CALL,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
+/* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LITERAL, 0),
+/* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP,
+			 ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
+			 AML_TYPE_BOGUS,
+			 AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP,
+			 ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP,
+			 ARGI_STATICSTRING_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
+			 AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN,
+			 AML_HAS_ARGS | AML_HAS_RETVAL),
+/* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID,
+			 AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
+			 AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
+			 AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
 
 /* ACPI 2.0 opcodes */
 
-/* 6E */ ACPI_OP ("QwordConst",         ARGP_QWORD_OP,             ARGI_QWORD_OP,              ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 6F */ ACPI_OP ("Package", /* Var */  ARGP_VAR_PACKAGE_OP,       ARGI_VAR_PACKAGE_OP,        ACPI_TYPE_PACKAGE,           AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER),
-/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,    ARGI_CONCAT_RES_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 71 */ ACPI_OP ("Mod",                ARGP_MOD_OP,               ARGI_MOD_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 72 */ ACPI_OP ("CreateQWordField",   ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 73 */ ACPI_OP ("ToBuffer",           ARGP_TO_BUFFER_OP,         ARGI_TO_BUFFER_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 74 */ ACPI_OP ("ToDecimalString",    ARGP_TO_DEC_STR_OP,        ARGI_TO_DEC_STR_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 75 */ ACPI_OP ("ToHexString",        ARGP_TO_HEX_STR_OP,        ARGI_TO_HEX_STR_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 76 */ ACPI_OP ("ToInteger",          ARGP_TO_INTEGER_OP,        ARGI_TO_INTEGER_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 77 */ ACPI_OP ("ToString",           ARGP_TO_STRING_OP,         ARGI_TO_STRING_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 78 */ ACPI_OP ("CopyObject",         ARGP_COPY_OP,              ARGI_COPY_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R),
-/* 79 */ ACPI_OP ("Mid",                ARGP_MID_OP,               ARGI_MID_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_3A_1T_1R,   AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
-/* 7A */ ACPI_OP ("Continue",           ARGP_CONTINUE_OP,          ARGI_CONTINUE_OP,           ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 7B */ ACPI_OP ("LoadTable",          ARGP_LOAD_TABLE_OP,        ARGI_LOAD_TABLE_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_6A_0T_1R,   AML_FLAGS_EXEC_6A_0T_1R),
-/* 7C */ ACPI_OP ("DataTableRegion",    ARGP_DATA_REGION_OP,       ARGI_DATA_REGION_OP,        ACPI_TYPE_REGION,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 7D */ ACPI_OP ("[EvalSubTree]",      ARGP_SCOPE_OP,             ARGI_SCOPE_OP,              ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
+/* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP,
+			 ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+			 AML_TYPE_LITERAL, AML_CONSTANT),
+	/* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP,
+			 ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE,
+			 AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT,
+			 AML_HAS_ARGS | AML_DEFER),
+/* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,
+			 ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,
+			 ARGI_CREATE_QWORD_FIELD_OP,
+			 ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+			 AML_TYPE_CREATE_FIELD,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+			 AML_DEFER | AML_CREATE),
+/* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP,
+			 ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_1T_1R,
+			 AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_2A_1T_1R,
+			 AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R,
+			 AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
+/* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+			 AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
+/* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP,
+			 ARGI_DATA_REGION_OP, ACPI_TYPE_REGION,
+			 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE | AML_NAMED),
+/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
+			 ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
+			 AML_TYPE_NAMED_NO_OBJ,
+			 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+			 AML_NSNODE),
 
 /* ACPI 3.0 opcodes */
 
-/* 7E */ ACPI_OP ("Timer",              ARGP_TIMER_OP,             ARGI_TIMER_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_0A_0T_1R,   AML_FLAGS_EXEC_0A_0T_1R)
+/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY,
+			 AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R,
+			 AML_FLAGS_EXEC_0A_0T_1R)
 
 /*! [End] no source code translation !*/
 };
@@ -338,73 +646,70 @@ const struct acpi_opcode_info     acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
  * This table is directly indexed by the opcodes, and returns an
  * index into the table above
  */
-static const u8 acpi_gbl_short_op_index[256] =
-{
+static const u8 acpi_gbl_short_op_index[256] = {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
-/* 0x00 */	0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
-/* 0x08 */	0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
-/* 0x10 */	0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
-/* 0x18 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x20 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x28 */	_UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
-/* 0x30 */	0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
-/* 0x38 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x40 */	_UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x48 */	_ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x50 */	_ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x58 */	_ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
-/* 0x60 */	0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
-/* 0x68 */	0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
-/* 0x70 */	0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
-/* 0x78 */	0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
-/* 0x80 */	0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
-/* 0x88 */	0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
-/* 0x90 */	0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
-/* 0x98 */	0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
-/* 0xA0 */	0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
-/* 0xA8 */	0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xB0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xB8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xC0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xC8 */	_UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
-/* 0xD0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xD8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xE0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xE8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xF0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xF8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
+/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
+/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
+/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
+/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
+/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
+/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
+/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
+/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
+/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
+/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
+/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
+/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
+/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
+/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
+/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
+/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
+/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
 };
 
 /*
  * This table is indexed by the second opcode of the extended opcode
  * pair.  It returns an index into the opcode table (acpi_gbl_aml_op_info)
  */
-static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
-{
+static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
-/* 0x00 */	_UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x08 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x10 */	_UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
-/* 0x18 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
-/* 0x20 */	0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
-/* 0x28 */	0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x30 */	0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
-/* 0x38 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x40 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x48 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x50 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x58 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x60 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x68 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x70 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x78 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x80 */	0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
-/* 0x88 */	0x7C,
+/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
+/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
+/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
+/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
+/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+/* 0x88 */ 0x7C,
 };
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_opcode_info
@@ -418,12 +723,9 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
  *
  ******************************************************************************/
 
-const struct acpi_opcode_info *
-acpi_ps_get_opcode_info (
-	u16                             opcode)
+const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 {
-	ACPI_FUNCTION_NAME ("ps_get_opcode_info");
-
+	ACPI_FUNCTION_NAME("ps_get_opcode_info");
 
 	/*
 	 * Detect normal 8-bit opcode or extended 16-bit opcode
@@ -431,25 +733,26 @@ acpi_ps_get_opcode_info (
 	if (!(opcode & 0xFF00)) {
 		/* Simple (8-bit) opcode: 0-255, can't index beyond table  */
 
-		return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]);
+		return (&acpi_gbl_aml_op_info
+			[acpi_gbl_short_op_index[(u8) opcode]]);
 	}
 
 	if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
-		(((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
+	    (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
 		/* Valid extended (16-bit) opcode */
 
-		return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
+		return (&acpi_gbl_aml_op_info
+			[acpi_gbl_long_op_index[(u8) opcode]]);
 	}
 
 	/* Unknown AML opcode */
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-		"Unknown AML opcode [%4.4X]\n", opcode));
+	ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			  "Unknown AML opcode [%4.4X]\n", opcode));
 
-	return (&acpi_gbl_aml_op_info [_UNK]);
+	return (&acpi_gbl_aml_op_info[_UNK]);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_opcode_name
@@ -463,16 +766,13 @@ acpi_ps_get_opcode_info (
  *
  ******************************************************************************/
 
-char *
-acpi_ps_get_opcode_name (
-	u16                             opcode)
+char *acpi_ps_get_opcode_name(u16 opcode)
 {
 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
 
-	const struct acpi_opcode_info   *op;
-
+	const struct acpi_opcode_info *op;
 
-	op = acpi_ps_get_opcode_info (opcode);
+	op = acpi_ps_get_opcode_info(opcode);
 
 	/* Always guaranteed to return a valid pointer */
 
@@ -483,4 +783,3 @@ acpi_ps_get_opcode_name (
 
 #endif
 }
-

+ 185 - 177
drivers/acpi/parser/psparse.c

@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * Parse the AML and build an operation tree as most interpreters,
  * like Perl, do.  Parsing is done by hand rather than with a YACC
@@ -59,8 +58,7 @@
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("psparse")
-
+ACPI_MODULE_NAME("psparse")
 
 /*******************************************************************************
  *
@@ -73,10 +71,7 @@
  * DESCRIPTION: Get the size of the current opcode.
  *
  ******************************************************************************/
-
-u32
-acpi_ps_get_opcode_size (
-	u32                             opcode)
+u32 acpi_ps_get_opcode_size(u32 opcode)
 {
 
 	/* Extended (2-byte) opcode if > 255 */
@@ -90,7 +85,6 @@ acpi_ps_get_opcode_size (
 	return (1);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_peek_opcode
@@ -103,28 +97,24 @@ acpi_ps_get_opcode_size (
  *
  ******************************************************************************/
 
-u16
-acpi_ps_peek_opcode (
-	struct acpi_parse_state         *parser_state)
+u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
 {
-	u8                              *aml;
-	u16                             opcode;
-
+	u8 *aml;
+	u16 opcode;
 
 	aml = parser_state->aml;
-	opcode = (u16) ACPI_GET8 (aml);
+	opcode = (u16) ACPI_GET8(aml);
 
 	if (opcode == AML_EXTENDED_OP_PREFIX) {
 		/* Extended opcode, get the second opcode byte */
 
 		aml++;
-		opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml));
+		opcode = (u16) ((opcode << 8) | ACPI_GET8(aml));
 	}
 
 	return (opcode);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_complete_this_op
@@ -139,30 +129,28 @@ acpi_ps_peek_opcode (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_complete_this_op (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *op)
+acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
+			 union acpi_parse_object * op)
 {
-	union acpi_parse_object         *prev;
-	union acpi_parse_object         *next;
-	const struct acpi_opcode_info   *parent_info;
-	union acpi_parse_object         *replacement_op = NULL;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ps_complete_this_op", op);
+	union acpi_parse_object *prev;
+	union acpi_parse_object *next;
+	const struct acpi_opcode_info *parent_info;
+	union acpi_parse_object *replacement_op = NULL;
 
+	ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op);
 
 	/* Check for null Op, can happen if AML code is corrupt */
 
 	if (!op) {
-		return_ACPI_STATUS (AE_OK);  /* OK for now */
+		return_ACPI_STATUS(AE_OK);	/* OK for now */
 	}
 
 	/* Delete this op and the subtree below it if asked to */
 
-	if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
-		 (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
-		return_ACPI_STATUS (AE_OK);
+	if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) !=
+	     ACPI_PARSE_DELETE_TREE)
+	    || (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	/* Make sure that we only delete this subtree */
@@ -179,7 +167,9 @@ acpi_ps_complete_this_op (
 		 * Check if we need to replace the operator and its subtree
 		 * with a return value op (placeholder op)
 		 */
-		parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
+		parent_info =
+		    acpi_ps_get_opcode_info(op->common.parent->common.
+					    aml_opcode);
 
 		switch (parent_info->class) {
 		case AML_CLASS_CONTROL:
@@ -191,7 +181,8 @@ acpi_ps_complete_this_op (
 			 * These opcodes contain term_arg operands. The current
 			 * op must be replaced by a placeholder return op
 			 */
-			replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
+			replacement_op =
+			    acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
 			if (!replacement_op) {
 				goto allocate_error;
 			}
@@ -203,35 +194,49 @@ acpi_ps_complete_this_op (
 			 * These opcodes contain term_arg operands. The current
 			 * op must be replaced by a placeholder return op
 			 */
-			if ((op->common.parent->common.aml_opcode == AML_REGION_OP)      ||
-				(op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
-				(op->common.parent->common.aml_opcode == AML_BUFFER_OP)      ||
-				(op->common.parent->common.aml_opcode == AML_PACKAGE_OP)     ||
-				(op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
-				replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
+			if ((op->common.parent->common.aml_opcode ==
+			     AML_REGION_OP)
+			    || (op->common.parent->common.aml_opcode ==
+				AML_DATA_REGION_OP)
+			    || (op->common.parent->common.aml_opcode ==
+				AML_BUFFER_OP)
+			    || (op->common.parent->common.aml_opcode ==
+				AML_PACKAGE_OP)
+			    || (op->common.parent->common.aml_opcode ==
+				AML_VAR_PACKAGE_OP)) {
+				replacement_op =
+				    acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
 				if (!replacement_op) {
 					goto allocate_error;
 				}
-			}
-			else if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
-					 (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
-				if ((op->common.aml_opcode == AML_BUFFER_OP) ||
-					(op->common.aml_opcode == AML_PACKAGE_OP) ||
-					(op->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
-					replacement_op = acpi_ps_alloc_op (op->common.aml_opcode);
+			} else
+			    if ((op->common.parent->common.aml_opcode ==
+				 AML_NAME_OP)
+				&& (walk_state->pass_number <=
+				    ACPI_IMODE_LOAD_PASS2)) {
+				if ((op->common.aml_opcode == AML_BUFFER_OP)
+				    || (op->common.aml_opcode == AML_PACKAGE_OP)
+				    || (op->common.aml_opcode ==
+					AML_VAR_PACKAGE_OP)) {
+					replacement_op =
+					    acpi_ps_alloc_op(op->common.
+							     aml_opcode);
 					if (!replacement_op) {
 						goto allocate_error;
 					}
 
-					replacement_op->named.data = op->named.data;
-					replacement_op->named.length = op->named.length;
+					replacement_op->named.data =
+					    op->named.data;
+					replacement_op->named.length =
+					    op->named.length;
 				}
 			}
 			break;
 
 		default:
 
-			replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
+			replacement_op =
+			    acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
 			if (!replacement_op) {
 				goto allocate_error;
 			}
@@ -243,59 +248,64 @@ acpi_ps_complete_this_op (
 			/* This op is the first in the list */
 
 			if (replacement_op) {
-				replacement_op->common.parent       = op->common.parent;
-				replacement_op->common.value.arg    = NULL;
-				replacement_op->common.node         = op->common.node;
-				op->common.parent->common.value.arg = replacement_op;
-				replacement_op->common.next         = op->common.next;
-			}
-			else {
-				op->common.parent->common.value.arg = op->common.next;
+				replacement_op->common.parent =
+				    op->common.parent;
+				replacement_op->common.value.arg = NULL;
+				replacement_op->common.node = op->common.node;
+				op->common.parent->common.value.arg =
+				    replacement_op;
+				replacement_op->common.next = op->common.next;
+			} else {
+				op->common.parent->common.value.arg =
+				    op->common.next;
 			}
 		}
 
 		/* Search the parent list */
 
-		else while (prev) {
-			/* Traverse all siblings in the parent's argument list */
-
-			next = prev->common.next;
-			if (next == op) {
-				if (replacement_op) {
-					replacement_op->common.parent   = op->common.parent;
-					replacement_op->common.value.arg = NULL;
-					replacement_op->common.node     = op->common.node;
-					prev->common.next               = replacement_op;
-					replacement_op->common.next     = op->common.next;
-					next = NULL;
-				}
-				else {
-					prev->common.next = op->common.next;
-					next = NULL;
+		else
+			while (prev) {
+				/* Traverse all siblings in the parent's argument list */
+
+				next = prev->common.next;
+				if (next == op) {
+					if (replacement_op) {
+						replacement_op->common.parent =
+						    op->common.parent;
+						replacement_op->common.value.
+						    arg = NULL;
+						replacement_op->common.node =
+						    op->common.node;
+						prev->common.next =
+						    replacement_op;
+						replacement_op->common.next =
+						    op->common.next;
+						next = NULL;
+					} else {
+						prev->common.next =
+						    op->common.next;
+						next = NULL;
+					}
 				}
+				prev = next;
 			}
-			prev = next;
-		}
 	}
 
-
-cleanup:
+      cleanup:
 
 	/* Now we can actually delete the subtree rooted at Op */
 
-	acpi_ps_delete_parse_tree (op);
-	return_ACPI_STATUS (AE_OK);
+	acpi_ps_delete_parse_tree(op);
+	return_ACPI_STATUS(AE_OK);
 
-
-allocate_error:
+      allocate_error:
 
 	/* Always delete the subtree, even on error */
 
-	acpi_ps_delete_parse_tree (op);
-	return_ACPI_STATUS (AE_NO_MEMORY);
+	acpi_ps_delete_parse_tree(op);
+	return_ACPI_STATUS(AE_NO_MEMORY);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_next_parse_state
@@ -312,17 +322,14 @@ allocate_error:
  ******************************************************************************/
 
 acpi_status
-acpi_ps_next_parse_state (
-	struct acpi_walk_state          *walk_state,
-	union acpi_parse_object         *op,
-	acpi_status                     callback_status)
+acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
+			 union acpi_parse_object *op,
+			 acpi_status callback_status)
 {
-	struct acpi_parse_state         *parser_state = &walk_state->parser_state;
-	acpi_status                     status = AE_CTRL_PENDING;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ps_next_parse_state", op);
+	struct acpi_parse_state *parser_state = &walk_state->parser_state;
+	acpi_status status = AE_CTRL_PENDING;
 
+	ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op);
 
 	switch (callback_status) {
 	case AE_CTRL_TERMINATE:
@@ -335,7 +342,6 @@ acpi_ps_next_parse_state (
 		status = AE_CTRL_TERMINATE;
 		break;
 
-
 	case AE_CTRL_BREAK:
 
 		parser_state->aml = walk_state->aml_last_while;
@@ -345,7 +351,6 @@ acpi_ps_next_parse_state (
 
 	case AE_CTRL_CONTINUE:
 
-
 		parser_state->aml = walk_state->aml_last_while;
 		status = AE_CTRL_CONTINUE;
 		break;
@@ -369,10 +374,9 @@ acpi_ps_next_parse_state (
 		 * Predicate of an IF was true, and we are at the matching ELSE.
 		 * Just close out this package
 		 */
-		parser_state->aml = acpi_ps_get_next_package_end (parser_state);
+		parser_state->aml = acpi_ps_get_next_package_end(parser_state);
 		break;
 
-
 	case AE_CTRL_FALSE:
 
 		/*
@@ -390,7 +394,6 @@ acpi_ps_next_parse_state (
 		status = AE_CTRL_END;
 		break;
 
-
 	case AE_CTRL_TRANSFER:
 
 		/* A method call (invocation) -- transfer control */
@@ -398,14 +401,15 @@ acpi_ps_next_parse_state (
 		status = AE_CTRL_TRANSFER;
 		walk_state->prev_op = op;
 		walk_state->method_call_op = op;
-		walk_state->method_call_node = (op->common.value.arg)->common.node;
+		walk_state->method_call_node =
+		    (op->common.value.arg)->common.node;
 
 		/* Will return value (if any) be used by the caller? */
 
-		walk_state->return_used = acpi_ds_is_result_used (op, walk_state);
+		walk_state->return_used =
+		    acpi_ds_is_result_used(op, walk_state);
 		break;
 
-
 	default:
 
 		status = callback_status;
@@ -415,10 +419,9 @@ acpi_ps_next_parse_state (
 		break;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_parse_aml
@@ -432,34 +435,30 @@ acpi_ps_next_parse_state (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ps_parse_aml (
-	struct acpi_walk_state          *walk_state)
+acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
 {
-	acpi_status                     status;
-	acpi_status                     terminate_status;
-	struct acpi_thread_state        *thread;
-	struct acpi_thread_state        *prev_walk_list = acpi_gbl_current_walk_list;
-	struct acpi_walk_state          *previous_walk_state;
-
-
-	ACPI_FUNCTION_TRACE ("ps_parse_aml");
+	acpi_status status;
+	acpi_status terminate_status;
+	struct acpi_thread_state *thread;
+	struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
+	struct acpi_walk_state *previous_walk_state;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-		"Entered with walk_state=%p Aml=%p size=%X\n",
-		walk_state, walk_state->parser_state.aml,
-		walk_state->parser_state.aml_size));
+	ACPI_FUNCTION_TRACE("ps_parse_aml");
 
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+			  "Entered with walk_state=%p Aml=%p size=%X\n",
+			  walk_state, walk_state->parser_state.aml,
+			  walk_state->parser_state.aml_size));
 
 	/* Create and initialize a new thread state */
 
-	thread = acpi_ut_create_thread_state ();
+	thread = acpi_ut_create_thread_state();
 	if (!thread) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	walk_state->thread = thread;
-	acpi_ds_push_walk_state (walk_state, thread);
+	acpi_ds_push_walk_state(walk_state, thread);
 
 	/*
 	 * This global allows the AML debugger to get a handle to the currently
@@ -471,54 +470,56 @@ acpi_ps_parse_aml (
 	 * Execute the walk loop as long as there is a valid Walk State.  This
 	 * handles nested control method invocations without recursion.
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", walk_state));
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "State=%p\n", walk_state));
 
 	status = AE_OK;
 	while (walk_state) {
-		if (ACPI_SUCCESS (status)) {
+		if (ACPI_SUCCESS(status)) {
 			/*
 			 * The parse_loop executes AML until the method terminates
 			 * or calls another method.
 			 */
-			status = acpi_ps_parse_loop (walk_state);
+			status = acpi_ps_parse_loop(walk_state);
 		}
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-			"Completed one call to walk loop, %s State=%p\n",
-			acpi_format_exception (status), walk_state));
+		ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+				  "Completed one call to walk loop, %s State=%p\n",
+				  acpi_format_exception(status), walk_state));
 
 		if (status == AE_CTRL_TRANSFER) {
 			/*
 			 * A method call was detected.
 			 * Transfer control to the called control method
 			 */
-			status = acpi_ds_call_control_method (thread, walk_state, NULL);
+			status =
+			    acpi_ds_call_control_method(thread, walk_state,
+							NULL);
 
 			/*
 			 * If the transfer to the new method method call worked, a new walk
 			 * state was created -- get it
 			 */
-			walk_state = acpi_ds_get_current_walk_state (thread);
+			walk_state = acpi_ds_get_current_walk_state(thread);
 			continue;
-		}
-		else if (status == AE_CTRL_TERMINATE) {
+		} else if (status == AE_CTRL_TERMINATE) {
 			status = AE_OK;
-		}
-		else if ((status != AE_OK) && (walk_state->method_desc)) {
-			ACPI_REPORT_METHOD_ERROR ("Method execution failed",
-				walk_state->method_node, NULL, status);
+		} else if ((status != AE_OK) && (walk_state->method_desc)) {
+			ACPI_REPORT_METHOD_ERROR("Method execution failed",
+						 walk_state->method_node, NULL,
+						 status);
 
 			/* Check for possible multi-thread reentrancy problem */
 
 			if ((status == AE_ALREADY_EXISTS) &&
-				(!walk_state->method_desc->method.semaphore)) {
+			    (!walk_state->method_desc->method.semaphore)) {
 				/*
 				 * This method is marked not_serialized, but it tried to create
 				 * a named object, causing the second thread entrance to fail.
 				 * We will workaround this by marking the method permanently
 				 * as Serialized.
 				 */
-				walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
+				walk_state->method_desc->method.method_flags |=
+				    AML_METHOD_SERIALIZED;
 				walk_state->method_desc->method.concurrency = 1;
 			}
 		}
@@ -533,21 +534,22 @@ acpi_ps_parse_aml (
 
 		/* We are done with this walk, move on to the parent if any */
 
-		walk_state = acpi_ds_pop_walk_state (thread);
+		walk_state = acpi_ds_pop_walk_state(thread);
 
 		/* Reset the current scope to the beginning of scope stack */
 
-		acpi_ds_scope_stack_clear (walk_state);
+		acpi_ds_scope_stack_clear(walk_state);
 
 		/*
 		 * If we just returned from the execution of a control method,
 		 * there's lots of cleanup to do
 		 */
-		if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) {
-			terminate_status = acpi_ds_terminate_control_method (walk_state);
-			if (ACPI_FAILURE (terminate_status)) {
-				ACPI_REPORT_ERROR ((
-					"Could not terminate control method properly\n"));
+		if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
+		    ACPI_PARSE_EXECUTE) {
+			terminate_status =
+			    acpi_ds_terminate_control_method(walk_state);
+			if (ACPI_FAILURE(terminate_status)) {
+				ACPI_REPORT_ERROR(("Could not terminate control method properly\n"));
 
 				/* Ignore error and continue */
 			}
@@ -555,46 +557,53 @@ acpi_ps_parse_aml (
 
 		/* Delete this walk state and all linked control states */
 
-		acpi_ps_cleanup_scope (&walk_state->parser_state);
+		acpi_ps_cleanup_scope(&walk_state->parser_state);
 
 		previous_walk_state = walk_state;
 
-		ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-			"return_value=%p, implicit_value=%p State=%p\n",
-			walk_state->return_desc, walk_state->implicit_return_obj, walk_state));
+		ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+				  "return_value=%p, implicit_value=%p State=%p\n",
+				  walk_state->return_desc,
+				  walk_state->implicit_return_obj, walk_state));
 
 		/* Check if we have restarted a preempted walk */
 
-		walk_state = acpi_ds_get_current_walk_state (thread);
+		walk_state = acpi_ds_get_current_walk_state(thread);
 		if (walk_state) {
-			if (ACPI_SUCCESS (status)) {
+			if (ACPI_SUCCESS(status)) {
 				/*
 				 * There is another walk state, restart it.
 				 * If the method return value is not used by the parent,
 				 * The object is deleted
 				 */
 				if (!previous_walk_state->return_desc) {
-					status = acpi_ds_restart_control_method (walk_state,
-							 previous_walk_state->implicit_return_obj);
-				}
-				else {
+					status =
+					    acpi_ds_restart_control_method
+					    (walk_state,
+					     previous_walk_state->
+					     implicit_return_obj);
+				} else {
 					/*
 					 * We have a valid return value, delete any implicit
 					 * return value.
 					 */
-					acpi_ds_clear_implicit_return (previous_walk_state);
+					acpi_ds_clear_implicit_return
+					    (previous_walk_state);
 
-					status = acpi_ds_restart_control_method (walk_state,
-							 previous_walk_state->return_desc);
+					status =
+					    acpi_ds_restart_control_method
+					    (walk_state,
+					     previous_walk_state->return_desc);
 				}
-				if (ACPI_SUCCESS (status)) {
-					walk_state->walk_type |= ACPI_WALK_METHOD_RESTART;
+				if (ACPI_SUCCESS(status)) {
+					walk_state->walk_type |=
+					    ACPI_WALK_METHOD_RESTART;
 				}
-			}
-			else {
+			} else {
 				/* On error, delete any return object */
 
-				acpi_ut_remove_reference (previous_walk_state->return_desc);
+				acpi_ut_remove_reference(previous_walk_state->
+							 return_desc);
 			}
 		}
 
@@ -605,37 +614,36 @@ acpi_ps_parse_aml (
 		else if (previous_walk_state->caller_return_desc) {
 			if (previous_walk_state->implicit_return_obj) {
 				*(previous_walk_state->caller_return_desc) =
-					previous_walk_state->implicit_return_obj;
-			}
-			else {
-				 /* NULL if no return value */
+				    previous_walk_state->implicit_return_obj;
+			} else {
+				/* NULL if no return value */
 
 				*(previous_walk_state->caller_return_desc) =
-					previous_walk_state->return_desc;
+				    previous_walk_state->return_desc;
 			}
-		}
-		else {
+		} else {
 			if (previous_walk_state->return_desc) {
 				/* Caller doesn't want it, must delete it */
 
-				acpi_ut_remove_reference (previous_walk_state->return_desc);
+				acpi_ut_remove_reference(previous_walk_state->
+							 return_desc);
 			}
 			if (previous_walk_state->implicit_return_obj) {
 				/* Caller doesn't want it, must delete it */
 
-				acpi_ut_remove_reference (previous_walk_state->implicit_return_obj);
+				acpi_ut_remove_reference(previous_walk_state->
+							 implicit_return_obj);
 			}
 		}
 
-		acpi_ds_delete_walk_state (previous_walk_state);
+		acpi_ds_delete_walk_state(previous_walk_state);
 	}
 
 	/* Normal exit */
 
-	acpi_ex_release_all_mutexes (thread);
-	acpi_ut_delete_generic_state (ACPI_CAST_PTR (union acpi_generic_state, thread));
+	acpi_ex_release_all_mutexes(thread);
+	acpi_ut_delete_generic_state(ACPI_CAST_PTR
+				     (union acpi_generic_state, thread));
 	acpi_gbl_current_walk_list = prev_walk_list;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-

+ 50 - 80
drivers/acpi/parser/psscope.c

@@ -41,13 +41,11 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("psscope")
-
+ACPI_MODULE_NAME("psscope")
 
 /*******************************************************************************
  *
@@ -60,16 +58,13 @@
  * DESCRIPTION: Get parent of current op being parsed
  *
  ******************************************************************************/
-
-union acpi_parse_object *
-acpi_ps_get_parent_scope (
-	struct acpi_parse_state         *parser_state)
+union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
+						  *parser_state)
 {
 
 	return (parser_state->scope->parse_scope.op);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_has_completed_scope
@@ -84,17 +79,14 @@ acpi_ps_get_parent_scope (
  *
  ******************************************************************************/
 
-u8
-acpi_ps_has_completed_scope (
-	struct acpi_parse_state         *parser_state)
+u8 acpi_ps_has_completed_scope(struct acpi_parse_state * parser_state)
 {
 
 	return ((u8)
-			((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
-			 !parser_state->scope->parse_scope.arg_count)));
+		((parser_state->aml >= parser_state->scope->parse_scope.arg_end
+		  || !parser_state->scope->parse_scope.arg_count)));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_init_scope
@@ -109,34 +101,30 @@ acpi_ps_has_completed_scope (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_init_scope (
-	struct acpi_parse_state         *parser_state,
-	union acpi_parse_object         *root_op)
+acpi_ps_init_scope(struct acpi_parse_state * parser_state,
+		   union acpi_parse_object * root_op)
 {
-	union acpi_generic_state        *scope;
+	union acpi_generic_state *scope;
 
+	ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op);
 
-	ACPI_FUNCTION_TRACE_PTR ("ps_init_scope", root_op);
-
-
-	scope = acpi_ut_create_generic_state ();
+	scope = acpi_ut_create_generic_state();
 	if (!scope) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
-	scope->common.data_type     = ACPI_DESC_TYPE_STATE_RPSCOPE;
-	scope->parse_scope.op       = root_op;
+	scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
+	scope->parse_scope.op = root_op;
 	scope->parse_scope.arg_count = ACPI_VAR_ARGS;
-	scope->parse_scope.arg_end  = parser_state->aml_end;
-	scope->parse_scope.pkg_end  = parser_state->aml_end;
+	scope->parse_scope.arg_end = parser_state->aml_end;
+	scope->parse_scope.pkg_end = parser_state->aml_end;
 
-	parser_state->scope         = scope;
-	parser_state->start_op      = root_op;
+	parser_state->scope = scope;
+	parser_state->start_op = root_op;
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_push_scope
@@ -153,48 +141,42 @@ acpi_ps_init_scope (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_push_scope (
-	struct acpi_parse_state         *parser_state,
-	union acpi_parse_object         *op,
-	u32                             remaining_args,
-	u32                             arg_count)
+acpi_ps_push_scope(struct acpi_parse_state *parser_state,
+		   union acpi_parse_object *op,
+		   u32 remaining_args, u32 arg_count)
 {
-	union acpi_generic_state        *scope;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ps_push_scope", op);
+	union acpi_generic_state *scope;
 
+	ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op);
 
-	scope = acpi_ut_create_generic_state ();
+	scope = acpi_ut_create_generic_state();
 	if (!scope) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
-	scope->common.data_type    = ACPI_DESC_TYPE_STATE_PSCOPE;
-	scope->parse_scope.op      = op;
+	scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
+	scope->parse_scope.op = op;
 	scope->parse_scope.arg_list = remaining_args;
 	scope->parse_scope.arg_count = arg_count;
 	scope->parse_scope.pkg_end = parser_state->pkg_end;
 
 	/* Push onto scope stack */
 
-	acpi_ut_push_generic_state (&parser_state->scope, scope);
+	acpi_ut_push_generic_state(&parser_state->scope, scope);
 
 	if (arg_count == ACPI_VAR_ARGS) {
 		/* Multiple arguments */
 
 		scope->parse_scope.arg_end = parser_state->pkg_end;
-	}
-	else {
+	} else {
 		/* Single argument */
 
-		scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR);
+		scope->parse_scope.arg_end = ACPI_TO_POINTER(ACPI_MAX_PTR);
 	}
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_pop_scope
@@ -212,48 +194,41 @@ acpi_ps_push_scope (
  ******************************************************************************/
 
 void
-acpi_ps_pop_scope (
-	struct acpi_parse_state         *parser_state,
-	union acpi_parse_object         **op,
-	u32                             *arg_list,
-	u32                             *arg_count)
+acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
+		  union acpi_parse_object **op, u32 * arg_list, u32 * arg_count)
 {
-	union acpi_generic_state        *scope = parser_state->scope;
-
-
-	ACPI_FUNCTION_TRACE ("ps_pop_scope");
+	union acpi_generic_state *scope = parser_state->scope;
 
+	ACPI_FUNCTION_TRACE("ps_pop_scope");
 
 	/* Only pop the scope if there is in fact a next scope */
 
 	if (scope->common.next) {
-		scope = acpi_ut_pop_generic_state (&parser_state->scope);
+		scope = acpi_ut_pop_generic_state(&parser_state->scope);
 
 		/* return to parsing previous op */
 
-		*op                 = scope->parse_scope.op;
-		*arg_list           = scope->parse_scope.arg_list;
-		*arg_count          = scope->parse_scope.arg_count;
+		*op = scope->parse_scope.op;
+		*arg_list = scope->parse_scope.arg_list;
+		*arg_count = scope->parse_scope.arg_count;
 		parser_state->pkg_end = scope->parse_scope.pkg_end;
 
 		/* All done with this scope state structure */
 
-		acpi_ut_delete_generic_state (scope);
-	}
-	else {
+		acpi_ut_delete_generic_state(scope);
+	} else {
 		/* empty parse stack, prepare to fetch next opcode */
 
-		*op       = NULL;
+		*op = NULL;
 		*arg_list = 0;
 		*arg_count = 0;
 	}
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-		"Popped Op %p Args %X\n", *op, *arg_count));
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+			  "Popped Op %p Args %X\n", *op, *arg_count));
 	return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_cleanup_scope
@@ -267,15 +242,11 @@ acpi_ps_pop_scope (
  *
  ******************************************************************************/
 
-void
-acpi_ps_cleanup_scope (
-	struct acpi_parse_state         *parser_state)
+void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state)
 {
-	union acpi_generic_state        *scope;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ps_cleanup_scope", parser_state);
+	union acpi_generic_state *scope;
 
+	ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state);
 
 	if (!parser_state) {
 		return_VOID;
@@ -284,10 +255,9 @@ acpi_ps_cleanup_scope (
 	/* Delete anything on the scope stack */
 
 	while (parser_state->scope) {
-		scope = acpi_ut_pop_generic_state (&parser_state->scope);
-		acpi_ut_delete_generic_state (scope);
+		scope = acpi_ut_pop_generic_state(&parser_state->scope);
+		acpi_ut_delete_generic_state(scope);
 	}
 
 	return_VOID;
 }
-

+ 30 - 62
drivers/acpi/parser/pstree.c

@@ -41,23 +41,18 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("pstree")
+ACPI_MODULE_NAME("pstree")
 
 /* Local prototypes */
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
-union acpi_parse_object *
-acpi_ps_get_child (
-	union acpi_parse_object         *op);
+union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op);
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_arg
@@ -71,21 +66,16 @@ acpi_ps_get_child (
  *
  ******************************************************************************/
 
-union acpi_parse_object *
-acpi_ps_get_arg (
-	union acpi_parse_object         *op,
-	u32                             argn)
+union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
 {
-	union acpi_parse_object         *arg = NULL;
-	const struct acpi_opcode_info   *op_info;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_parse_object *arg = NULL;
+	const struct acpi_opcode_info *op_info;
 
+	ACPI_FUNCTION_ENTRY();
 
 	/* Get the info structure for this opcode */
 
-	op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+	op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
 	if (op_info->class == AML_CLASS_UNKNOWN) {
 		/* Invalid opcode or ASCII character */
 
@@ -111,7 +101,6 @@ acpi_ps_get_arg (
 	return (arg);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_append_arg
@@ -126,16 +115,12 @@ acpi_ps_get_arg (
  ******************************************************************************/
 
 void
-acpi_ps_append_arg (
-	union acpi_parse_object         *op,
-	union acpi_parse_object         *arg)
+acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
 {
-	union acpi_parse_object         *prev_arg;
-	const struct acpi_opcode_info   *op_info;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_parse_object *prev_arg;
+	const struct acpi_opcode_info *op_info;
 
+	ACPI_FUNCTION_ENTRY();
 
 	if (!op) {
 		return;
@@ -143,12 +128,11 @@ acpi_ps_append_arg (
 
 	/* Get the info structure for this opcode */
 
-	op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+	op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
 	if (op_info->class == AML_CLASS_UNKNOWN) {
 		/* Invalid opcode */
 
-		ACPI_REPORT_ERROR (("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n",
-			op->common.aml_opcode));
+		ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode));
 		return;
 	}
 
@@ -170,8 +154,7 @@ acpi_ps_append_arg (
 			prev_arg = prev_arg->common.next;
 		}
 		prev_arg->common.next = arg;
-	}
-	else {
+	} else {
 		/* No argument list, this will be the first argument */
 
 		op->common.value.arg = arg;
@@ -185,7 +168,6 @@ acpi_ps_append_arg (
 	}
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -201,18 +183,14 @@ acpi_ps_append_arg (
  *
  ******************************************************************************/
 
-union acpi_parse_object *
-acpi_ps_get_depth_next (
-	union acpi_parse_object         *origin,
-	union acpi_parse_object         *op)
+union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
+						union acpi_parse_object *op)
 {
-	union acpi_parse_object         *next = NULL;
-	union acpi_parse_object         *parent;
-	union acpi_parse_object         *arg;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_parse_object *next = NULL;
+	union acpi_parse_object *parent;
+	union acpi_parse_object *arg;
 
+	ACPI_FUNCTION_ENTRY();
 
 	if (!op) {
 		return (NULL);
@@ -220,7 +198,7 @@ acpi_ps_get_depth_next (
 
 	/* Look for an argument or child */
 
-	next = acpi_ps_get_arg (op, 0);
+	next = acpi_ps_get_arg(op, 0);
 	if (next) {
 		return (next);
 	}
@@ -237,7 +215,7 @@ acpi_ps_get_depth_next (
 	parent = op->common.parent;
 
 	while (parent) {
-		arg = acpi_ps_get_arg (parent, 0);
+		arg = acpi_ps_get_arg(parent, 0);
 		while (arg && (arg != origin) && (arg != op)) {
 			arg = arg->common.next;
 		}
@@ -261,7 +239,6 @@ acpi_ps_get_depth_next (
 	return (next);
 }
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
@@ -275,15 +252,11 @@ acpi_ps_get_depth_next (
  *
  ******************************************************************************/
 
-union acpi_parse_object *
-acpi_ps_get_child (
-	union acpi_parse_object         *op)
+union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
 {
-	union acpi_parse_object         *child = NULL;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_parse_object *child = NULL;
 
+	ACPI_FUNCTION_ENTRY();
 
 	switch (op->common.aml_opcode) {
 	case AML_SCOPE_OP:
@@ -292,10 +265,9 @@ acpi_ps_get_child (
 	case AML_THERMAL_ZONE_OP:
 	case AML_INT_METHODCALL_OP:
 
-		child = acpi_ps_get_arg (op, 0);
+		child = acpi_ps_get_arg(op, 0);
 		break;
 
-
 	case AML_BUFFER_OP:
 	case AML_PACKAGE_OP:
 	case AML_METHOD_OP:
@@ -303,24 +275,21 @@ acpi_ps_get_child (
 	case AML_WHILE_OP:
 	case AML_FIELD_OP:
 
-		child = acpi_ps_get_arg (op, 1);
+		child = acpi_ps_get_arg(op, 1);
 		break;
 
-
 	case AML_POWER_RES_OP:
 	case AML_INDEX_FIELD_OP:
 
-		child = acpi_ps_get_arg (op, 2);
+		child = acpi_ps_get_arg(op, 2);
 		break;
 
-
 	case AML_PROCESSOR_OP:
 	case AML_BANK_FIELD_OP:
 
-		child = acpi_ps_get_arg (op, 3);
+		child = acpi_ps_get_arg(op, 3);
 		break;
 
-
 	default:
 		/* All others have no children */
 		break;
@@ -330,5 +299,4 @@ acpi_ps_get_child (
 }
 #endif
 
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif				/*  ACPI_FUTURE_USAGE  */

+ 34 - 71
drivers/acpi/parser/psutils.c

@@ -41,14 +41,12 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("psutils")
-
+ACPI_MODULE_NAME("psutils")
 
 /*******************************************************************************
  *
@@ -61,15 +59,11 @@
  * DESCRIPTION: Create a Scope and associated namepath op with the root name
  *
  ******************************************************************************/
-
-union acpi_parse_object *
-acpi_ps_create_scope_op (
-	void)
+union acpi_parse_object *acpi_ps_create_scope_op(void)
 {
-	union acpi_parse_object         *scope_op;
+	union acpi_parse_object *scope_op;
 
-
-	scope_op = acpi_ps_alloc_op (AML_SCOPE_OP);
+	scope_op = acpi_ps_alloc_op(AML_SCOPE_OP);
 	if (!scope_op) {
 		return (NULL);
 	}
@@ -78,7 +72,6 @@ acpi_ps_create_scope_op (
 	return (scope_op);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_init_op
@@ -92,23 +85,19 @@ acpi_ps_create_scope_op (
  *
  ******************************************************************************/
 
-void
-acpi_ps_init_op (
-	union acpi_parse_object         *op,
-	u16                             opcode)
+void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
 {
-	ACPI_FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY();
 
 	op->common.data_type = ACPI_DESC_TYPE_PARSER;
 	op->common.aml_opcode = opcode;
 
-	ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
-			(acpi_ps_get_opcode_info (opcode))->name,
-				sizeof (op->common.aml_op_name)));
+	ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
+					      (acpi_ps_get_opcode_info
+					       (opcode))->name,
+					      sizeof(op->common.aml_op_name)));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_alloc_op
@@ -123,29 +112,23 @@ acpi_ps_init_op (
  *
  ******************************************************************************/
 
-union acpi_parse_object*
-acpi_ps_alloc_op (
-	u16                             opcode)
+union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
 {
-	union acpi_parse_object         *op;
-	const struct acpi_opcode_info   *op_info;
-	u8                              flags = ACPI_PARSEOP_GENERIC;
-
-
-	ACPI_FUNCTION_ENTRY ();
+	union acpi_parse_object *op;
+	const struct acpi_opcode_info *op_info;
+	u8 flags = ACPI_PARSEOP_GENERIC;
 
+	ACPI_FUNCTION_ENTRY();
 
-	op_info = acpi_ps_get_opcode_info (opcode);
+	op_info = acpi_ps_get_opcode_info(opcode);
 
 	/* Determine type of parse_op required */
 
 	if (op_info->flags & AML_DEFER) {
 		flags = ACPI_PARSEOP_DEFERRED;
-	}
-	else if (op_info->flags & AML_NAMED) {
+	} else if (op_info->flags & AML_NAMED) {
 		flags = ACPI_PARSEOP_NAMED;
-	}
-	else if (opcode == AML_INT_BYTELIST_OP) {
+	} else if (opcode == AML_INT_BYTELIST_OP) {
 		flags = ACPI_PARSEOP_BYTELIST;
 	}
 
@@ -154,27 +137,25 @@ acpi_ps_alloc_op (
 	if (flags == ACPI_PARSEOP_GENERIC) {
 		/* The generic op (default) is by far the most common (16 to 1) */
 
-		op = acpi_os_acquire_object (acpi_gbl_ps_node_cache);
+		op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
 		memset(op, 0, sizeof(struct acpi_parse_obj_common));
-	}
-	else {
+	} else {
 		/* Extended parseop */
 
-		op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache);
+		op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
 		memset(op, 0, sizeof(struct acpi_parse_obj_named));
 	}
 
 	/* Initialize the Op */
 
 	if (op) {
-		acpi_ps_init_op (op, opcode);
+		acpi_ps_init_op(op, opcode);
 		op->common.flags = flags;
 	}
 
 	return (op);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_free_op
@@ -188,26 +169,22 @@ acpi_ps_alloc_op (
  *
  ******************************************************************************/
 
-void
-acpi_ps_free_op (
-	union acpi_parse_object         *op)
+void acpi_ps_free_op(union acpi_parse_object *op)
 {
-	ACPI_FUNCTION_NAME ("ps_free_op");
-
+	ACPI_FUNCTION_NAME("ps_free_op");
 
 	if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
+		ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n",
+				  op));
 	}
 
 	if (op->common.flags & ACPI_PARSEOP_GENERIC) {
-		(void) acpi_os_release_object (acpi_gbl_ps_node_cache, op);
-	}
-	else {
-		(void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
+		(void)acpi_os_release_object(acpi_gbl_ps_node_cache, op);
+	} else {
+		(void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op);
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    Utility functions
@@ -216,36 +193,27 @@ acpi_ps_free_op (
  *
  ******************************************************************************/
 
-
 /*
  * Is "c" a namestring lead character?
  */
-u8
-acpi_ps_is_leading_char (
-	u32                             c)
+u8 acpi_ps_is_leading_char(u32 c)
 {
 	return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
 }
 
-
 /*
  * Is "c" a namestring prefix character?
  */
-u8
-acpi_ps_is_prefix_char (
-	u32                             c)
+u8 acpi_ps_is_prefix_char(u32 c)
 {
 	return ((u8) (c == '\\' || c == '^'));
 }
 
-
 /*
  * Get op's name (4-byte name segment) or 0 if unnamed
  */
 #ifdef ACPI_FUTURE_USAGE
-u32
-acpi_ps_get_name (
-	union acpi_parse_object         *op)
+u32 acpi_ps_get_name(union acpi_parse_object * op)
 {
 
 	/* The "generic" object has no name associated with it */
@@ -258,16 +226,12 @@ acpi_ps_get_name (
 
 	return (op->named.name);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif				/*  ACPI_FUTURE_USAGE  */
 
 /*
  * Set op's name
  */
-void
-acpi_ps_set_name (
-	union acpi_parse_object         *op,
-	u32                             name)
+void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
 {
 
 	/* The "generic" object has no name associated with it */
@@ -278,4 +242,3 @@ acpi_ps_set_name (
 
 	op->named.name = name;
 }
-

+ 9 - 17
drivers/acpi/parser/pswalk.c

@@ -41,13 +41,11 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("pswalk")
-
+ACPI_MODULE_NAME("pswalk")
 
 /*******************************************************************************
  *
@@ -60,18 +58,13 @@
  * DESCRIPTION: Delete a portion of or an entire parse tree.
  *
  ******************************************************************************/
-
-void
-acpi_ps_delete_parse_tree (
-	union acpi_parse_object         *subtree_root)
+void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
 {
-	union acpi_parse_object         *op = subtree_root;
-	union acpi_parse_object         *next = NULL;
-	union acpi_parse_object         *parent = NULL;
-
-
-	ACPI_FUNCTION_TRACE_PTR ("ps_delete_parse_tree", subtree_root);
+	union acpi_parse_object *op = subtree_root;
+	union acpi_parse_object *next = NULL;
+	union acpi_parse_object *parent = NULL;
 
+	ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root);
 
 	/* Visit all nodes in the subtree */
 
@@ -81,7 +74,7 @@ acpi_ps_delete_parse_tree (
 		if (op != parent) {
 			/* Look for an argument or child of the current op */
 
-			next = acpi_ps_get_arg (op, 0);
+			next = acpi_ps_get_arg(op, 0);
 			if (next) {
 				/* Still going downward in tree (Op is not completed yet) */
 
@@ -95,7 +88,7 @@ acpi_ps_delete_parse_tree (
 		next = op->common.next;
 		parent = op->common.parent;
 
-		acpi_ps_free_op (op);
+		acpi_ps_free_op(op);
 
 		/* If we are back to the starting point, the walk is complete. */
 
@@ -104,8 +97,7 @@ acpi_ps_delete_parse_tree (
 		}
 		if (next) {
 			op = next;
-		}
-		else {
+		} else {
 			op = parent;
 		}
 	}

+ 61 - 81
drivers/acpi/parser/psxface.c

@@ -41,27 +41,19 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_PARSER
-	 ACPI_MODULE_NAME    ("psxface")
+ACPI_MODULE_NAME("psxface")
 
 /* Local Prototypes */
-
-static acpi_status
-acpi_ps_execute_pass (
-	struct acpi_parameter_info      *info);
+static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
 
 static void
-acpi_ps_update_parameter_list (
-	struct acpi_parameter_info      *info,
-	u16                             action);
-
+acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
 
 /*******************************************************************************
  *
@@ -86,27 +78,24 @@ acpi_ps_update_parameter_list (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ps_execute_method (
-	struct acpi_parameter_info      *info)
+acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
 {
-	acpi_status                     status;
-
-
-	ACPI_FUNCTION_TRACE ("ps_execute_method");
+	acpi_status status;
 
+	ACPI_FUNCTION_TRACE("ps_execute_method");
 
 	/* Validate the Info and method Node */
 
 	if (!info || !info->node) {
-		return_ACPI_STATUS (AE_NULL_ENTRY);
+		return_ACPI_STATUS(AE_NULL_ENTRY);
 	}
 
 	/* Init for new method, wait on concurrency semaphore */
 
-	status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status =
+	    acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -114,55 +103,54 @@ acpi_ps_execute_method (
 	 * objects (such as Operation Regions) can be created during the
 	 * first pass parse.
 	 */
-	status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id);
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
 	 * The caller "owns" the parameters, so give each one an extra
 	 * reference
 	 */
-	acpi_ps_update_parameter_list (info, REF_INCREMENT);
+	acpi_ps_update_parameter_list(info, REF_INCREMENT);
 
 	/*
 	 * 1) Perform the first pass parse of the method to enter any
 	 *    named objects that it creates into the namespace
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-		"**** Begin Method Parse **** Entry=%p obj=%p\n",
-		info->node, info->obj_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+			  "**** Begin Method Parse **** Entry=%p obj=%p\n",
+			  info->node, info->obj_desc));
 
 	info->pass_number = 1;
-	status = acpi_ps_execute_pass (info);
-	if (ACPI_FAILURE (status)) {
+	status = acpi_ps_execute_pass(info);
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/*
 	 * 2) Execute the method. Performs second pass parse simultaneously
 	 */
-	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-		"**** Begin Method Execution **** Entry=%p obj=%p\n",
-		info->node, info->obj_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+			  "**** Begin Method Execution **** Entry=%p obj=%p\n",
+			  info->node, info->obj_desc));
 
 	info->pass_number = 3;
-	status = acpi_ps_execute_pass (info);
-
+	status = acpi_ps_execute_pass(info);
 
-cleanup:
+      cleanup:
 	if (info->obj_desc->method.owner_id) {
-		acpi_ut_release_owner_id (&info->obj_desc->method.owner_id);
+		acpi_ut_release_owner_id(&info->obj_desc->method.owner_id);
 	}
 
 	/* Take away the extra reference that we gave the parameters above */
 
-	acpi_ps_update_parameter_list (info, REF_DECREMENT);
+	acpi_ps_update_parameter_list(info, REF_DECREMENT);
 
 	/* Exit now if error above */
 
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
 	}
 
 	/*
@@ -170,17 +158,17 @@ cleanup:
 	 * a control exception code
 	 */
 	if (info->return_object) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
-			info->return_object));
-		ACPI_DUMP_STACK_ENTRY (info->return_object);
+		ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+				  "Method returned obj_desc=%p\n",
+				  info->return_object));
+		ACPI_DUMP_STACK_ENTRY(info->return_object);
 
 		status = AE_CTRL_RETURN_VALUE;
 	}
 
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_update_parameter_list
@@ -196,26 +184,23 @@ cleanup:
  ******************************************************************************/
 
 static void
-acpi_ps_update_parameter_list (
-	struct acpi_parameter_info      *info,
-	u16                             action)
+acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
 {
-	acpi_native_uint                i;
-
+	acpi_native_uint i;
 
-	if ((info->parameter_type == ACPI_PARAM_ARGS) &&
-		(info->parameters)) {
+	if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
 		/* Update reference count for each parameter */
 
 		for (i = 0; info->parameters[i]; i++) {
 			/* Ignore errors, just do them all */
 
-			(void) acpi_ut_update_object_reference (info->parameters[i], action);
+			(void)acpi_ut_update_object_reference(info->
+							      parameters[i],
+							      action);
 		}
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_execute_pass
@@ -229,53 +214,48 @@ acpi_ps_update_parameter_list (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ps_execute_pass (
-	struct acpi_parameter_info      *info)
+static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info)
 {
-	acpi_status                     status;
-	union acpi_parse_object         *op;
-	struct acpi_walk_state          *walk_state;
-
-
-	ACPI_FUNCTION_TRACE ("ps_execute_pass");
+	acpi_status status;
+	union acpi_parse_object *op;
+	struct acpi_walk_state *walk_state;
 
+	ACPI_FUNCTION_TRACE("ps_execute_pass");
 
 	/* Create and init a Root Node */
 
-	op = acpi_ps_create_scope_op ();
+	op = acpi_ps_create_scope_op();
 	if (!op) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Create and initialize a new walk state */
 
-	walk_state = acpi_ds_create_walk_state (
-			  info->obj_desc->method.owner_id, NULL, NULL, NULL);
+	walk_state =
+	    acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
+				      NULL, NULL);
 	if (!walk_state) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
 	}
 
-	status = acpi_ds_init_aml_walk (walk_state, op, info->node,
-			  info->obj_desc->method.aml_start,
-			  info->obj_desc->method.aml_length,
-			  info->pass_number == 1 ? NULL : info,
-			  info->pass_number);
-	if (ACPI_FAILURE (status)) {
-		acpi_ds_delete_walk_state (walk_state);
+	status = acpi_ds_init_aml_walk(walk_state, op, info->node,
+				       info->obj_desc->method.aml_start,
+				       info->obj_desc->method.aml_length,
+				       info->pass_number == 1 ? NULL : info,
+				       info->pass_number);
+	if (ACPI_FAILURE(status)) {
+		acpi_ds_delete_walk_state(walk_state);
 		goto cleanup;
 	}
 
 	/* Parse the AML */
 
-	status = acpi_ps_parse_aml (walk_state);
+	status = acpi_ps_parse_aml(walk_state);
 
 	/* Walk state was deleted by parse_aml */
 
-cleanup:
-	acpi_ps_delete_parse_tree (op);
-	return_ACPI_STATUS (status);
+      cleanup:
+	acpi_ps_delete_parse_tree(op);
+	return_ACPI_STATUS(status);
 }
-
-

+ 103 - 116
drivers/acpi/pci_bind.c

@@ -35,22 +35,16 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT		ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME		("pci_bind")
+ACPI_MODULE_NAME("pci_bind")
 
 struct acpi_pci_data {
-	struct acpi_pci_id	id;
-	struct pci_bus		*bus;
-	struct pci_dev		*dev;
+	struct acpi_pci_id id;
+	struct pci_bus *bus;
+	struct pci_dev *dev;
 };
 
-
-void
-acpi_pci_data_handler (
-	acpi_handle		handle,
-	u32			function,
-	void			*context)
+void acpi_pci_data_handler(acpi_handle handle, u32 function, void *context)
 {
 	ACPI_FUNCTION_TRACE("acpi_pci_data_handler");
 
@@ -59,7 +53,6 @@ acpi_pci_data_handler (
 	return_VOID;
 }
 
-
 /**
  * acpi_get_pci_id
  * ------------------
@@ -67,15 +60,12 @@ acpi_pci_data_handler (
  * to resolve PCI information for ACPI-PCI devices defined in the namespace.
  * This typically occurs when resolving PCI operation region information.
  */
-acpi_status
-acpi_get_pci_id (
-	acpi_handle		handle,
-	struct acpi_pci_id	*id)
+acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	struct acpi_device	*device = NULL;
-	struct acpi_pci_data	*data = NULL;
+	int result = 0;
+	acpi_status status = AE_OK;
+	struct acpi_device *device = NULL;
+	struct acpi_pci_data *data = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_get_pci_id");
 
@@ -84,52 +74,50 @@ acpi_get_pci_id (
 
 	result = acpi_bus_get_device(handle, &device);
 	if (result) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-			"Invalid ACPI Bus context for device %s\n",
-			acpi_device_bid(device)));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Invalid ACPI Bus context for device %s\n",
+				  acpi_device_bid(device)));
 		return_ACPI_STATUS(AE_NOT_EXIST);
 	}
 
-	status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data);
+	status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data);
 	if (ACPI_FAILURE(status) || !data) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-			"Invalid ACPI-PCI context for device %s\n",
-			acpi_device_bid(device)));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Invalid ACPI-PCI context for device %s\n",
+				  acpi_device_bid(device)));
 		return_ACPI_STATUS(status);
 	}
 
 	*id = data->id;
-	
+
 	/*
-	id->segment = data->id.segment;
-	id->bus = data->id.bus;
-	id->device = data->id.device;
-	id->function = data->id.function;
-	*/
+	   id->segment = data->id.segment;
+	   id->bus = data->id.bus;
+	   id->device = data->id.device;
+	   id->function = data->id.function;
+	 */
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-		"Device %s has PCI address %02x:%02x:%02x.%02x\n", 
-		acpi_device_bid(device), id->segment, id->bus, 
-		id->device, id->function));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "Device %s has PCI address %02x:%02x:%02x.%02x\n",
+			  acpi_device_bid(device), id->segment, id->bus,
+			  id->device, id->function));
 
 	return_ACPI_STATUS(AE_OK);
 }
+
 EXPORT_SYMBOL(acpi_get_pci_id);
 
-	
-int
-acpi_pci_bind (
-	struct acpi_device	*device)
+int acpi_pci_bind(struct acpi_device *device)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	struct acpi_pci_data	*data = NULL;
-	struct acpi_pci_data	*pdata = NULL;
-	char			*pathname = NULL;
-	struct acpi_buffer	buffer = {0, NULL};
-	acpi_handle		handle = NULL;
-	struct pci_dev		*dev;
-	struct pci_bus 		*bus;
+	int result = 0;
+	acpi_status status = AE_OK;
+	struct acpi_pci_data *data = NULL;
+	struct acpi_pci_data *pdata = NULL;
+	char *pathname = NULL;
+	struct acpi_buffer buffer = { 0, NULL };
+	acpi_handle handle = NULL;
+	struct pci_dev *dev;
+	struct pci_bus *bus;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_bind");
 
@@ -137,34 +125,34 @@ acpi_pci_bind (
 		return_VALUE(-EINVAL);
 
 	pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-	if(!pathname)
+	if (!pathname)
 		return_VALUE(-ENOMEM);
 	memset(pathname, 0, ACPI_PATHNAME_MAX);
 	buffer.length = ACPI_PATHNAME_MAX;
 	buffer.pointer = pathname;
 
 	data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
-	if (!data){
-		kfree (pathname);
+	if (!data) {
+		kfree(pathname);
 		return_VALUE(-ENOMEM);
 	}
 	memset(data, 0, sizeof(struct acpi_pci_data));
 
 	acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", 
-		pathname));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
+			  pathname));
 
 	/* 
 	 * Segment & Bus
 	 * -------------
 	 * These are obtained via the parent device's ACPI-PCI context.
 	 */
-	status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, 
-		(void**) &pdata);
+	status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
+			       (void **)&pdata);
 	if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-			"Invalid ACPI-PCI context for parent device %s\n",
-			acpi_device_bid(device->parent)));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Invalid ACPI-PCI context for parent device %s\n",
+				  acpi_device_bid(device->parent)));
 		result = -ENODEV;
 		goto end;
 	}
@@ -181,8 +169,8 @@ acpi_pci_bind (
 	data->id.function = device->pnp.bus_address & 0xFFFF;
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %02x:%02x:%02x.%02x\n",
-		data->id.segment, data->id.bus, data->id.device, 
-		data->id.function));
+			  data->id.segment, data->id.bus, data->id.device,
+			  data->id.function));
 
 	/*
 	 * TBD: Support slot devices (e.g. function=0xFFFF).
@@ -202,25 +190,25 @@ acpi_pci_bind (
 	if (bus) {
 		list_for_each_entry(dev, &bus->devices, bus_list) {
 			if (dev->devfn == PCI_DEVFN(data->id.device,
-						data->id.function)) {
+						    data->id.function)) {
 				data->dev = dev;
 				break;
 			}
 		}
 	}
 	if (!data->dev) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-			"Device %02x:%02x:%02x.%02x not present in PCI namespace\n",
-			data->id.segment, data->id.bus, 
-			data->id.device, data->id.function));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Device %02x:%02x:%02x.%02x not present in PCI namespace\n",
+				  data->id.segment, data->id.bus,
+				  data->id.device, data->id.function));
 		result = -ENODEV;
 		goto end;
 	}
 	if (!data->dev->bus) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-			"Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
-			data->id.segment, data->id.bus, 
-			data->id.device, data->id.function));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
+				  data->id.segment, data->id.bus,
+				  data->id.device, data->id.function));
 		result = -ENODEV;
 		goto end;
 	}
@@ -232,10 +220,10 @@ acpi_pci_bind (
 	 * facilitate callbacks for all of its children.
 	 */
 	if (data->dev->subordinate) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-			"Device %02x:%02x:%02x.%02x is a PCI bridge\n",
-			data->id.segment, data->id.bus, 
-			data->id.device, data->id.function));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "Device %02x:%02x:%02x.%02x is a PCI bridge\n",
+				  data->id.segment, data->id.bus,
+				  data->id.device, data->id.function));
 		data->bus = data->dev->subordinate;
 		device->ops.bind = acpi_pci_bind;
 		device->ops.unbind = acpi_pci_unbind;
@@ -249,8 +237,8 @@ acpi_pci_bind (
 	status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to attach ACPI-PCI context to device %s\n",
-			acpi_device_bid(device)));
+				  "Unable to attach ACPI-PCI context to device %s\n",
+				  acpi_device_bid(device)));
 		result = -ENODEV;
 		goto end;
 	}
@@ -267,15 +255,15 @@ acpi_pci_bind (
 	 */
 	status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
 	if (ACPI_SUCCESS(status)) {
-		if (data->bus)				    /* PCI-PCI bridge */
-			acpi_pci_irq_add_prt(device->handle, data->id.segment, 
-				data->bus->number);
-		else				     /* non-bridge PCI device */
+		if (data->bus)	/* PCI-PCI bridge */
 			acpi_pci_irq_add_prt(device->handle, data->id.segment,
-				data->id.bus);
+					     data->bus->number);
+		else		/* non-bridge PCI device */
+			acpi_pci_irq_add_prt(device->handle, data->id.segment,
+					     data->id.bus);
 	}
 
-end:
+      end:
 	kfree(pathname);
 	if (result)
 		kfree(data);
@@ -283,22 +271,21 @@ end:
 	return_VALUE(result);
 }
 
-int acpi_pci_unbind(
-	struct acpi_device      *device)
+int acpi_pci_unbind(struct acpi_device *device)
 {
-	int                     result = 0;
-	acpi_status             status = AE_OK;
-	struct acpi_pci_data    *data = NULL;
-	char                    *pathname = NULL;
-	struct acpi_buffer      buffer = {0, NULL};
+	int result = 0;
+	acpi_status status = AE_OK;
+	struct acpi_pci_data *data = NULL;
+	char *pathname = NULL;
+	struct acpi_buffer buffer = { 0, NULL };
 
 	ACPI_FUNCTION_TRACE("acpi_pci_unbind");
 
 	if (!device || !device->parent)
 		return_VALUE(-EINVAL);
 
-	pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-	if(!pathname)
+	pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+	if (!pathname)
 		return_VALUE(-ENOMEM);
 	memset(pathname, 0, ACPI_PATHNAME_MAX);
 
@@ -306,14 +293,16 @@ int acpi_pci_unbind(
 	buffer.pointer = pathname;
 	acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
-		pathname));
+			  pathname));
 	kfree(pathname);
 
-	status = acpi_get_data(device->handle, acpi_pci_data_handler, (void**)&data);
+	status =
+	    acpi_get_data(device->handle, acpi_pci_data_handler,
+			  (void **)&data);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to get data from device %s\n",
-			acpi_device_bid(device)));
+				  "Unable to get data from device %s\n",
+				  acpi_device_bid(device)));
 		result = -ENODEV;
 		goto end;
 	}
@@ -321,8 +310,8 @@ int acpi_pci_unbind(
 	status = acpi_detach_data(device->handle, acpi_pci_data_handler);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to detach data from device %s\n",
-			acpi_device_bid(device)));
+				  "Unable to detach data from device %s\n",
+				  acpi_device_bid(device)));
 		result = -ENODEV;
 		goto end;
 	}
@@ -331,39 +320,37 @@ int acpi_pci_unbind(
 	}
 	kfree(data);
 
-end:
+      end:
 	return_VALUE(result);
 }
 
-int 
-acpi_pci_bind_root (
-	struct acpi_device	*device,
-	struct acpi_pci_id	*id,
-	struct pci_bus		*bus) 
+int
+acpi_pci_bind_root(struct acpi_device *device,
+		   struct acpi_pci_id *id, struct pci_bus *bus)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
-	struct acpi_pci_data	*data = NULL;
-	char			*pathname = NULL;
-	struct acpi_buffer	buffer = {0, NULL};
+	int result = 0;
+	acpi_status status = AE_OK;
+	struct acpi_pci_data *data = NULL;
+	char *pathname = NULL;
+	struct acpi_buffer buffer = { 0, NULL };
 
 	ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
 
 	pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-	if(!pathname)
+	if (!pathname)
 		return_VALUE(-ENOMEM);
 	memset(pathname, 0, ACPI_PATHNAME_MAX);
 
 	buffer.length = ACPI_PATHNAME_MAX;
 	buffer.pointer = pathname;
 
-	if (!device || !id || !bus){
+	if (!device || !id || !bus) {
 		kfree(pathname);
 		return_VALUE(-EINVAL);
 	}
 
 	data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
-	if (!data){
+	if (!data) {
 		kfree(pathname);
 		return_VALUE(-ENOMEM);
 	}
@@ -377,18 +364,18 @@ acpi_pci_bind_root (
 	acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to "
-		"%02x:%02x\n", pathname, id->segment, id->bus));
+			  "%02x:%02x\n", pathname, id->segment, id->bus));
 
 	status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to attach ACPI-PCI context to device %s\n",
-			pathname));
+				  "Unable to attach ACPI-PCI context to device %s\n",
+				  pathname));
 		result = -ENODEV;
 		goto end;
 	}
 
-end:
+      end:
 	kfree(pathname);
 	if (result != 0)
 		kfree(data);

+ 125 - 138
drivers/acpi/pci_irq.c

@@ -38,26 +38,22 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT		ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME		("pci_irq")
+ACPI_MODULE_NAME("pci_irq")
 
-static struct acpi_prt_list	acpi_prt;
+static struct acpi_prt_list acpi_prt;
 static DEFINE_SPINLOCK(acpi_prt_lock);
 
 /* --------------------------------------------------------------------------
                          PCI IRQ Routing Table (PRT) Support
    -------------------------------------------------------------------------- */
 
-static struct acpi_prt_entry *
-acpi_pci_irq_find_prt_entry (
-	int			segment,
-	int			bus,
-	int			device,
-	int			pin)
+static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
+							  int bus,
+							  int device, int pin)
 {
-	struct list_head	*node = NULL;
-	struct acpi_prt_entry	*entry = NULL;
+	struct list_head *node = NULL;
+	struct acpi_prt_entry *entry = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry");
 
@@ -72,10 +68,10 @@ acpi_pci_irq_find_prt_entry (
 	spin_lock(&acpi_prt_lock);
 	list_for_each(node, &acpi_prt.entries) {
 		entry = list_entry(node, struct acpi_prt_entry, node);
-		if ((segment == entry->id.segment) 
-			&& (bus == entry->id.bus) 
-			&& (device == entry->id.device)
-			&& (pin == entry->pin)) {
+		if ((segment == entry->id.segment)
+		    && (bus == entry->id.bus)
+		    && (device == entry->id.device)
+		    && (pin == entry->pin)) {
 			spin_unlock(&acpi_prt_lock);
 			return_PTR(entry);
 		}
@@ -85,15 +81,11 @@ acpi_pci_irq_find_prt_entry (
 	return_PTR(NULL);
 }
 
-
 static int
-acpi_pci_irq_add_entry (
-	acpi_handle			handle,
-	int				segment,
-	int				bus,
-	struct acpi_pci_routing_table	*prt)
+acpi_pci_irq_add_entry(acpi_handle handle,
+		       int segment, int bus, struct acpi_pci_routing_table *prt)
 {
-	struct acpi_prt_entry	*entry = NULL;
+	struct acpi_prt_entry *entry = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry");
 
@@ -139,9 +131,10 @@ acpi_pci_irq_add_entry (
 		entry->link.index = prt->source_index;
 
 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
-		"      %02X:%02X:%02X[%c] -> %s[%d]\n", 
-		entry->id.segment, entry->id.bus, entry->id.device, 
-		('A' + entry->pin), prt->source, entry->link.index));
+			      "      %02X:%02X:%02X[%c] -> %s[%d]\n",
+			      entry->id.segment, entry->id.bus,
+			      entry->id.device, ('A' + entry->pin), prt->source,
+			      entry->link.index));
 
 	spin_lock(&acpi_prt_lock);
 	list_add_tail(&entry->node, &acpi_prt.entries);
@@ -151,38 +144,29 @@ acpi_pci_irq_add_entry (
 	return_VALUE(0);
 }
 
-
 static void
-acpi_pci_irq_del_entry (
-	int				segment,
-	int				bus,
-	struct acpi_prt_entry		*entry)
+acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry)
 {
-	if (segment == entry->id.segment && bus == entry->id.bus){
+	if (segment == entry->id.segment && bus == entry->id.bus) {
 		acpi_prt.count--;
 		list_del(&entry->node);
 		kfree(entry);
 	}
 }
 
-
-int
-acpi_pci_irq_add_prt (
-	acpi_handle		handle,
-	int			segment,
-	int			bus)
+int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
 {
-	acpi_status			status = AE_OK;
-	char				*pathname = NULL;
-	struct acpi_buffer		buffer = {0, NULL};
-	struct acpi_pci_routing_table	*prt = NULL;
-	struct acpi_pci_routing_table	*entry = NULL;
-	static int			first_time = 1;
+	acpi_status status = AE_OK;
+	char *pathname = NULL;
+	struct acpi_buffer buffer = { 0, NULL };
+	struct acpi_pci_routing_table *prt = NULL;
+	struct acpi_pci_routing_table *entry = NULL;
+	static int first_time = 1;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt");
 
-	pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-	if(!pathname)
+	pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+	if (!pathname)
 		return_VALUE(-ENOMEM);
 	memset(pathname, 0, ACPI_PATHNAME_MAX);
 
@@ -202,7 +186,7 @@ acpi_pci_irq_add_prt (
 	acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
 
 	printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
-		pathname);
+	       pathname);
 
 	/* 
 	 * Evaluate this _PRT and add its entries to our global list (acpi_prt).
@@ -214,12 +198,12 @@ acpi_pci_irq_add_prt (
 	status = acpi_get_irq_routing_table(handle, &buffer);
 	if (status != AE_BUFFER_OVERFLOW) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
-			acpi_format_exception(status)));
+				  acpi_format_exception(status)));
 		return_VALUE(-ENODEV);
 	}
 
 	prt = kmalloc(buffer.length, GFP_KERNEL);
-	if (!prt){
+	if (!prt) {
 		return_VALUE(-ENOMEM);
 	}
 	memset(prt, 0, buffer.length);
@@ -228,7 +212,7 @@ acpi_pci_irq_add_prt (
 	status = acpi_get_irq_routing_table(handle, &buffer);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
-			acpi_format_exception(status)));
+				  acpi_format_exception(status)));
 		kfree(buffer.pointer);
 		return_VALUE(-ENODEV);
 	}
@@ -238,7 +222,7 @@ acpi_pci_irq_add_prt (
 	while (entry && (entry->length > 0)) {
 		acpi_pci_irq_add_entry(handle, segment, bus, entry);
 		entry = (struct acpi_pci_routing_table *)
-			((unsigned long) entry + entry->length);
+		    ((unsigned long)entry + entry->length);
 	}
 
 	kfree(prt);
@@ -246,18 +230,18 @@ acpi_pci_irq_add_prt (
 	return_VALUE(0);
 }
 
-void
-acpi_pci_irq_del_prt (int segment, int bus)
+void acpi_pci_irq_del_prt(int segment, int bus)
 {
-	struct list_head        *node = NULL, *n = NULL;
-	struct acpi_prt_entry   *entry = NULL;
+	struct list_head *node = NULL, *n = NULL;
+	struct acpi_prt_entry *entry = NULL;
 
-	if (!acpi_prt.count)    {
+	if (!acpi_prt.count) {
 		return;
 	}
 
-	printk(KERN_DEBUG "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n",
-		segment, bus);
+	printk(KERN_DEBUG
+	       "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", segment,
+	       bus);
 	spin_lock(&acpi_prt_lock);
 	list_for_each_safe(node, n, &acpi_prt.entries) {
 		entry = list_entry(node, struct acpi_prt_entry, node);
@@ -266,26 +250,27 @@ acpi_pci_irq_del_prt (int segment, int bus)
 	}
 	spin_unlock(&acpi_prt_lock);
 }
+
 /* --------------------------------------------------------------------------
                           PCI Interrupt Routing Support
    -------------------------------------------------------------------------- */
-typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **);
+typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
 
 static int
 acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
-	int	*edge_level,
-	int	*active_high_low,
-	char	**link)
+		      int *edge_level, int *active_high_low, char **link)
 {
-	int	irq;
+	int irq;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");
 
 	if (entry->link.handle) {
 		irq = acpi_pci_link_allocate_irq(entry->link.handle,
-			entry->link.index, edge_level, active_high_low, link);
+						 entry->link.index, edge_level,
+						 active_high_low, link);
 		if (irq < 0) {
-			ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));
+			ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+					  "Invalid IRQ link routing entry\n"));
 			return_VALUE(-1);
 		}
 	} else {
@@ -300,11 +285,9 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
 
 static int
 acpi_pci_free_irq(struct acpi_prt_entry *entry,
-	int	*edge_level,
-	int	*active_high_low,
-	char	**link)
+		  int *edge_level, int *active_high_low, char **link)
 {
-	int	irq;
+	int irq;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_free_irq");
 	if (entry->link.handle) {
@@ -314,38 +297,36 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
 	}
 	return_VALUE(irq);
 }
+
 /*
  * acpi_pci_irq_lookup
  * success: return IRQ >= 0
  * failure: return -1
  */
 static int
-acpi_pci_irq_lookup (
-	struct pci_bus		*bus,
-	int			device,
-	int			pin,
-	int			*edge_level,
-	int			*active_high_low,
-	char			**link,
-	irq_lookup_func		func)
+acpi_pci_irq_lookup(struct pci_bus *bus,
+		    int device,
+		    int pin,
+		    int *edge_level,
+		    int *active_high_low, char **link, irq_lookup_func func)
 {
-	struct acpi_prt_entry	*entry = NULL;
+	struct acpi_prt_entry *entry = NULL;
 	int segment = pci_domain_nr(bus);
 	int bus_nr = bus->number;
 	int ret;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-		"Searching for PRT entry for %02x:%02x:%02x[%c]\n", 
-		segment, bus_nr, device, ('A' + pin)));
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			  "Searching for PRT entry for %02x:%02x:%02x[%c]\n",
+			  segment, bus_nr, device, ('A' + pin)));
 
-	entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); 
+	entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
 	if (!entry) {
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n"));
 		return_VALUE(-1);
 	}
-	
+
 	ret = func(entry, edge_level, active_high_low, link);
 	return_VALUE(ret);
 }
@@ -356,17 +337,14 @@ acpi_pci_irq_lookup (
  * failure: return < 0
  */
 static int
-acpi_pci_irq_derive (
-	struct pci_dev		*dev,
-	int			pin,
-	int			*edge_level,
-	int			*active_high_low,
-	char			**link,
-	irq_lookup_func		func)
+acpi_pci_irq_derive(struct pci_dev *dev,
+		    int pin,
+		    int *edge_level,
+		    int *active_high_low, char **link, irq_lookup_func func)
 {
-	struct pci_dev		*bridge = dev;
-	int			irq = -1;
-	u8			bridge_pin = 0;
+	struct pci_dev *bridge = dev;
+	int irq = -1;
+	u8 bridge_pin = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_derive");
 
@@ -383,28 +361,33 @@ acpi_pci_irq_derive (
 
 		if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) {
 			/* PC card has the same IRQ as its cardbridge */
-			pci_read_config_byte(bridge, PCI_INTERRUPT_PIN, &bridge_pin);
+			pci_read_config_byte(bridge, PCI_INTERRUPT_PIN,
+					     &bridge_pin);
 			if (!bridge_pin) {
-				ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-					"No interrupt pin configured for device %s\n", pci_name(bridge)));
+				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+						  "No interrupt pin configured for device %s\n",
+						  pci_name(bridge)));
 				return_VALUE(-1);
 			}
 			/* Pin is from 0 to 3 */
-			bridge_pin --;
+			bridge_pin--;
 			pin = bridge_pin;
 		}
 
 		irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
-			pin, edge_level, active_high_low, link, func);
+					  pin, edge_level, active_high_low,
+					  link, func);
 	}
 
 	if (irq < 0) {
-		ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to derive IRQ for device %s\n", pci_name(dev)));
+		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+				  "Unable to derive IRQ for device %s\n",
+				  pci_name(dev)));
 		return_VALUE(-1);
 	}
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n",
-		irq, pci_name(dev), pci_name(bridge)));
+			  irq, pci_name(dev), pci_name(bridge)));
 
 	return_VALUE(irq);
 }
@@ -415,31 +398,32 @@ acpi_pci_irq_derive (
  * failure: return < 0
  */
 
-int
-acpi_pci_irq_enable (
-	struct pci_dev		*dev)
+int acpi_pci_irq_enable(struct pci_dev *dev)
 {
-	int			irq = 0;
-	u8			pin = 0;
-	int			edge_level = ACPI_LEVEL_SENSITIVE;
-	int			active_high_low = ACPI_ACTIVE_LOW;
-	char			*link = NULL;
-	int			rc;
+	int irq = 0;
+	u8 pin = 0;
+	int edge_level = ACPI_LEVEL_SENSITIVE;
+	int active_high_low = ACPI_ACTIVE_LOW;
+	char *link = NULL;
+	int rc;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_enable");
 
 	if (!dev)
 		return_VALUE(-EINVAL);
-	
+
 	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
 	if (!pin) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(dev)));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+				  "No interrupt pin configured for device %s\n",
+				  pci_name(dev)));
 		return_VALUE(0);
 	}
 	pin--;
 
 	if (!dev->bus) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) 'bus' field\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Invalid (NULL) 'bus' field\n"));
 		return_VALUE(-ENODEV);
 	}
 
@@ -447,35 +431,37 @@ acpi_pci_irq_enable (
 	 * First we check the PCI IRQ routing table (PRT) for an IRQ.  PRT
 	 * values override any BIOS-assigned IRQs set during boot.
 	 */
- 	irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
-		&edge_level, &active_high_low, &link, acpi_pci_allocate_irq);
+	irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
+				  &edge_level, &active_high_low, &link,
+				  acpi_pci_allocate_irq);
 
 	/*
 	 * If no PRT entry was found, we'll try to derive an IRQ from the
 	 * device's parent bridge.
 	 */
 	if (irq < 0)
- 		irq = acpi_pci_irq_derive(dev, pin, &edge_level,
-			&active_high_low, &link, acpi_pci_allocate_irq);
- 
+		irq = acpi_pci_irq_derive(dev, pin, &edge_level,
+					  &active_high_low, &link,
+					  acpi_pci_allocate_irq);
+
 	/*
 	 * No IRQ known to the ACPI subsystem - maybe the BIOS / 
 	 * driver reported one, then use it. Exit in any case.
 	 */
 	if (irq < 0) {
 		printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",
-			pci_name(dev), ('A' + pin));
+		       pci_name(dev), ('A' + pin));
 		/* Interrupt Line values above 0xF are forbidden */
 		if (dev->irq > 0 && (dev->irq <= 0xF)) {
 			printk(" - using IRQ %d\n", dev->irq);
-			acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
+			acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
+					  ACPI_ACTIVE_LOW);
 			return_VALUE(0);
-		}
-		else {
+		} else {
 			printk("\n");
 			return_VALUE(0);
 		}
- 	}
+	}
 
 	rc = acpi_register_gsi(irq, edge_level, active_high_low);
 	if (rc < 0) {
@@ -486,32 +472,31 @@ acpi_pci_irq_enable (
 	dev->irq = rc;
 
 	printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ",
-		pci_name(dev), 'A' + pin);
+	       pci_name(dev), 'A' + pin);
 
 	if (link)
 		printk("Link [%s] -> ", link);
 
 	printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
-		(edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
-		(active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high",
-		dev->irq);
+	       (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
+	       (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
 
 	return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_pci_irq_enable);
 
+EXPORT_SYMBOL(acpi_pci_irq_enable);
 
 /* FIXME: implement x86/x86_64 version */
-void __attribute__((weak)) acpi_unregister_gsi(u32 i) {}
+void __attribute__ ((weak)) acpi_unregister_gsi(u32 i)
+{
+}
 
-void
-acpi_pci_irq_disable (
-	struct pci_dev		*dev)
+void acpi_pci_irq_disable(struct pci_dev *dev)
 {
-	int			gsi = 0;
-	u8			pin = 0;
-	int			edge_level = ACPI_LEVEL_SENSITIVE;
-	int			active_high_low = ACPI_ACTIVE_LOW;
+	int gsi = 0;
+	u8 pin = 0;
+	int edge_level = ACPI_LEVEL_SENSITIVE;
+	int active_high_low = ACPI_ACTIVE_LOW;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
 
@@ -529,15 +514,17 @@ acpi_pci_irq_disable (
 	/*
 	 * First we check the PCI IRQ routing table (PRT) for an IRQ.
 	 */
- 	gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
-			&edge_level, &active_high_low, NULL, acpi_pci_free_irq);
+	gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
+				  &edge_level, &active_high_low, NULL,
+				  acpi_pci_free_irq);
 	/*
 	 * If no PRT entry was found, we'll try to derive an IRQ from the
 	 * device's parent bridge.
 	 */
 	if (gsi < 0)
- 		gsi = acpi_pci_irq_derive(dev, pin,
-			&edge_level, &active_high_low, NULL, acpi_pci_free_irq);
+		gsi = acpi_pci_irq_derive(dev, pin,
+					  &edge_level, &active_high_low, NULL,
+					  acpi_pci_free_irq);
 	if (gsi < 0)
 		return_VOID;
 

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels