aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/ac.c53
-rw-r--r--drivers/acpi/acpi_memhotplug.c82
-rw-r--r--drivers/acpi/battery.c97
-rw-r--r--drivers/acpi/bus.c105
-rw-r--r--drivers/acpi/button.c56
-rw-r--r--drivers/acpi/container.c34
-rw-r--r--drivers/acpi/debug.c14
-rw-r--r--drivers/acpi/ec.c146
-rw-r--r--drivers/acpi/event.c14
-rw-r--r--drivers/acpi/fan.c46
-rw-r--r--drivers/acpi/hotkey.c94
-rw-r--r--drivers/acpi/motherboard.c5
-rw-r--r--drivers/acpi/osl.c35
-rw-r--r--drivers/acpi/pci_bind.c37
-rw-r--r--drivers/acpi/pci_irq.c71
-rw-r--r--drivers/acpi/pci_link.c105
-rw-r--r--drivers/acpi/pci_root.c24
-rw-r--r--drivers/acpi/power.c125
-rw-r--r--drivers/acpi/processor_core.c111
-rw-r--r--drivers/acpi/processor_idle.c71
-rw-r--r--drivers/acpi/processor_perflib.c87
-rw-r--r--drivers/acpi/processor_thermal.c37
-rw-r--r--drivers/acpi/processor_throttling.c43
-rw-r--r--drivers/acpi/scan.c77
-rw-r--r--drivers/acpi/system.c18
-rw-r--r--drivers/acpi/thermal.c170
-rw-r--r--drivers/acpi/utils.c54
-rw-r--r--drivers/acpi/video.c238
28 files changed, 862 insertions, 1187 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 95223d8c5ecc..36ca365bcead 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -84,19 +84,18 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
84{ 84{
85 acpi_status status = AE_OK; 85 acpi_status status = AE_OK;
86 86
87 ACPI_FUNCTION_TRACE("acpi_ac_get_state");
88 87
89 if (!ac) 88 if (!ac)
90 return_VALUE(-EINVAL); 89 return -EINVAL;
91 90
92 status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); 91 status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
93 if (ACPI_FAILURE(status)) { 92 if (ACPI_FAILURE(status)) {
94 ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); 93 ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state"));
95 ac->state = ACPI_AC_STATUS_UNKNOWN; 94 ac->state = ACPI_AC_STATUS_UNKNOWN;
96 return_VALUE(-ENODEV); 95 return -ENODEV;
97 } 96 }
98 97
99 return_VALUE(0); 98 return 0;
100} 99}
101 100
102/* -------------------------------------------------------------------------- 101/* --------------------------------------------------------------------------
@@ -109,14 +108,13 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
109{ 108{
110 struct acpi_ac *ac = (struct acpi_ac *)seq->private; 109 struct acpi_ac *ac = (struct acpi_ac *)seq->private;
111 110
112 ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
113 111
114 if (!ac) 112 if (!ac)
115 return_VALUE(0); 113 return 0;
116 114
117 if (acpi_ac_get_state(ac)) { 115 if (acpi_ac_get_state(ac)) {
118 seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); 116 seq_puts(seq, "ERROR: Unable to read AC Adapter state\n");
119 return_VALUE(0); 117 return 0;
120 } 118 }
121 119
122 seq_puts(seq, "state: "); 120 seq_puts(seq, "state: ");
@@ -132,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
132 break; 130 break;
133 } 131 }
134 132
135 return_VALUE(0); 133 return 0;
136} 134}
137 135
138static int acpi_ac_open_fs(struct inode *inode, struct file *file) 136static int acpi_ac_open_fs(struct inode *inode, struct file *file)
@@ -144,13 +142,12 @@ static int acpi_ac_add_fs(struct acpi_device *device)
144{ 142{
145 struct proc_dir_entry *entry = NULL; 143 struct proc_dir_entry *entry = NULL;
146 144
147 ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
148 145
149 if (!acpi_device_dir(device)) { 146 if (!acpi_device_dir(device)) {
150 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 147 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
151 acpi_ac_dir); 148 acpi_ac_dir);
152 if (!acpi_device_dir(device)) 149 if (!acpi_device_dir(device))
153 return_VALUE(-ENODEV); 150 return -ENODEV;
154 acpi_device_dir(device)->owner = THIS_MODULE; 151 acpi_device_dir(device)->owner = THIS_MODULE;
155 } 152 }
156 153
@@ -158,19 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device)
158 entry = create_proc_entry(ACPI_AC_FILE_STATE, 155 entry = create_proc_entry(ACPI_AC_FILE_STATE,
159 S_IRUGO, acpi_device_dir(device)); 156 S_IRUGO, acpi_device_dir(device));
160 if (!entry) 157 if (!entry)
161 return_VALUE(-ENODEV); 158 return -ENODEV;
162 else { 159 else {
163 entry->proc_fops = &acpi_ac_fops; 160 entry->proc_fops = &acpi_ac_fops;
164 entry->data = acpi_driver_data(device); 161 entry->data = acpi_driver_data(device);
165 entry->owner = THIS_MODULE; 162 entry->owner = THIS_MODULE;
166 } 163 }
167 164
168 return_VALUE(0); 165 return 0;
169} 166}
170 167
171static int acpi_ac_remove_fs(struct acpi_device *device) 168static int acpi_ac_remove_fs(struct acpi_device *device)
172{ 169{
173 ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
174 170
175 if (acpi_device_dir(device)) { 171 if (acpi_device_dir(device)) {
176 remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device)); 172 remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
@@ -179,7 +175,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
179 acpi_device_dir(device) = NULL; 175 acpi_device_dir(device) = NULL;
180 } 176 }
181 177
182 return_VALUE(0); 178 return 0;
183} 179}
184 180
185/* -------------------------------------------------------------------------- 181/* --------------------------------------------------------------------------
@@ -191,13 +187,12 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
191 struct acpi_ac *ac = (struct acpi_ac *)data; 187 struct acpi_ac *ac = (struct acpi_ac *)data;
192 struct acpi_device *device = NULL; 188 struct acpi_device *device = NULL;
193 189
194 ACPI_FUNCTION_TRACE("acpi_ac_notify");
195 190
196 if (!ac) 191 if (!ac)
197 return_VOID; 192 return;
198 193
199 if (acpi_bus_get_device(ac->handle, &device)) 194 if (acpi_bus_get_device(ac->handle, &device))
200 return_VOID; 195 return;
201 196
202 switch (event) { 197 switch (event) {
203 case ACPI_AC_NOTIFY_STATUS: 198 case ACPI_AC_NOTIFY_STATUS:
@@ -210,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
210 break; 205 break;
211 } 206 }
212 207
213 return_VOID; 208 return;
214} 209}
215 210
216static int acpi_ac_add(struct acpi_device *device) 211static int acpi_ac_add(struct acpi_device *device)
@@ -219,14 +214,13 @@ static int acpi_ac_add(struct acpi_device *device)
219 acpi_status status = AE_OK; 214 acpi_status status = AE_OK;
220 struct acpi_ac *ac = NULL; 215 struct acpi_ac *ac = NULL;
221 216
222 ACPI_FUNCTION_TRACE("acpi_ac_add");
223 217
224 if (!device) 218 if (!device)
225 return_VALUE(-EINVAL); 219 return -EINVAL;
226 220
227 ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL); 221 ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
228 if (!ac) 222 if (!ac)
229 return_VALUE(-ENOMEM); 223 return -ENOMEM;
230 memset(ac, 0, sizeof(struct acpi_ac)); 224 memset(ac, 0, sizeof(struct acpi_ac));
231 225
232 ac->handle = device->handle; 226 ac->handle = device->handle;
@@ -260,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device)
260 kfree(ac); 254 kfree(ac);
261 } 255 }
262 256
263 return_VALUE(result); 257 return result;
264} 258}
265 259
266static int acpi_ac_remove(struct acpi_device *device, int type) 260static int acpi_ac_remove(struct acpi_device *device, int type)
@@ -268,10 +262,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
268 acpi_status status = AE_OK; 262 acpi_status status = AE_OK;
269 struct acpi_ac *ac = NULL; 263 struct acpi_ac *ac = NULL;
270 264
271 ACPI_FUNCTION_TRACE("acpi_ac_remove");
272 265
273 if (!device || !acpi_driver_data(device)) 266 if (!device || !acpi_driver_data(device))
274 return_VALUE(-EINVAL); 267 return -EINVAL;
275 268
276 ac = (struct acpi_ac *)acpi_driver_data(device); 269 ac = (struct acpi_ac *)acpi_driver_data(device);
277 270
@@ -282,38 +275,36 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
282 275
283 kfree(ac); 276 kfree(ac);
284 277
285 return_VALUE(0); 278 return 0;
286} 279}
287 280
288static int __init acpi_ac_init(void) 281static int __init acpi_ac_init(void)
289{ 282{
290 int result = 0; 283 int result = 0;
291 284
292 ACPI_FUNCTION_TRACE("acpi_ac_init");
293 285
294 acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); 286 acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
295 if (!acpi_ac_dir) 287 if (!acpi_ac_dir)
296 return_VALUE(-ENODEV); 288 return -ENODEV;
297 acpi_ac_dir->owner = THIS_MODULE; 289 acpi_ac_dir->owner = THIS_MODULE;
298 290
299 result = acpi_bus_register_driver(&acpi_ac_driver); 291 result = acpi_bus_register_driver(&acpi_ac_driver);
300 if (result < 0) { 292 if (result < 0) {
301 remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); 293 remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
302 return_VALUE(-ENODEV); 294 return -ENODEV;
303 } 295 }
304 296
305 return_VALUE(0); 297 return 0;
306} 298}
307 299
308static void __exit acpi_ac_exit(void) 300static void __exit acpi_ac_exit(void)
309{ 301{
310 ACPI_FUNCTION_TRACE("acpi_ac_exit");
311 302
312 acpi_bus_unregister_driver(&acpi_ac_driver); 303 acpi_bus_unregister_driver(&acpi_ac_driver);
313 304
314 remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); 305 remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
315 306
316 return_VOID; 307 return;
317} 308}
318 309
319module_init(acpi_ac_init); 310module_init(acpi_ac_init);
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index c7c8d537a063..b05469513842 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -85,12 +85,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
85 struct acpi_resource *resource = NULL; 85 struct acpi_resource *resource = NULL;
86 struct acpi_resource_address64 address64; 86 struct acpi_resource_address64 address64;
87 87
88 ACPI_FUNCTION_TRACE("acpi_memory_get_device_resources");
89 88
90 /* Get the range from the _CRS */ 89 /* Get the range from the _CRS */
91 status = acpi_get_current_resources(mem_device->handle, &buffer); 90 status = acpi_get_current_resources(mem_device->handle, &buffer);
92 if (ACPI_FAILURE(status)) 91 if (ACPI_FAILURE(status))
93 return_VALUE(-EINVAL); 92 return -EINVAL;
94 93
95 resource = (struct acpi_resource *)buffer.pointer; 94 resource = (struct acpi_resource *)buffer.pointer;
96 status = acpi_resource_to_address64(resource, &address64); 95 status = acpi_resource_to_address64(resource, &address64);
@@ -106,7 +105,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
106 } 105 }
107 106
108 acpi_os_free(buffer.pointer); 107 acpi_os_free(buffer.pointer);
109 return_VALUE(0); 108 return 0;
110} 109}
111 110
112static int 111static int
@@ -118,7 +117,6 @@ acpi_memory_get_device(acpi_handle handle,
118 struct acpi_device *device = NULL; 117 struct acpi_device *device = NULL;
119 struct acpi_device *pdevice = NULL; 118 struct acpi_device *pdevice = NULL;
120 119
121 ACPI_FUNCTION_TRACE("acpi_memory_get_device");
122 120
123 if (!acpi_bus_get_device(handle, &device) && device) 121 if (!acpi_bus_get_device(handle, &device) && device)
124 goto end; 122 goto end;
@@ -126,14 +124,14 @@ acpi_memory_get_device(acpi_handle handle,
126 status = acpi_get_parent(handle, &phandle); 124 status = acpi_get_parent(handle, &phandle);
127 if (ACPI_FAILURE(status)) { 125 if (ACPI_FAILURE(status)) {
128 ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); 126 ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent"));
129 return_VALUE(-EINVAL); 127 return -EINVAL;
130 } 128 }
131 129
132 /* Get the parent device */ 130 /* Get the parent device */
133 status = acpi_bus_get_device(phandle, &pdevice); 131 status = acpi_bus_get_device(phandle, &pdevice);
134 if (ACPI_FAILURE(status)) { 132 if (ACPI_FAILURE(status)) {
135 ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); 133 ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device"));
136 return_VALUE(-EINVAL); 134 return -EINVAL;
137 } 135 }
138 136
139 /* 137 /*
@@ -143,29 +141,28 @@ acpi_memory_get_device(acpi_handle handle,
143 status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); 141 status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
144 if (ACPI_FAILURE(status)) { 142 if (ACPI_FAILURE(status)) {
145 ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); 143 ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus"));
146 return_VALUE(-EINVAL); 144 return -EINVAL;
147 } 145 }
148 146
149 end: 147 end:
150 *mem_device = acpi_driver_data(device); 148 *mem_device = acpi_driver_data(device);
151 if (!(*mem_device)) { 149 if (!(*mem_device)) {
152 printk(KERN_ERR "\n driver data not found"); 150 printk(KERN_ERR "\n driver data not found");
153 return_VALUE(-ENODEV); 151 return -ENODEV;
154 } 152 }
155 153
156 return_VALUE(0); 154 return 0;
157} 155}
158 156
159static int acpi_memory_check_device(struct acpi_memory_device *mem_device) 157static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
160{ 158{
161 unsigned long current_status; 159 unsigned long current_status;
162 160
163 ACPI_FUNCTION_TRACE("acpi_memory_check_device");
164 161
165 /* Get device present/absent information from the _STA */ 162 /* Get device present/absent information from the _STA */
166 if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", 163 if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
167 NULL, &current_status))) 164 NULL, &current_status)))
168 return_VALUE(-ENODEV); 165 return -ENODEV;
169 /* 166 /*
170 * Check for device status. Device should be 167 * Check for device status. Device should be
171 * present/enabled/functioning. 168 * present/enabled/functioning.
@@ -173,16 +170,15 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
173 if (!((current_status & ACPI_MEMORY_STA_PRESENT) 170 if (!((current_status & ACPI_MEMORY_STA_PRESENT)
174 && (current_status & ACPI_MEMORY_STA_ENABLED) 171 && (current_status & ACPI_MEMORY_STA_ENABLED)
175 && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) 172 && (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
176 return_VALUE(-ENODEV); 173 return -ENODEV;
177 174
178 return_VALUE(0); 175 return 0;
179} 176}
180 177
181static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) 178static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
182{ 179{
183 int result; 180 int result;
184 181
185 ACPI_FUNCTION_TRACE("acpi_memory_enable_device");
186 182
187 /* Get the range from the _CRS */ 183 /* Get the range from the _CRS */
188 result = acpi_memory_get_device_resources(mem_device); 184 result = acpi_memory_get_device_resources(mem_device);
@@ -213,7 +209,6 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
213 union acpi_object arg; 209 union acpi_object arg;
214 unsigned long current_status; 210 unsigned long current_status;
215 211
216 ACPI_FUNCTION_TRACE("acpi_memory_powerdown_device");
217 212
218 /* Issue the _EJ0 command */ 213 /* Issue the _EJ0 command */
219 arg_list.count = 1; 214 arg_list.count = 1;
@@ -225,20 +220,20 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
225 /* Return on _EJ0 failure */ 220 /* Return on _EJ0 failure */
226 if (ACPI_FAILURE(status)) { 221 if (ACPI_FAILURE(status)) {
227 ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed")); 222 ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed"));
228 return_VALUE(-ENODEV); 223 return -ENODEV;
229 } 224 }
230 225
231 /* Evalute _STA to check if the device is disabled */ 226 /* Evalute _STA to check if the device is disabled */
232 status = acpi_evaluate_integer(mem_device->handle, "_STA", 227 status = acpi_evaluate_integer(mem_device->handle, "_STA",
233 NULL, &current_status); 228 NULL, &current_status);
234 if (ACPI_FAILURE(status)) 229 if (ACPI_FAILURE(status))
235 return_VALUE(-ENODEV); 230 return -ENODEV;
236 231
237 /* Check for device status. Device should be disabled */ 232 /* Check for device status. Device should be disabled */
238 if (current_status & ACPI_MEMORY_STA_ENABLED) 233 if (current_status & ACPI_MEMORY_STA_ENABLED)
239 return_VALUE(-EINVAL); 234 return -EINVAL;
240 235
241 return_VALUE(0); 236 return 0;
242} 237}
243 238
244static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) 239static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
@@ -247,7 +242,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
247 u64 start = mem_device->start_addr; 242 u64 start = mem_device->start_addr;
248 u64 len = mem_device->length; 243 u64 len = mem_device->length;
249 244
250 ACPI_FUNCTION_TRACE("acpi_memory_disable_device");
251 245
252 /* 246 /*
253 * Ask the VM to offline this memory range. 247 * Ask the VM to offline this memory range.
@@ -255,7 +249,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
255 */ 249 */
256 result = remove_memory(start, len); 250 result = remove_memory(start, len);
257 if (result) 251 if (result)
258 return_VALUE(result); 252 return result;
259 253
260 /* Power-off and eject the device */ 254 /* Power-off and eject the device */
261 result = acpi_memory_powerdown_device(mem_device); 255 result = acpi_memory_powerdown_device(mem_device);
@@ -274,7 +268,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
274 struct acpi_memory_device *mem_device; 268 struct acpi_memory_device *mem_device;
275 struct acpi_device *device; 269 struct acpi_device *device;
276 270
277 ACPI_FUNCTION_TRACE("acpi_memory_device_notify");
278 271
279 switch (event) { 272 switch (event) {
280 case ACPI_NOTIFY_BUS_CHECK: 273 case ACPI_NOTIFY_BUS_CHECK:
@@ -287,7 +280,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
287 "\nReceived DEVICE CHECK notification for device\n")); 280 "\nReceived DEVICE CHECK notification for device\n"));
288 if (acpi_memory_get_device(handle, &mem_device)) { 281 if (acpi_memory_get_device(handle, &mem_device)) {
289 printk(KERN_ERR PREFIX "Cannot find driver data\n"); 282 printk(KERN_ERR PREFIX "Cannot find driver data\n");
290 return_VOID; 283 return;
291 } 284 }
292 285
293 if (!acpi_memory_check_device(mem_device)) { 286 if (!acpi_memory_check_device(mem_device)) {
@@ -329,7 +322,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
329 break; 322 break;
330 } 323 }
331 324
332 return_VOID; 325 return;
333} 326}
334 327
335static int acpi_memory_device_add(struct acpi_device *device) 328static int acpi_memory_device_add(struct acpi_device *device)
@@ -337,14 +330,13 @@ static int acpi_memory_device_add(struct acpi_device *device)
337 int result; 330 int result;
338 struct acpi_memory_device *mem_device = NULL; 331 struct acpi_memory_device *mem_device = NULL;
339 332
340 ACPI_FUNCTION_TRACE("acpi_memory_device_add");
341 333
342 if (!device) 334 if (!device)
343 return_VALUE(-EINVAL); 335 return -EINVAL;
344 336
345 mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); 337 mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
346 if (!mem_device) 338 if (!mem_device)
347 return_VALUE(-ENOMEM); 339 return -ENOMEM;
348 memset(mem_device, 0, sizeof(struct acpi_memory_device)); 340 memset(mem_device, 0, sizeof(struct acpi_memory_device));
349 341
350 mem_device->handle = device->handle; 342 mem_device->handle = device->handle;
@@ -356,7 +348,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
356 result = acpi_memory_get_device_resources(mem_device); 348 result = acpi_memory_get_device_resources(mem_device);
357 if (result) { 349 if (result) {
358 kfree(mem_device); 350 kfree(mem_device);
359 return_VALUE(result); 351 return result;
360 } 352 }
361 353
362 /* Set the device state */ 354 /* Set the device state */
@@ -364,22 +356,21 @@ static int acpi_memory_device_add(struct acpi_device *device)
364 356
365 printk(KERN_INFO "%s \n", acpi_device_name(device)); 357 printk(KERN_INFO "%s \n", acpi_device_name(device));
366 358
367 return_VALUE(result); 359 return result;
368} 360}
369 361
370static int acpi_memory_device_remove(struct acpi_device *device, int type) 362static int acpi_memory_device_remove(struct acpi_device *device, int type)
371{ 363{
372 struct acpi_memory_device *mem_device = NULL; 364 struct acpi_memory_device *mem_device = NULL;
373 365
374 ACPI_FUNCTION_TRACE("acpi_memory_device_remove");
375 366
376 if (!device || !acpi_driver_data(device)) 367 if (!device || !acpi_driver_data(device))
377 return_VALUE(-EINVAL); 368 return -EINVAL;
378 369
379 mem_device = (struct acpi_memory_device *)acpi_driver_data(device); 370 mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
380 kfree(mem_device); 371 kfree(mem_device);
381 372
382 return_VALUE(0); 373 return 0;
383} 374}
384 375
385/* 376/*
@@ -392,16 +383,15 @@ static acpi_status is_memory_device(acpi_handle handle)
392 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 383 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
393 struct acpi_device_info *info; 384 struct acpi_device_info *info;
394 385
395 ACPI_FUNCTION_TRACE("is_memory_device");
396 386
397 status = acpi_get_object_info(handle, &buffer); 387 status = acpi_get_object_info(handle, &buffer);
398 if (ACPI_FAILURE(status)) 388 if (ACPI_FAILURE(status))
399 return_ACPI_STATUS(status); 389 return status;
400 390
401 info = buffer.pointer; 391 info = buffer.pointer;
402 if (!(info->valid & ACPI_VALID_HID)) { 392 if (!(info->valid & ACPI_VALID_HID)) {
403 acpi_os_free(buffer.pointer); 393 acpi_os_free(buffer.pointer);
404 return_ACPI_STATUS(AE_ERROR); 394 return AE_ERROR;
405 } 395 }
406 396
407 hardware_id = info->hardware_id.value; 397 hardware_id = info->hardware_id.value;
@@ -410,7 +400,7 @@ static acpi_status is_memory_device(acpi_handle handle)
410 status = AE_ERROR; 400 status = AE_ERROR;
411 401
412 acpi_os_free(buffer.pointer); 402 acpi_os_free(buffer.pointer);
413 return_ACPI_STATUS(status); 403 return status;
414} 404}
415 405
416static acpi_status 406static acpi_status
@@ -419,18 +409,17 @@ acpi_memory_register_notify_handler(acpi_handle handle,
419{ 409{
420 acpi_status status; 410 acpi_status status;
421 411
422 ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler");
423 412
424 status = is_memory_device(handle); 413 status = is_memory_device(handle);
425 if (ACPI_FAILURE(status)){ 414 if (ACPI_FAILURE(status)){
426 ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); 415 ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device"));
427 return_ACPI_STATUS(AE_OK); /* continue */ 416 return AE_OK; /* continue */
428 } 417 }
429 418
430 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 419 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
431 acpi_memory_device_notify, NULL); 420 acpi_memory_device_notify, NULL);
432 /* continue */ 421 /* continue */
433 return_ACPI_STATUS(AE_OK); 422 return AE_OK;
434} 423}
435 424
436static acpi_status 425static acpi_status
@@ -439,19 +428,18 @@ acpi_memory_deregister_notify_handler(acpi_handle handle,
439{ 428{
440 acpi_status status; 429 acpi_status status;
441 430
442 ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler");
443 431
444 status = is_memory_device(handle); 432 status = is_memory_device(handle);
445 if (ACPI_FAILURE(status)){ 433 if (ACPI_FAILURE(status)){
446 ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); 434 ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device"));
447 return_ACPI_STATUS(AE_OK); /* continue */ 435 return AE_OK; /* continue */
448 } 436 }
449 437
450 status = acpi_remove_notify_handler(handle, 438 status = acpi_remove_notify_handler(handle,
451 ACPI_SYSTEM_NOTIFY, 439 ACPI_SYSTEM_NOTIFY,
452 acpi_memory_device_notify); 440 acpi_memory_device_notify);
453 441
454 return_ACPI_STATUS(AE_OK); /* continue */ 442 return AE_OK; /* continue */
455} 443}
456 444
457static int __init acpi_memory_device_init(void) 445static int __init acpi_memory_device_init(void)
@@ -459,12 +447,11 @@ static int __init acpi_memory_device_init(void)
459 int result; 447 int result;
460 acpi_status status; 448 acpi_status status;
461 449
462 ACPI_FUNCTION_TRACE("acpi_memory_device_init");
463 450
464 result = acpi_bus_register_driver(&acpi_memory_device_driver); 451 result = acpi_bus_register_driver(&acpi_memory_device_driver);
465 452
466 if (result < 0) 453 if (result < 0)
467 return_VALUE(-ENODEV); 454 return -ENODEV;
468 455
469 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 456 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
470 ACPI_UINT32_MAX, 457 ACPI_UINT32_MAX,
@@ -474,17 +461,16 @@ static int __init acpi_memory_device_init(void)
474 if (ACPI_FAILURE(status)) { 461 if (ACPI_FAILURE(status)) {
475 ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); 462 ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed"));
476 acpi_bus_unregister_driver(&acpi_memory_device_driver); 463 acpi_bus_unregister_driver(&acpi_memory_device_driver);
477 return_VALUE(-ENODEV); 464 return -ENODEV;
478 } 465 }
479 466
480 return_VALUE(0); 467 return 0;
481} 468}
482 469
483static void __exit acpi_memory_device_exit(void) 470static void __exit acpi_memory_device_exit(void)
484{ 471{
485 acpi_status status; 472 acpi_status status;
486 473
487 ACPI_FUNCTION_TRACE("acpi_memory_device_exit");
488 474
489 /* 475 /*
490 * Adding this to un-install notification handlers for all the device 476 * Adding this to un-install notification handlers for all the device
@@ -500,7 +486,7 @@ static void __exit acpi_memory_device_exit(void)
500 486
501 acpi_bus_unregister_driver(&acpi_memory_device_driver); 487 acpi_bus_unregister_driver(&acpi_memory_device_driver);
502 488
503 return_VOID; 489 return;
504} 490}
505 491
506module_init(acpi_memory_device_init); 492module_init(acpi_memory_device_init);
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 3b92c94ebc60..00b0728efe82 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -132,17 +132,16 @@ acpi_battery_get_info(struct acpi_battery *battery,
132 struct acpi_buffer data = { 0, NULL }; 132 struct acpi_buffer data = { 0, NULL };
133 union acpi_object *package = NULL; 133 union acpi_object *package = NULL;
134 134
135 ACPI_FUNCTION_TRACE("acpi_battery_get_info");
136 135
137 if (!battery || !bif) 136 if (!battery || !bif)
138 return_VALUE(-EINVAL); 137 return -EINVAL;
139 138
140 /* Evalute _BIF */ 139 /* Evalute _BIF */
141 140
142 status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); 141 status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
143 if (ACPI_FAILURE(status)) { 142 if (ACPI_FAILURE(status)) {
144 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); 143 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
145 return_VALUE(-ENODEV); 144 return -ENODEV;
146 } 145 }
147 146
148 package = (union acpi_object *)buffer.pointer; 147 package = (union acpi_object *)buffer.pointer;
@@ -177,7 +176,7 @@ acpi_battery_get_info(struct acpi_battery *battery,
177 if (!result) 176 if (!result)
178 (*bif) = (struct acpi_battery_info *)data.pointer; 177 (*bif) = (struct acpi_battery_info *)data.pointer;
179 178
180 return_VALUE(result); 179 return result;
181} 180}
182 181
183static int 182static int
@@ -193,17 +192,16 @@ acpi_battery_get_status(struct acpi_battery *battery,
193 struct acpi_buffer data = { 0, NULL }; 192 struct acpi_buffer data = { 0, NULL };
194 union acpi_object *package = NULL; 193 union acpi_object *package = NULL;
195 194
196 ACPI_FUNCTION_TRACE("acpi_battery_get_status");
197 195
198 if (!battery || !bst) 196 if (!battery || !bst)
199 return_VALUE(-EINVAL); 197 return -EINVAL;
200 198
201 /* Evalute _BST */ 199 /* Evalute _BST */
202 200
203 status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); 201 status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
204 if (ACPI_FAILURE(status)) { 202 if (ACPI_FAILURE(status)) {
205 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 203 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
206 return_VALUE(-ENODEV); 204 return -ENODEV;
207 } 205 }
208 206
209 package = (union acpi_object *)buffer.pointer; 207 package = (union acpi_object *)buffer.pointer;
@@ -238,7 +236,7 @@ acpi_battery_get_status(struct acpi_battery *battery,
238 if (!result) 236 if (!result)
239 (*bst) = (struct acpi_battery_status *)data.pointer; 237 (*bst) = (struct acpi_battery_status *)data.pointer;
240 238
241 return_VALUE(result); 239 return result;
242} 240}
243 241
244static int 242static int
@@ -248,25 +246,24 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
248 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 246 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
249 struct acpi_object_list arg_list = { 1, &arg0 }; 247 struct acpi_object_list arg_list = { 1, &arg0 };
250 248
251 ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
252 249
253 if (!battery) 250 if (!battery)
254 return_VALUE(-EINVAL); 251 return -EINVAL;
255 252
256 if (!battery->flags.alarm) 253 if (!battery->flags.alarm)
257 return_VALUE(-ENODEV); 254 return -ENODEV;
258 255
259 arg0.integer.value = alarm; 256 arg0.integer.value = alarm;
260 257
261 status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL); 258 status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL);
262 if (ACPI_FAILURE(status)) 259 if (ACPI_FAILURE(status))
263 return_VALUE(-ENODEV); 260 return -ENODEV;
264 261
265 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm)); 262 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm));
266 263
267 battery->alarm = alarm; 264 battery->alarm = alarm;
268 265
269 return_VALUE(0); 266 return 0;
270} 267}
271 268
272static int acpi_battery_check(struct acpi_battery *battery) 269static int acpi_battery_check(struct acpi_battery *battery)
@@ -277,18 +274,17 @@ static int acpi_battery_check(struct acpi_battery *battery)
277 struct acpi_device *device = NULL; 274 struct acpi_device *device = NULL;
278 struct acpi_battery_info *bif = NULL; 275 struct acpi_battery_info *bif = NULL;
279 276
280 ACPI_FUNCTION_TRACE("acpi_battery_check");
281 277
282 if (!battery) 278 if (!battery)
283 return_VALUE(-EINVAL); 279 return -EINVAL;
284 280
285 result = acpi_bus_get_device(battery->handle, &device); 281 result = acpi_bus_get_device(battery->handle, &device);
286 if (result) 282 if (result)
287 return_VALUE(result); 283 return result;
288 284
289 result = acpi_bus_get_status(device); 285 result = acpi_bus_get_status(device);
290 if (result) 286 if (result)
291 return_VALUE(result); 287 return result;
292 288
293 /* Insertion? */ 289 /* Insertion? */
294 290
@@ -300,7 +296,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
300 296
301 result = acpi_battery_get_info(battery, &bif); 297 result = acpi_battery_get_info(battery, &bif);
302 if (result) 298 if (result)
303 return_VALUE(result); 299 return result;
304 300
305 battery->flags.power_unit = bif->power_unit; 301 battery->flags.power_unit = bif->power_unit;
306 battery->trips.warning = bif->design_capacity_warning; 302 battery->trips.warning = bif->design_capacity_warning;
@@ -324,7 +320,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
324 320
325 battery->flags.present = device->status.battery_present; 321 battery->flags.present = device->status.battery_present;
326 322
327 return_VALUE(result); 323 return result;
328} 324}
329 325
330/* -------------------------------------------------------------------------- 326/* --------------------------------------------------------------------------
@@ -339,7 +335,6 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
339 struct acpi_battery_info *bif = NULL; 335 struct acpi_battery_info *bif = NULL;
340 char *units = "?"; 336 char *units = "?";
341 337
342 ACPI_FUNCTION_TRACE("acpi_battery_read_info");
343 338
344 if (!battery) 339 if (!battery)
345 goto end; 340 goto end;
@@ -409,7 +404,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
409 end: 404 end:
410 kfree(bif); 405 kfree(bif);
411 406
412 return_VALUE(0); 407 return 0;
413} 408}
414 409
415static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) 410static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
@@ -424,7 +419,6 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
424 struct acpi_battery_status *bst = NULL; 419 struct acpi_battery_status *bst = NULL;
425 char *units = "?"; 420 char *units = "?";
426 421
427 ACPI_FUNCTION_TRACE("acpi_battery_read_state");
428 422
429 if (!battery) 423 if (!battery)
430 goto end; 424 goto end;
@@ -487,7 +481,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
487 end: 481 end:
488 kfree(bst); 482 kfree(bst);
489 483
490 return_VALUE(0); 484 return 0;
491} 485}
492 486
493static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) 487static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
@@ -500,7 +494,6 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
500 struct acpi_battery *battery = (struct acpi_battery *)seq->private; 494 struct acpi_battery *battery = (struct acpi_battery *)seq->private;
501 char *units = "?"; 495 char *units = "?";
502 496
503 ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
504 497
505 if (!battery) 498 if (!battery)
506 goto end; 499 goto end;
@@ -525,7 +518,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
525 seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units); 518 seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
526 519
527 end: 520 end:
528 return_VALUE(0); 521 return 0;
529} 522}
530 523
531static ssize_t 524static ssize_t
@@ -538,25 +531,24 @@ acpi_battery_write_alarm(struct file *file,
538 struct seq_file *m = (struct seq_file *)file->private_data; 531 struct seq_file *m = (struct seq_file *)file->private_data;
539 struct acpi_battery *battery = (struct acpi_battery *)m->private; 532 struct acpi_battery *battery = (struct acpi_battery *)m->private;
540 533
541 ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
542 534
543 if (!battery || (count > sizeof(alarm_string) - 1)) 535 if (!battery || (count > sizeof(alarm_string) - 1))
544 return_VALUE(-EINVAL); 536 return -EINVAL;
545 537
546 if (!battery->flags.present) 538 if (!battery->flags.present)
547 return_VALUE(-ENODEV); 539 return -ENODEV;
548 540
549 if (copy_from_user(alarm_string, buffer, count)) 541 if (copy_from_user(alarm_string, buffer, count))
550 return_VALUE(-EFAULT); 542 return -EFAULT;
551 543
552 alarm_string[count] = '\0'; 544 alarm_string[count] = '\0';
553 545
554 result = acpi_battery_set_alarm(battery, 546 result = acpi_battery_set_alarm(battery,
555 simple_strtoul(alarm_string, NULL, 0)); 547 simple_strtoul(alarm_string, NULL, 0));
556 if (result) 548 if (result)
557 return_VALUE(result); 549 return result;
558 550
559 return_VALUE(count); 551 return count;
560} 552}
561 553
562static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) 554static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
@@ -593,13 +585,12 @@ static int acpi_battery_add_fs(struct acpi_device *device)
593{ 585{
594 struct proc_dir_entry *entry = NULL; 586 struct proc_dir_entry *entry = NULL;
595 587
596 ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
597 588
598 if (!acpi_device_dir(device)) { 589 if (!acpi_device_dir(device)) {
599 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 590 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
600 acpi_battery_dir); 591 acpi_battery_dir);
601 if (!acpi_device_dir(device)) 592 if (!acpi_device_dir(device))
602 return_VALUE(-ENODEV); 593 return -ENODEV;
603 acpi_device_dir(device)->owner = THIS_MODULE; 594 acpi_device_dir(device)->owner = THIS_MODULE;
604 } 595 }
605 596
@@ -607,7 +598,7 @@ static int acpi_battery_add_fs(struct acpi_device *device)
607 entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, 598 entry = create_proc_entry(ACPI_BATTERY_FILE_INFO,
608 S_IRUGO, acpi_device_dir(device)); 599 S_IRUGO, acpi_device_dir(device));
609 if (!entry) 600 if (!entry)
610 return_VALUE(-ENODEV); 601 return -ENODEV;
611 else { 602 else {
612 entry->proc_fops = &acpi_battery_info_ops; 603 entry->proc_fops = &acpi_battery_info_ops;
613 entry->data = acpi_driver_data(device); 604 entry->data = acpi_driver_data(device);
@@ -618,7 +609,7 @@ static int acpi_battery_add_fs(struct acpi_device *device)
618 entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, 609 entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS,
619 S_IRUGO, acpi_device_dir(device)); 610 S_IRUGO, acpi_device_dir(device));
620 if (!entry) 611 if (!entry)
621 return_VALUE(-ENODEV); 612 return -ENODEV;
622 else { 613 else {
623 entry->proc_fops = &acpi_battery_state_ops; 614 entry->proc_fops = &acpi_battery_state_ops;
624 entry->data = acpi_driver_data(device); 615 entry->data = acpi_driver_data(device);
@@ -630,19 +621,18 @@ static int acpi_battery_add_fs(struct acpi_device *device)
630 S_IFREG | S_IRUGO | S_IWUSR, 621 S_IFREG | S_IRUGO | S_IWUSR,
631 acpi_device_dir(device)); 622 acpi_device_dir(device));
632 if (!entry) 623 if (!entry)
633 return_VALUE(-ENODEV); 624 return -ENODEV;
634 else { 625 else {
635 entry->proc_fops = &acpi_battery_alarm_ops; 626 entry->proc_fops = &acpi_battery_alarm_ops;
636 entry->data = acpi_driver_data(device); 627 entry->data = acpi_driver_data(device);
637 entry->owner = THIS_MODULE; 628 entry->owner = THIS_MODULE;
638 } 629 }
639 630
640 return_VALUE(0); 631 return 0;
641} 632}
642 633
643static int acpi_battery_remove_fs(struct acpi_device *device) 634static int acpi_battery_remove_fs(struct acpi_device *device)
644{ 635{
645 ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
646 636
647 if (acpi_device_dir(device)) { 637 if (acpi_device_dir(device)) {
648 remove_proc_entry(ACPI_BATTERY_FILE_ALARM, 638 remove_proc_entry(ACPI_BATTERY_FILE_ALARM,
@@ -656,7 +646,7 @@ static int acpi_battery_remove_fs(struct acpi_device *device)
656 acpi_device_dir(device) = NULL; 646 acpi_device_dir(device) = NULL;
657 } 647 }
658 648
659 return_VALUE(0); 649 return 0;
660} 650}
661 651
662/* -------------------------------------------------------------------------- 652/* --------------------------------------------------------------------------
@@ -668,13 +658,12 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
668 struct acpi_battery *battery = (struct acpi_battery *)data; 658 struct acpi_battery *battery = (struct acpi_battery *)data;
669 struct acpi_device *device = NULL; 659 struct acpi_device *device = NULL;
670 660
671 ACPI_FUNCTION_TRACE("acpi_battery_notify");
672 661
673 if (!battery) 662 if (!battery)
674 return_VOID; 663 return;
675 664
676 if (acpi_bus_get_device(handle, &device)) 665 if (acpi_bus_get_device(handle, &device))
677 return_VOID; 666 return;
678 667
679 switch (event) { 668 switch (event) {
680 case ACPI_BATTERY_NOTIFY_STATUS: 669 case ACPI_BATTERY_NOTIFY_STATUS:
@@ -688,7 +677,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
688 break; 677 break;
689 } 678 }
690 679
691 return_VOID; 680 return;
692} 681}
693 682
694static int acpi_battery_add(struct acpi_device *device) 683static int acpi_battery_add(struct acpi_device *device)
@@ -697,14 +686,13 @@ static int acpi_battery_add(struct acpi_device *device)
697 acpi_status status = 0; 686 acpi_status status = 0;
698 struct acpi_battery *battery = NULL; 687 struct acpi_battery *battery = NULL;
699 688
700 ACPI_FUNCTION_TRACE("acpi_battery_add");
701 689
702 if (!device) 690 if (!device)
703 return_VALUE(-EINVAL); 691 return -EINVAL;
704 692
705 battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL); 693 battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL);
706 if (!battery) 694 if (!battery)
707 return_VALUE(-ENOMEM); 695 return -ENOMEM;
708 memset(battery, 0, sizeof(struct acpi_battery)); 696 memset(battery, 0, sizeof(struct acpi_battery));
709 697
710 battery->handle = device->handle; 698 battery->handle = device->handle;
@@ -738,7 +726,7 @@ static int acpi_battery_add(struct acpi_device *device)
738 kfree(battery); 726 kfree(battery);
739 } 727 }
740 728
741 return_VALUE(result); 729 return result;
742} 730}
743 731
744static int acpi_battery_remove(struct acpi_device *device, int type) 732static int acpi_battery_remove(struct acpi_device *device, int type)
@@ -746,10 +734,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
746 acpi_status status = 0; 734 acpi_status status = 0;
747 struct acpi_battery *battery = NULL; 735 struct acpi_battery *battery = NULL;
748 736
749 ACPI_FUNCTION_TRACE("acpi_battery_remove");
750 737
751 if (!device || !acpi_driver_data(device)) 738 if (!device || !acpi_driver_data(device))
752 return_VALUE(-EINVAL); 739 return -EINVAL;
753 740
754 battery = (struct acpi_battery *)acpi_driver_data(device); 741 battery = (struct acpi_battery *)acpi_driver_data(device);
755 742
@@ -761,38 +748,36 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
761 748
762 kfree(battery); 749 kfree(battery);
763 750
764 return_VALUE(0); 751 return 0;
765} 752}
766 753
767static int __init acpi_battery_init(void) 754static int __init acpi_battery_init(void)
768{ 755{
769 int result = 0; 756 int result = 0;
770 757
771 ACPI_FUNCTION_TRACE("acpi_battery_init");
772 758
773 acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); 759 acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
774 if (!acpi_battery_dir) 760 if (!acpi_battery_dir)
775 return_VALUE(-ENODEV); 761 return -ENODEV;
776 acpi_battery_dir->owner = THIS_MODULE; 762 acpi_battery_dir->owner = THIS_MODULE;
777 763
778 result = acpi_bus_register_driver(&acpi_battery_driver); 764 result = acpi_bus_register_driver(&acpi_battery_driver);
779 if (result < 0) { 765 if (result < 0) {
780 remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); 766 remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
781 return_VALUE(-ENODEV); 767 return -ENODEV;
782 } 768 }
783 769
784 return_VALUE(0); 770 return 0;
785} 771}
786 772
787static void __exit acpi_battery_exit(void) 773static void __exit acpi_battery_exit(void)
788{ 774{
789 ACPI_FUNCTION_TRACE("acpi_battery_exit");
790 775
791 acpi_bus_unregister_driver(&acpi_battery_driver); 776 acpi_bus_unregister_driver(&acpi_battery_driver);
792 777
793 remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); 778 remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
794 779
795 return_VOID; 780 return;
796} 781}
797 782
798module_init(acpi_battery_init); 783module_init(acpi_battery_init);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 6c6286290127..dec044c04273 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -60,20 +60,19 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
60{ 60{
61 acpi_status status = AE_OK; 61 acpi_status status = AE_OK;
62 62
63 ACPI_FUNCTION_TRACE("acpi_bus_get_device");
64 63
65 if (!device) 64 if (!device)
66 return_VALUE(-EINVAL); 65 return -EINVAL;
67 66
68 /* TBD: Support fixed-feature devices */ 67 /* TBD: Support fixed-feature devices */
69 68
70 status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device); 69 status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
71 if (ACPI_FAILURE(status) || !*device) { 70 if (ACPI_FAILURE(status) || !*device) {
72 ACPI_EXCEPTION((AE_INFO, status, "No context for object [%p]", handle)); 71 ACPI_EXCEPTION((AE_INFO, status, "No context for object [%p]", handle));
73 return_VALUE(-ENODEV); 72 return -ENODEV;
74 } 73 }
75 74
76 return_VALUE(0); 75 return 0;
77} 76}
78 77
79EXPORT_SYMBOL(acpi_bus_get_device); 78EXPORT_SYMBOL(acpi_bus_get_device);
@@ -83,10 +82,9 @@ int acpi_bus_get_status(struct acpi_device *device)
83 acpi_status status = AE_OK; 82 acpi_status status = AE_OK;
84 unsigned long sta = 0; 83 unsigned long sta = 0;
85 84
86 ACPI_FUNCTION_TRACE("acpi_bus_get_status");
87 85
88 if (!device) 86 if (!device)
89 return_VALUE(-EINVAL); 87 return -EINVAL;
90 88
91 /* 89 /*
92 * Evaluate _STA if present. 90 * Evaluate _STA if present.
@@ -95,7 +93,7 @@ int acpi_bus_get_status(struct acpi_device *device)
95 status = 93 status =
96 acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); 94 acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
97 if (ACPI_FAILURE(status)) 95 if (ACPI_FAILURE(status))
98 return_VALUE(-ENODEV); 96 return -ENODEV;
99 STRUCT_TO_INT(device->status) = (int)sta; 97 STRUCT_TO_INT(device->status) = (int)sta;
100 } 98 }
101 99
@@ -119,7 +117,7 @@ int acpi_bus_get_status(struct acpi_device *device)
119 device->pnp.bus_id, 117 device->pnp.bus_id,
120 (u32) STRUCT_TO_INT(device->status))); 118 (u32) STRUCT_TO_INT(device->status)));
121 119
122 return_VALUE(0); 120 return 0;
123} 121}
124 122
125EXPORT_SYMBOL(acpi_bus_get_status); 123EXPORT_SYMBOL(acpi_bus_get_status);
@@ -135,11 +133,10 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
135 struct acpi_device *device = NULL; 133 struct acpi_device *device = NULL;
136 unsigned long psc = 0; 134 unsigned long psc = 0;
137 135
138 ACPI_FUNCTION_TRACE("acpi_bus_get_power");
139 136
140 result = acpi_bus_get_device(handle, &device); 137 result = acpi_bus_get_device(handle, &device);
141 if (result) 138 if (result)
142 return_VALUE(result); 139 return result;
143 140
144 *state = ACPI_STATE_UNKNOWN; 141 *state = ACPI_STATE_UNKNOWN;
145 142
@@ -158,12 +155,12 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
158 status = acpi_evaluate_integer(device->handle, "_PSC", 155 status = acpi_evaluate_integer(device->handle, "_PSC",
159 NULL, &psc); 156 NULL, &psc);
160 if (ACPI_FAILURE(status)) 157 if (ACPI_FAILURE(status))
161 return_VALUE(-ENODEV); 158 return -ENODEV;
162 device->power.state = (int)psc; 159 device->power.state = (int)psc;
163 } else if (device->power.flags.power_resources) { 160 } else if (device->power.flags.power_resources) {
164 result = acpi_power_get_inferred_state(device); 161 result = acpi_power_get_inferred_state(device);
165 if (result) 162 if (result)
166 return_VALUE(result); 163 return result;
167 } 164 }
168 165
169 *state = device->power.state; 166 *state = device->power.state;
@@ -172,7 +169,7 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
172 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n", 169 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
173 device->pnp.bus_id, device->power.state)); 170 device->pnp.bus_id, device->power.state));
174 171
175 return_VALUE(0); 172 return 0;
176} 173}
177 174
178EXPORT_SYMBOL(acpi_bus_get_power); 175EXPORT_SYMBOL(acpi_bus_get_power);
@@ -184,21 +181,20 @@ int acpi_bus_set_power(acpi_handle handle, int state)
184 struct acpi_device *device = NULL; 181 struct acpi_device *device = NULL;
185 char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' }; 182 char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
186 183
187 ACPI_FUNCTION_TRACE("acpi_bus_set_power");
188 184
189 result = acpi_bus_get_device(handle, &device); 185 result = acpi_bus_get_device(handle, &device);
190 if (result) 186 if (result)
191 return_VALUE(result); 187 return result;
192 188
193 if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) 189 if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
194 return_VALUE(-EINVAL); 190 return -EINVAL;
195 191
196 /* Make sure this is a valid target state */ 192 /* Make sure this is a valid target state */
197 193
198 if (!device->flags.power_manageable) { 194 if (!device->flags.power_manageable) {
199 printk(KERN_DEBUG "Device `[%s]is not power manageable", 195 printk(KERN_DEBUG "Device `[%s]is not power manageable",
200 device->kobj.name); 196 device->kobj.name);
201 return_VALUE(-ENODEV); 197 return -ENODEV;
202 } 198 }
203 /* 199 /*
204 * Get device's current power state if it's unknown 200 * Get device's current power state if it's unknown
@@ -210,18 +206,18 @@ int acpi_bus_set_power(acpi_handle handle, int state)
210 if (state == device->power.state) { 206 if (state == device->power.state) {
211 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", 207 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
212 state)); 208 state));
213 return_VALUE(0); 209 return 0;
214 } 210 }
215 } 211 }
216 if (!device->power.states[state].flags.valid) { 212 if (!device->power.states[state].flags.valid) {
217 printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); 213 printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
218 return_VALUE(-ENODEV); 214 return -ENODEV;
219 } 215 }
220 if (device->parent && (state < device->parent->power.state)) { 216 if (device->parent && (state < device->parent->power.state)) {
221 printk(KERN_WARNING PREFIX 217 printk(KERN_WARNING PREFIX
222 "Cannot set device to a higher-powered" 218 "Cannot set device to a higher-powered"
223 " state than parent\n"); 219 " state than parent\n");
224 return_VALUE(-ENODEV); 220 return -ENODEV;
225 } 221 }
226 222
227 /* 223 /*
@@ -271,7 +267,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
271 "Device [%s] transitioned to D%d\n", 267 "Device [%s] transitioned to D%d\n",
272 device->pnp.bus_id, state)); 268 device->pnp.bus_id, state));
273 269
274 return_VALUE(result); 270 return result;
275} 271}
276 272
277EXPORT_SYMBOL(acpi_bus_set_power); 273EXPORT_SYMBOL(acpi_bus_set_power);
@@ -292,18 +288,17 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
292 struct acpi_bus_event *event = NULL; 288 struct acpi_bus_event *event = NULL;
293 unsigned long flags = 0; 289 unsigned long flags = 0;
294 290
295 ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
296 291
297 if (!device) 292 if (!device)
298 return_VALUE(-EINVAL); 293 return -EINVAL;
299 294
300 /* drop event on the floor if no one's listening */ 295 /* drop event on the floor if no one's listening */
301 if (!event_is_open) 296 if (!event_is_open)
302 return_VALUE(0); 297 return 0;
303 298
304 event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC); 299 event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
305 if (!event) 300 if (!event)
306 return_VALUE(-ENOMEM); 301 return -ENOMEM;
307 302
308 strcpy(event->device_class, device->pnp.device_class); 303 strcpy(event->device_class, device->pnp.device_class);
309 strcpy(event->bus_id, device->pnp.bus_id); 304 strcpy(event->bus_id, device->pnp.bus_id);
@@ -316,7 +311,7 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
316 311
317 wake_up_interruptible(&acpi_bus_event_queue); 312 wake_up_interruptible(&acpi_bus_event_queue);
318 313
319 return_VALUE(0); 314 return 0;
320} 315}
321 316
322EXPORT_SYMBOL(acpi_bus_generate_event); 317EXPORT_SYMBOL(acpi_bus_generate_event);
@@ -328,10 +323,9 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
328 323
329 DECLARE_WAITQUEUE(wait, current); 324 DECLARE_WAITQUEUE(wait, current);
330 325
331 ACPI_FUNCTION_TRACE("acpi_bus_receive_event");
332 326
333 if (!event) 327 if (!event)
334 return_VALUE(-EINVAL); 328 return -EINVAL;
335 329
336 if (list_empty(&acpi_bus_event_list)) { 330 if (list_empty(&acpi_bus_event_list)) {
337 331
@@ -345,7 +339,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
345 set_current_state(TASK_RUNNING); 339 set_current_state(TASK_RUNNING);
346 340
347 if (signal_pending(current)) 341 if (signal_pending(current))
348 return_VALUE(-ERESTARTSYS); 342 return -ERESTARTSYS;
349 } 343 }
350 344
351 spin_lock_irqsave(&acpi_bus_event_lock, flags); 345 spin_lock_irqsave(&acpi_bus_event_lock, flags);
@@ -356,13 +350,13 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
356 spin_unlock_irqrestore(&acpi_bus_event_lock, flags); 350 spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
357 351
358 if (!entry) 352 if (!entry)
359 return_VALUE(-ENODEV); 353 return -ENODEV;
360 354
361 memcpy(event, entry, sizeof(struct acpi_bus_event)); 355 memcpy(event, entry, sizeof(struct acpi_bus_event));
362 356
363 kfree(entry); 357 kfree(entry);
364 358
365 return_VALUE(0); 359 return 0;
366} 360}
367 361
368EXPORT_SYMBOL(acpi_bus_receive_event); 362EXPORT_SYMBOL(acpi_bus_receive_event);
@@ -377,10 +371,9 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
377 acpi_status status = 0; 371 acpi_status status = 0;
378 struct acpi_device_status old_status; 372 struct acpi_device_status old_status;
379 373
380 ACPI_FUNCTION_TRACE("acpi_bus_check_device");
381 374
382 if (!device) 375 if (!device)
383 return_VALUE(-EINVAL); 376 return -EINVAL;
384 377
385 if (status_changed) 378 if (status_changed)
386 *status_changed = 0; 379 *status_changed = 0;
@@ -397,15 +390,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
397 if (status_changed) 390 if (status_changed)
398 *status_changed = 1; 391 *status_changed = 1;
399 } 392 }
400 return_VALUE(0); 393 return 0;
401 } 394 }
402 395
403 status = acpi_bus_get_status(device); 396 status = acpi_bus_get_status(device);
404 if (ACPI_FAILURE(status)) 397 if (ACPI_FAILURE(status))
405 return_VALUE(-ENODEV); 398 return -ENODEV;
406 399
407 if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status)) 400 if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
408 return_VALUE(0); 401 return 0;
409 402
410 if (status_changed) 403 if (status_changed)
411 *status_changed = 1; 404 *status_changed = 1;
@@ -421,7 +414,7 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
421 /* TBD: Handle device removal */ 414 /* TBD: Handle device removal */
422 } 415 }
423 416
424 return_VALUE(0); 417 return 0;
425} 418}
426 419
427static int acpi_bus_check_scope(struct acpi_device *device) 420static int acpi_bus_check_scope(struct acpi_device *device)
@@ -429,25 +422,24 @@ static int acpi_bus_check_scope(struct acpi_device *device)
429 int result = 0; 422 int result = 0;
430 int status_changed = 0; 423 int status_changed = 0;
431 424
432 ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
433 425
434 if (!device) 426 if (!device)
435 return_VALUE(-EINVAL); 427 return -EINVAL;
436 428
437 /* Status Change? */ 429 /* Status Change? */
438 result = acpi_bus_check_device(device, &status_changed); 430 result = acpi_bus_check_device(device, &status_changed);
439 if (result) 431 if (result)
440 return_VALUE(result); 432 return result;
441 433
442 if (!status_changed) 434 if (!status_changed)
443 return_VALUE(0); 435 return 0;
444 436
445 /* 437 /*
446 * TBD: Enumerate child devices within this device's scope and 438 * TBD: Enumerate child devices within this device's scope and
447 * run acpi_bus_check_device()'s on them. 439 * run acpi_bus_check_device()'s on them.
448 */ 440 */
449 441
450 return_VALUE(0); 442 return 0;
451} 443}
452 444
453/** 445/**
@@ -460,10 +452,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
460 int result = 0; 452 int result = 0;
461 struct acpi_device *device = NULL; 453 struct acpi_device *device = NULL;
462 454
463 ACPI_FUNCTION_TRACE("acpi_bus_notify");
464 455
465 if (acpi_bus_get_device(handle, &device)) 456 if (acpi_bus_get_device(handle, &device))
466 return_VOID; 457 return;
467 458
468 switch (type) { 459 switch (type) {
469 460
@@ -538,7 +529,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
538 break; 529 break;
539 } 530 }
540 531
541 return_VOID; 532 return;
542} 533}
543 534
544/* -------------------------------------------------------------------------- 535/* --------------------------------------------------------------------------
@@ -552,7 +543,6 @@ static int __init acpi_bus_init_irq(void)
552 struct acpi_object_list arg_list = { 1, &arg }; 543 struct acpi_object_list arg_list = { 1, &arg };
553 char *message = NULL; 544 char *message = NULL;
554 545
555 ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
556 546
557 /* 547 /*
558 * Let the system know what interrupt model we are using by 548 * Let the system know what interrupt model we are using by
@@ -571,7 +561,7 @@ static int __init acpi_bus_init_irq(void)
571 break; 561 break;
572 default: 562 default:
573 printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n"); 563 printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n");
574 return_VALUE(-ENODEV); 564 return -ENODEV;
575 } 565 }
576 566
577 printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message); 567 printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message);
@@ -581,10 +571,10 @@ static int __init acpi_bus_init_irq(void)
581 status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL); 571 status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL);
582 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { 572 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
583 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); 573 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC"));
584 return_VALUE(-ENODEV); 574 return -ENODEV;
585 } 575 }
586 576
587 return_VALUE(0); 577 return 0;
588} 578}
589 579
590void __init acpi_early_init(void) 580void __init acpi_early_init(void)
@@ -592,10 +582,9 @@ void __init acpi_early_init(void)
592 acpi_status status = AE_OK; 582 acpi_status status = AE_OK;
593 struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt }; 583 struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
594 584
595 ACPI_FUNCTION_TRACE("acpi_early_init");
596 585
597 if (acpi_disabled) 586 if (acpi_disabled)
598 return_VOID; 587 return;
599 588
600 printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); 589 printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);
601 590
@@ -655,11 +644,11 @@ void __init acpi_early_init(void)
655 goto error0; 644 goto error0;
656 } 645 }
657 646
658 return_VOID; 647 return;
659 648
660 error0: 649 error0:
661 disable_acpi(); 650 disable_acpi();
662 return_VOID; 651 return;
663} 652}
664 653
665static int __init acpi_bus_init(void) 654static int __init acpi_bus_init(void)
@@ -668,7 +657,6 @@ static int __init acpi_bus_init(void)
668 acpi_status status = AE_OK; 657 acpi_status status = AE_OK;
669 extern acpi_status acpi_os_initialize1(void); 658 extern acpi_status acpi_os_initialize1(void);
670 659
671 ACPI_FUNCTION_TRACE("acpi_bus_init");
672 660
673 status = acpi_os_initialize1(); 661 status = acpi_os_initialize1();
674 662
@@ -730,12 +718,12 @@ static int __init acpi_bus_init(void)
730 */ 718 */
731 acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL); 719 acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL);
732 720
733 return_VALUE(0); 721 return 0;
734 722
735 /* Mimic structured exception handling */ 723 /* Mimic structured exception handling */
736 error1: 724 error1:
737 acpi_terminate(); 725 acpi_terminate();
738 return_VALUE(-ENODEV); 726 return -ENODEV;
739} 727}
740 728
741decl_subsys(acpi, NULL, NULL); 729decl_subsys(acpi, NULL, NULL);
@@ -744,11 +732,10 @@ static int __init acpi_init(void)
744{ 732{
745 int result = 0; 733 int result = 0;
746 734
747 ACPI_FUNCTION_TRACE("acpi_init");
748 735
749 if (acpi_disabled) { 736 if (acpi_disabled) {
750 printk(KERN_INFO PREFIX "Interpreter disabled.\n"); 737 printk(KERN_INFO PREFIX "Interpreter disabled.\n");
751 return_VALUE(-ENODEV); 738 return -ENODEV;
752 } 739 }
753 740
754 firmware_register(&acpi_subsys); 741 firmware_register(&acpi_subsys);
@@ -769,7 +756,7 @@ static int __init acpi_init(void)
769 } else 756 } else
770 disable_acpi(); 757 disable_acpi();
771 758
772 return_VALUE(result); 759 return result;
773} 760}
774 761
775subsys_initcall(acpi_init); 762subsys_initcall(acpi_init);
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 63db284bb5cf..02594639c4d9 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -112,15 +112,14 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
112{ 112{
113 struct acpi_button *button = (struct acpi_button *)seq->private; 113 struct acpi_button *button = (struct acpi_button *)seq->private;
114 114
115 ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
116 115
117 if (!button || !button->device) 116 if (!button || !button->device)
118 return_VALUE(0); 117 return 0;
119 118
120 seq_printf(seq, "type: %s\n", 119 seq_printf(seq, "type: %s\n",
121 acpi_device_name(button->device)); 120 acpi_device_name(button->device));
122 121
123 return_VALUE(0); 122 return 0;
124} 123}
125 124
126static int acpi_button_info_open_fs(struct inode *inode, struct file *file) 125static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
@@ -134,10 +133,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
134 acpi_status status; 133 acpi_status status;
135 unsigned long state; 134 unsigned long state;
136 135
137 ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
138 136
139 if (!button || !button->device) 137 if (!button || !button->device)
140 return_VALUE(0); 138 return 0;
141 139
142 status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); 140 status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
143 if (ACPI_FAILURE(status)) { 141 if (ACPI_FAILURE(status)) {
@@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
147 (state ? "open" : "closed")); 145 (state ? "open" : "closed"));
148 } 146 }
149 147
150 return_VALUE(0); 148 return 0;
151} 149}
152 150
153static int acpi_button_state_open_fs(struct inode *inode, struct file *file) 151static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
@@ -164,10 +162,9 @@ static int acpi_button_add_fs(struct acpi_device *device)
164 struct proc_dir_entry *entry = NULL; 162 struct proc_dir_entry *entry = NULL;
165 struct acpi_button *button = NULL; 163 struct acpi_button *button = NULL;
166 164
167 ACPI_FUNCTION_TRACE("acpi_button_add_fs");
168 165
169 if (!device || !acpi_driver_data(device)) 166 if (!device || !acpi_driver_data(device))
170 return_VALUE(-EINVAL); 167 return -EINVAL;
171 168
172 button = acpi_driver_data(device); 169 button = acpi_driver_data(device);
173 170
@@ -195,19 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device)
195 } 192 }
196 193
197 if (!entry) 194 if (!entry)
198 return_VALUE(-ENODEV); 195 return -ENODEV;
199 entry->owner = THIS_MODULE; 196 entry->owner = THIS_MODULE;
200 197
201 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); 198 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
202 if (!acpi_device_dir(device)) 199 if (!acpi_device_dir(device))
203 return_VALUE(-ENODEV); 200 return -ENODEV;
204 acpi_device_dir(device)->owner = THIS_MODULE; 201 acpi_device_dir(device)->owner = THIS_MODULE;
205 202
206 /* 'info' [R] */ 203 /* 'info' [R] */
207 entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, 204 entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
208 S_IRUGO, acpi_device_dir(device)); 205 S_IRUGO, acpi_device_dir(device));
209 if (!entry) 206 if (!entry)
210 return_VALUE(-ENODEV); 207 return -ENODEV;
211 else { 208 else {
212 entry->proc_fops = &acpi_button_info_fops; 209 entry->proc_fops = &acpi_button_info_fops;
213 entry->data = acpi_driver_data(device); 210 entry->data = acpi_driver_data(device);
@@ -227,14 +224,13 @@ static int acpi_button_add_fs(struct acpi_device *device)
227 } 224 }
228 } 225 }
229 226
230 return_VALUE(0); 227 return 0;
231} 228}
232 229
233static int acpi_button_remove_fs(struct acpi_device *device) 230static int acpi_button_remove_fs(struct acpi_device *device)
234{ 231{
235 struct acpi_button *button = NULL; 232 struct acpi_button *button = NULL;
236 233
237 ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
238 234
239 button = acpi_driver_data(device); 235 button = acpi_driver_data(device);
240 if (acpi_device_dir(device)) { 236 if (acpi_device_dir(device)) {
@@ -249,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device)
249 acpi_device_dir(device) = NULL; 245 acpi_device_dir(device) = NULL;
250 } 246 }
251 247
252 return_VALUE(0); 248 return 0;
253} 249}
254 250
255/* -------------------------------------------------------------------------- 251/* --------------------------------------------------------------------------
@@ -260,10 +256,9 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
260{ 256{
261 struct acpi_button *button = (struct acpi_button *)data; 257 struct acpi_button *button = (struct acpi_button *)data;
262 258
263 ACPI_FUNCTION_TRACE("acpi_button_notify");
264 259
265 if (!button || !button->device) 260 if (!button || !button->device)
266 return_VOID; 261 return;
267 262
268 switch (event) { 263 switch (event) {
269 case ACPI_BUTTON_NOTIFY_STATUS: 264 case ACPI_BUTTON_NOTIFY_STATUS:
@@ -276,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
276 break; 271 break;
277 } 272 }
278 273
279 return_VOID; 274 return;
280} 275}
281 276
282static acpi_status acpi_button_notify_fixed(void *data) 277static acpi_status acpi_button_notify_fixed(void *data)
283{ 278{
284 struct acpi_button *button = (struct acpi_button *)data; 279 struct acpi_button *button = (struct acpi_button *)data;
285 280
286 ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
287 281
288 if (!button) 282 if (!button)
289 return_ACPI_STATUS(AE_BAD_PARAMETER); 283 return AE_BAD_PARAMETER;
290 284
291 acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); 285 acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
292 286
293 return_ACPI_STATUS(AE_OK); 287 return AE_OK;
294} 288}
295 289
296static int acpi_button_add(struct acpi_device *device) 290static int acpi_button_add(struct acpi_device *device)
@@ -299,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device)
299 acpi_status status = AE_OK; 293 acpi_status status = AE_OK;
300 struct acpi_button *button = NULL; 294 struct acpi_button *button = NULL;
301 295
302 ACPI_FUNCTION_TRACE("acpi_button_add");
303 296
304 if (!device) 297 if (!device)
305 return_VALUE(-EINVAL); 298 return -EINVAL;
306 299
307 button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); 300 button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL);
308 if (!button) 301 if (!button)
309 return_VALUE(-ENOMEM); 302 return -ENOMEM;
310 memset(button, 0, sizeof(struct acpi_button)); 303 memset(button, 0, sizeof(struct acpi_button));
311 304
312 button->device = device; 305 button->device = device;
@@ -400,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device)
400 kfree(button); 393 kfree(button);
401 } 394 }
402 395
403 return_VALUE(result); 396 return result;
404} 397}
405 398
406static int acpi_button_remove(struct acpi_device *device, int type) 399static int acpi_button_remove(struct acpi_device *device, int type)
@@ -408,10 +401,9 @@ static int acpi_button_remove(struct acpi_device *device, int type)
408 acpi_status status = 0; 401 acpi_status status = 0;
409 struct acpi_button *button = NULL; 402 struct acpi_button *button = NULL;
410 403
411 ACPI_FUNCTION_TRACE("acpi_button_remove");
412 404
413 if (!device || !acpi_driver_data(device)) 405 if (!device || !acpi_driver_data(device))
414 return_VALUE(-EINVAL); 406 return -EINVAL;
415 407
416 button = acpi_driver_data(device); 408 button = acpi_driver_data(device);
417 409
@@ -438,31 +430,29 @@ static int acpi_button_remove(struct acpi_device *device, int type)
438 430
439 kfree(button); 431 kfree(button);
440 432
441 return_VALUE(0); 433 return 0;
442} 434}
443 435
444static int __init acpi_button_init(void) 436static int __init acpi_button_init(void)
445{ 437{
446 int result = 0; 438 int result = 0;
447 439
448 ACPI_FUNCTION_TRACE("acpi_button_init");
449 440
450 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); 441 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
451 if (!acpi_button_dir) 442 if (!acpi_button_dir)
452 return_VALUE(-ENODEV); 443 return -ENODEV;
453 acpi_button_dir->owner = THIS_MODULE; 444 acpi_button_dir->owner = THIS_MODULE;
454 result = acpi_bus_register_driver(&acpi_button_driver); 445 result = acpi_bus_register_driver(&acpi_button_driver);
455 if (result < 0) { 446 if (result < 0) {
456 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); 447 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
457 return_VALUE(-ENODEV); 448 return -ENODEV;
458 } 449 }
459 450
460 return_VALUE(0); 451 return 0;
461} 452}
462 453
463static void __exit acpi_button_exit(void) 454static void __exit acpi_button_exit(void)
464{ 455{
465 ACPI_FUNCTION_TRACE("acpi_button_exit");
466 456
467 acpi_bus_unregister_driver(&acpi_button_driver); 457 acpi_bus_unregister_driver(&acpi_button_driver);
468 458
@@ -474,7 +464,7 @@ static void __exit acpi_button_exit(void)
474 remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); 464 remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
475 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); 465 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
476 466
477 return_VOID; 467 return;
478} 468}
479 469
480module_init(acpi_button_init); 470module_init(acpi_button_init);
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index e2fcef4a83df..7f7e41d40a3b 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle)
73 acpi_status status; 73 acpi_status status;
74 unsigned long sta; 74 unsigned long sta;
75 75
76 ACPI_FUNCTION_TRACE("is_device_present");
77 76
78 status = acpi_get_handle(handle, "_STA", &temp); 77 status = acpi_get_handle(handle, "_STA", &temp);
79 if (ACPI_FAILURE(status)) 78 if (ACPI_FAILURE(status))
80 return_VALUE(1); /* _STA not found, assmue device present */ 79 return 1; /* _STA not found, assmue device present */
81 80
82 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 81 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
83 if (ACPI_FAILURE(status)) 82 if (ACPI_FAILURE(status))
84 return_VALUE(0); /* Firmware error */ 83 return 0; /* Firmware error */
85 84
86 return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); 85 return ((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
87} 86}
88 87
89/*******************************************************************/ 88/*******************************************************************/
@@ -91,16 +90,15 @@ static int acpi_container_add(struct acpi_device *device)
91{ 90{
92 struct acpi_container *container; 91 struct acpi_container *container;
93 92
94 ACPI_FUNCTION_TRACE("acpi_container_add");
95 93
96 if (!device) { 94 if (!device) {
97 printk(KERN_ERR PREFIX "device is NULL\n"); 95 printk(KERN_ERR PREFIX "device is NULL\n");
98 return_VALUE(-EINVAL); 96 return -EINVAL;
99 } 97 }
100 98
101 container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); 99 container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
102 if (!container) 100 if (!container)
103 return_VALUE(-ENOMEM); 101 return -ENOMEM;
104 102
105 memset(container, 0, sizeof(struct acpi_container)); 103 memset(container, 0, sizeof(struct acpi_container));
106 container->handle = device->handle; 104 container->handle = device->handle;
@@ -111,7 +109,7 @@ static int acpi_container_add(struct acpi_device *device)
111 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", 109 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
112 acpi_device_name(device), acpi_device_bid(device))); 110 acpi_device_name(device), acpi_device_bid(device)));
113 111
114 return_VALUE(0); 112 return 0;
115} 113}
116 114
117static int acpi_container_remove(struct acpi_device *device, int type) 115static int acpi_container_remove(struct acpi_device *device, int type)
@@ -130,23 +128,22 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle)
130 struct acpi_device *pdev; 128 struct acpi_device *pdev;
131 int result; 129 int result;
132 130
133 ACPI_FUNCTION_TRACE("container_device_add");
134 131
135 if (acpi_get_parent(handle, &phandle)) { 132 if (acpi_get_parent(handle, &phandle)) {
136 return_VALUE(-ENODEV); 133 return -ENODEV;
137 } 134 }
138 135
139 if (acpi_bus_get_device(phandle, &pdev)) { 136 if (acpi_bus_get_device(phandle, &pdev)) {
140 return_VALUE(-ENODEV); 137 return -ENODEV;
141 } 138 }
142 139
143 if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { 140 if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) {
144 return_VALUE(-ENODEV); 141 return -ENODEV;
145 } 142 }
146 143
147 result = acpi_bus_start(*device); 144 result = acpi_bus_start(*device);
148 145
149 return_VALUE(result); 146 return result;
150} 147}
151 148
152static void container_notify_cb(acpi_handle handle, u32 type, void *context) 149static void container_notify_cb(acpi_handle handle, u32 type, void *context)
@@ -156,7 +153,6 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
156 int present; 153 int present;
157 acpi_status status; 154 acpi_status status;
158 155
159 ACPI_FUNCTION_TRACE("container_notify_cb");
160 156
161 present = is_device_present(handle); 157 present = is_device_present(handle);
162 158
@@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
192 default: 188 default:
193 break; 189 break;
194 } 190 }
195 return_VOID; 191 return;
196} 192}
197 193
198static acpi_status 194static acpi_status
@@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle,
205 acpi_status status; 201 acpi_status status;
206 int *action = context; 202 int *action = context;
207 203
208 ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
209 204
210 status = acpi_get_object_info(handle, &buffer); 205 status = acpi_get_object_info(handle, &buffer);
211 if (ACPI_FAILURE(status) || !buffer.pointer) { 206 if (ACPI_FAILURE(status) || !buffer.pointer) {
212 return_ACPI_STATUS(AE_OK); 207 return AE_OK;
213 } 208 }
214 209
215 info = buffer.pointer; 210 info = buffer.pointer;
@@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle,
243 end: 238 end:
244 acpi_os_free(buffer.pointer); 239 acpi_os_free(buffer.pointer);
245 240
246 return_ACPI_STATUS(AE_OK); 241 return AE_OK;
247} 242}
248 243
249static int __init acpi_container_init(void) 244static int __init acpi_container_init(void)
@@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void)
269{ 264{
270 int action = UNINSTALL_NOTIFY_HANDLER; 265 int action = UNINSTALL_NOTIFY_HANDLER;
271 266
272 ACPI_FUNCTION_TRACE("acpi_container_exit");
273 267
274 acpi_walk_namespace(ACPI_TYPE_DEVICE, 268 acpi_walk_namespace(ACPI_TYPE_DEVICE,
275 ACPI_ROOT_OBJECT, 269 ACPI_ROOT_OBJECT,
@@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void)
278 272
279 acpi_bus_unregister_driver(&acpi_container_driver); 273 acpi_bus_unregister_driver(&acpi_container_driver);
280 274
281 return_VOID; 275 return;
282} 276}
283 277
284module_init(acpi_container_init); 278module_init(acpi_container_init);
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c
index ec7bcee77085..35c6af8a83cd 100644
--- a/drivers/acpi/debug.c
+++ b/drivers/acpi/debug.c
@@ -155,13 +155,12 @@ acpi_system_write_debug(struct file *file,
155{ 155{
156 char debug_string[12] = { '\0' }; 156 char debug_string[12] = { '\0' };
157 157
158 ACPI_FUNCTION_TRACE("acpi_system_write_debug");
159 158
160 if (count > sizeof(debug_string) - 1) 159 if (count > sizeof(debug_string) - 1)
161 return_VALUE(-EINVAL); 160 return -EINVAL;
162 161
163 if (copy_from_user(debug_string, buffer, count)) 162 if (copy_from_user(debug_string, buffer, count))
164 return_VALUE(-EFAULT); 163 return -EFAULT;
165 164
166 debug_string[count] = '\0'; 165 debug_string[count] = '\0';
167 166
@@ -173,10 +172,10 @@ acpi_system_write_debug(struct file *file,
173 acpi_dbg_level = simple_strtoul(debug_string, NULL, 0); 172 acpi_dbg_level = simple_strtoul(debug_string, NULL, 0);
174 break; 173 break;
175 default: 174 default:
176 return_VALUE(-EINVAL); 175 return -EINVAL;
177 } 176 }
178 177
179 return_VALUE(count); 178 return count;
180} 179}
181 180
182static int __init acpi_debug_init(void) 181static int __init acpi_debug_init(void)
@@ -185,10 +184,9 @@ static int __init acpi_debug_init(void)
185 int error = 0; 184 int error = 0;
186 char *name; 185 char *name;
187 186
188 ACPI_FUNCTION_TRACE("acpi_debug_init");
189 187
190 if (acpi_disabled) 188 if (acpi_disabled)
191 return_VALUE(0); 189 return 0;
192 190
193 /* 'debug_layer' [R/W] */ 191 /* 'debug_layer' [R/W] */
194 name = ACPI_SYSTEM_FILE_DEBUG_LAYER; 192 name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
@@ -213,7 +211,7 @@ static int __init acpi_debug_init(void)
213 goto Error; 211 goto Error;
214 212
215 Done: 213 Done:
216 return_VALUE(error); 214 return error;
217 215
218 Error: 216 Error:
219 remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); 217 remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 0bba8783de55..874f912962c4 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -207,7 +207,6 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
207{ 207{
208 int result = 0; 208 int result = 0;
209 209
210 ACPI_FUNCTION_TRACE("acpi_ec_wait");
211 210
212 ec->intr.expect_event = event; 211 ec->intr.expect_event = event;
213 smp_mb(); 212 smp_mb();
@@ -216,7 +215,7 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
216 case ACPI_EC_EVENT_IBE: 215 case ACPI_EC_EVENT_IBE:
217 if (~acpi_ec_read_status(ec) & event) { 216 if (~acpi_ec_read_status(ec) & event) {
218 ec->intr.expect_event = 0; 217 ec->intr.expect_event = 0;
219 return_VALUE(0); 218 return 0;
220 } 219 }
221 break; 220 break;
222 default: 221 default:
@@ -238,16 +237,16 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
238 switch (event) { 237 switch (event) {
239 case ACPI_EC_EVENT_OBF: 238 case ACPI_EC_EVENT_OBF:
240 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) 239 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF)
241 return_VALUE(0); 240 return 0;
242 break; 241 break;
243 242
244 case ACPI_EC_EVENT_IBE: 243 case ACPI_EC_EVENT_IBE:
245 if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) 244 if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
246 return_VALUE(0); 245 return 0;
247 break; 246 break;
248 } 247 }
249 248
250 return_VALUE(-ETIME); 249 return -ETIME;
251} 250}
252 251
253#ifdef ACPI_FUTURE_USAGE 252#ifdef ACPI_FUTURE_USAGE
@@ -260,7 +259,6 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec)
260 u32 tmp = 0; 259 u32 tmp = 0;
261 int status = 0; 260 int status = 0;
262 261
263 ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode");
264 262
265 status = acpi_ec_read_status(ec); 263 status = acpi_ec_read_status(ec);
266 if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { 264 if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
@@ -272,22 +270,21 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec)
272 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 270 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
273 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); 271 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
274 if (tmp != 0x90) { /* Burst ACK byte */ 272 if (tmp != 0x90) { /* Burst ACK byte */
275 return_VALUE(-EINVAL); 273 return -EINVAL;
276 } 274 }
277 } 275 }
278 276
279 atomic_set(&ec->intr.leaving_burst, 0); 277 atomic_set(&ec->intr.leaving_burst, 0);
280 return_VALUE(0); 278 return 0;
281 end: 279 end:
282 ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); 280 ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode");
283 return_VALUE(-1); 281 return -1;
284} 282}
285 283
286int acpi_ec_leave_burst_mode(union acpi_ec *ec) 284int acpi_ec_leave_burst_mode(union acpi_ec *ec)
287{ 285{
288 int status = 0; 286 int status = 0;
289 287
290 ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
291 288
292 status = acpi_ec_read_status(ec); 289 status = acpi_ec_read_status(ec);
293 if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ 290 if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){
@@ -298,10 +295,10 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec)
298 acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); 295 acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
299 } 296 }
300 atomic_set(&ec->intr.leaving_burst, 1); 297 atomic_set(&ec->intr.leaving_burst, 1);
301 return_VALUE(0); 298 return 0;
302end: 299end:
303 ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); 300 ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode");
304 return_VALUE(-1); 301 return -1;
305} 302}
306#endif /* ACPI_FUTURE_USAGE */ 303#endif /* ACPI_FUTURE_USAGE */
307 304
@@ -325,17 +322,16 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
325 int result = 0; 322 int result = 0;
326 u32 glk = 0; 323 u32 glk = 0;
327 324
328 ACPI_FUNCTION_TRACE("acpi_ec_read");
329 325
330 if (!ec || !data) 326 if (!ec || !data)
331 return_VALUE(-EINVAL); 327 return -EINVAL;
332 328
333 *data = 0; 329 *data = 0;
334 330
335 if (ec->common.global_lock) { 331 if (ec->common.global_lock) {
336 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 332 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
337 if (ACPI_FAILURE(status)) 333 if (ACPI_FAILURE(status))
338 return_VALUE(-ENODEV); 334 return -ENODEV;
339 } 335 }
340 336
341 if (down_interruptible(&ec->poll.sem)) { 337 if (down_interruptible(&ec->poll.sem)) {
@@ -365,7 +361,7 @@ end_nosem:
365 if (ec->common.global_lock) 361 if (ec->common.global_lock)
366 acpi_release_global_lock(glk); 362 acpi_release_global_lock(glk);
367 363
368 return_VALUE(result); 364 return result;
369} 365}
370 366
371static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) 367static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
@@ -374,15 +370,14 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
374 acpi_status status = AE_OK; 370 acpi_status status = AE_OK;
375 u32 glk = 0; 371 u32 glk = 0;
376 372
377 ACPI_FUNCTION_TRACE("acpi_ec_write");
378 373
379 if (!ec) 374 if (!ec)
380 return_VALUE(-EINVAL); 375 return -EINVAL;
381 376
382 if (ec->common.global_lock) { 377 if (ec->common.global_lock) {
383 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 378 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
384 if (ACPI_FAILURE(status)) 379 if (ACPI_FAILURE(status))
385 return_VALUE(-ENODEV); 380 return -ENODEV;
386 } 381 }
387 382
388 if (down_interruptible(&ec->poll.sem)) { 383 if (down_interruptible(&ec->poll.sem)) {
@@ -415,7 +410,7 @@ end_nosem:
415 if (ec->common.global_lock) 410 if (ec->common.global_lock)
416 acpi_release_global_lock(glk); 411 acpi_release_global_lock(glk);
417 412
418 return_VALUE(result); 413 return result;
419} 414}
420 415
421static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) 416static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
@@ -423,17 +418,16 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
423 int status = 0; 418 int status = 0;
424 u32 glk; 419 u32 glk;
425 420
426 ACPI_FUNCTION_TRACE("acpi_ec_read");
427 421
428 if (!ec || !data) 422 if (!ec || !data)
429 return_VALUE(-EINVAL); 423 return -EINVAL;
430 424
431 *data = 0; 425 *data = 0;
432 426
433 if (ec->common.global_lock) { 427 if (ec->common.global_lock) {
434 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 428 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
435 if (ACPI_FAILURE(status)) 429 if (ACPI_FAILURE(status))
436 return_VALUE(-ENODEV); 430 return -ENODEV;
437 } 431 }
438 432
439 WARN_ON(in_interrupt()); 433 WARN_ON(in_interrupt());
@@ -467,7 +461,7 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
467 if (ec->common.global_lock) 461 if (ec->common.global_lock)
468 acpi_release_global_lock(glk); 462 acpi_release_global_lock(glk);
469 463
470 return_VALUE(status); 464 return status;
471} 465}
472 466
473static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) 467static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
@@ -475,15 +469,14 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
475 int status = 0; 469 int status = 0;
476 u32 glk; 470 u32 glk;
477 471
478 ACPI_FUNCTION_TRACE("acpi_ec_write");
479 472
480 if (!ec) 473 if (!ec)
481 return_VALUE(-EINVAL); 474 return -EINVAL;
482 475
483 if (ec->common.global_lock) { 476 if (ec->common.global_lock) {
484 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 477 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
485 if (ACPI_FAILURE(status)) 478 if (ACPI_FAILURE(status))
486 return_VALUE(-ENODEV); 479 return -ENODEV;
487 } 480 }
488 481
489 WARN_ON(in_interrupt()); 482 WARN_ON(in_interrupt());
@@ -516,7 +509,7 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
516 if (ec->common.global_lock) 509 if (ec->common.global_lock)
517 acpi_release_global_lock(glk); 510 acpi_release_global_lock(glk);
518 511
519 return_VALUE(status); 512 return status;
520} 513}
521 514
522/* 515/*
@@ -574,17 +567,16 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data)
574 acpi_status status = AE_OK; 567 acpi_status status = AE_OK;
575 u32 glk = 0; 568 u32 glk = 0;
576 569
577 ACPI_FUNCTION_TRACE("acpi_ec_query");
578 570
579 if (!ec || !data) 571 if (!ec || !data)
580 return_VALUE(-EINVAL); 572 return -EINVAL;
581 573
582 *data = 0; 574 *data = 0;
583 575
584 if (ec->common.global_lock) { 576 if (ec->common.global_lock) {
585 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 577 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
586 if (ACPI_FAILURE(status)) 578 if (ACPI_FAILURE(status))
587 return_VALUE(-ENODEV); 579 return -ENODEV;
588 } 580 }
589 581
590 /* 582 /*
@@ -613,23 +605,22 @@ end_nosem:
613 if (ec->common.global_lock) 605 if (ec->common.global_lock)
614 acpi_release_global_lock(glk); 606 acpi_release_global_lock(glk);
615 607
616 return_VALUE(result); 608 return result;
617} 609}
618static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) 610static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data)
619{ 611{
620 int status = 0; 612 int status = 0;
621 u32 glk; 613 u32 glk;
622 614
623 ACPI_FUNCTION_TRACE("acpi_ec_query");
624 615
625 if (!ec || !data) 616 if (!ec || !data)
626 return_VALUE(-EINVAL); 617 return -EINVAL;
627 *data = 0; 618 *data = 0;
628 619
629 if (ec->common.global_lock) { 620 if (ec->common.global_lock) {
630 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 621 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
631 if (ACPI_FAILURE(status)) 622 if (ACPI_FAILURE(status))
632 return_VALUE(-ENODEV); 623 return -ENODEV;
633 } 624 }
634 625
635 down(&ec->intr.sem); 626 down(&ec->intr.sem);
@@ -662,7 +653,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data)
662 if (ec->common.global_lock) 653 if (ec->common.global_lock)
663 acpi_release_global_lock(glk); 654 acpi_release_global_lock(glk);
664 655
665 return_VALUE(status); 656 return status;
666} 657}
667 658
668/* -------------------------------------------------------------------------- 659/* --------------------------------------------------------------------------
@@ -691,13 +682,12 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt)
691 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 682 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
692 }; 683 };
693 684
694 ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
695 685
696 if (!ec_cxt) 686 if (!ec_cxt)
697 goto end; 687 goto end;
698 688
699 if (down_interruptible (&ec->poll.sem)) { 689 if (down_interruptible (&ec->poll.sem)) {
700 return_VOID; 690 return;
701 } 691 }
702 acpi_hw_low_level_read(8, &value, &ec->common.command_addr); 692 acpi_hw_low_level_read(8, &value, &ec->common.command_addr);
703 up(&ec->poll.sem); 693 up(&ec->poll.sem);
@@ -734,7 +724,6 @@ static void acpi_ec_gpe_intr_query(void *ec_cxt)
734 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 724 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
735 }; 725 };
736 726
737 ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
738 727
739 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) 728 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI)
740 result = acpi_ec_query(ec, &value); 729 result = acpi_ec_query(ec, &value);
@@ -846,15 +835,14 @@ acpi_ec_space_handler(u32 function,
846 acpi_integer f_v = 0; 835 acpi_integer f_v = 0;
847 int i = 0; 836 int i = 0;
848 837
849 ACPI_FUNCTION_TRACE("acpi_ec_space_handler");
850 838
851 if ((address > 0xFF) || !value || !handler_context) 839 if ((address > 0xFF) || !value || !handler_context)
852 return_VALUE(AE_BAD_PARAMETER); 840 return AE_BAD_PARAMETER;
853 841
854 if (bit_width != 8 && acpi_strict) { 842 if (bit_width != 8 && acpi_strict) {
855 printk(KERN_WARNING PREFIX 843 printk(KERN_WARNING PREFIX
856 "acpi_ec_space_handler: bit_width should be 8\n"); 844 "acpi_ec_space_handler: bit_width should be 8\n");
857 return_VALUE(AE_BAD_PARAMETER); 845 return AE_BAD_PARAMETER;
858 } 846 }
859 847
860 ec = (union acpi_ec *)handler_context; 848 ec = (union acpi_ec *)handler_context;
@@ -893,16 +881,16 @@ acpi_ec_space_handler(u32 function,
893 out: 881 out:
894 switch (result) { 882 switch (result) {
895 case -EINVAL: 883 case -EINVAL:
896 return_VALUE(AE_BAD_PARAMETER); 884 return AE_BAD_PARAMETER;
897 break; 885 break;
898 case -ENODEV: 886 case -ENODEV:
899 return_VALUE(AE_NOT_FOUND); 887 return AE_NOT_FOUND;
900 break; 888 break;
901 case -ETIME: 889 case -ETIME:
902 return_VALUE(AE_TIME); 890 return AE_TIME;
903 break; 891 break;
904 default: 892 default:
905 return_VALUE(AE_OK); 893 return AE_OK;
906 } 894 }
907} 895}
908 896
@@ -916,7 +904,6 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset)
916{ 904{
917 union acpi_ec *ec = (union acpi_ec *)seq->private; 905 union acpi_ec *ec = (union acpi_ec *)seq->private;
918 906
919 ACPI_FUNCTION_TRACE("acpi_ec_read_info");
920 907
921 if (!ec) 908 if (!ec)
922 goto end; 909 goto end;
@@ -931,7 +918,7 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset)
931 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 918 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
932 919
933 end: 920 end:
934 return_VALUE(0); 921 return 0;
935} 922}
936 923
937static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) 924static int acpi_ec_info_open_fs(struct inode *inode, struct file *file)
@@ -951,31 +938,29 @@ static int acpi_ec_add_fs(struct acpi_device *device)
951{ 938{
952 struct proc_dir_entry *entry = NULL; 939 struct proc_dir_entry *entry = NULL;
953 940
954 ACPI_FUNCTION_TRACE("acpi_ec_add_fs");
955 941
956 if (!acpi_device_dir(device)) { 942 if (!acpi_device_dir(device)) {
957 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 943 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
958 acpi_ec_dir); 944 acpi_ec_dir);
959 if (!acpi_device_dir(device)) 945 if (!acpi_device_dir(device))
960 return_VALUE(-ENODEV); 946 return -ENODEV;
961 } 947 }
962 948
963 entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, 949 entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO,
964 acpi_device_dir(device)); 950 acpi_device_dir(device));
965 if (!entry) 951 if (!entry)
966 return_VALUE(-ENODEV); 952 return -ENODEV;
967 else { 953 else {
968 entry->proc_fops = &acpi_ec_info_ops; 954 entry->proc_fops = &acpi_ec_info_ops;
969 entry->data = acpi_driver_data(device); 955 entry->data = acpi_driver_data(device);
970 entry->owner = THIS_MODULE; 956 entry->owner = THIS_MODULE;
971 } 957 }
972 958
973 return_VALUE(0); 959 return 0;
974} 960}
975 961
976static int acpi_ec_remove_fs(struct acpi_device *device) 962static int acpi_ec_remove_fs(struct acpi_device *device)
977{ 963{
978 ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
979 964
980 if (acpi_device_dir(device)) { 965 if (acpi_device_dir(device)) {
981 remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device)); 966 remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
@@ -983,7 +968,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device)
983 acpi_device_dir(device) = NULL; 968 acpi_device_dir(device) = NULL;
984 } 969 }
985 970
986 return_VALUE(0); 971 return 0;
987} 972}
988 973
989/* -------------------------------------------------------------------------- 974/* --------------------------------------------------------------------------
@@ -996,14 +981,13 @@ static int acpi_ec_poll_add(struct acpi_device *device)
996 acpi_status status = AE_OK; 981 acpi_status status = AE_OK;
997 union acpi_ec *ec = NULL; 982 union acpi_ec *ec = NULL;
998 983
999 ACPI_FUNCTION_TRACE("acpi_ec_add");
1000 984
1001 if (!device) 985 if (!device)
1002 return_VALUE(-EINVAL); 986 return -EINVAL;
1003 987
1004 ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); 988 ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
1005 if (!ec) 989 if (!ec)
1006 return_VALUE(-ENOMEM); 990 return -ENOMEM;
1007 memset(ec, 0, sizeof(union acpi_ec)); 991 memset(ec, 0, sizeof(union acpi_ec));
1008 992
1009 ec->common.handle = device->handle; 993 ec->common.handle = device->handle;
@@ -1056,7 +1040,7 @@ static int acpi_ec_poll_add(struct acpi_device *device)
1056 if (result) 1040 if (result)
1057 kfree(ec); 1041 kfree(ec);
1058 1042
1059 return_VALUE(result); 1043 return result;
1060} 1044}
1061static int acpi_ec_intr_add(struct acpi_device *device) 1045static int acpi_ec_intr_add(struct acpi_device *device)
1062{ 1046{
@@ -1064,14 +1048,13 @@ static int acpi_ec_intr_add(struct acpi_device *device)
1064 acpi_status status = AE_OK; 1048 acpi_status status = AE_OK;
1065 union acpi_ec *ec = NULL; 1049 union acpi_ec *ec = NULL;
1066 1050
1067 ACPI_FUNCTION_TRACE("acpi_ec_add");
1068 1051
1069 if (!device) 1052 if (!device)
1070 return_VALUE(-EINVAL); 1053 return -EINVAL;
1071 1054
1072 ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); 1055 ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
1073 if (!ec) 1056 if (!ec)
1074 return_VALUE(-ENOMEM); 1057 return -ENOMEM;
1075 memset(ec, 0, sizeof(union acpi_ec)); 1058 memset(ec, 0, sizeof(union acpi_ec));
1076 1059
1077 ec->common.handle = device->handle; 1060 ec->common.handle = device->handle;
@@ -1127,17 +1110,16 @@ static int acpi_ec_intr_add(struct acpi_device *device)
1127 if (result) 1110 if (result)
1128 kfree(ec); 1111 kfree(ec);
1129 1112
1130 return_VALUE(result); 1113 return result;
1131} 1114}
1132 1115
1133static int acpi_ec_remove(struct acpi_device *device, int type) 1116static int acpi_ec_remove(struct acpi_device *device, int type)
1134{ 1117{
1135 union acpi_ec *ec = NULL; 1118 union acpi_ec *ec = NULL;
1136 1119
1137 ACPI_FUNCTION_TRACE("acpi_ec_remove");
1138 1120
1139 if (!device) 1121 if (!device)
1140 return_VALUE(-EINVAL); 1122 return -EINVAL;
1141 1123
1142 ec = acpi_driver_data(device); 1124 ec = acpi_driver_data(device);
1143 1125
@@ -1145,7 +1127,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
1145 1127
1146 kfree(ec); 1128 kfree(ec);
1147 1129
1148 return_VALUE(0); 1130 return 0;
1149} 1131}
1150 1132
1151static acpi_status 1133static acpi_status
@@ -1184,15 +1166,14 @@ static int acpi_ec_start(struct acpi_device *device)
1184 acpi_status status = AE_OK; 1166 acpi_status status = AE_OK;
1185 union acpi_ec *ec = NULL; 1167 union acpi_ec *ec = NULL;
1186 1168
1187 ACPI_FUNCTION_TRACE("acpi_ec_start");
1188 1169
1189 if (!device) 1170 if (!device)
1190 return_VALUE(-EINVAL); 1171 return -EINVAL;
1191 1172
1192 ec = acpi_driver_data(device); 1173 ec = acpi_driver_data(device);
1193 1174
1194 if (!ec) 1175 if (!ec)
1195 return_VALUE(-EINVAL); 1176 return -EINVAL;
1196 1177
1197 /* 1178 /*
1198 * Get I/O port addresses. Convert to GAS format. 1179 * Get I/O port addresses. Convert to GAS format.
@@ -1202,7 +1183,7 @@ static int acpi_ec_start(struct acpi_device *device)
1202 if (ACPI_FAILURE(status) 1183 if (ACPI_FAILURE(status)
1203 || ec->common.command_addr.register_bit_width == 0) { 1184 || ec->common.command_addr.register_bit_width == 0) {
1204 printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); 1185 printk(KERN_ERR PREFIX "Error getting I/O port addresses\n");
1205 return_VALUE(-ENODEV); 1186 return -ENODEV;
1206 } 1187 }
1207 1188
1208 ec->common.status_addr = ec->common.command_addr; 1189 ec->common.status_addr = ec->common.command_addr;
@@ -1219,7 +1200,7 @@ static int acpi_ec_start(struct acpi_device *device)
1219 ACPI_GPE_EDGE_TRIGGERED, 1200 ACPI_GPE_EDGE_TRIGGERED,
1220 &acpi_ec_gpe_handler, ec); 1201 &acpi_ec_gpe_handler, ec);
1221 if (ACPI_FAILURE(status)) { 1202 if (ACPI_FAILURE(status)) {
1222 return_VALUE(-ENODEV); 1203 return -ENODEV;
1223 } 1204 }
1224 acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); 1205 acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
1225 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 1206 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
@@ -1231,10 +1212,10 @@ static int acpi_ec_start(struct acpi_device *device)
1231 if (ACPI_FAILURE(status)) { 1212 if (ACPI_FAILURE(status)) {
1232 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, 1213 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
1233 &acpi_ec_gpe_handler); 1214 &acpi_ec_gpe_handler);
1234 return_VALUE(-ENODEV); 1215 return -ENODEV;
1235 } 1216 }
1236 1217
1237 return_VALUE(AE_OK); 1218 return AE_OK;
1238} 1219}
1239 1220
1240static int acpi_ec_stop(struct acpi_device *device, int type) 1221static int acpi_ec_stop(struct acpi_device *device, int type)
@@ -1242,10 +1223,9 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
1242 acpi_status status = AE_OK; 1223 acpi_status status = AE_OK;
1243 union acpi_ec *ec = NULL; 1224 union acpi_ec *ec = NULL;
1244 1225
1245 ACPI_FUNCTION_TRACE("acpi_ec_stop");
1246 1226
1247 if (!device) 1227 if (!device)
1248 return_VALUE(-EINVAL); 1228 return -EINVAL;
1249 1229
1250 ec = acpi_driver_data(device); 1230 ec = acpi_driver_data(device);
1251 1231
@@ -1253,15 +1233,15 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
1253 ACPI_ADR_SPACE_EC, 1233 ACPI_ADR_SPACE_EC,
1254 &acpi_ec_space_handler); 1234 &acpi_ec_space_handler);
1255 if (ACPI_FAILURE(status)) 1235 if (ACPI_FAILURE(status))
1256 return_VALUE(-ENODEV); 1236 return -ENODEV;
1257 1237
1258 status = 1238 status =
1259 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, 1239 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
1260 &acpi_ec_gpe_handler); 1240 &acpi_ec_gpe_handler);
1261 if (ACPI_FAILURE(status)) 1241 if (ACPI_FAILURE(status))
1262 return_VALUE(-ENODEV); 1242 return -ENODEV;
1263 1243
1264 return_VALUE(0); 1244 return 0;
1265} 1245}
1266 1246
1267static acpi_status __init 1247static acpi_status __init
@@ -1531,23 +1511,22 @@ static int __init acpi_ec_init(void)
1531{ 1511{
1532 int result = 0; 1512 int result = 0;
1533 1513
1534 ACPI_FUNCTION_TRACE("acpi_ec_init");
1535 1514
1536 if (acpi_disabled) 1515 if (acpi_disabled)
1537 return_VALUE(0); 1516 return 0;
1538 1517
1539 acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); 1518 acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir);
1540 if (!acpi_ec_dir) 1519 if (!acpi_ec_dir)
1541 return_VALUE(-ENODEV); 1520 return -ENODEV;
1542 1521
1543 /* Now register the driver for the EC */ 1522 /* Now register the driver for the EC */
1544 result = acpi_bus_register_driver(&acpi_ec_driver); 1523 result = acpi_bus_register_driver(&acpi_ec_driver);
1545 if (result < 0) { 1524 if (result < 0) {
1546 remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); 1525 remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
1547 return_VALUE(-ENODEV); 1526 return -ENODEV;
1548 } 1527 }
1549 1528
1550 return_VALUE(result); 1529 return result;
1551} 1530}
1552 1531
1553subsys_initcall(acpi_ec_init); 1532subsys_initcall(acpi_ec_init);
@@ -1556,13 +1535,12 @@ subsys_initcall(acpi_ec_init);
1556#if 0 1535#if 0
1557static void __exit acpi_ec_exit(void) 1536static void __exit acpi_ec_exit(void)
1558{ 1537{
1559 ACPI_FUNCTION_TRACE("acpi_ec_exit");
1560 1538
1561 acpi_bus_unregister_driver(&acpi_ec_driver); 1539 acpi_bus_unregister_driver(&acpi_ec_driver);
1562 1540
1563 remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); 1541 remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
1564 1542
1565 return_VOID; 1543 return;
1566} 1544}
1567#endif /* 0 */ 1545#endif /* 0 */
1568 1546
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index dab09d3f6307..a901b23e95e7 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -48,18 +48,17 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
48 static int chars_remaining = 0; 48 static int chars_remaining = 0;
49 static char *ptr; 49 static char *ptr;
50 50
51 ACPI_FUNCTION_TRACE("acpi_system_read_event");
52 51
53 if (!chars_remaining) { 52 if (!chars_remaining) {
54 memset(&event, 0, sizeof(struct acpi_bus_event)); 53 memset(&event, 0, sizeof(struct acpi_bus_event));
55 54
56 if ((file->f_flags & O_NONBLOCK) 55 if ((file->f_flags & O_NONBLOCK)
57 && (list_empty(&acpi_bus_event_list))) 56 && (list_empty(&acpi_bus_event_list)))
58 return_VALUE(-EAGAIN); 57 return -EAGAIN;
59 58
60 result = acpi_bus_receive_event(&event); 59 result = acpi_bus_receive_event(&event);
61 if (result) 60 if (result)
62 return_VALUE(result); 61 return result;
63 62
64 chars_remaining = sprintf(str, "%s %s %08x %08x\n", 63 chars_remaining = sprintf(str, "%s %s %08x %08x\n",
65 event.device_class ? event. 64 event.device_class ? event.
@@ -75,13 +74,13 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
75 } 74 }
76 75
77 if (copy_to_user(buffer, ptr, count)) 76 if (copy_to_user(buffer, ptr, count))
78 return_VALUE(-EFAULT); 77 return -EFAULT;
79 78
80 *ppos += count; 79 *ppos += count;
81 chars_remaining -= count; 80 chars_remaining -= count;
82 ptr += count; 81 ptr += count;
83 82
84 return_VALUE(count); 83 return count;
85} 84}
86 85
87static int acpi_system_close_event(struct inode *inode, struct file *file) 86static int acpi_system_close_event(struct inode *inode, struct file *file)
@@ -112,10 +111,9 @@ static int __init acpi_event_init(void)
112 struct proc_dir_entry *entry; 111 struct proc_dir_entry *entry;
113 int error = 0; 112 int error = 0;
114 113
115 ACPI_FUNCTION_TRACE("acpi_event_init");
116 114
117 if (acpi_disabled) 115 if (acpi_disabled)
118 return_VALUE(0); 116 return 0;
119 117
120 /* 'event' [R] */ 118 /* 'event' [R] */
121 entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); 119 entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
@@ -124,7 +122,7 @@ static int __init acpi_event_init(void)
124 else { 122 else {
125 error = -ENODEV; 123 error = -ENODEV;
126 } 124 }
127 return_VALUE(error); 125 return error;
128} 126}
129 127
130subsys_initcall(acpi_event_init); 128subsys_initcall(acpi_event_init);
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 65bdcde2c4e3..38acc69b21bc 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -78,7 +78,6 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
78 struct acpi_fan *fan = seq->private; 78 struct acpi_fan *fan = seq->private;
79 int state = 0; 79 int state = 0;
80 80
81 ACPI_FUNCTION_TRACE("acpi_fan_read_state");
82 81
83 if (fan) { 82 if (fan) {
84 if (acpi_bus_get_power(fan->handle, &state)) 83 if (acpi_bus_get_power(fan->handle, &state))
@@ -87,7 +86,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
87 seq_printf(seq, "status: %s\n", 86 seq_printf(seq, "status: %s\n",
88 !state ? "on" : "off"); 87 !state ? "on" : "off");
89 } 88 }
90 return_VALUE(0); 89 return 0;
91} 90}
92 91
93static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) 92static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
@@ -104,22 +103,21 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
104 struct acpi_fan *fan = (struct acpi_fan *)m->private; 103 struct acpi_fan *fan = (struct acpi_fan *)m->private;
105 char state_string[12] = { '\0' }; 104 char state_string[12] = { '\0' };
106 105
107 ACPI_FUNCTION_TRACE("acpi_fan_write_state");
108 106
109 if (!fan || (count > sizeof(state_string) - 1)) 107 if (!fan || (count > sizeof(state_string) - 1))
110 return_VALUE(-EINVAL); 108 return -EINVAL;
111 109
112 if (copy_from_user(state_string, buffer, count)) 110 if (copy_from_user(state_string, buffer, count))
113 return_VALUE(-EFAULT); 111 return -EFAULT;
114 112
115 state_string[count] = '\0'; 113 state_string[count] = '\0';
116 114
117 result = acpi_bus_set_power(fan->handle, 115 result = acpi_bus_set_power(fan->handle,
118 simple_strtoul(state_string, NULL, 0)); 116 simple_strtoul(state_string, NULL, 0));
119 if (result) 117 if (result)
120 return_VALUE(result); 118 return result;
121 119
122 return_VALUE(count); 120 return count;
123} 121}
124 122
125static struct file_operations acpi_fan_state_ops = { 123static struct file_operations acpi_fan_state_ops = {
@@ -135,16 +133,15 @@ static int acpi_fan_add_fs(struct acpi_device *device)
135{ 133{
136 struct proc_dir_entry *entry = NULL; 134 struct proc_dir_entry *entry = NULL;
137 135
138 ACPI_FUNCTION_TRACE("acpi_fan_add_fs");
139 136
140 if (!device) 137 if (!device)
141 return_VALUE(-EINVAL); 138 return -EINVAL;
142 139
143 if (!acpi_device_dir(device)) { 140 if (!acpi_device_dir(device)) {
144 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 141 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
145 acpi_fan_dir); 142 acpi_fan_dir);
146 if (!acpi_device_dir(device)) 143 if (!acpi_device_dir(device))
147 return_VALUE(-ENODEV); 144 return -ENODEV;
148 acpi_device_dir(device)->owner = THIS_MODULE; 145 acpi_device_dir(device)->owner = THIS_MODULE;
149 } 146 }
150 147
@@ -153,19 +150,18 @@ static int acpi_fan_add_fs(struct acpi_device *device)
153 S_IFREG | S_IRUGO | S_IWUSR, 150 S_IFREG | S_IRUGO | S_IWUSR,
154 acpi_device_dir(device)); 151 acpi_device_dir(device));
155 if (!entry) 152 if (!entry)
156 return_VALUE(-ENODEV); 153 return -ENODEV;
157 else { 154 else {
158 entry->proc_fops = &acpi_fan_state_ops; 155 entry->proc_fops = &acpi_fan_state_ops;
159 entry->data = acpi_driver_data(device); 156 entry->data = acpi_driver_data(device);
160 entry->owner = THIS_MODULE; 157 entry->owner = THIS_MODULE;
161 } 158 }
162 159
163 return_VALUE(0); 160 return 0;
164} 161}
165 162
166static int acpi_fan_remove_fs(struct acpi_device *device) 163static int acpi_fan_remove_fs(struct acpi_device *device)
167{ 164{
168 ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
169 165
170 if (acpi_device_dir(device)) { 166 if (acpi_device_dir(device)) {
171 remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); 167 remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
@@ -173,7 +169,7 @@ static int acpi_fan_remove_fs(struct acpi_device *device)
173 acpi_device_dir(device) = NULL; 169 acpi_device_dir(device) = NULL;
174 } 170 }
175 171
176 return_VALUE(0); 172 return 0;
177} 173}
178 174
179/* -------------------------------------------------------------------------- 175/* --------------------------------------------------------------------------
@@ -186,14 +182,13 @@ static int acpi_fan_add(struct acpi_device *device)
186 struct acpi_fan *fan = NULL; 182 struct acpi_fan *fan = NULL;
187 int state = 0; 183 int state = 0;
188 184
189 ACPI_FUNCTION_TRACE("acpi_fan_add");
190 185
191 if (!device) 186 if (!device)
192 return_VALUE(-EINVAL); 187 return -EINVAL;
193 188
194 fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL); 189 fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL);
195 if (!fan) 190 if (!fan)
196 return_VALUE(-ENOMEM); 191 return -ENOMEM;
197 memset(fan, 0, sizeof(struct acpi_fan)); 192 memset(fan, 0, sizeof(struct acpi_fan));
198 193
199 fan->handle = device->handle; 194 fan->handle = device->handle;
@@ -223,17 +218,16 @@ static int acpi_fan_add(struct acpi_device *device)
223 if (result) 218 if (result)
224 kfree(fan); 219 kfree(fan);
225 220
226 return_VALUE(result); 221 return result;
227} 222}
228 223
229static int acpi_fan_remove(struct acpi_device *device, int type) 224static int acpi_fan_remove(struct acpi_device *device, int type)
230{ 225{
231 struct acpi_fan *fan = NULL; 226 struct acpi_fan *fan = NULL;
232 227
233 ACPI_FUNCTION_TRACE("acpi_fan_remove");
234 228
235 if (!device || !acpi_driver_data(device)) 229 if (!device || !acpi_driver_data(device))
236 return_VALUE(-EINVAL); 230 return -EINVAL;
237 231
238 fan = (struct acpi_fan *)acpi_driver_data(device); 232 fan = (struct acpi_fan *)acpi_driver_data(device);
239 233
@@ -241,7 +235,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
241 235
242 kfree(fan); 236 kfree(fan);
243 237
244 return_VALUE(0); 238 return 0;
245} 239}
246 240
247static int acpi_fan_suspend(struct acpi_device *device, int state) 241static int acpi_fan_suspend(struct acpi_device *device, int state)
@@ -280,31 +274,29 @@ static int __init acpi_fan_init(void)
280{ 274{
281 int result = 0; 275 int result = 0;
282 276
283 ACPI_FUNCTION_TRACE("acpi_fan_init");
284 277
285 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); 278 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
286 if (!acpi_fan_dir) 279 if (!acpi_fan_dir)
287 return_VALUE(-ENODEV); 280 return -ENODEV;
288 acpi_fan_dir->owner = THIS_MODULE; 281 acpi_fan_dir->owner = THIS_MODULE;
289 282
290 result = acpi_bus_register_driver(&acpi_fan_driver); 283 result = acpi_bus_register_driver(&acpi_fan_driver);
291 if (result < 0) { 284 if (result < 0) {
292 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); 285 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
293 return_VALUE(-ENODEV); 286 return -ENODEV;
294 } 287 }
295 288
296 return_VALUE(0); 289 return 0;
297} 290}
298 291
299static void __exit acpi_fan_exit(void) 292static void __exit acpi_fan_exit(void)
300{ 293{
301 ACPI_FUNCTION_TRACE("acpi_fan_exit");
302 294
303 acpi_bus_unregister_driver(&acpi_fan_driver); 295 acpi_bus_unregister_driver(&acpi_fan_driver);
304 296
305 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); 297 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
306 298
307 return_VOID; 299 return;
308} 300}
309 301
310module_init(acpi_fan_init); 302module_init(acpi_fan_init);
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c
index 393dbbca4e85..fd81a0f5222f 100644
--- a/drivers/acpi/hotkey.c
+++ b/drivers/acpi/hotkey.c
@@ -231,11 +231,10 @@ struct list_head hotkey_entries; /* head of the list of hotkey_list */
231 231
232static int hotkey_info_seq_show(struct seq_file *seq, void *offset) 232static int hotkey_info_seq_show(struct seq_file *seq, void *offset)
233{ 233{
234 ACPI_FUNCTION_TRACE("hotkey_info_seq_show");
235 234
236 seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION); 235 seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION);
237 236
238 return_VALUE(0); 237 return 0;
239} 238}
240 239
241static int hotkey_info_open_fs(struct inode *inode, struct file *file) 240static int hotkey_info_open_fs(struct inode *inode, struct file *file)
@@ -266,7 +265,6 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
266 (struct acpi_polling_hotkey *)seq->private; 265 (struct acpi_polling_hotkey *)seq->private;
267 char *buf; 266 char *buf;
268 267
269 ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
270 268
271 if (poll_hotkey->poll_result) { 269 if (poll_hotkey->poll_result) {
272 buf = format_result(poll_hotkey->poll_result); 270 buf = format_result(poll_hotkey->poll_result);
@@ -274,7 +272,7 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
274 seq_printf(seq, "%s", buf); 272 seq_printf(seq, "%s", buf);
275 kfree(buf); 273 kfree(buf);
276 } 274 }
277 return_VALUE(0); 275 return 0;
278} 276}
279 277
280static int hotkey_polling_open_fs(struct inode *inode, struct file *file) 278static int hotkey_polling_open_fs(struct inode *inode, struct file *file)
@@ -293,7 +291,6 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
293 struct list_head *entries; 291 struct list_head *entries;
294 int val = -1; 292 int val = -1;
295 293
296 ACPI_FUNCTION_TRACE("hotkey_get_internal_event");
297 294
298 list_for_each(entries, list->entries) { 295 list_for_each(entries, list->entries) {
299 union acpi_hotkey *key = 296 union acpi_hotkey *key =
@@ -305,7 +302,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
305 } 302 }
306 } 303 }
307 304
308 return_VALUE(val); 305 return val;
309} 306}
310 307
311static void 308static void
@@ -314,15 +311,14 @@ acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data)
314 struct acpi_device *device = NULL; 311 struct acpi_device *device = NULL;
315 u32 internal_event; 312 u32 internal_event;
316 313
317 ACPI_FUNCTION_TRACE("acpi_hotkey_notify_handler");
318 314
319 if (acpi_bus_get_device(handle, &device)) 315 if (acpi_bus_get_device(handle, &device))
320 return_VOID; 316 return;
321 317
322 internal_event = hotkey_get_internal_event(event, &global_hotkey_list); 318 internal_event = hotkey_get_internal_event(event, &global_hotkey_list);
323 acpi_bus_generate_event(device, internal_event, 0); 319 acpi_bus_generate_event(device, internal_event, 0);
324 320
325 return_VOID; 321 return;
326} 322}
327 323
328/* Need to invent automatically hotkey add method */ 324/* Need to invent automatically hotkey add method */
@@ -346,7 +342,6 @@ static int create_polling_proc(union acpi_hotkey *device)
346 char proc_name[80]; 342 char proc_name[80];
347 mode_t mode; 343 mode_t mode;
348 344
349 ACPI_FUNCTION_TRACE("create_polling_proc");
350 mode = S_IFREG | S_IRUGO | S_IWUGO; 345 mode = S_IFREG | S_IRUGO | S_IWUGO;
351 346
352 sprintf(proc_name, "%d", device->link.hotkey_standard_num); 347 sprintf(proc_name, "%d", device->link.hotkey_standard_num);
@@ -356,7 +351,7 @@ static int create_polling_proc(union acpi_hotkey *device)
356 proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); 351 proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
357 352
358 if (!proc) { 353 if (!proc) {
359 return_VALUE(-ENODEV); 354 return -ENODEV;
360 } else { 355 } else {
361 proc->proc_fops = &hotkey_polling_fops; 356 proc->proc_fops = &hotkey_polling_fops;
362 proc->owner = THIS_MODULE; 357 proc->owner = THIS_MODULE;
@@ -365,7 +360,7 @@ static int create_polling_proc(union acpi_hotkey *device)
365 proc->gid = 0; 360 proc->gid = 0;
366 device->poll_hotkey.proc = proc; 361 device->poll_hotkey.proc = proc;
367 } 362 }
368 return_VALUE(0); 363 return 0;
369} 364}
370 365
371static int hotkey_add(union acpi_hotkey *device) 366static int hotkey_add(union acpi_hotkey *device)
@@ -373,7 +368,6 @@ static int hotkey_add(union acpi_hotkey *device)
373 int status = 0; 368 int status = 0;
374 struct acpi_device *dev = NULL; 369 struct acpi_device *dev = NULL;
375 370
376 ACPI_FUNCTION_TRACE("hotkey_add");
377 371
378 if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { 372 if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) {
379 acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); 373 acpi_bus_get_device(device->event_hotkey.bus_handle, &dev);
@@ -388,14 +382,13 @@ static int hotkey_add(union acpi_hotkey *device)
388 382
389 list_add_tail(&device->link.entries, global_hotkey_list.entries); 383 list_add_tail(&device->link.entries, global_hotkey_list.entries);
390 384
391 return_VALUE(status); 385 return status;
392} 386}
393 387
394static int hotkey_remove(union acpi_hotkey *device) 388static int hotkey_remove(union acpi_hotkey *device)
395{ 389{
396 struct list_head *entries, *next; 390 struct list_head *entries, *next;
397 391
398 ACPI_FUNCTION_TRACE("hotkey_remove");
399 392
400 list_for_each_safe(entries, next, global_hotkey_list.entries) { 393 list_for_each_safe(entries, next, global_hotkey_list.entries) {
401 union acpi_hotkey *key = 394 union acpi_hotkey *key =
@@ -409,14 +402,13 @@ static int hotkey_remove(union acpi_hotkey *device)
409 } 402 }
410 } 403 }
411 kfree(device); 404 kfree(device);
412 return_VALUE(0); 405 return 0;
413} 406}
414 407
415static int hotkey_update(union acpi_hotkey *key) 408static int hotkey_update(union acpi_hotkey *key)
416{ 409{
417 struct list_head *entries; 410 struct list_head *entries;
418 411
419 ACPI_FUNCTION_TRACE("hotkey_update");
420 412
421 list_for_each(entries, global_hotkey_list.entries) { 413 list_for_each(entries, global_hotkey_list.entries) {
422 union acpi_hotkey *tmp = 414 union acpi_hotkey *tmp =
@@ -458,19 +450,18 @@ static int hotkey_update(union acpi_hotkey *key)
458 */ 450 */
459 kfree(key); 451 kfree(key);
460 } 452 }
461 return_VALUE(0); 453 return 0;
462 break; 454 break;
463 } 455 }
464 } 456 }
465 457
466 return_VALUE(-ENODEV); 458 return -ENODEV;
467} 459}
468 460
469static void free_hotkey_device(union acpi_hotkey *key) 461static void free_hotkey_device(union acpi_hotkey *key)
470{ 462{
471 struct acpi_device *dev; 463 struct acpi_device *dev;
472 464
473 ACPI_FUNCTION_TRACE("free_hotkey_device");
474 465
475 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { 466 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
476 acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); 467 acpi_bus_get_device(key->event_hotkey.bus_handle, &dev);
@@ -490,7 +481,7 @@ static void free_hotkey_device(union acpi_hotkey *key)
490 free_poll_hotkey_buffer(key); 481 free_poll_hotkey_buffer(key);
491 } 482 }
492 kfree(key); 483 kfree(key);
493 return_VOID; 484 return;
494} 485}
495 486
496static void free_hotkey_buffer(union acpi_hotkey *key) 487static void free_hotkey_buffer(union acpi_hotkey *key)
@@ -511,7 +502,6 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
511 acpi_handle tmp_handle; 502 acpi_handle tmp_handle;
512 acpi_status status = AE_OK; 503 acpi_status status = AE_OK;
513 504
514 ACPI_FUNCTION_TRACE("init_hotkey_device");
515 505
516 if (std_num < 0 || IS_POLL(std_num) || !key) 506 if (std_num < 0 || IS_POLL(std_num) || !key)
517 goto do_fail; 507 goto do_fail;
@@ -538,9 +528,9 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
538 method, &tmp_handle); 528 method, &tmp_handle);
539 if (ACPI_FAILURE(status)) 529 if (ACPI_FAILURE(status))
540 goto do_fail; 530 goto do_fail;
541 return_VALUE(AE_OK); 531 return AE_OK;
542 do_fail: 532 do_fail:
543 return_VALUE(-ENODEV); 533 return -ENODEV;
544} 534}
545 535
546static int 536static int
@@ -552,7 +542,6 @@ init_poll_hotkey_device(union acpi_hotkey *key,
552 acpi_status status = AE_OK; 542 acpi_status status = AE_OK;
553 acpi_handle tmp_handle; 543 acpi_handle tmp_handle;
554 544
555 ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
556 545
557 if (std_num < 0 || IS_EVENT(std_num) || !key) 546 if (std_num < 0 || IS_EVENT(std_num) || !key)
558 goto do_fail; 547 goto do_fail;
@@ -587,22 +576,20 @@ init_poll_hotkey_device(union acpi_hotkey *key,
587 (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); 576 (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
588 if (!key->poll_hotkey.poll_result) 577 if (!key->poll_hotkey.poll_result)
589 goto do_fail; 578 goto do_fail;
590 return_VALUE(AE_OK); 579 return AE_OK;
591 do_fail: 580 do_fail:
592 return_VALUE(-ENODEV); 581 return -ENODEV;
593} 582}
594 583
595static int hotkey_open_config(struct inode *inode, struct file *file) 584static int hotkey_open_config(struct inode *inode, struct file *file)
596{ 585{
597 ACPI_FUNCTION_TRACE("hotkey_open_config"); 586 return (single_open
598 return_VALUE(single_open
599 (file, hotkey_config_seq_show, PDE(inode)->data)); 587 (file, hotkey_config_seq_show, PDE(inode)->data));
600} 588}
601 589
602static int hotkey_poll_open_config(struct inode *inode, struct file *file) 590static int hotkey_poll_open_config(struct inode *inode, struct file *file)
603{ 591{
604 ACPI_FUNCTION_TRACE("hotkey_poll_open_config"); 592 return (single_open
605 return_VALUE(single_open
606 (file, hotkey_poll_config_seq_show, PDE(inode)->data)); 593 (file, hotkey_poll_config_seq_show, PDE(inode)->data));
607} 594}
608 595
@@ -615,7 +602,6 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
615 struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; 602 struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name };
616 struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; 603 struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name };
617 604
618 ACPI_FUNCTION_TRACE(("hotkey_config_seq_show"));
619 605
620 list_for_each(entries, hotkey_list->entries) { 606 list_for_each(entries, hotkey_list->entries) {
621 union acpi_hotkey *key = 607 union acpi_hotkey *key =
@@ -633,7 +619,7 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
633 } 619 }
634 } 620 }
635 seq_puts(seq, "\n"); 621 seq_puts(seq, "\n");
636 return_VALUE(0); 622 return 0;
637} 623}
638 624
639static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) 625static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset)
@@ -645,7 +631,6 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset)
645 struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; 631 struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name };
646 struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; 632 struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name };
647 633
648 ACPI_FUNCTION_TRACE(("hotkey_config_seq_show"));
649 634
650 list_for_each(entries, hotkey_list->entries) { 635 list_for_each(entries, hotkey_list->entries) {
651 union acpi_hotkey *key = 636 union acpi_hotkey *key =
@@ -663,7 +648,7 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset)
663 } 648 }
664 } 649 }
665 seq_puts(seq, "\n"); 650 seq_puts(seq, "\n");
666 return_VALUE(0); 651 return 0;
667} 652}
668 653
669static int 654static int
@@ -675,7 +660,6 @@ get_parms(char *config_record,
675 char **method, int *internal_event_num, int *external_event_num) 660 char **method, int *internal_event_num, int *external_event_num)
676{ 661{
677 char *tmp, *tmp1, count; 662 char *tmp, *tmp1, count;
678 ACPI_FUNCTION_TRACE(("get_parms"));
679 663
680 sscanf(config_record, "%d", cmd); 664 sscanf(config_record, "%d", cmd);
681 665
@@ -741,9 +725,9 @@ get_parms(char *config_record,
741 0) 725 0)
742 goto do_fail; 726 goto do_fail;
743 727
744 return_VALUE(6); 728 return 6;
745 do_fail: 729 do_fail:
746 return_VALUE(-1); 730 return -1;
747} 731}
748 732
749/* count is length for one input record */ 733/* count is length for one input record */
@@ -760,16 +744,15 @@ static ssize_t hotkey_write_config(struct file *file,
760 int ret = 0; 744 int ret = 0;
761 union acpi_hotkey *key = NULL; 745 union acpi_hotkey *key = NULL;
762 746
763 ACPI_FUNCTION_TRACE(("hotkey_write_config"));
764 747
765 config_record = (char *)kmalloc(count + 1, GFP_KERNEL); 748 config_record = (char *)kmalloc(count + 1, GFP_KERNEL);
766 if (!config_record) 749 if (!config_record)
767 return_VALUE(-ENOMEM); 750 return -ENOMEM;
768 751
769 if (copy_from_user(config_record, buffer, count)) { 752 if (copy_from_user(config_record, buffer, count)) {
770 kfree(config_record); 753 kfree(config_record);
771 printk(KERN_ERR PREFIX "Invalid data\n"); 754 printk(KERN_ERR PREFIX "Invalid data\n");
772 return_VALUE(-EINVAL); 755 return -EINVAL;
773 } 756 }
774 config_record[count] = 0; 757 config_record[count] = 0;
775 758
@@ -790,7 +773,7 @@ static ssize_t hotkey_write_config(struct file *file,
790 kfree(action_handle); 773 kfree(action_handle);
791 kfree(method); 774 kfree(method);
792 printk(KERN_ERR PREFIX "Invalid data format ret=%d\n", ret); 775 printk(KERN_ERR PREFIX "Invalid data format ret=%d\n", ret);
793 return_VALUE(-EINVAL); 776 return -EINVAL;
794 } 777 }
795 778
796 key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); 779 key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
@@ -825,7 +808,7 @@ static ssize_t hotkey_write_config(struct file *file,
825 free_poll_hotkey_buffer(key); 808 free_poll_hotkey_buffer(key);
826 kfree(key); 809 kfree(key);
827 printk(KERN_ERR PREFIX "Invalid hotkey\n"); 810 printk(KERN_ERR PREFIX "Invalid hotkey\n");
828 return_VALUE(-EINVAL); 811 return -EINVAL;
829 } 812 }
830 813
831 cont_cmd: 814 cont_cmd:
@@ -851,7 +834,7 @@ static ssize_t hotkey_write_config(struct file *file,
851 goto fail_out; 834 goto fail_out;
852 break; 835 break;
853 } 836 }
854 return_VALUE(count); 837 return count;
855 fail_out: 838 fail_out:
856 if (IS_EVENT(internal_event_num)) 839 if (IS_EVENT(internal_event_num))
857 free_hotkey_buffer(key); 840 free_hotkey_buffer(key);
@@ -859,7 +842,7 @@ static ssize_t hotkey_write_config(struct file *file,
859 free_poll_hotkey_buffer(key); 842 free_poll_hotkey_buffer(key);
860 kfree(key); 843 kfree(key);
861 printk(KERN_ERR PREFIX "invalid key\n"); 844 printk(KERN_ERR PREFIX "invalid key\n");
862 return_VALUE(-EINVAL); 845 return -EINVAL;
863} 846}
864 847
865/* 848/*
@@ -876,7 +859,6 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
876 union acpi_object in_obj; /* the only param we use */ 859 union acpi_object in_obj; /* the only param we use */
877 acpi_status status; 860 acpi_status status;
878 861
879 ACPI_FUNCTION_TRACE("write_acpi_int");
880 params.count = 1; 862 params.count = 1;
881 params.pointer = &in_obj; 863 params.pointer = &in_obj;
882 in_obj.type = ACPI_TYPE_INTEGER; 864 in_obj.type = ACPI_TYPE_INTEGER;
@@ -884,7 +866,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
884 866
885 status = acpi_evaluate_object(handle, (char *)method, &params, output); 867 status = acpi_evaluate_object(handle, (char *)method, &params, output);
886 868
887 return_VALUE(status == AE_OK); 869 return (status == AE_OK);
888} 870}
889 871
890static int read_acpi_int(acpi_handle handle, const char *method, 872static int read_acpi_int(acpi_handle handle, const char *method,
@@ -894,7 +876,6 @@ static int read_acpi_int(acpi_handle handle, const char *method,
894 union acpi_object out_obj; 876 union acpi_object out_obj;
895 acpi_status status; 877 acpi_status status;
896 878
897 ACPI_FUNCTION_TRACE("read_acpi_int");
898 output.length = sizeof(out_obj); 879 output.length = sizeof(out_obj);
899 output.pointer = &out_obj; 880 output.pointer = &out_obj;
900 881
@@ -904,7 +885,7 @@ static int read_acpi_int(acpi_handle handle, const char *method,
904 val->type = out_obj.type; 885 val->type = out_obj.type;
905 } else 886 } else
906 printk(KERN_ERR PREFIX "null val pointer\n"); 887 printk(KERN_ERR PREFIX "null val pointer\n");
907 return_VALUE((status == AE_OK) 888 return ((status == AE_OK)
908 && (out_obj.type == ACPI_TYPE_INTEGER)); 889 && (out_obj.type == ACPI_TYPE_INTEGER));
909} 890}
910 891
@@ -941,24 +922,23 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
941 int event, method_type, type, value; 922 int event, method_type, type, value;
942 union acpi_hotkey *key; 923 union acpi_hotkey *key;
943 924
944 ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
945 925
946 arg = (char *)kmalloc(count + 1, GFP_KERNEL); 926 arg = (char *)kmalloc(count + 1, GFP_KERNEL);
947 if (!arg) 927 if (!arg)
948 return_VALUE(-ENOMEM); 928 return -ENOMEM;
949 arg[count] = 0; 929 arg[count] = 0;
950 930
951 if (copy_from_user(arg, buffer, count)) { 931 if (copy_from_user(arg, buffer, count)) {
952 kfree(arg); 932 kfree(arg);
953 printk(KERN_ERR PREFIX "Invalid argument 2\n"); 933 printk(KERN_ERR PREFIX "Invalid argument 2\n");
954 return_VALUE(-EINVAL); 934 return -EINVAL;
955 } 935 }
956 936
957 if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 937 if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) !=
958 4) { 938 4) {
959 kfree(arg); 939 kfree(arg);
960 printk(KERN_ERR PREFIX "Invalid argument 3\n"); 940 printk(KERN_ERR PREFIX "Invalid argument 3\n");
961 return_VALUE(-EINVAL); 941 return -EINVAL;
962 } 942 }
963 kfree(arg); 943 kfree(arg);
964 if (type == ACPI_TYPE_INTEGER) { 944 if (type == ACPI_TYPE_INTEGER) {
@@ -984,11 +964,11 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
984 } 964 }
985 } else { 965 } else {
986 printk(KERN_WARNING "Not supported\n"); 966 printk(KERN_WARNING "Not supported\n");
987 return_VALUE(-EINVAL); 967 return -EINVAL;
988 } 968 }
989 return_VALUE(count); 969 return count;
990 do_fail: 970 do_fail:
991 return_VALUE(-EINVAL); 971 return -EINVAL;
992 972
993} 973}
994 974
@@ -997,7 +977,6 @@ static int __init hotkey_init(void)
997 int result; 977 int result;
998 mode_t mode = S_IFREG | S_IRUGO | S_IWUGO; 978 mode_t mode = S_IFREG | S_IRUGO | S_IWUGO;
999 979
1000 ACPI_FUNCTION_TRACE("hotkey_init");
1001 980
1002 if (acpi_disabled) 981 if (acpi_disabled)
1003 return -ENODEV; 982 return -ENODEV;
@@ -1084,7 +1063,6 @@ static void __exit hotkey_exit(void)
1084{ 1063{
1085 struct list_head *entries, *next; 1064 struct list_head *entries, *next;
1086 1065
1087 ACPI_FUNCTION_TRACE("hotkey_exit");
1088 1066
1089 list_for_each_safe(entries, next, global_hotkey_list.entries) { 1067 list_for_each_safe(entries, next, global_hotkey_list.entries) {
1090 union acpi_hotkey *key = 1068 union acpi_hotkey *key =
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
index d51d68f5dd8d..ec6b7f9ede34 100644
--- a/drivers/acpi/motherboard.c
+++ b/drivers/acpi/motherboard.c
@@ -52,13 +52,12 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
52{ 52{
53 struct resource *requested_res = NULL; 53 struct resource *requested_res = NULL;
54 54
55 ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
56 55
57 if (res->type == ACPI_RESOURCE_TYPE_IO) { 56 if (res->type == ACPI_RESOURCE_TYPE_IO) {
58 struct acpi_resource_io *io_res = &res->data.io; 57 struct acpi_resource_io *io_res = &res->data.io;
59 58
60 if (io_res->minimum != io_res->maximum) 59 if (io_res->minimum != io_res->maximum)
61 return_VALUE(AE_OK); 60 return AE_OK;
62 if (IS_RESERVED_ADDR 61 if (IS_RESERVED_ADDR
63 (io_res->minimum, io_res->address_length)) { 62 (io_res->minimum, io_res->address_length)) {
64 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 63 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -92,7 +91,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
92 91
93 if (requested_res) 92 if (requested_res)
94 requested_res->flags &= ~IORESOURCE_BUSY; 93 requested_res->flags &= ~IORESOURCE_BUSY;
95 return_VALUE(AE_OK); 94 return AE_OK;
96} 95}
97 96
98static int acpi_motherboard_add(struct acpi_device *device) 97static int acpi_motherboard_add(struct acpi_device *device)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 7d4cc122b026..8e46d1b39491 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -587,19 +587,18 @@ static void acpi_os_execute_deferred(void *context)
587{ 587{
588 struct acpi_os_dpc *dpc = NULL; 588 struct acpi_os_dpc *dpc = NULL;
589 589
590 ACPI_FUNCTION_TRACE("os_execute_deferred");
591 590
592 dpc = (struct acpi_os_dpc *)context; 591 dpc = (struct acpi_os_dpc *)context;
593 if (!dpc) { 592 if (!dpc) {
594 printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); 593 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
595 return_VOID; 594 return;
596 } 595 }
597 596
598 dpc->function(dpc->context); 597 dpc->function(dpc->context);
599 598
600 kfree(dpc); 599 kfree(dpc);
601 600
602 return_VOID; 601 return;
603} 602}
604 603
605static int acpi_os_execute_thread(void *context) 604static int acpi_os_execute_thread(void *context)
@@ -693,7 +692,6 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle)
693{ 692{
694 spinlock_t *lock_ptr; 693 spinlock_t *lock_ptr;
695 694
696 ACPI_FUNCTION_TRACE("os_create_lock");
697 695
698 lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); 696 lock_ptr = acpi_os_allocate(sizeof(spinlock_t));
699 697
@@ -703,7 +701,7 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle)
703 701
704 *out_handle = lock_ptr; 702 *out_handle = lock_ptr;
705 703
706 return_ACPI_STATUS(AE_OK); 704 return AE_OK;
707} 705}
708 706
709/* 707/*
@@ -711,13 +709,12 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle)
711 */ 709 */
712void acpi_os_delete_lock(acpi_handle handle) 710void acpi_os_delete_lock(acpi_handle handle)
713{ 711{
714 ACPI_FUNCTION_TRACE("os_create_lock");
715 712
716 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); 713 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle));
717 714
718 acpi_os_free(handle); 715 acpi_os_free(handle);
719 716
720 return_VOID; 717 return;
721} 718}
722 719
723acpi_status 720acpi_status
@@ -725,11 +722,10 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
725{ 722{
726 struct semaphore *sem = NULL; 723 struct semaphore *sem = NULL;
727 724
728 ACPI_FUNCTION_TRACE("os_create_semaphore");
729 725
730 sem = acpi_os_allocate(sizeof(struct semaphore)); 726 sem = acpi_os_allocate(sizeof(struct semaphore));
731 if (!sem) 727 if (!sem)
732 return_ACPI_STATUS(AE_NO_MEMORY); 728 return AE_NO_MEMORY;
733 memset(sem, 0, sizeof(struct semaphore)); 729 memset(sem, 0, sizeof(struct semaphore));
734 730
735 sema_init(sem, initial_units); 731 sema_init(sem, initial_units);
@@ -739,7 +735,7 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
739 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", 735 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
740 *handle, initial_units)); 736 *handle, initial_units));
741 737
742 return_ACPI_STATUS(AE_OK); 738 return AE_OK;
743} 739}
744 740
745EXPORT_SYMBOL(acpi_os_create_semaphore); 741EXPORT_SYMBOL(acpi_os_create_semaphore);
@@ -755,17 +751,16 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle)
755{ 751{
756 struct semaphore *sem = (struct semaphore *)handle; 752 struct semaphore *sem = (struct semaphore *)handle;
757 753
758 ACPI_FUNCTION_TRACE("os_delete_semaphore");
759 754
760 if (!sem) 755 if (!sem)
761 return_ACPI_STATUS(AE_BAD_PARAMETER); 756 return AE_BAD_PARAMETER;
762 757
763 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); 758 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
764 759
765 acpi_os_free(sem); 760 acpi_os_free(sem);
766 sem = NULL; 761 sem = NULL;
767 762
768 return_ACPI_STATUS(AE_OK); 763 return AE_OK;
769} 764}
770 765
771EXPORT_SYMBOL(acpi_os_delete_semaphore); 766EXPORT_SYMBOL(acpi_os_delete_semaphore);
@@ -785,13 +780,12 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
785 struct semaphore *sem = (struct semaphore *)handle; 780 struct semaphore *sem = (struct semaphore *)handle;
786 int ret = 0; 781 int ret = 0;
787 782
788 ACPI_FUNCTION_TRACE("os_wait_semaphore");
789 783
790 if (!sem || (units < 1)) 784 if (!sem || (units < 1))
791 return_ACPI_STATUS(AE_BAD_PARAMETER); 785 return AE_BAD_PARAMETER;
792 786
793 if (units > 1) 787 if (units > 1)
794 return_ACPI_STATUS(AE_SUPPORT); 788 return AE_SUPPORT;
795 789
796 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", 790 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
797 handle, units, timeout)); 791 handle, units, timeout));
@@ -850,7 +844,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
850 units, timeout)); 844 units, timeout));
851 } 845 }
852 846
853 return_ACPI_STATUS(status); 847 return status;
854} 848}
855 849
856EXPORT_SYMBOL(acpi_os_wait_semaphore); 850EXPORT_SYMBOL(acpi_os_wait_semaphore);
@@ -862,20 +856,19 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
862{ 856{
863 struct semaphore *sem = (struct semaphore *)handle; 857 struct semaphore *sem = (struct semaphore *)handle;
864 858
865 ACPI_FUNCTION_TRACE("os_signal_semaphore");
866 859
867 if (!sem || (units < 1)) 860 if (!sem || (units < 1))
868 return_ACPI_STATUS(AE_BAD_PARAMETER); 861 return AE_BAD_PARAMETER;
869 862
870 if (units > 1) 863 if (units > 1)
871 return_ACPI_STATUS(AE_SUPPORT); 864 return AE_SUPPORT;
872 865
873 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, 866 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
874 units)); 867 units));
875 868
876 up(sem); 869 up(sem);
877 870
878 return_ACPI_STATUS(AE_OK); 871 return AE_OK;
879} 872}
880 873
881EXPORT_SYMBOL(acpi_os_signal_semaphore); 874EXPORT_SYMBOL(acpi_os_signal_semaphore);
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
index 3e7d0191c75c..1e2ae6e7a7e4 100644
--- a/drivers/acpi/pci_bind.c
+++ b/drivers/acpi/pci_bind.c
@@ -47,11 +47,10 @@ struct acpi_pci_data {
47static void acpi_pci_data_handler(acpi_handle handle, u32 function, 47static void acpi_pci_data_handler(acpi_handle handle, u32 function,
48 void *context) 48 void *context)
49{ 49{
50 ACPI_FUNCTION_TRACE("acpi_pci_data_handler");
51 50
52 /* TBD: Anything we need to do here? */ 51 /* TBD: Anything we need to do here? */
53 52
54 return_VOID; 53 return;
55} 54}
56 55
57/** 56/**
@@ -68,17 +67,16 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
68 struct acpi_device *device = NULL; 67 struct acpi_device *device = NULL;
69 struct acpi_pci_data *data = NULL; 68 struct acpi_pci_data *data = NULL;
70 69
71 ACPI_FUNCTION_TRACE("acpi_get_pci_id");
72 70
73 if (!id) 71 if (!id)
74 return_ACPI_STATUS(AE_BAD_PARAMETER); 72 return AE_BAD_PARAMETER;
75 73
76 result = acpi_bus_get_device(handle, &device); 74 result = acpi_bus_get_device(handle, &device);
77 if (result) { 75 if (result) {
78 printk(KERN_ERR PREFIX 76 printk(KERN_ERR PREFIX
79 "Invalid ACPI Bus context for device %s\n", 77 "Invalid ACPI Bus context for device %s\n",
80 acpi_device_bid(device)); 78 acpi_device_bid(device));
81 return_ACPI_STATUS(AE_NOT_EXIST); 79 return AE_NOT_EXIST;
82 } 80 }
83 81
84 status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data); 82 status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data);
@@ -86,7 +84,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
86 ACPI_EXCEPTION((AE_INFO, status, 84 ACPI_EXCEPTION((AE_INFO, status,
87 "Invalid ACPI-PCI context for device %s", 85 "Invalid ACPI-PCI context for device %s",
88 acpi_device_bid(device))); 86 acpi_device_bid(device)));
89 return_ACPI_STATUS(status); 87 return status;
90 } 88 }
91 89
92 *id = data->id; 90 *id = data->id;
@@ -103,7 +101,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
103 acpi_device_bid(device), id->segment, id->bus, 101 acpi_device_bid(device), id->segment, id->bus,
104 id->device, id->function)); 102 id->device, id->function));
105 103
106 return_ACPI_STATUS(AE_OK); 104 return AE_OK;
107} 105}
108 106
109EXPORT_SYMBOL(acpi_get_pci_id); 107EXPORT_SYMBOL(acpi_get_pci_id);
@@ -120,14 +118,13 @@ int acpi_pci_bind(struct acpi_device *device)
120 struct pci_dev *dev; 118 struct pci_dev *dev;
121 struct pci_bus *bus; 119 struct pci_bus *bus;
122 120
123 ACPI_FUNCTION_TRACE("acpi_pci_bind");
124 121
125 if (!device || !device->parent) 122 if (!device || !device->parent)
126 return_VALUE(-EINVAL); 123 return -EINVAL;
127 124
128 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 125 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
129 if (!pathname) 126 if (!pathname)
130 return_VALUE(-ENOMEM); 127 return -ENOMEM;
131 memset(pathname, 0, ACPI_PATHNAME_MAX); 128 memset(pathname, 0, ACPI_PATHNAME_MAX);
132 buffer.length = ACPI_PATHNAME_MAX; 129 buffer.length = ACPI_PATHNAME_MAX;
133 buffer.pointer = pathname; 130 buffer.pointer = pathname;
@@ -135,7 +132,7 @@ int acpi_pci_bind(struct acpi_device *device)
135 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 132 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
136 if (!data) { 133 if (!data) {
137 kfree(pathname); 134 kfree(pathname);
138 return_VALUE(-ENOMEM); 135 return -ENOMEM;
139 } 136 }
140 memset(data, 0, sizeof(struct acpi_pci_data)); 137 memset(data, 0, sizeof(struct acpi_pci_data));
141 138
@@ -269,7 +266,7 @@ int acpi_pci_bind(struct acpi_device *device)
269 if (result) 266 if (result)
270 kfree(data); 267 kfree(data);
271 268
272 return_VALUE(result); 269 return result;
273} 270}
274 271
275int acpi_pci_unbind(struct acpi_device *device) 272int acpi_pci_unbind(struct acpi_device *device)
@@ -280,14 +277,13 @@ int acpi_pci_unbind(struct acpi_device *device)
280 char *pathname = NULL; 277 char *pathname = NULL;
281 struct acpi_buffer buffer = { 0, NULL }; 278 struct acpi_buffer buffer = { 0, NULL };
282 279
283 ACPI_FUNCTION_TRACE("acpi_pci_unbind");
284 280
285 if (!device || !device->parent) 281 if (!device || !device->parent)
286 return_VALUE(-EINVAL); 282 return -EINVAL;
287 283
288 pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 284 pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
289 if (!pathname) 285 if (!pathname)
290 return_VALUE(-ENOMEM); 286 return -ENOMEM;
291 memset(pathname, 0, ACPI_PATHNAME_MAX); 287 memset(pathname, 0, ACPI_PATHNAME_MAX);
292 288
293 buffer.length = ACPI_PATHNAME_MAX; 289 buffer.length = ACPI_PATHNAME_MAX;
@@ -322,7 +318,7 @@ int acpi_pci_unbind(struct acpi_device *device)
322 kfree(data); 318 kfree(data);
323 319
324 end: 320 end:
325 return_VALUE(result); 321 return result;
326} 322}
327 323
328int 324int
@@ -335,11 +331,10 @@ acpi_pci_bind_root(struct acpi_device *device,
335 char *pathname = NULL; 331 char *pathname = NULL;
336 struct acpi_buffer buffer = { 0, NULL }; 332 struct acpi_buffer buffer = { 0, NULL };
337 333
338 ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
339 334
340 pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 335 pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
341 if (!pathname) 336 if (!pathname)
342 return_VALUE(-ENOMEM); 337 return -ENOMEM;
343 memset(pathname, 0, ACPI_PATHNAME_MAX); 338 memset(pathname, 0, ACPI_PATHNAME_MAX);
344 339
345 buffer.length = ACPI_PATHNAME_MAX; 340 buffer.length = ACPI_PATHNAME_MAX;
@@ -347,13 +342,13 @@ acpi_pci_bind_root(struct acpi_device *device,
347 342
348 if (!device || !id || !bus) { 343 if (!device || !id || !bus) {
349 kfree(pathname); 344 kfree(pathname);
350 return_VALUE(-EINVAL); 345 return -EINVAL;
351 } 346 }
352 347
353 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 348 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
354 if (!data) { 349 if (!data) {
355 kfree(pathname); 350 kfree(pathname);
356 return_VALUE(-ENOMEM); 351 return -ENOMEM;
357 } 352 }
358 memset(data, 0, sizeof(struct acpi_pci_data)); 353 memset(data, 0, sizeof(struct acpi_pci_data));
359 354
@@ -381,5 +376,5 @@ acpi_pci_bind_root(struct acpi_device *device,
381 if (result != 0) 376 if (result != 0)
382 kfree(data); 377 kfree(data);
383 378
384 return_VALUE(result); 379 return result;
385} 380}
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index f24a610008a0..fb96e3bf969b 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -55,10 +55,9 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
55 struct list_head *node = NULL; 55 struct list_head *node = NULL;
56 struct acpi_prt_entry *entry = NULL; 56 struct acpi_prt_entry *entry = NULL;
57 57
58 ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry");
59 58
60 if (!acpi_prt.count) 59 if (!acpi_prt.count)
61 return_PTR(NULL); 60 return NULL;
62 61
63 /* 62 /*
64 * Parse through all PRT entries looking for a match on the specified 63 * Parse through all PRT entries looking for a match on the specified
@@ -73,12 +72,12 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
73 && (device == entry->id.device) 72 && (device == entry->id.device)
74 && (pin == entry->pin)) { 73 && (pin == entry->pin)) {
75 spin_unlock(&acpi_prt_lock); 74 spin_unlock(&acpi_prt_lock);
76 return_PTR(entry); 75 return entry;
77 } 76 }
78 } 77 }
79 78
80 spin_unlock(&acpi_prt_lock); 79 spin_unlock(&acpi_prt_lock);
81 return_PTR(NULL); 80 return NULL;
82} 81}
83 82
84static int 83static int
@@ -87,14 +86,13 @@ acpi_pci_irq_add_entry(acpi_handle handle,
87{ 86{
88 struct acpi_prt_entry *entry = NULL; 87 struct acpi_prt_entry *entry = NULL;
89 88
90 ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry");
91 89
92 if (!prt) 90 if (!prt)
93 return_VALUE(-EINVAL); 91 return -EINVAL;
94 92
95 entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); 93 entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
96 if (!entry) 94 if (!entry)
97 return_VALUE(-ENOMEM); 95 return -ENOMEM;
98 memset(entry, 0, sizeof(struct acpi_prt_entry)); 96 memset(entry, 0, sizeof(struct acpi_prt_entry));
99 97
100 entry->id.segment = segment; 98 entry->id.segment = segment;
@@ -141,7 +139,7 @@ acpi_pci_irq_add_entry(acpi_handle handle,
141 acpi_prt.count++; 139 acpi_prt.count++;
142 spin_unlock(&acpi_prt_lock); 140 spin_unlock(&acpi_prt_lock);
143 141
144 return_VALUE(0); 142 return 0;
145} 143}
146 144
147static void 145static void
@@ -163,11 +161,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
163 struct acpi_pci_routing_table *entry = NULL; 161 struct acpi_pci_routing_table *entry = NULL;
164 static int first_time = 1; 162 static int first_time = 1;
165 163
166 ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt");
167 164
168 pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 165 pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
169 if (!pathname) 166 if (!pathname)
170 return_VALUE(-ENOMEM); 167 return -ENOMEM;
171 memset(pathname, 0, ACPI_PATHNAME_MAX); 168 memset(pathname, 0, ACPI_PATHNAME_MAX);
172 169
173 if (first_time) { 170 if (first_time) {
@@ -199,12 +196,12 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
199 if (status != AE_BUFFER_OVERFLOW) { 196 if (status != AE_BUFFER_OVERFLOW) {
200 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", 197 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
201 acpi_format_exception(status))); 198 acpi_format_exception(status)));
202 return_VALUE(-ENODEV); 199 return -ENODEV;
203 } 200 }
204 201
205 prt = kmalloc(buffer.length, GFP_KERNEL); 202 prt = kmalloc(buffer.length, GFP_KERNEL);
206 if (!prt) { 203 if (!prt) {
207 return_VALUE(-ENOMEM); 204 return -ENOMEM;
208 } 205 }
209 memset(prt, 0, buffer.length); 206 memset(prt, 0, buffer.length);
210 buffer.pointer = prt; 207 buffer.pointer = prt;
@@ -214,7 +211,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
214 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", 211 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
215 acpi_format_exception(status))); 212 acpi_format_exception(status)));
216 kfree(buffer.pointer); 213 kfree(buffer.pointer);
217 return_VALUE(-ENODEV); 214 return -ENODEV;
218 } 215 }
219 216
220 entry = prt; 217 entry = prt;
@@ -227,7 +224,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
227 224
228 kfree(prt); 225 kfree(prt);
229 226
230 return_VALUE(0); 227 return 0;
231} 228}
232 229
233void acpi_pci_irq_del_prt(int segment, int bus) 230void acpi_pci_irq_del_prt(int segment, int bus)
@@ -262,7 +259,6 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
262{ 259{
263 int irq; 260 int irq;
264 261
265 ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");
266 262
267 if (entry->link.handle) { 263 if (entry->link.handle) {
268 irq = acpi_pci_link_allocate_irq(entry->link.handle, 264 irq = acpi_pci_link_allocate_irq(entry->link.handle,
@@ -271,7 +267,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
271 if (irq < 0) { 267 if (irq < 0) {
272 printk(KERN_WARNING PREFIX 268 printk(KERN_WARNING PREFIX
273 "Invalid IRQ link routing entry\n"); 269 "Invalid IRQ link routing entry\n");
274 return_VALUE(-1); 270 return -1;
275 } 271 }
276 } else { 272 } else {
277 irq = entry->link.index; 273 irq = entry->link.index;
@@ -280,7 +276,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
280 } 276 }
281 277
282 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); 278 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
283 return_VALUE(irq); 279 return irq;
284} 280}
285 281
286static int 282static int
@@ -289,13 +285,12 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
289{ 285{
290 int irq; 286 int irq;
291 287
292 ACPI_FUNCTION_TRACE("acpi_pci_free_irq");
293 if (entry->link.handle) { 288 if (entry->link.handle) {
294 irq = acpi_pci_link_free_irq(entry->link.handle); 289 irq = acpi_pci_link_free_irq(entry->link.handle);
295 } else { 290 } else {
296 irq = entry->link.index; 291 irq = entry->link.index;
297 } 292 }
298 return_VALUE(irq); 293 return irq;
299} 294}
300 295
301/* 296/*
@@ -315,7 +310,6 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
315 int bus_nr = bus->number; 310 int bus_nr = bus->number;
316 int ret; 311 int ret;
317 312
318 ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
319 313
320 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 314 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
321 "Searching for PRT entry for %02x:%02x:%02x[%c]\n", 315 "Searching for PRT entry for %02x:%02x:%02x[%c]\n",
@@ -324,11 +318,11 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
324 entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); 318 entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
325 if (!entry) { 319 if (!entry) {
326 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); 320 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n"));
327 return_VALUE(-1); 321 return -1;
328 } 322 }
329 323
330 ret = func(entry, triggering, polarity, link); 324 ret = func(entry, triggering, polarity, link);
331 return_VALUE(ret); 325 return ret;
332} 326}
333 327
334/* 328/*
@@ -346,10 +340,9 @@ acpi_pci_irq_derive(struct pci_dev *dev,
346 int irq = -1; 340 int irq = -1;
347 u8 bridge_pin = 0; 341 u8 bridge_pin = 0;
348 342
349 ACPI_FUNCTION_TRACE("acpi_pci_irq_derive");
350 343
351 if (!dev) 344 if (!dev)
352 return_VALUE(-EINVAL); 345 return -EINVAL;
353 346
354 /* 347 /*
355 * Attempt to derive an IRQ for this device from a parent bridge's 348 * Attempt to derive an IRQ for this device from a parent bridge's
@@ -366,7 +359,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
366 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 359 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
367 "No interrupt pin configured for device %s\n", 360 "No interrupt pin configured for device %s\n",
368 pci_name(bridge))); 361 pci_name(bridge)));
369 return_VALUE(-1); 362 return -1;
370 } 363 }
371 /* Pin is from 0 to 3 */ 364 /* Pin is from 0 to 3 */
372 bridge_pin--; 365 bridge_pin--;
@@ -381,13 +374,13 @@ acpi_pci_irq_derive(struct pci_dev *dev,
381 if (irq < 0) { 374 if (irq < 0) {
382 printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", 375 printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n",
383 pci_name(dev)); 376 pci_name(dev));
384 return_VALUE(-1); 377 return -1;
385 } 378 }
386 379
387 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", 380 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n",
388 irq, pci_name(dev), pci_name(bridge))); 381 irq, pci_name(dev), pci_name(bridge)));
389 382
390 return_VALUE(irq); 383 return irq;
391} 384}
392 385
393/* 386/*
@@ -405,23 +398,22 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
405 char *link = NULL; 398 char *link = NULL;
406 int rc; 399 int rc;
407 400
408 ACPI_FUNCTION_TRACE("acpi_pci_irq_enable");
409 401
410 if (!dev) 402 if (!dev)
411 return_VALUE(-EINVAL); 403 return -EINVAL;
412 404
413 pin = dev->pin; 405 pin = dev->pin;
414 if (!pin) { 406 if (!pin) {
415 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 407 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
416 "No interrupt pin configured for device %s\n", 408 "No interrupt pin configured for device %s\n",
417 pci_name(dev))); 409 pci_name(dev)));
418 return_VALUE(0); 410 return 0;
419 } 411 }
420 pin--; 412 pin--;
421 413
422 if (!dev->bus) { 414 if (!dev->bus) {
423 printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); 415 printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n");
424 return_VALUE(-ENODEV); 416 return -ENODEV;
425 } 417 }
426 418
427 /* 419 /*
@@ -453,10 +445,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
453 printk(" - using IRQ %d\n", dev->irq); 445 printk(" - using IRQ %d\n", dev->irq);
454 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, 446 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
455 ACPI_ACTIVE_LOW); 447 ACPI_ACTIVE_LOW);
456 return_VALUE(0); 448 return 0;
457 } else { 449 } else {
458 printk("\n"); 450 printk("\n");
459 return_VALUE(0); 451 return 0;
460 } 452 }
461 } 453 }
462 454
@@ -464,7 +456,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
464 if (rc < 0) { 456 if (rc < 0) {
465 printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " 457 printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
466 "to register GSI\n", pci_name(dev), ('A' + pin)); 458 "to register GSI\n", pci_name(dev), ('A' + pin));
467 return_VALUE(rc); 459 return rc;
468 } 460 }
469 dev->irq = rc; 461 dev->irq = rc;
470 462
@@ -478,7 +470,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
478 (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", 470 (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
479 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); 471 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
480 472
481 return_VALUE(0); 473 return 0;
482} 474}
483 475
484EXPORT_SYMBOL(acpi_pci_irq_enable); 476EXPORT_SYMBOL(acpi_pci_irq_enable);
@@ -495,14 +487,13 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
495 int triggering = ACPI_LEVEL_SENSITIVE; 487 int triggering = ACPI_LEVEL_SENSITIVE;
496 int polarity = ACPI_ACTIVE_LOW; 488 int polarity = ACPI_ACTIVE_LOW;
497 489
498 ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
499 490
500 if (!dev || !dev->bus) 491 if (!dev || !dev->bus)
501 return_VOID; 492 return;
502 493
503 pin = dev->pin; 494 pin = dev->pin;
504 if (!pin) 495 if (!pin)
505 return_VOID; 496 return;
506 pin--; 497 pin--;
507 498
508 /* 499 /*
@@ -520,7 +511,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
520 &triggering, &polarity, NULL, 511 &triggering, &polarity, NULL,
521 acpi_pci_free_irq); 512 acpi_pci_free_irq);
522 if (gsi < 0) 513 if (gsi < 0)
523 return_VOID; 514 return;
524 515
525 /* 516 /*
526 * TBD: It might be worth clearing dev->irq by magic constant 517 * TBD: It might be worth clearing dev->irq by magic constant
@@ -532,5 +523,5 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
532 523
533 acpi_unregister_gsi(gsi); 524 acpi_unregister_gsi(gsi);
534 525
535 return_VOID; 526 return;
536} 527}
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index d7aa9c10335c..1badce27a83f 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -107,17 +107,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
107 struct acpi_pci_link *link = (struct acpi_pci_link *)context; 107 struct acpi_pci_link *link = (struct acpi_pci_link *)context;
108 u32 i = 0; 108 u32 i = 0;
109 109
110 ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible");
111 110
112 switch (resource->type) { 111 switch (resource->type) {
113 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 112 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
114 return_ACPI_STATUS(AE_OK); 113 return AE_OK;
115 case ACPI_RESOURCE_TYPE_IRQ: 114 case ACPI_RESOURCE_TYPE_IRQ:
116 { 115 {
117 struct acpi_resource_irq *p = &resource->data.irq; 116 struct acpi_resource_irq *p = &resource->data.irq;
118 if (!p || !p->interrupt_count) { 117 if (!p || !p->interrupt_count) {
119 printk(KERN_WARNING PREFIX "Blank IRQ resource\n"); 118 printk(KERN_WARNING PREFIX "Blank IRQ resource\n");
120 return_ACPI_STATUS(AE_OK); 119 return AE_OK;
121 } 120 }
122 for (i = 0; 121 for (i = 0;
123 (i < p->interrupt_count 122 (i < p->interrupt_count
@@ -142,7 +141,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
142 if (!p || !p->interrupt_count) { 141 if (!p || !p->interrupt_count) {
143 printk(KERN_WARNING PREFIX 142 printk(KERN_WARNING PREFIX
144 "Blank EXT IRQ resource\n"); 143 "Blank EXT IRQ resource\n");
145 return_ACPI_STATUS(AE_OK); 144 return AE_OK;
146 } 145 }
147 for (i = 0; 146 for (i = 0;
148 (i < p->interrupt_count 147 (i < p->interrupt_count
@@ -162,33 +161,32 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
162 } 161 }
163 default: 162 default:
164 printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n"); 163 printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n");
165 return_ACPI_STATUS(AE_OK); 164 return AE_OK;
166 } 165 }
167 166
168 return_ACPI_STATUS(AE_CTRL_TERMINATE); 167 return AE_CTRL_TERMINATE;
169} 168}
170 169
171static int acpi_pci_link_get_possible(struct acpi_pci_link *link) 170static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
172{ 171{
173 acpi_status status; 172 acpi_status status;
174 173
175 ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible");
176 174
177 if (!link) 175 if (!link)
178 return_VALUE(-EINVAL); 176 return -EINVAL;
179 177
180 status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, 178 status = acpi_walk_resources(link->handle, METHOD_NAME__PRS,
181 acpi_pci_link_check_possible, link); 179 acpi_pci_link_check_possible, link);
182 if (ACPI_FAILURE(status)) { 180 if (ACPI_FAILURE(status)) {
183 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); 181 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS"));
184 return_VALUE(-ENODEV); 182 return -ENODEV;
185 } 183 }
186 184
187 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 185 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
188 "Found %d possible IRQs\n", 186 "Found %d possible IRQs\n",
189 link->irq.possible_count)); 187 link->irq.possible_count));
190 188
191 return_VALUE(0); 189 return 0;
192} 190}
193 191
194static acpi_status 192static acpi_status
@@ -196,7 +194,6 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
196{ 194{
197 int *irq = (int *)context; 195 int *irq = (int *)context;
198 196
199 ACPI_FUNCTION_TRACE("acpi_pci_link_check_current");
200 197
201 switch (resource->type) { 198 switch (resource->type) {
202 case ACPI_RESOURCE_TYPE_IRQ: 199 case ACPI_RESOURCE_TYPE_IRQ:
@@ -209,7 +206,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
209 */ 206 */
210 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 207 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
211 "Blank IRQ resource\n")); 208 "Blank IRQ resource\n"));
212 return_ACPI_STATUS(AE_OK); 209 return AE_OK;
213 } 210 }
214 *irq = p->interrupts[0]; 211 *irq = p->interrupts[0];
215 break; 212 break;
@@ -225,7 +222,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
225 */ 222 */
226 printk(KERN_WARNING PREFIX 223 printk(KERN_WARNING PREFIX
227 "Blank EXT IRQ resource\n"); 224 "Blank EXT IRQ resource\n");
228 return_ACPI_STATUS(AE_OK); 225 return AE_OK;
229 } 226 }
230 *irq = p->interrupts[0]; 227 *irq = p->interrupts[0];
231 break; 228 break;
@@ -234,9 +231,9 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
234 default: 231 default:
235 printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type); 232 printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type);
236 case ACPI_RESOURCE_TYPE_END_TAG: 233 case ACPI_RESOURCE_TYPE_END_TAG:
237 return_ACPI_STATUS(AE_OK); 234 return AE_OK;
238 } 235 }
239 return_ACPI_STATUS(AE_CTRL_TERMINATE); 236 return AE_CTRL_TERMINATE;
240} 237}
241 238
242/* 239/*
@@ -252,10 +249,9 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
252 acpi_status status = AE_OK; 249 acpi_status status = AE_OK;
253 int irq = 0; 250 int irq = 0;
254 251
255 ACPI_FUNCTION_TRACE("acpi_pci_link_get_current");
256 252
257 if (!link || !link->handle) 253 if (!link || !link->handle)
258 return_VALUE(-EINVAL); 254 return -EINVAL;
259 255
260 link->irq.active = 0; 256 link->irq.active = 0;
261 257
@@ -270,7 +266,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
270 266
271 if (!link->device->status.enabled) { 267 if (!link->device->status.enabled) {
272 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n")); 268 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n"));
273 return_VALUE(0); 269 return 0;
274 } 270 }
275 } 271 }
276 272
@@ -296,7 +292,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
296 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); 292 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active));
297 293
298 end: 294 end:
299 return_VALUE(result); 295 return result;
300} 296}
301 297
302static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) 298static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
@@ -309,14 +305,13 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
309 } *resource; 305 } *resource;
310 struct acpi_buffer buffer = { 0, NULL }; 306 struct acpi_buffer buffer = { 0, NULL };
311 307
312 ACPI_FUNCTION_TRACE("acpi_pci_link_set");
313 308
314 if (!link || !irq) 309 if (!link || !irq)
315 return_VALUE(-EINVAL); 310 return -EINVAL;
316 311
317 resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC); 312 resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC);
318 if (!resource) 313 if (!resource)
319 return_VALUE(-ENOMEM); 314 return -ENOMEM;
320 315
321 memset(resource, 0, sizeof(*resource) + 1); 316 memset(resource, 0, sizeof(*resource) + 1);
322 buffer.length = sizeof(*resource) + 1; 317 buffer.length = sizeof(*resource) + 1;
@@ -413,7 +408,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
413 408
414 end: 409 end:
415 kfree(resource); 410 kfree(resource);
416 return_VALUE(result); 411 return result;
417} 412}
418 413
419/* -------------------------------------------------------------------------- 414/* --------------------------------------------------------------------------
@@ -487,7 +482,6 @@ int __init acpi_irq_penalty_init(void)
487 struct acpi_pci_link *link = NULL; 482 struct acpi_pci_link *link = NULL;
488 int i = 0; 483 int i = 0;
489 484
490 ACPI_FUNCTION_TRACE("acpi_irq_penalty_init");
491 485
492 /* 486 /*
493 * Update penalties to facilitate IRQ balancing. 487 * Update penalties to facilitate IRQ balancing.
@@ -524,7 +518,7 @@ int __init acpi_irq_penalty_init(void)
524 /* Add a penalty for the SCI */ 518 /* Add a penalty for the SCI */
525 acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING; 519 acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING;
526 520
527 return_VALUE(0); 521 return 0;
528} 522}
529 523
530static int acpi_irq_balance; /* 0: static, 1: balance */ 524static int acpi_irq_balance; /* 0: static, 1: balance */
@@ -534,13 +528,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
534 int irq; 528 int irq;
535 int i; 529 int i;
536 530
537 ACPI_FUNCTION_TRACE("acpi_pci_link_allocate");
538 531
539 if (link->irq.initialized) { 532 if (link->irq.initialized) {
540 if (link->refcnt == 0) 533 if (link->refcnt == 0)
541 /* This means the link is disabled but initialized */ 534 /* This means the link is disabled but initialized */
542 acpi_pci_link_set(link, link->irq.active); 535 acpi_pci_link_set(link, link->irq.active);
543 return_VALUE(0); 536 return 0;
544 } 537 }
545 538
546 /* 539 /*
@@ -587,7 +580,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
587 "Try pci=noacpi or acpi=off\n", 580 "Try pci=noacpi or acpi=off\n",
588 acpi_device_name(link->device), 581 acpi_device_name(link->device),
589 acpi_device_bid(link->device)); 582 acpi_device_bid(link->device));
590 return_VALUE(-ENODEV); 583 return -ENODEV;
591 } else { 584 } else {
592 acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; 585 acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
593 printk(PREFIX "%s [%s] enabled at IRQ %d\n", 586 printk(PREFIX "%s [%s] enabled at IRQ %d\n",
@@ -597,7 +590,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
597 590
598 link->irq.initialized = 1; 591 link->irq.initialized = 1;
599 592
600 return_VALUE(0); 593 return 0;
601} 594}
602 595
603/* 596/*
@@ -615,36 +608,35 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
615 struct acpi_device *device = NULL; 608 struct acpi_device *device = NULL;
616 struct acpi_pci_link *link = NULL; 609 struct acpi_pci_link *link = NULL;
617 610
618 ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq");
619 611
620 result = acpi_bus_get_device(handle, &device); 612 result = acpi_bus_get_device(handle, &device);
621 if (result) { 613 if (result) {
622 printk(KERN_ERR PREFIX "Invalid link device\n"); 614 printk(KERN_ERR PREFIX "Invalid link device\n");
623 return_VALUE(-1); 615 return -1;
624 } 616 }
625 617
626 link = (struct acpi_pci_link *)acpi_driver_data(device); 618 link = (struct acpi_pci_link *)acpi_driver_data(device);
627 if (!link) { 619 if (!link) {
628 printk(KERN_ERR PREFIX "Invalid link context\n"); 620 printk(KERN_ERR PREFIX "Invalid link context\n");
629 return_VALUE(-1); 621 return -1;
630 } 622 }
631 623
632 /* TBD: Support multiple index (IRQ) entries per Link Device */ 624 /* TBD: Support multiple index (IRQ) entries per Link Device */
633 if (index) { 625 if (index) {
634 printk(KERN_ERR PREFIX "Invalid index %d\n", index); 626 printk(KERN_ERR PREFIX "Invalid index %d\n", index);
635 return_VALUE(-1); 627 return -1;
636 } 628 }
637 629
638 mutex_lock(&acpi_link_lock); 630 mutex_lock(&acpi_link_lock);
639 if (acpi_pci_link_allocate(link)) { 631 if (acpi_pci_link_allocate(link)) {
640 mutex_unlock(&acpi_link_lock); 632 mutex_unlock(&acpi_link_lock);
641 return_VALUE(-1); 633 return -1;
642 } 634 }
643 635
644 if (!link->irq.active) { 636 if (!link->irq.active) {
645 mutex_unlock(&acpi_link_lock); 637 mutex_unlock(&acpi_link_lock);
646 printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); 638 printk(KERN_ERR PREFIX "Link active IRQ is 0!\n");
647 return_VALUE(-1); 639 return -1;
648 } 640 }
649 link->refcnt++; 641 link->refcnt++;
650 mutex_unlock(&acpi_link_lock); 642 mutex_unlock(&acpi_link_lock);
@@ -658,7 +650,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
658 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 650 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
659 "Link %s is referenced\n", 651 "Link %s is referenced\n",
660 acpi_device_bid(link->device))); 652 acpi_device_bid(link->device)));
661 return_VALUE(link->irq.active); 653 return (link->irq.active);
662} 654}
663 655
664/* 656/*
@@ -671,25 +663,24 @@ int acpi_pci_link_free_irq(acpi_handle handle)
671 struct acpi_pci_link *link = NULL; 663 struct acpi_pci_link *link = NULL;
672 acpi_status result; 664 acpi_status result;
673 665
674 ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq");
675 666
676 result = acpi_bus_get_device(handle, &device); 667 result = acpi_bus_get_device(handle, &device);
677 if (result) { 668 if (result) {
678 printk(KERN_ERR PREFIX "Invalid link device\n"); 669 printk(KERN_ERR PREFIX "Invalid link device\n");
679 return_VALUE(-1); 670 return -1;
680 } 671 }
681 672
682 link = (struct acpi_pci_link *)acpi_driver_data(device); 673 link = (struct acpi_pci_link *)acpi_driver_data(device);
683 if (!link) { 674 if (!link) {
684 printk(KERN_ERR PREFIX "Invalid link context\n"); 675 printk(KERN_ERR PREFIX "Invalid link context\n");
685 return_VALUE(-1); 676 return -1;
686 } 677 }
687 678
688 mutex_lock(&acpi_link_lock); 679 mutex_lock(&acpi_link_lock);
689 if (!link->irq.initialized) { 680 if (!link->irq.initialized) {
690 mutex_unlock(&acpi_link_lock); 681 mutex_unlock(&acpi_link_lock);
691 printk(KERN_ERR PREFIX "Link isn't initialized\n"); 682 printk(KERN_ERR PREFIX "Link isn't initialized\n");
692 return_VALUE(-1); 683 return -1;
693 } 684 }
694#ifdef FUTURE_USE 685#ifdef FUTURE_USE
695 /* 686 /*
@@ -711,7 +702,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
711 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); 702 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
712 } 703 }
713 mutex_unlock(&acpi_link_lock); 704 mutex_unlock(&acpi_link_lock);
714 return_VALUE(link->irq.active); 705 return (link->irq.active);
715} 706}
716 707
717/* -------------------------------------------------------------------------- 708/* --------------------------------------------------------------------------
@@ -725,14 +716,13 @@ static int acpi_pci_link_add(struct acpi_device *device)
725 int i = 0; 716 int i = 0;
726 int found = 0; 717 int found = 0;
727 718
728 ACPI_FUNCTION_TRACE("acpi_pci_link_add");
729 719
730 if (!device) 720 if (!device)
731 return_VALUE(-EINVAL); 721 return -EINVAL;
732 722
733 link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); 723 link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL);
734 if (!link) 724 if (!link)
735 return_VALUE(-ENOMEM); 725 return -ENOMEM;
736 memset(link, 0, sizeof(struct acpi_pci_link)); 726 memset(link, 0, sizeof(struct acpi_pci_link));
737 727
738 link->device = device; 728 link->device = device;
@@ -781,17 +771,16 @@ static int acpi_pci_link_add(struct acpi_device *device)
781 if (result) 771 if (result)
782 kfree(link); 772 kfree(link);
783 773
784 return_VALUE(result); 774 return result;
785} 775}
786 776
787static int acpi_pci_link_resume(struct acpi_pci_link *link) 777static int acpi_pci_link_resume(struct acpi_pci_link *link)
788{ 778{
789 ACPI_FUNCTION_TRACE("acpi_pci_link_resume");
790 779
791 if (link->refcnt && link->irq.active && link->irq.initialized) 780 if (link->refcnt && link->irq.active && link->irq.initialized)
792 return_VALUE(acpi_pci_link_set(link, link->irq.active)); 781 return (acpi_pci_link_set(link, link->irq.active));
793 else 782 else
794 return_VALUE(0); 783 return 0;
795} 784}
796 785
797/* 786/*
@@ -804,7 +793,6 @@ static int irqrouter_resume(struct sys_device *dev)
804 struct list_head *node = NULL; 793 struct list_head *node = NULL;
805 struct acpi_pci_link *link = NULL; 794 struct acpi_pci_link *link = NULL;
806 795
807 ACPI_FUNCTION_TRACE("irqrouter_resume");
808 796
809 /* Make sure SCI is enabled again (Apple firmware bug?) */ 797 /* Make sure SCI is enabled again (Apple firmware bug?) */
810 acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); 798 acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK);
@@ -819,17 +807,16 @@ static int irqrouter_resume(struct sys_device *dev)
819 acpi_pci_link_resume(link); 807 acpi_pci_link_resume(link);
820 } 808 }
821 acpi_in_resume = 0; 809 acpi_in_resume = 0;
822 return_VALUE(0); 810 return 0;
823} 811}
824 812
825static int acpi_pci_link_remove(struct acpi_device *device, int type) 813static int acpi_pci_link_remove(struct acpi_device *device, int type)
826{ 814{
827 struct acpi_pci_link *link = NULL; 815 struct acpi_pci_link *link = NULL;
828 816
829 ACPI_FUNCTION_TRACE("acpi_pci_link_remove");
830 817
831 if (!device || !acpi_driver_data(device)) 818 if (!device || !acpi_driver_data(device))
832 return_VALUE(-EINVAL); 819 return -EINVAL;
833 820
834 link = (struct acpi_pci_link *)acpi_driver_data(device); 821 link = (struct acpi_pci_link *)acpi_driver_data(device);
835 822
@@ -839,7 +826,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type)
839 826
840 kfree(link); 827 kfree(link);
841 828
842 return_VALUE(0); 829 return 0;
843} 830}
844 831
845/* 832/*
@@ -945,34 +932,32 @@ static int __init irqrouter_init_sysfs(void)
945{ 932{
946 int error; 933 int error;
947 934
948 ACPI_FUNCTION_TRACE("irqrouter_init_sysfs");
949 935
950 if (acpi_disabled || acpi_noirq) 936 if (acpi_disabled || acpi_noirq)
951 return_VALUE(0); 937 return 0;
952 938
953 error = sysdev_class_register(&irqrouter_sysdev_class); 939 error = sysdev_class_register(&irqrouter_sysdev_class);
954 if (!error) 940 if (!error)
955 error = sysdev_register(&device_irqrouter); 941 error = sysdev_register(&device_irqrouter);
956 942
957 return_VALUE(error); 943 return error;
958} 944}
959 945
960device_initcall(irqrouter_init_sysfs); 946device_initcall(irqrouter_init_sysfs);
961 947
962static int __init acpi_pci_link_init(void) 948static int __init acpi_pci_link_init(void)
963{ 949{
964 ACPI_FUNCTION_TRACE("acpi_pci_link_init");
965 950
966 if (acpi_noirq) 951 if (acpi_noirq)
967 return_VALUE(0); 952 return 0;
968 953
969 acpi_link.count = 0; 954 acpi_link.count = 0;
970 INIT_LIST_HEAD(&acpi_link.entries); 955 INIT_LIST_HEAD(&acpi_link.entries);
971 956
972 if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) 957 if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0)
973 return_VALUE(-ENODEV); 958 return -ENODEV;
974 959
975 return_VALUE(0); 960 return 0;
976} 961}
977 962
978subsys_initcall(acpi_pci_link_init); 963subsys_initcall(acpi_pci_link_init);
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 1930397e3c52..8f10442119f0 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -160,14 +160,13 @@ static int acpi_pci_root_add(struct acpi_device *device)
160 unsigned long value = 0; 160 unsigned long value = 0;
161 acpi_handle handle = NULL; 161 acpi_handle handle = NULL;
162 162
163 ACPI_FUNCTION_TRACE("acpi_pci_root_add");
164 163
165 if (!device) 164 if (!device)
166 return_VALUE(-EINVAL); 165 return -EINVAL;
167 166
168 root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); 167 root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
169 if (!root) 168 if (!root)
170 return_VALUE(-ENOMEM); 169 return -ENOMEM;
171 memset(root, 0, sizeof(struct acpi_pci_root)); 170 memset(root, 0, sizeof(struct acpi_pci_root));
172 INIT_LIST_HEAD(&root->node); 171 INIT_LIST_HEAD(&root->node);
173 172
@@ -307,46 +306,43 @@ static int acpi_pci_root_add(struct acpi_device *device)
307 kfree(root); 306 kfree(root);
308 } 307 }
309 308
310 return_VALUE(result); 309 return result;
311} 310}
312 311
313static int acpi_pci_root_start(struct acpi_device *device) 312static int acpi_pci_root_start(struct acpi_device *device)
314{ 313{
315 struct acpi_pci_root *root; 314 struct acpi_pci_root *root;
316 315
317 ACPI_FUNCTION_TRACE("acpi_pci_root_start");
318 316
319 list_for_each_entry(root, &acpi_pci_roots, node) { 317 list_for_each_entry(root, &acpi_pci_roots, node) {
320 if (root->handle == device->handle) { 318 if (root->handle == device->handle) {
321 pci_bus_add_devices(root->bus); 319 pci_bus_add_devices(root->bus);
322 return_VALUE(0); 320 return 0;
323 } 321 }
324 } 322 }
325 return_VALUE(-ENODEV); 323 return -ENODEV;
326} 324}
327 325
328static int acpi_pci_root_remove(struct acpi_device *device, int type) 326static int acpi_pci_root_remove(struct acpi_device *device, int type)
329{ 327{
330 struct acpi_pci_root *root = NULL; 328 struct acpi_pci_root *root = NULL;
331 329
332 ACPI_FUNCTION_TRACE("acpi_pci_root_remove");
333 330
334 if (!device || !acpi_driver_data(device)) 331 if (!device || !acpi_driver_data(device))
335 return_VALUE(-EINVAL); 332 return -EINVAL;
336 333
337 root = (struct acpi_pci_root *)acpi_driver_data(device); 334 root = (struct acpi_pci_root *)acpi_driver_data(device);
338 335
339 kfree(root); 336 kfree(root);
340 337
341 return_VALUE(0); 338 return 0;
342} 339}
343 340
344static int __init acpi_pci_root_init(void) 341static int __init acpi_pci_root_init(void)
345{ 342{
346 ACPI_FUNCTION_TRACE("acpi_pci_root_init");
347 343
348 if (acpi_pci_disabled) 344 if (acpi_pci_disabled)
349 return_VALUE(0); 345 return 0;
350 346
351 /* DEBUG: 347 /* DEBUG:
352 acpi_dbg_layer = ACPI_PCI_COMPONENT; 348 acpi_dbg_layer = ACPI_PCI_COMPONENT;
@@ -354,9 +350,9 @@ static int __init acpi_pci_root_init(void)
354 */ 350 */
355 351
356 if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) 352 if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0)
357 return_VALUE(-ENODEV); 353 return -ENODEV;
358 354
359 return_VALUE(0); 355 return 0;
360} 356}
361 357
362subsys_initcall(acpi_pci_root_init); 358subsys_initcall(acpi_pci_root_init);
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index efc4bb751286..224f729f700e 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -98,22 +98,21 @@ acpi_power_get_context(acpi_handle handle,
98 int result = 0; 98 int result = 0;
99 struct acpi_device *device = NULL; 99 struct acpi_device *device = NULL;
100 100
101 ACPI_FUNCTION_TRACE("acpi_power_get_context");
102 101
103 if (!resource) 102 if (!resource)
104 return_VALUE(-ENODEV); 103 return -ENODEV;
105 104
106 result = acpi_bus_get_device(handle, &device); 105 result = acpi_bus_get_device(handle, &device);
107 if (result) { 106 if (result) {
108 printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle); 107 printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle);
109 return_VALUE(result); 108 return result;
110 } 109 }
111 110
112 *resource = (struct acpi_power_resource *)acpi_driver_data(device); 111 *resource = (struct acpi_power_resource *)acpi_driver_data(device);
113 if (!resource) 112 if (!resource)
114 return_VALUE(-ENODEV); 113 return -ENODEV;
115 114
116 return_VALUE(0); 115 return 0;
117} 116}
118 117
119static int acpi_power_get_state(struct acpi_power_resource *resource) 118static int acpi_power_get_state(struct acpi_power_resource *resource)
@@ -121,14 +120,13 @@ static int acpi_power_get_state(struct acpi_power_resource *resource)
121 acpi_status status = AE_OK; 120 acpi_status status = AE_OK;
122 unsigned long sta = 0; 121 unsigned long sta = 0;
123 122
124 ACPI_FUNCTION_TRACE("acpi_power_get_state");
125 123
126 if (!resource) 124 if (!resource)
127 return_VALUE(-EINVAL); 125 return -EINVAL;
128 126
129 status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta); 127 status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta);
130 if (ACPI_FAILURE(status)) 128 if (ACPI_FAILURE(status))
131 return_VALUE(-ENODEV); 129 return -ENODEV;
132 130
133 if (sta & 0x01) 131 if (sta & 0x01)
134 resource->state = ACPI_POWER_RESOURCE_STATE_ON; 132 resource->state = ACPI_POWER_RESOURCE_STATE_ON;
@@ -138,7 +136,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource)
138 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", 136 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
139 resource->name, resource->state ? "on" : "off")); 137 resource->name, resource->state ? "on" : "off"));
140 138
141 return_VALUE(0); 139 return 0;
142} 140}
143 141
144static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) 142static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
@@ -147,20 +145,19 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
147 struct acpi_power_resource *resource = NULL; 145 struct acpi_power_resource *resource = NULL;
148 u32 i = 0; 146 u32 i = 0;
149 147
150 ACPI_FUNCTION_TRACE("acpi_power_get_list_state");
151 148
152 if (!list || !state) 149 if (!list || !state)
153 return_VALUE(-EINVAL); 150 return -EINVAL;
154 151
155 /* The state of the list is 'on' IFF all resources are 'on'. */ 152 /* The state of the list is 'on' IFF all resources are 'on'. */
156 153
157 for (i = 0; i < list->count; i++) { 154 for (i = 0; i < list->count; i++) {
158 result = acpi_power_get_context(list->handles[i], &resource); 155 result = acpi_power_get_context(list->handles[i], &resource);
159 if (result) 156 if (result)
160 return_VALUE(result); 157 return result;
161 result = acpi_power_get_state(resource); 158 result = acpi_power_get_state(resource);
162 if (result) 159 if (result)
163 return_VALUE(result); 160 return result;
164 161
165 *state = resource->state; 162 *state = resource->state;
166 163
@@ -171,7 +168,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
171 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", 168 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n",
172 *state ? "on" : "off")); 169 *state ? "on" : "off"));
173 170
174 return_VALUE(result); 171 return result;
175} 172}
176 173
177static int acpi_power_on(acpi_handle handle) 174static int acpi_power_on(acpi_handle handle)
@@ -181,11 +178,10 @@ static int acpi_power_on(acpi_handle handle)
181 struct acpi_device *device = NULL; 178 struct acpi_device *device = NULL;
182 struct acpi_power_resource *resource = NULL; 179 struct acpi_power_resource *resource = NULL;
183 180
184 ACPI_FUNCTION_TRACE("acpi_power_on");
185 181
186 result = acpi_power_get_context(handle, &resource); 182 result = acpi_power_get_context(handle, &resource);
187 if (result) 183 if (result)
188 return_VALUE(result); 184 return result;
189 185
190 resource->references++; 186 resource->references++;
191 187
@@ -193,29 +189,29 @@ static int acpi_power_on(acpi_handle handle)
193 || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { 189 || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) {
194 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", 190 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n",
195 resource->name)); 191 resource->name));
196 return_VALUE(0); 192 return 0;
197 } 193 }
198 194
199 status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL); 195 status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL);
200 if (ACPI_FAILURE(status)) 196 if (ACPI_FAILURE(status))
201 return_VALUE(-ENODEV); 197 return -ENODEV;
202 198
203 result = acpi_power_get_state(resource); 199 result = acpi_power_get_state(resource);
204 if (result) 200 if (result)
205 return_VALUE(result); 201 return result;
206 if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) 202 if (resource->state != ACPI_POWER_RESOURCE_STATE_ON)
207 return_VALUE(-ENOEXEC); 203 return -ENOEXEC;
208 204
209 /* Update the power resource's _device_ power state */ 205 /* Update the power resource's _device_ power state */
210 result = acpi_bus_get_device(resource->handle, &device); 206 result = acpi_bus_get_device(resource->handle, &device);
211 if (result) 207 if (result)
212 return_VALUE(result); 208 return result;
213 device->power.state = ACPI_STATE_D0; 209 device->power.state = ACPI_STATE_D0;
214 210
215 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", 211 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
216 resource->name)); 212 resource->name));
217 213
218 return_VALUE(0); 214 return 0;
219} 215}
220 216
221static int acpi_power_off_device(acpi_handle handle) 217static int acpi_power_off_device(acpi_handle handle)
@@ -225,11 +221,10 @@ static int acpi_power_off_device(acpi_handle handle)
225 struct acpi_device *device = NULL; 221 struct acpi_device *device = NULL;
226 struct acpi_power_resource *resource = NULL; 222 struct acpi_power_resource *resource = NULL;
227 223
228 ACPI_FUNCTION_TRACE("acpi_power_off_device");
229 224
230 result = acpi_power_get_context(handle, &resource); 225 result = acpi_power_get_context(handle, &resource);
231 if (result) 226 if (result)
232 return_VALUE(result); 227 return result;
233 228
234 if (resource->references) 229 if (resource->references)
235 resource->references--; 230 resource->references--;
@@ -238,35 +233,35 @@ static int acpi_power_off_device(acpi_handle handle)
238 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 233 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
239 "Resource [%s] is still in use, dereferencing\n", 234 "Resource [%s] is still in use, dereferencing\n",
240 device->pnp.bus_id)); 235 device->pnp.bus_id));
241 return_VALUE(0); 236 return 0;
242 } 237 }
243 238
244 if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { 239 if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) {
245 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", 240 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n",
246 device->pnp.bus_id)); 241 device->pnp.bus_id));
247 return_VALUE(0); 242 return 0;
248 } 243 }
249 244
250 status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL); 245 status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL);
251 if (ACPI_FAILURE(status)) 246 if (ACPI_FAILURE(status))
252 return_VALUE(-ENODEV); 247 return -ENODEV;
253 248
254 result = acpi_power_get_state(resource); 249 result = acpi_power_get_state(resource);
255 if (result) 250 if (result)
256 return_VALUE(result); 251 return result;
257 if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) 252 if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF)
258 return_VALUE(-ENOEXEC); 253 return -ENOEXEC;
259 254
260 /* Update the power resource's _device_ power state */ 255 /* Update the power resource's _device_ power state */
261 result = acpi_bus_get_device(resource->handle, &device); 256 result = acpi_bus_get_device(resource->handle, &device);
262 if (result) 257 if (result)
263 return_VALUE(result); 258 return result;
264 device->power.state = ACPI_STATE_D3; 259 device->power.state = ACPI_STATE_D3;
265 260
266 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", 261 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
267 resource->name)); 262 resource->name));
268 263
269 return_VALUE(0); 264 return 0;
270} 265}
271 266
272/* 267/*
@@ -282,9 +277,8 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev)
282 int i; 277 int i;
283 int ret = 0; 278 int ret = 0;
284 279
285 ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power");
286 if (!dev || !dev->wakeup.flags.valid) 280 if (!dev || !dev->wakeup.flags.valid)
287 return_VALUE(-1); 281 return -1;
288 282
289 arg.integer.value = 1; 283 arg.integer.value = 1;
290 /* Open power resource */ 284 /* Open power resource */
@@ -293,7 +287,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev)
293 if (ret) { 287 if (ret) {
294 printk(KERN_ERR PREFIX "Transition power state\n"); 288 printk(KERN_ERR PREFIX "Transition power state\n");
295 dev->wakeup.flags.valid = 0; 289 dev->wakeup.flags.valid = 0;
296 return_VALUE(-1); 290 return -1;
297 } 291 }
298 } 292 }
299 293
@@ -305,7 +299,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev)
305 ret = -1; 299 ret = -1;
306 } 300 }
307 301
308 return_VALUE(ret); 302 return ret;
309} 303}
310 304
311/* 305/*
@@ -321,10 +315,9 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
321 int i; 315 int i;
322 int ret = 0; 316 int ret = 0;
323 317
324 ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power");
325 318
326 if (!dev || !dev->wakeup.flags.valid) 319 if (!dev || !dev->wakeup.flags.valid)
327 return_VALUE(-1); 320 return -1;
328 321
329 arg.integer.value = 0; 322 arg.integer.value = 0;
330 /* Execute PSW */ 323 /* Execute PSW */
@@ -332,7 +325,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
332 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { 325 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
333 printk(KERN_ERR PREFIX "Evaluate _PSW\n"); 326 printk(KERN_ERR PREFIX "Evaluate _PSW\n");
334 dev->wakeup.flags.valid = 0; 327 dev->wakeup.flags.valid = 0;
335 return_VALUE(-1); 328 return -1;
336 } 329 }
337 330
338 /* Close power resource */ 331 /* Close power resource */
@@ -341,11 +334,11 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
341 if (ret) { 334 if (ret) {
342 printk(KERN_ERR PREFIX "Transition power state\n"); 335 printk(KERN_ERR PREFIX "Transition power state\n");
343 dev->wakeup.flags.valid = 0; 336 dev->wakeup.flags.valid = 0;
344 return_VALUE(-1); 337 return -1;
345 } 338 }
346 } 339 }
347 340
348 return_VALUE(ret); 341 return ret;
349} 342}
350 343
351/* -------------------------------------------------------------------------- 344/* --------------------------------------------------------------------------
@@ -359,10 +352,9 @@ int acpi_power_get_inferred_state(struct acpi_device *device)
359 int list_state = 0; 352 int list_state = 0;
360 int i = 0; 353 int i = 0;
361 354
362 ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state");
363 355
364 if (!device) 356 if (!device)
365 return_VALUE(-EINVAL); 357 return -EINVAL;
366 358
367 device->power.state = ACPI_STATE_UNKNOWN; 359 device->power.state = ACPI_STATE_UNKNOWN;
368 360
@@ -377,17 +369,17 @@ int acpi_power_get_inferred_state(struct acpi_device *device)
377 369
378 result = acpi_power_get_list_state(list, &list_state); 370 result = acpi_power_get_list_state(list, &list_state);
379 if (result) 371 if (result)
380 return_VALUE(result); 372 return result;
381 373
382 if (list_state == ACPI_POWER_RESOURCE_STATE_ON) { 374 if (list_state == ACPI_POWER_RESOURCE_STATE_ON) {
383 device->power.state = i; 375 device->power.state = i;
384 return_VALUE(0); 376 return 0;
385 } 377 }
386 } 378 }
387 379
388 device->power.state = ACPI_STATE_D3; 380 device->power.state = ACPI_STATE_D3;
389 381
390 return_VALUE(0); 382 return 0;
391} 383}
392 384
393int acpi_power_transition(struct acpi_device *device, int state) 385int acpi_power_transition(struct acpi_device *device, int state)
@@ -397,14 +389,13 @@ int acpi_power_transition(struct acpi_device *device, int state)
397 struct acpi_handle_list *tl = NULL; /* Target Resources */ 389 struct acpi_handle_list *tl = NULL; /* Target Resources */
398 int i = 0; 390 int i = 0;
399 391
400 ACPI_FUNCTION_TRACE("acpi_power_transition");
401 392
402 if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) 393 if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
403 return_VALUE(-EINVAL); 394 return -EINVAL;
404 395
405 if ((device->power.state < ACPI_STATE_D0) 396 if ((device->power.state < ACPI_STATE_D0)
406 || (device->power.state > ACPI_STATE_D3)) 397 || (device->power.state > ACPI_STATE_D3))
407 return_VALUE(-ENODEV); 398 return -ENODEV;
408 399
409 cl = &device->power.states[device->power.state].resources; 400 cl = &device->power.states[device->power.state].resources;
410 tl = &device->power.states[state].resources; 401 tl = &device->power.states[state].resources;
@@ -444,7 +435,7 @@ int acpi_power_transition(struct acpi_device *device, int state)
444 printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", 435 printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
445 device->pnp.bus_id, state); 436 device->pnp.bus_id, state);
446 437
447 return_VALUE(result); 438 return result;
448} 439}
449 440
450/* -------------------------------------------------------------------------- 441/* --------------------------------------------------------------------------
@@ -457,7 +448,6 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
457{ 448{
458 struct acpi_power_resource *resource = NULL; 449 struct acpi_power_resource *resource = NULL;
459 450
460 ACPI_FUNCTION_TRACE("acpi_power_seq_show");
461 451
462 resource = (struct acpi_power_resource *)seq->private; 452 resource = (struct acpi_power_resource *)seq->private;
463 453
@@ -484,7 +474,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
484 resource->order, resource->references); 474 resource->order, resource->references);
485 475
486 end: 476 end:
487 return_VALUE(0); 477 return 0;
488} 478}
489 479
490static int acpi_power_open_fs(struct inode *inode, struct file *file) 480static int acpi_power_open_fs(struct inode *inode, struct file *file)
@@ -496,34 +486,32 @@ static int acpi_power_add_fs(struct acpi_device *device)
496{ 486{
497 struct proc_dir_entry *entry = NULL; 487 struct proc_dir_entry *entry = NULL;
498 488
499 ACPI_FUNCTION_TRACE("acpi_power_add_fs");
500 489
501 if (!device) 490 if (!device)
502 return_VALUE(-EINVAL); 491 return -EINVAL;
503 492
504 if (!acpi_device_dir(device)) { 493 if (!acpi_device_dir(device)) {
505 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 494 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
506 acpi_power_dir); 495 acpi_power_dir);
507 if (!acpi_device_dir(device)) 496 if (!acpi_device_dir(device))
508 return_VALUE(-ENODEV); 497 return -ENODEV;
509 } 498 }
510 499
511 /* 'status' [R] */ 500 /* 'status' [R] */
512 entry = create_proc_entry(ACPI_POWER_FILE_STATUS, 501 entry = create_proc_entry(ACPI_POWER_FILE_STATUS,
513 S_IRUGO, acpi_device_dir(device)); 502 S_IRUGO, acpi_device_dir(device));
514 if (!entry) 503 if (!entry)
515 return_VALUE(-EIO); 504 return -EIO;
516 else { 505 else {
517 entry->proc_fops = &acpi_power_fops; 506 entry->proc_fops = &acpi_power_fops;
518 entry->data = acpi_driver_data(device); 507 entry->data = acpi_driver_data(device);
519 } 508 }
520 509
521 return_VALUE(0); 510 return 0;
522} 511}
523 512
524static int acpi_power_remove_fs(struct acpi_device *device) 513static int acpi_power_remove_fs(struct acpi_device *device)
525{ 514{
526 ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
527 515
528 if (acpi_device_dir(device)) { 516 if (acpi_device_dir(device)) {
529 remove_proc_entry(ACPI_POWER_FILE_STATUS, 517 remove_proc_entry(ACPI_POWER_FILE_STATUS,
@@ -532,7 +520,7 @@ static int acpi_power_remove_fs(struct acpi_device *device)
532 acpi_device_dir(device) = NULL; 520 acpi_device_dir(device) = NULL;
533 } 521 }
534 522
535 return_VALUE(0); 523 return 0;
536} 524}
537 525
538/* -------------------------------------------------------------------------- 526/* --------------------------------------------------------------------------
@@ -547,14 +535,13 @@ static int acpi_power_add(struct acpi_device *device)
547 union acpi_object acpi_object; 535 union acpi_object acpi_object;
548 struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; 536 struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object };
549 537
550 ACPI_FUNCTION_TRACE("acpi_power_add");
551 538
552 if (!device) 539 if (!device)
553 return_VALUE(-EINVAL); 540 return -EINVAL;
554 541
555 resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); 542 resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL);
556 if (!resource) 543 if (!resource)
557 return_VALUE(-ENOMEM); 544 return -ENOMEM;
558 memset(resource, 0, sizeof(struct acpi_power_resource)); 545 memset(resource, 0, sizeof(struct acpi_power_resource));
559 546
560 resource->handle = device->handle; 547 resource->handle = device->handle;
@@ -599,17 +586,16 @@ static int acpi_power_add(struct acpi_device *device)
599 if (result) 586 if (result)
600 kfree(resource); 587 kfree(resource);
601 588
602 return_VALUE(result); 589 return result;
603} 590}
604 591
605static int acpi_power_remove(struct acpi_device *device, int type) 592static int acpi_power_remove(struct acpi_device *device, int type)
606{ 593{
607 struct acpi_power_resource *resource = NULL; 594 struct acpi_power_resource *resource = NULL;
608 595
609 ACPI_FUNCTION_TRACE("acpi_power_remove");
610 596
611 if (!device || !acpi_driver_data(device)) 597 if (!device || !acpi_driver_data(device))
612 return_VALUE(-EINVAL); 598 return -EINVAL;
613 599
614 resource = (struct acpi_power_resource *)acpi_driver_data(device); 600 resource = (struct acpi_power_resource *)acpi_driver_data(device);
615 601
@@ -617,31 +603,30 @@ static int acpi_power_remove(struct acpi_device *device, int type)
617 603
618 kfree(resource); 604 kfree(resource);
619 605
620 return_VALUE(0); 606 return 0;
621} 607}
622 608
623static int __init acpi_power_init(void) 609static int __init acpi_power_init(void)
624{ 610{
625 int result = 0; 611 int result = 0;
626 612
627 ACPI_FUNCTION_TRACE("acpi_power_init");
628 613
629 if (acpi_disabled) 614 if (acpi_disabled)
630 return_VALUE(0); 615 return 0;
631 616
632 INIT_LIST_HEAD(&acpi_power_resource_list); 617 INIT_LIST_HEAD(&acpi_power_resource_list);
633 618
634 acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); 619 acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
635 if (!acpi_power_dir) 620 if (!acpi_power_dir)
636 return_VALUE(-ENODEV); 621 return -ENODEV;
637 622
638 result = acpi_bus_register_driver(&acpi_power_driver); 623 result = acpi_bus_register_driver(&acpi_power_driver);
639 if (result < 0) { 624 if (result < 0) {
640 remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); 625 remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir);
641 return_VALUE(-ENODEV); 626 return -ENODEV;
642 } 627 }
643 628
644 return_VALUE(0); 629 return 0;
645} 630}
646 631
647subsys_initcall(acpi_power_init); 632subsys_initcall(acpi_power_init);
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 80bbf187a37d..52674323b14d 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -122,10 +122,9 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
122 u8 value1 = 0; 122 u8 value1 = 0;
123 u8 value2 = 0; 123 u8 value2 = 0;
124 124
125 ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4");
126 125
127 if (!dev) 126 if (!dev)
128 return_VALUE(-EINVAL); 127 return -EINVAL;
129 128
130 /* 129 /*
131 * Note that 'dev' references the PIIX4 ACPI Controller. 130 * Note that 'dev' references the PIIX4 ACPI Controller.
@@ -218,7 +217,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
218 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 217 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
219 "Type-F DMA livelock erratum (C3 disabled)\n")); 218 "Type-F DMA livelock erratum (C3 disabled)\n"));
220 219
221 return_VALUE(0); 220 return 0;
222} 221}
223 222
224static int acpi_processor_errata(struct acpi_processor *pr) 223static int acpi_processor_errata(struct acpi_processor *pr)
@@ -226,10 +225,9 @@ static int acpi_processor_errata(struct acpi_processor *pr)
226 int result = 0; 225 int result = 0;
227 struct pci_dev *dev = NULL; 226 struct pci_dev *dev = NULL;
228 227
229 ACPI_FUNCTION_TRACE("acpi_processor_errata");
230 228
231 if (!pr) 229 if (!pr)
232 return_VALUE(-EINVAL); 230 return -EINVAL;
233 231
234 /* 232 /*
235 * PIIX4 233 * PIIX4
@@ -242,7 +240,7 @@ static int acpi_processor_errata(struct acpi_processor *pr)
242 pci_dev_put(dev); 240 pci_dev_put(dev);
243 } 241 }
244 242
245 return_VALUE(result); 243 return result;
246} 244}
247 245
248/* -------------------------------------------------------------------------- 246/* --------------------------------------------------------------------------
@@ -258,10 +256,9 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr)
258 struct acpi_object_list *pdc_in = pr->pdc; 256 struct acpi_object_list *pdc_in = pr->pdc;
259 acpi_status status = AE_OK; 257 acpi_status status = AE_OK;
260 258
261 ACPI_FUNCTION_TRACE("acpi_processor_set_pdc");
262 259
263 if (!pdc_in) 260 if (!pdc_in)
264 return_VALUE(status); 261 return status;
265 262
266 status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); 263 status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL);
267 264
@@ -269,7 +266,7 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr)
269 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 266 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
270 "Could not evaluate _PDC, using legacy perf. control...\n")); 267 "Could not evaluate _PDC, using legacy perf. control...\n"));
271 268
272 return_VALUE(status); 269 return status;
273} 270}
274 271
275/* -------------------------------------------------------------------------- 272/* --------------------------------------------------------------------------
@@ -282,7 +279,6 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
282{ 279{
283 struct acpi_processor *pr = (struct acpi_processor *)seq->private; 280 struct acpi_processor *pr = (struct acpi_processor *)seq->private;
284 281
285 ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show");
286 282
287 if (!pr) 283 if (!pr)
288 goto end; 284 goto end;
@@ -301,7 +297,7 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
301 pr->flags.limit ? "yes" : "no"); 297 pr->flags.limit ? "yes" : "no");
302 298
303 end: 299 end:
304 return_VALUE(0); 300 return 0;
305} 301}
306 302
307static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) 303static int acpi_processor_info_open_fs(struct inode *inode, struct file *file)
@@ -314,13 +310,12 @@ static int acpi_processor_add_fs(struct acpi_device *device)
314{ 310{
315 struct proc_dir_entry *entry = NULL; 311 struct proc_dir_entry *entry = NULL;
316 312
317 ACPI_FUNCTION_TRACE("acpi_processor_add_fs");
318 313
319 if (!acpi_device_dir(device)) { 314 if (!acpi_device_dir(device)) {
320 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 315 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
321 acpi_processor_dir); 316 acpi_processor_dir);
322 if (!acpi_device_dir(device)) 317 if (!acpi_device_dir(device))
323 return_VALUE(-ENODEV); 318 return -ENODEV;
324 } 319 }
325 acpi_device_dir(device)->owner = THIS_MODULE; 320 acpi_device_dir(device)->owner = THIS_MODULE;
326 321
@@ -328,7 +323,7 @@ static int acpi_processor_add_fs(struct acpi_device *device)
328 entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, 323 entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO,
329 S_IRUGO, acpi_device_dir(device)); 324 S_IRUGO, acpi_device_dir(device));
330 if (!entry) 325 if (!entry)
331 return_VALUE(-EIO); 326 return -EIO;
332 else { 327 else {
333 entry->proc_fops = &acpi_processor_info_fops; 328 entry->proc_fops = &acpi_processor_info_fops;
334 entry->data = acpi_driver_data(device); 329 entry->data = acpi_driver_data(device);
@@ -340,7 +335,7 @@ static int acpi_processor_add_fs(struct acpi_device *device)
340 S_IFREG | S_IRUGO | S_IWUSR, 335 S_IFREG | S_IRUGO | S_IWUSR,
341 acpi_device_dir(device)); 336 acpi_device_dir(device));
342 if (!entry) 337 if (!entry)
343 return_VALUE(-EIO); 338 return -EIO;
344 else { 339 else {
345 entry->proc_fops = &acpi_processor_throttling_fops; 340 entry->proc_fops = &acpi_processor_throttling_fops;
346 entry->data = acpi_driver_data(device); 341 entry->data = acpi_driver_data(device);
@@ -352,19 +347,18 @@ static int acpi_processor_add_fs(struct acpi_device *device)
352 S_IFREG | S_IRUGO | S_IWUSR, 347 S_IFREG | S_IRUGO | S_IWUSR,
353 acpi_device_dir(device)); 348 acpi_device_dir(device));
354 if (!entry) 349 if (!entry)
355 return_VALUE( -EIO); 350 return -EIO;
356 else { 351 else {
357 entry->proc_fops = &acpi_processor_limit_fops; 352 entry->proc_fops = &acpi_processor_limit_fops;
358 entry->data = acpi_driver_data(device); 353 entry->data = acpi_driver_data(device);
359 entry->owner = THIS_MODULE; 354 entry->owner = THIS_MODULE;
360 } 355 }
361 356
362 return_VALUE(0); 357 return 0;
363} 358}
364 359
365static int acpi_processor_remove_fs(struct acpi_device *device) 360static int acpi_processor_remove_fs(struct acpi_device *device)
366{ 361{
367 ACPI_FUNCTION_TRACE("acpi_processor_remove_fs");
368 362
369 if (acpi_device_dir(device)) { 363 if (acpi_device_dir(device)) {
370 remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, 364 remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,
@@ -377,7 +371,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
377 acpi_device_dir(device) = NULL; 371 acpi_device_dir(device) = NULL;
378 } 372 }
379 373
380 return_VALUE(0); 374 return 0;
381} 375}
382 376
383/* Use the acpiid in MADT to map cpus in case of SMP */ 377/* Use the acpiid in MADT to map cpus in case of SMP */
@@ -424,10 +418,9 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
424 int cpu_index; 418 int cpu_index;
425 static int cpu0_initialized; 419 static int cpu0_initialized;
426 420
427 ACPI_FUNCTION_TRACE("acpi_processor_get_info");
428 421
429 if (!pr) 422 if (!pr)
430 return_VALUE(-EINVAL); 423 return -EINVAL;
431 424
432 if (num_online_cpus() > 1) 425 if (num_online_cpus() > 1)
433 errata.smp = TRUE; 426 errata.smp = TRUE;
@@ -454,7 +447,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
454 status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); 447 status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
455 if (ACPI_FAILURE(status)) { 448 if (ACPI_FAILURE(status)) {
456 printk(KERN_ERR PREFIX "Evaluating processor object\n"); 449 printk(KERN_ERR PREFIX "Evaluating processor object\n");
457 return_VALUE(-ENODEV); 450 return -ENODEV;
458 } 451 }
459 452
460 /* 453 /*
@@ -486,7 +479,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
486 printk(KERN_ERR PREFIX 479 printk(KERN_ERR PREFIX
487 "Getting cpuindex for acpiid 0x%x\n", 480 "Getting cpuindex for acpiid 0x%x\n",
488 pr->acpi_id); 481 pr->acpi_id);
489 return_VALUE(-ENODEV); 482 return -ENODEV;
490 } 483 }
491 } 484 }
492 485
@@ -521,7 +514,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
521 acpi_processor_get_throttling_info(pr); 514 acpi_processor_get_throttling_info(pr);
522 acpi_processor_get_limit_info(pr); 515 acpi_processor_get_limit_info(pr);
523 516
524 return_VALUE(0); 517 return 0;
525} 518}
526 519
527static void *processor_device_array[NR_CPUS]; 520static void *processor_device_array[NR_CPUS];
@@ -532,14 +525,13 @@ static int acpi_processor_start(struct acpi_device *device)
532 acpi_status status = AE_OK; 525 acpi_status status = AE_OK;
533 struct acpi_processor *pr; 526 struct acpi_processor *pr;
534 527
535 ACPI_FUNCTION_TRACE("acpi_processor_start");
536 528
537 pr = acpi_driver_data(device); 529 pr = acpi_driver_data(device);
538 530
539 result = acpi_processor_get_info(pr); 531 result = acpi_processor_get_info(pr);
540 if (result) { 532 if (result) {
541 /* Processor is physically not present */ 533 /* Processor is physically not present */
542 return_VALUE(0); 534 return 0;
543 } 535 }
544 536
545 BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); 537 BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
@@ -553,7 +545,7 @@ static int acpi_processor_start(struct acpi_device *device)
553 processor_device_array[pr->id] != (void *)device) { 545 processor_device_array[pr->id] != (void *)device) {
554 printk(KERN_WARNING "BIOS reported wrong ACPI id" 546 printk(KERN_WARNING "BIOS reported wrong ACPI id"
555 "for the processor\n"); 547 "for the processor\n");
556 return_VALUE(-ENODEV); 548 return -ENODEV;
557 } 549 }
558 processor_device_array[pr->id] = (void *)device; 550 processor_device_array[pr->id] = (void *)device;
559 551
@@ -581,7 +573,7 @@ static int acpi_processor_start(struct acpi_device *device)
581 573
582 end: 574 end:
583 575
584 return_VALUE(result); 576 return result;
585} 577}
586 578
587static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) 579static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
@@ -589,13 +581,12 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
589 struct acpi_processor *pr = (struct acpi_processor *)data; 581 struct acpi_processor *pr = (struct acpi_processor *)data;
590 struct acpi_device *device = NULL; 582 struct acpi_device *device = NULL;
591 583
592 ACPI_FUNCTION_TRACE("acpi_processor_notify");
593 584
594 if (!pr) 585 if (!pr)
595 return_VOID; 586 return;
596 587
597 if (acpi_bus_get_device(pr->handle, &device)) 588 if (acpi_bus_get_device(pr->handle, &device))
598 return_VOID; 589 return;
599 590
600 switch (event) { 591 switch (event) {
601 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: 592 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
@@ -613,21 +604,20 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
613 break; 604 break;
614 } 605 }
615 606
616 return_VOID; 607 return;
617} 608}
618 609
619static int acpi_processor_add(struct acpi_device *device) 610static int acpi_processor_add(struct acpi_device *device)
620{ 611{
621 struct acpi_processor *pr = NULL; 612 struct acpi_processor *pr = NULL;
622 613
623 ACPI_FUNCTION_TRACE("acpi_processor_add");
624 614
625 if (!device) 615 if (!device)
626 return_VALUE(-EINVAL); 616 return -EINVAL;
627 617
628 pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL); 618 pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL);
629 if (!pr) 619 if (!pr)
630 return_VALUE(-ENOMEM); 620 return -ENOMEM;
631 memset(pr, 0, sizeof(struct acpi_processor)); 621 memset(pr, 0, sizeof(struct acpi_processor));
632 622
633 pr->handle = device->handle; 623 pr->handle = device->handle;
@@ -635,7 +625,7 @@ static int acpi_processor_add(struct acpi_device *device)
635 strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); 625 strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
636 acpi_driver_data(device) = pr; 626 acpi_driver_data(device) = pr;
637 627
638 return_VALUE(0); 628 return 0;
639} 629}
640 630
641static int acpi_processor_remove(struct acpi_device *device, int type) 631static int acpi_processor_remove(struct acpi_device *device, int type)
@@ -643,21 +633,20 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
643 acpi_status status = AE_OK; 633 acpi_status status = AE_OK;
644 struct acpi_processor *pr = NULL; 634 struct acpi_processor *pr = NULL;
645 635
646 ACPI_FUNCTION_TRACE("acpi_processor_remove");
647 636
648 if (!device || !acpi_driver_data(device)) 637 if (!device || !acpi_driver_data(device))
649 return_VALUE(-EINVAL); 638 return -EINVAL;
650 639
651 pr = (struct acpi_processor *)acpi_driver_data(device); 640 pr = (struct acpi_processor *)acpi_driver_data(device);
652 641
653 if (pr->id >= NR_CPUS) { 642 if (pr->id >= NR_CPUS) {
654 kfree(pr); 643 kfree(pr);
655 return_VALUE(0); 644 return 0;
656 } 645 }
657 646
658 if (type == ACPI_BUS_REMOVAL_EJECT) { 647 if (type == ACPI_BUS_REMOVAL_EJECT) {
659 if (acpi_processor_handle_eject(pr)) 648 if (acpi_processor_handle_eject(pr))
660 return_VALUE(-EINVAL); 649 return -EINVAL;
661 } 650 }
662 651
663 acpi_processor_power_exit(pr, device); 652 acpi_processor_power_exit(pr, device);
@@ -671,7 +660,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
671 660
672 kfree(pr); 661 kfree(pr);
673 662
674 return_VALUE(0); 663 return 0;
675} 664}
676 665
677#ifdef CONFIG_ACPI_HOTPLUG_CPU 666#ifdef CONFIG_ACPI_HOTPLUG_CPU
@@ -686,14 +675,13 @@ static int is_processor_present(acpi_handle handle)
686 acpi_status status; 675 acpi_status status;
687 unsigned long sta = 0; 676 unsigned long sta = 0;
688 677
689 ACPI_FUNCTION_TRACE("is_processor_present");
690 678
691 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 679 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
692 if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { 680 if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) {
693 ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); 681 ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present"));
694 return_VALUE(0); 682 return 0;
695 } 683 }
696 return_VALUE(1); 684 return 1;
697} 685}
698 686
699static 687static
@@ -703,30 +691,29 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
703 struct acpi_device *pdev; 691 struct acpi_device *pdev;
704 struct acpi_processor *pr; 692 struct acpi_processor *pr;
705 693
706 ACPI_FUNCTION_TRACE("acpi_processor_device_add");
707 694
708 if (acpi_get_parent(handle, &phandle)) { 695 if (acpi_get_parent(handle, &phandle)) {
709 return_VALUE(-ENODEV); 696 return -ENODEV;
710 } 697 }
711 698
712 if (acpi_bus_get_device(phandle, &pdev)) { 699 if (acpi_bus_get_device(phandle, &pdev)) {
713 return_VALUE(-ENODEV); 700 return -ENODEV;
714 } 701 }
715 702
716 if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { 703 if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) {
717 return_VALUE(-ENODEV); 704 return -ENODEV;
718 } 705 }
719 706
720 acpi_bus_start(*device); 707 acpi_bus_start(*device);
721 708
722 pr = acpi_driver_data(*device); 709 pr = acpi_driver_data(*device);
723 if (!pr) 710 if (!pr)
724 return_VALUE(-ENODEV); 711 return -ENODEV;
725 712
726 if ((pr->id >= 0) && (pr->id < NR_CPUS)) { 713 if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
727 kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); 714 kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
728 } 715 }
729 return_VALUE(0); 716 return 0;
730} 717}
731 718
732static void 719static void
@@ -736,7 +723,6 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
736 struct acpi_device *device = NULL; 723 struct acpi_device *device = NULL;
737 int result; 724 int result;
738 725
739 ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify");
740 726
741 switch (event) { 727 switch (event) {
742 case ACPI_NOTIFY_BUS_CHECK: 728 case ACPI_NOTIFY_BUS_CHECK:
@@ -788,7 +774,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
788 if (!pr) { 774 if (!pr) {
789 printk(KERN_ERR PREFIX 775 printk(KERN_ERR PREFIX
790 "Driver data is NULL, dropping EJECT\n"); 776 "Driver data is NULL, dropping EJECT\n");
791 return_VOID; 777 return;
792 } 778 }
793 779
794 if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) 780 if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
@@ -800,7 +786,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
800 break; 786 break;
801 } 787 }
802 788
803 return_VOID; 789 return;
804} 790}
805 791
806static acpi_status 792static acpi_status
@@ -839,21 +825,20 @@ processor_walk_namespace_cb(acpi_handle handle,
839 825
840static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) 826static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu)
841{ 827{
842 ACPI_FUNCTION_TRACE("acpi_processor_hotadd_init");
843 828
844 if (!is_processor_present(handle)) { 829 if (!is_processor_present(handle)) {
845 return_VALUE(AE_ERROR); 830 return AE_ERROR;
846 } 831 }
847 832
848 if (acpi_map_lsapic(handle, p_cpu)) 833 if (acpi_map_lsapic(handle, p_cpu))
849 return_VALUE(AE_ERROR); 834 return AE_ERROR;
850 835
851 if (arch_register_cpu(*p_cpu)) { 836 if (arch_register_cpu(*p_cpu)) {
852 acpi_unmap_lsapic(*p_cpu); 837 acpi_unmap_lsapic(*p_cpu);
853 return_VALUE(AE_ERROR); 838 return AE_ERROR;
854 } 839 }
855 840
856 return_VALUE(AE_OK); 841 return AE_OK;
857} 842}
858 843
859static int acpi_processor_handle_eject(struct acpi_processor *pr) 844static int acpi_processor_handle_eject(struct acpi_processor *pr)
@@ -910,20 +895,19 @@ static int __init acpi_processor_init(void)
910{ 895{
911 int result = 0; 896 int result = 0;
912 897
913 ACPI_FUNCTION_TRACE("acpi_processor_init");
914 898
915 memset(&processors, 0, sizeof(processors)); 899 memset(&processors, 0, sizeof(processors));
916 memset(&errata, 0, sizeof(errata)); 900 memset(&errata, 0, sizeof(errata));
917 901
918 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); 902 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
919 if (!acpi_processor_dir) 903 if (!acpi_processor_dir)
920 return_VALUE(0); 904 return 0;
921 acpi_processor_dir->owner = THIS_MODULE; 905 acpi_processor_dir->owner = THIS_MODULE;
922 906
923 result = acpi_bus_register_driver(&acpi_processor_driver); 907 result = acpi_bus_register_driver(&acpi_processor_driver);
924 if (result < 0) { 908 if (result < 0) {
925 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 909 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
926 return_VALUE(0); 910 return 0;
927 } 911 }
928 912
929 acpi_processor_install_hotplug_notify(); 913 acpi_processor_install_hotplug_notify();
@@ -932,12 +916,11 @@ static int __init acpi_processor_init(void)
932 916
933 acpi_processor_ppc_init(); 917 acpi_processor_ppc_init();
934 918
935 return_VALUE(0); 919 return 0;
936} 920}
937 921
938static void __exit acpi_processor_exit(void) 922static void __exit acpi_processor_exit(void)
939{ 923{
940 ACPI_FUNCTION_TRACE("acpi_processor_exit");
941 924
942 acpi_processor_ppc_exit(); 925 acpi_processor_ppc_exit();
943 926
@@ -949,7 +932,7 @@ static void __exit acpi_processor_exit(void)
949 932
950 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 933 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
951 934
952 return_VOID; 935 return;
953} 936}
954 937
955module_init(acpi_processor_init); 938module_init(acpi_processor_init);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 786851da85c6..89d3fd4c3cd2 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -517,10 +517,9 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
517 struct acpi_processor_cx *higher = NULL; 517 struct acpi_processor_cx *higher = NULL;
518 struct acpi_processor_cx *cx; 518 struct acpi_processor_cx *cx;
519 519
520 ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy");
521 520
522 if (!pr) 521 if (!pr)
523 return_VALUE(-EINVAL); 522 return -EINVAL;
524 523
525 /* 524 /*
526 * This function sets the default Cx state policy (OS idle handler). 525 * This function sets the default Cx state policy (OS idle handler).
@@ -544,7 +543,7 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
544 } 543 }
545 544
546 if (!state_is_set) 545 if (!state_is_set)
547 return_VALUE(-ENODEV); 546 return -ENODEV;
548 547
549 /* demotion */ 548 /* demotion */
550 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { 549 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
@@ -583,18 +582,17 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
583 higher = cx; 582 higher = cx;
584 } 583 }
585 584
586 return_VALUE(0); 585 return 0;
587} 586}
588 587
589static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) 588static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
590{ 589{
591 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt");
592 590
593 if (!pr) 591 if (!pr)
594 return_VALUE(-EINVAL); 592 return -EINVAL;
595 593
596 if (!pr->pblk) 594 if (!pr->pblk)
597 return_VALUE(-ENODEV); 595 return -ENODEV;
598 596
599 /* if info is obtained from pblk/fadt, type equals state */ 597 /* if info is obtained from pblk/fadt, type equals state */
600 pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; 598 pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2;
@@ -606,7 +604,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
606 * an SMP system. 604 * an SMP system.
607 */ 605 */
608 if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) 606 if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up)
609 return_VALUE(-ENODEV); 607 return -ENODEV;
610#endif 608#endif
611 609
612 /* determine C2 and C3 address from pblk */ 610 /* determine C2 and C3 address from pblk */
@@ -622,12 +620,11 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
622 pr->power.states[ACPI_STATE_C2].address, 620 pr->power.states[ACPI_STATE_C2].address,
623 pr->power.states[ACPI_STATE_C3].address)); 621 pr->power.states[ACPI_STATE_C3].address));
624 622
625 return_VALUE(0); 623 return 0;
626} 624}
627 625
628static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) 626static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
629{ 627{
630 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
631 628
632 /* Zero initialize all the C-states info. */ 629 /* Zero initialize all the C-states info. */
633 memset(pr->power.states, 0, sizeof(pr->power.states)); 630 memset(pr->power.states, 0, sizeof(pr->power.states));
@@ -640,7 +637,7 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
640 pr->power.states[ACPI_STATE_C0].valid = 1; 637 pr->power.states[ACPI_STATE_C0].valid = 1;
641 pr->power.states[ACPI_STATE_C1].valid = 1; 638 pr->power.states[ACPI_STATE_C1].valid = 1;
642 639
643 return_VALUE(0); 640 return 0;
644} 641}
645 642
646static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) 643static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
@@ -652,10 +649,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
652 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 649 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
653 union acpi_object *cst; 650 union acpi_object *cst;
654 651
655 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst");
656 652
657 if (nocst) 653 if (nocst)
658 return_VALUE(-ENODEV); 654 return -ENODEV;
659 655
660 current_count = 1; 656 current_count = 1;
661 657
@@ -667,7 +663,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
667 status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); 663 status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);
668 if (ACPI_FAILURE(status)) { 664 if (ACPI_FAILURE(status)) {
669 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); 665 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n"));
670 return_VALUE(-ENODEV); 666 return -ENODEV;
671 } 667 }
672 668
673 cst = (union acpi_object *)buffer.pointer; 669 cst = (union acpi_object *)buffer.pointer;
@@ -773,15 +769,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
773 end: 769 end:
774 acpi_os_free(buffer.pointer); 770 acpi_os_free(buffer.pointer);
775 771
776 return_VALUE(status); 772 return status;
777} 773}
778 774
779static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) 775static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
780{ 776{
781 ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2");
782 777
783 if (!cx->address) 778 if (!cx->address)
784 return_VOID; 779 return;
785 780
786 /* 781 /*
787 * C2 latency must be less than or equal to 100 782 * C2 latency must be less than or equal to 100
@@ -790,7 +785,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
790 else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { 785 else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
791 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 786 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
792 "latency too large [%d]\n", cx->latency)); 787 "latency too large [%d]\n", cx->latency));
793 return_VOID; 788 return;
794 } 789 }
795 790
796 /* 791 /*
@@ -800,7 +795,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
800 cx->valid = 1; 795 cx->valid = 1;
801 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); 796 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
802 797
803 return_VOID; 798 return;
804} 799}
805 800
806static void acpi_processor_power_verify_c3(struct acpi_processor *pr, 801static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
@@ -808,10 +803,9 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
808{ 803{
809 static int bm_check_flag; 804 static int bm_check_flag;
810 805
811 ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3");
812 806
813 if (!cx->address) 807 if (!cx->address)
814 return_VOID; 808 return;
815 809
816 /* 810 /*
817 * C3 latency must be less than or equal to 1000 811 * C3 latency must be less than or equal to 1000
@@ -820,7 +814,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
820 else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { 814 else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) {
821 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 815 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
822 "latency too large [%d]\n", cx->latency)); 816 "latency too large [%d]\n", cx->latency));
823 return_VOID; 817 return;
824 } 818 }
825 819
826 /* 820 /*
@@ -833,7 +827,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
833 else if (errata.piix4.fdma) { 827 else if (errata.piix4.fdma) {
834 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 828 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
835 "C3 not supported on PIIX4 with Type-F DMA\n")); 829 "C3 not supported on PIIX4 with Type-F DMA\n"));
836 return_VOID; 830 return;
837 } 831 }
838 832
839 /* All the logic here assumes flags.bm_check is same across all CPUs */ 833 /* All the logic here assumes flags.bm_check is same across all CPUs */
@@ -850,7 +844,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
850 if (!pr->flags.bm_control) { 844 if (!pr->flags.bm_control) {
851 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 845 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
852 "C3 support requires bus mastering control\n")); 846 "C3 support requires bus mastering control\n"));
853 return_VOID; 847 return;
854 } 848 }
855 } else { 849 } else {
856 /* 850 /*
@@ -861,7 +855,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
861 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 855 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
862 "Cache invalidation should work properly" 856 "Cache invalidation should work properly"
863 " for C3 to be enabled on SMP systems\n")); 857 " for C3 to be enabled on SMP systems\n"));
864 return_VOID; 858 return;
865 } 859 }
866 acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 860 acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD,
867 0, ACPI_MTX_DO_NOT_LOCK); 861 0, ACPI_MTX_DO_NOT_LOCK);
@@ -876,7 +870,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
876 cx->valid = 1; 870 cx->valid = 1;
877 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); 871 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
878 872
879 return_VOID; 873 return;
880} 874}
881 875
882static int acpi_processor_power_verify(struct acpi_processor *pr) 876static int acpi_processor_power_verify(struct acpi_processor *pr)
@@ -935,7 +929,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
935 unsigned int i; 929 unsigned int i;
936 int result; 930 int result;
937 931
938 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info");
939 932
940 /* NOTE: the idle thread may not be running while calling 933 /* NOTE: the idle thread may not be running while calling
941 * this function */ 934 * this function */
@@ -958,7 +951,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
958 */ 951 */
959 result = acpi_processor_set_power_policy(pr); 952 result = acpi_processor_set_power_policy(pr);
960 if (result) 953 if (result)
961 return_VALUE(result); 954 return result;
962 955
963 /* 956 /*
964 * if one state of type C2 or C3 is available, mark this 957 * if one state of type C2 or C3 is available, mark this
@@ -972,24 +965,23 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
972 } 965 }
973 } 966 }
974 967
975 return_VALUE(0); 968 return 0;
976} 969}
977 970
978int acpi_processor_cst_has_changed(struct acpi_processor *pr) 971int acpi_processor_cst_has_changed(struct acpi_processor *pr)
979{ 972{
980 int result = 0; 973 int result = 0;
981 974
982 ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed");
983 975
984 if (!pr) 976 if (!pr)
985 return_VALUE(-EINVAL); 977 return -EINVAL;
986 978
987 if (nocst) { 979 if (nocst) {
988 return_VALUE(-ENODEV); 980 return -ENODEV;
989 } 981 }
990 982
991 if (!pr->flags.power_setup_done) 983 if (!pr->flags.power_setup_done)
992 return_VALUE(-ENODEV); 984 return -ENODEV;
993 985
994 /* Fall back to the default idle loop */ 986 /* Fall back to the default idle loop */
995 pm_idle = pm_idle_save; 987 pm_idle = pm_idle_save;
@@ -1000,7 +992,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1000 if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) 992 if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
1001 pm_idle = acpi_processor_idle; 993 pm_idle = acpi_processor_idle;
1002 994
1003 return_VALUE(result); 995 return result;
1004} 996}
1005 997
1006/* proc interface */ 998/* proc interface */
@@ -1010,7 +1002,6 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
1010 struct acpi_processor *pr = (struct acpi_processor *)seq->private; 1002 struct acpi_processor *pr = (struct acpi_processor *)seq->private;
1011 unsigned int i; 1003 unsigned int i;
1012 1004
1013 ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show");
1014 1005
1015 if (!pr) 1006 if (!pr)
1016 goto end; 1007 goto end;
@@ -1068,7 +1059,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
1068 } 1059 }
1069 1060
1070 end: 1061 end:
1071 return_VALUE(0); 1062 return 0;
1072} 1063}
1073 1064
1074static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) 1065static int acpi_processor_power_open_fs(struct inode *inode, struct file *file)
@@ -1092,7 +1083,6 @@ int acpi_processor_power_init(struct acpi_processor *pr,
1092 struct proc_dir_entry *entry = NULL; 1083 struct proc_dir_entry *entry = NULL;
1093 unsigned int i; 1084 unsigned int i;
1094 1085
1095 ACPI_FUNCTION_TRACE("acpi_processor_power_init");
1096 1086
1097 if (!first_run) { 1087 if (!first_run) {
1098 dmi_check_system(processor_power_dmi_table); 1088 dmi_check_system(processor_power_dmi_table);
@@ -1104,7 +1094,7 @@ int acpi_processor_power_init(struct acpi_processor *pr,
1104 } 1094 }
1105 1095
1106 if (!pr) 1096 if (!pr)
1107 return_VALUE(-EINVAL); 1097 return -EINVAL;
1108 1098
1109 if (acpi_fadt.cst_cnt && !nocst) { 1099 if (acpi_fadt.cst_cnt && !nocst) {
1110 status = 1100 status =
@@ -1149,13 +1139,12 @@ int acpi_processor_power_init(struct acpi_processor *pr,
1149 1139
1150 pr->flags.power_setup_done = 1; 1140 pr->flags.power_setup_done = 1;
1151 1141
1152 return_VALUE(0); 1142 return 0;
1153} 1143}
1154 1144
1155int acpi_processor_power_exit(struct acpi_processor *pr, 1145int acpi_processor_power_exit(struct acpi_processor *pr,
1156 struct acpi_device *device) 1146 struct acpi_device *device)
1157{ 1147{
1158 ACPI_FUNCTION_TRACE("acpi_processor_power_exit");
1159 1148
1160 pr->flags.power_setup_done = 0; 1149 pr->flags.power_setup_done = 0;
1161 1150
@@ -1175,5 +1164,5 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
1175 cpu_idle_wait(); 1164 cpu_idle_wait();
1176 } 1165 }
1177 1166
1178 return_VALUE(0); 1167 return 0;
1179} 1168}
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 5c24ac45717c..14a00e5a8f6a 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -108,10 +108,9 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
108 acpi_status status = 0; 108 acpi_status status = 0;
109 unsigned long ppc = 0; 109 unsigned long ppc = 0;
110 110
111 ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit");
112 111
113 if (!pr) 112 if (!pr)
114 return_VALUE(-EINVAL); 113 return -EINVAL;
115 114
116 /* 115 /*
117 * _PPC indicates the maximum state currently supported by the platform 116 * _PPC indicates the maximum state currently supported by the platform
@@ -124,12 +123,12 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
124 123
125 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 124 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
126 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); 125 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC"));
127 return_VALUE(-ENODEV); 126 return -ENODEV;
128 } 127 }
129 128
130 pr->performance_platform_limit = (int)ppc; 129 pr->performance_platform_limit = (int)ppc;
131 130
132 return_VALUE(0); 131 return 0;
133} 132}
134 133
135int acpi_processor_ppc_has_changed(struct acpi_processor *pr) 134int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
@@ -168,12 +167,11 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
168 union acpi_object *pct = NULL; 167 union acpi_object *pct = NULL;
169 union acpi_object obj = { 0 }; 168 union acpi_object obj = { 0 };
170 169
171 ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control");
172 170
173 status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); 171 status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
174 if (ACPI_FAILURE(status)) { 172 if (ACPI_FAILURE(status)) {
175 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT")); 173 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT"));
176 return_VALUE(-ENODEV); 174 return -ENODEV;
177 } 175 }
178 176
179 pct = (union acpi_object *)buffer.pointer; 177 pct = (union acpi_object *)buffer.pointer;
@@ -220,7 +218,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
220 end: 218 end:
221 acpi_os_free(buffer.pointer); 219 acpi_os_free(buffer.pointer);
222 220
223 return_VALUE(result); 221 return result;
224} 222}
225 223
226static int acpi_processor_get_performance_states(struct acpi_processor *pr) 224static int acpi_processor_get_performance_states(struct acpi_processor *pr)
@@ -233,12 +231,11 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
233 union acpi_object *pss = NULL; 231 union acpi_object *pss = NULL;
234 int i; 232 int i;
235 233
236 ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states");
237 234
238 status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); 235 status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
239 if (ACPI_FAILURE(status)) { 236 if (ACPI_FAILURE(status)) {
240 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS")); 237 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS"));
241 return_VALUE(-ENODEV); 238 return -ENODEV;
242 } 239 }
243 240
244 pss = (union acpi_object *)buffer.pointer; 241 pss = (union acpi_object *)buffer.pointer;
@@ -299,7 +296,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
299 end: 296 end:
300 acpi_os_free(buffer.pointer); 297 acpi_os_free(buffer.pointer);
301 298
302 return_VALUE(result); 299 return result;
303} 300}
304 301
305static int acpi_processor_get_performance_info(struct acpi_processor *pr) 302static int acpi_processor_get_performance_info(struct acpi_processor *pr)
@@ -308,31 +305,30 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
308 acpi_status status = AE_OK; 305 acpi_status status = AE_OK;
309 acpi_handle handle = NULL; 306 acpi_handle handle = NULL;
310 307
311 ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info");
312 308
313 if (!pr || !pr->performance || !pr->handle) 309 if (!pr || !pr->performance || !pr->handle)
314 return_VALUE(-EINVAL); 310 return -EINVAL;
315 311
316 status = acpi_get_handle(pr->handle, "_PCT", &handle); 312 status = acpi_get_handle(pr->handle, "_PCT", &handle);
317 if (ACPI_FAILURE(status)) { 313 if (ACPI_FAILURE(status)) {
318 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 314 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
319 "ACPI-based processor performance control unavailable\n")); 315 "ACPI-based processor performance control unavailable\n"));
320 return_VALUE(-ENODEV); 316 return -ENODEV;
321 } 317 }
322 318
323 result = acpi_processor_get_performance_control(pr); 319 result = acpi_processor_get_performance_control(pr);
324 if (result) 320 if (result)
325 return_VALUE(result); 321 return result;
326 322
327 result = acpi_processor_get_performance_states(pr); 323 result = acpi_processor_get_performance_states(pr);
328 if (result) 324 if (result)
329 return_VALUE(result); 325 return result;
330 326
331 result = acpi_processor_get_platform_limit(pr); 327 result = acpi_processor_get_platform_limit(pr);
332 if (result) 328 if (result)
333 return_VALUE(result); 329 return result;
334 330
335 return_VALUE(0); 331 return 0;
336} 332}
337 333
338int acpi_processor_notify_smm(struct module *calling_module) 334int acpi_processor_notify_smm(struct module *calling_module)
@@ -340,13 +336,12 @@ int acpi_processor_notify_smm(struct module *calling_module)
340 acpi_status status; 336 acpi_status status;
341 static int is_done = 0; 337 static int is_done = 0;
342 338
343 ACPI_FUNCTION_TRACE("acpi_processor_notify_smm");
344 339
345 if (!(acpi_processor_ppc_status & PPC_REGISTERED)) 340 if (!(acpi_processor_ppc_status & PPC_REGISTERED))
346 return_VALUE(-EBUSY); 341 return -EBUSY;
347 342
348 if (!try_module_get(calling_module)) 343 if (!try_module_get(calling_module))
349 return_VALUE(-EINVAL); 344 return -EINVAL;
350 345
351 /* is_done is set to negative if an error occured, 346 /* is_done is set to negative if an error occured,
352 * and to postitive if _no_ error occured, but SMM 347 * and to postitive if _no_ error occured, but SMM
@@ -355,10 +350,10 @@ int acpi_processor_notify_smm(struct module *calling_module)
355 */ 350 */
356 if (is_done > 0) { 351 if (is_done > 0) {
357 module_put(calling_module); 352 module_put(calling_module);
358 return_VALUE(0); 353 return 0;
359 } else if (is_done < 0) { 354 } else if (is_done < 0) {
360 module_put(calling_module); 355 module_put(calling_module);
361 return_VALUE(is_done); 356 return is_done;
362 } 357 }
363 358
364 is_done = -EIO; 359 is_done = -EIO;
@@ -367,7 +362,7 @@ int acpi_processor_notify_smm(struct module *calling_module)
367 if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { 362 if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) {
368 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n")); 363 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n"));
369 module_put(calling_module); 364 module_put(calling_module);
370 return_VALUE(0); 365 return 0;
371 } 366 }
372 367
373 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 368 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -389,7 +384,7 @@ int acpi_processor_notify_smm(struct module *calling_module)
389 "smi_cmd [0x%x]", acpi_fadt.pstate_cnt, 384 "smi_cmd [0x%x]", acpi_fadt.pstate_cnt,
390 acpi_fadt.smi_cmd)); 385 acpi_fadt.smi_cmd));
391 module_put(calling_module); 386 module_put(calling_module);
392 return_VALUE(status); 387 return status;
393 } 388 }
394 389
395 /* Success. If there's no _PPC, we need to fear nothing, so 390 /* Success. If there's no _PPC, we need to fear nothing, so
@@ -399,7 +394,7 @@ int acpi_processor_notify_smm(struct module *calling_module)
399 if (!(acpi_processor_ppc_status & PPC_IN_USE)) 394 if (!(acpi_processor_ppc_status & PPC_IN_USE))
400 module_put(calling_module); 395 module_put(calling_module);
401 396
402 return_VALUE(0); 397 return 0;
403} 398}
404 399
405EXPORT_SYMBOL(acpi_processor_notify_smm); 400EXPORT_SYMBOL(acpi_processor_notify_smm);
@@ -420,7 +415,6 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
420 struct acpi_processor *pr = (struct acpi_processor *)seq->private; 415 struct acpi_processor *pr = (struct acpi_processor *)seq->private;
421 int i; 416 int i;
422 417
423 ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show");
424 418
425 if (!pr) 419 if (!pr)
426 goto end; 420 goto end;
@@ -444,7 +438,7 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
444 (u32) pr->performance->states[i].transition_latency); 438 (u32) pr->performance->states[i].transition_latency);
445 439
446 end: 440 end:
447 return_VALUE(0); 441 return 0;
448} 442}
449 443
450static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) 444static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
@@ -466,23 +460,22 @@ acpi_processor_write_performance(struct file *file,
466 unsigned int new_state = 0; 460 unsigned int new_state = 0;
467 struct cpufreq_policy policy; 461 struct cpufreq_policy policy;
468 462
469 ACPI_FUNCTION_TRACE("acpi_processor_write_performance");
470 463
471 if (!pr || (count > sizeof(state_string) - 1)) 464 if (!pr || (count > sizeof(state_string) - 1))
472 return_VALUE(-EINVAL); 465 return -EINVAL;
473 466
474 perf = pr->performance; 467 perf = pr->performance;
475 if (!perf) 468 if (!perf)
476 return_VALUE(-EINVAL); 469 return -EINVAL;
477 470
478 if (copy_from_user(state_string, buffer, count)) 471 if (copy_from_user(state_string, buffer, count))
479 return_VALUE(-EFAULT); 472 return -EFAULT;
480 473
481 state_string[count] = '\0'; 474 state_string[count] = '\0';
482 new_state = simple_strtoul(state_string, NULL, 0); 475 new_state = simple_strtoul(state_string, NULL, 0);
483 476
484 if (new_state >= perf->state_count) 477 if (new_state >= perf->state_count)
485 return_VALUE(-EINVAL); 478 return -EINVAL;
486 479
487 cpufreq_get_policy(&policy, pr->id); 480 cpufreq_get_policy(&policy, pr->id);
488 481
@@ -492,9 +485,9 @@ acpi_processor_write_performance(struct file *file,
492 485
493 result = cpufreq_set_policy(&policy); 486 result = cpufreq_set_policy(&policy);
494 if (result) 487 if (result)
495 return_VALUE(result); 488 return result;
496 489
497 return_VALUE(count); 490 return count;
498} 491}
499 492
500static void acpi_cpufreq_add_file(struct acpi_processor *pr) 493static void acpi_cpufreq_add_file(struct acpi_processor *pr)
@@ -502,10 +495,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
502 struct proc_dir_entry *entry = NULL; 495 struct proc_dir_entry *entry = NULL;
503 struct acpi_device *device = NULL; 496 struct acpi_device *device = NULL;
504 497
505 ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile");
506 498
507 if (acpi_bus_get_device(pr->handle, &device)) 499 if (acpi_bus_get_device(pr->handle, &device))
508 return_VOID; 500 return;
509 501
510 /* add file 'performance' [R/W] */ 502 /* add file 'performance' [R/W] */
511 entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, 503 entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
@@ -517,23 +509,22 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
517 entry->data = acpi_driver_data(device); 509 entry->data = acpi_driver_data(device);
518 entry->owner = THIS_MODULE; 510 entry->owner = THIS_MODULE;
519 } 511 }
520 return_VOID; 512 return;
521} 513}
522 514
523static void acpi_cpufreq_remove_file(struct acpi_processor *pr) 515static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
524{ 516{
525 struct acpi_device *device = NULL; 517 struct acpi_device *device = NULL;
526 518
527 ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile");
528 519
529 if (acpi_bus_get_device(pr->handle, &device)) 520 if (acpi_bus_get_device(pr->handle, &device))
530 return_VOID; 521 return;
531 522
532 /* remove file 'performance' */ 523 /* remove file 'performance' */
533 remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, 524 remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
534 acpi_device_dir(device)); 525 acpi_device_dir(device));
535 526
536 return_VOID; 527 return;
537} 528}
538 529
539#else 530#else
@@ -777,22 +768,21 @@ acpi_processor_register_performance(struct acpi_processor_performance
777{ 768{
778 struct acpi_processor *pr; 769 struct acpi_processor *pr;
779 770
780 ACPI_FUNCTION_TRACE("acpi_processor_register_performance");
781 771
782 if (!(acpi_processor_ppc_status & PPC_REGISTERED)) 772 if (!(acpi_processor_ppc_status & PPC_REGISTERED))
783 return_VALUE(-EINVAL); 773 return -EINVAL;
784 774
785 mutex_lock(&performance_mutex); 775 mutex_lock(&performance_mutex);
786 776
787 pr = processors[cpu]; 777 pr = processors[cpu];
788 if (!pr) { 778 if (!pr) {
789 mutex_unlock(&performance_mutex); 779 mutex_unlock(&performance_mutex);
790 return_VALUE(-ENODEV); 780 return -ENODEV;
791 } 781 }
792 782
793 if (pr->performance) { 783 if (pr->performance) {
794 mutex_unlock(&performance_mutex); 784 mutex_unlock(&performance_mutex);
795 return_VALUE(-EBUSY); 785 return -EBUSY;
796 } 786 }
797 787
798 WARN_ON(!performance); 788 WARN_ON(!performance);
@@ -802,13 +792,13 @@ acpi_processor_register_performance(struct acpi_processor_performance
802 if (acpi_processor_get_performance_info(pr)) { 792 if (acpi_processor_get_performance_info(pr)) {
803 pr->performance = NULL; 793 pr->performance = NULL;
804 mutex_unlock(&performance_mutex); 794 mutex_unlock(&performance_mutex);
805 return_VALUE(-EIO); 795 return -EIO;
806 } 796 }
807 797
808 acpi_cpufreq_add_file(pr); 798 acpi_cpufreq_add_file(pr);
809 799
810 mutex_unlock(&performance_mutex); 800 mutex_unlock(&performance_mutex);
811 return_VALUE(0); 801 return 0;
812} 802}
813 803
814EXPORT_SYMBOL(acpi_processor_register_performance); 804EXPORT_SYMBOL(acpi_processor_register_performance);
@@ -819,14 +809,13 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
819{ 809{
820 struct acpi_processor *pr; 810 struct acpi_processor *pr;
821 811
822 ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance");
823 812
824 mutex_lock(&performance_mutex); 813 mutex_lock(&performance_mutex);
825 814
826 pr = processors[cpu]; 815 pr = processors[cpu];
827 if (!pr) { 816 if (!pr) {
828 mutex_unlock(&performance_mutex); 817 mutex_unlock(&performance_mutex);
829 return_VOID; 818 return;
830 } 819 }
831 820
832 if (pr->performance) 821 if (pr->performance)
@@ -837,7 +826,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
837 826
838 mutex_unlock(&performance_mutex); 827 mutex_unlock(&performance_mutex);
839 828
840 return_VOID; 829 return;
841} 830}
842 831
843EXPORT_SYMBOL(acpi_processor_unregister_performance); 832EXPORT_SYMBOL(acpi_processor_unregister_performance);
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
index 0f86d0253c60..ef5e0f6efdba 100644
--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -54,13 +54,12 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr)
54 u16 px = 0; 54 u16 px = 0;
55 u16 tx = 0; 55 u16 tx = 0;
56 56
57 ACPI_FUNCTION_TRACE("acpi_processor_apply_limit");
58 57
59 if (!pr) 58 if (!pr)
60 return_VALUE(-EINVAL); 59 return -EINVAL;
61 60
62 if (!pr->flags.limit) 61 if (!pr->flags.limit)
63 return_VALUE(-ENODEV); 62 return -ENODEV;
64 63
65 if (pr->flags.throttling) { 64 if (pr->flags.throttling) {
66 if (pr->limit.user.tx > tx) 65 if (pr->limit.user.tx > tx)
@@ -84,7 +83,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr)
84 if (result) 83 if (result)
85 printk(KERN_ERR PREFIX "Unable to set limit\n"); 84 printk(KERN_ERR PREFIX "Unable to set limit\n");
86 85
87 return_VALUE(result); 86 return result;
88} 87}
89 88
90#ifdef CONFIG_CPU_FREQ 89#ifdef CONFIG_CPU_FREQ
@@ -200,19 +199,18 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type)
200 struct acpi_device *device = NULL; 199 struct acpi_device *device = NULL;
201 int tx = 0, max_tx_px = 0; 200 int tx = 0, max_tx_px = 0;
202 201
203 ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit");
204 202
205 if ((type < ACPI_PROCESSOR_LIMIT_NONE) 203 if ((type < ACPI_PROCESSOR_LIMIT_NONE)
206 || (type > ACPI_PROCESSOR_LIMIT_DECREMENT)) 204 || (type > ACPI_PROCESSOR_LIMIT_DECREMENT))
207 return_VALUE(-EINVAL); 205 return -EINVAL;
208 206
209 result = acpi_bus_get_device(handle, &device); 207 result = acpi_bus_get_device(handle, &device);
210 if (result) 208 if (result)
211 return_VALUE(result); 209 return result;
212 210
213 pr = (struct acpi_processor *)acpi_driver_data(device); 211 pr = (struct acpi_processor *)acpi_driver_data(device);
214 if (!pr) 212 if (!pr)
215 return_VALUE(-ENODEV); 213 return -ENODEV;
216 214
217 /* Thermal limits are always relative to the current Px/Tx state. */ 215 /* Thermal limits are always relative to the current Px/Tx state. */
218 if (pr->flags.throttling) 216 if (pr->flags.throttling)
@@ -296,22 +294,21 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type)
296 } else 294 } else
297 result = 0; 295 result = 0;
298 if (max_tx_px) 296 if (max_tx_px)
299 return_VALUE(1); 297 return 1;
300 else 298 else
301 return_VALUE(result); 299 return result;
302} 300}
303 301
304int acpi_processor_get_limit_info(struct acpi_processor *pr) 302int acpi_processor_get_limit_info(struct acpi_processor *pr)
305{ 303{
306 ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info");
307 304
308 if (!pr) 305 if (!pr)
309 return_VALUE(-EINVAL); 306 return -EINVAL;
310 307
311 if (pr->flags.throttling) 308 if (pr->flags.throttling)
312 pr->flags.limit = 1; 309 pr->flags.limit = 1;
313 310
314 return_VALUE(0); 311 return 0;
315} 312}
316 313
317/* /proc interface */ 314/* /proc interface */
@@ -320,7 +317,6 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
320{ 317{
321 struct acpi_processor *pr = (struct acpi_processor *)seq->private; 318 struct acpi_processor *pr = (struct acpi_processor *)seq->private;
322 319
323 ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show");
324 320
325 if (!pr) 321 if (!pr)
326 goto end; 322 goto end;
@@ -338,7 +334,7 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
338 pr->limit.thermal.px, pr->limit.thermal.tx); 334 pr->limit.thermal.px, pr->limit.thermal.tx);
339 335
340 end: 336 end:
341 return_VALUE(0); 337 return 0;
342} 338}
343 339
344static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) 340static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file)
@@ -358,34 +354,33 @@ static ssize_t acpi_processor_write_limit(struct file * file,
358 int px = 0; 354 int px = 0;
359 int tx = 0; 355 int tx = 0;
360 356
361 ACPI_FUNCTION_TRACE("acpi_processor_write_limit");
362 357
363 if (!pr || (count > sizeof(limit_string) - 1)) { 358 if (!pr || (count > sizeof(limit_string) - 1)) {
364 return_VALUE(-EINVAL); 359 return -EINVAL;
365 } 360 }
366 361
367 if (copy_from_user(limit_string, buffer, count)) { 362 if (copy_from_user(limit_string, buffer, count)) {
368 return_VALUE(-EFAULT); 363 return -EFAULT;
369 } 364 }
370 365
371 limit_string[count] = '\0'; 366 limit_string[count] = '\0';
372 367
373 if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { 368 if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) {
374 printk(KERN_ERR PREFIX "Invalid data format\n"); 369 printk(KERN_ERR PREFIX "Invalid data format\n");
375 return_VALUE(-EINVAL); 370 return -EINVAL;
376 } 371 }
377 372
378 if (pr->flags.throttling) { 373 if (pr->flags.throttling) {
379 if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { 374 if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) {
380 printk(KERN_ERR PREFIX "Invalid tx\n"); 375 printk(KERN_ERR PREFIX "Invalid tx\n");
381 return_VALUE(-EINVAL); 376 return -EINVAL;
382 } 377 }
383 pr->limit.user.tx = tx; 378 pr->limit.user.tx = tx;
384 } 379 }
385 380
386 result = acpi_processor_apply_limit(pr); 381 result = acpi_processor_apply_limit(pr);
387 382
388 return_VALUE(count); 383 return count;
389} 384}
390 385
391struct file_operations acpi_processor_limit_fops = { 386struct file_operations acpi_processor_limit_fops = {
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 2de40bd5fdff..d044ec519db0 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -55,13 +55,12 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
55 u32 duty_mask = 0; 55 u32 duty_mask = 0;
56 u32 duty_value = 0; 56 u32 duty_value = 0;
57 57
58 ACPI_FUNCTION_TRACE("acpi_processor_get_throttling");
59 58
60 if (!pr) 59 if (!pr)
61 return_VALUE(-EINVAL); 60 return -EINVAL;
62 61
63 if (!pr->flags.throttling) 62 if (!pr->flags.throttling)
64 return_VALUE(-ENODEV); 63 return -ENODEV;
65 64
66 pr->throttling.state = 0; 65 pr->throttling.state = 0;
67 66
@@ -93,7 +92,7 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
93 "Throttling state is T%d (%d%% throttling applied)\n", 92 "Throttling state is T%d (%d%% throttling applied)\n",
94 state, pr->throttling.states[state].performance)); 93 state, pr->throttling.states[state].performance));
95 94
96 return_VALUE(0); 95 return 0;
97} 96}
98 97
99int acpi_processor_set_throttling(struct acpi_processor *pr, int state) 98int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
@@ -102,19 +101,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
102 u32 duty_mask = 0; 101 u32 duty_mask = 0;
103 u32 duty_value = 0; 102 u32 duty_value = 0;
104 103
105 ACPI_FUNCTION_TRACE("acpi_processor_set_throttling");
106 104
107 if (!pr) 105 if (!pr)
108 return_VALUE(-EINVAL); 106 return -EINVAL;
109 107
110 if ((state < 0) || (state > (pr->throttling.state_count - 1))) 108 if ((state < 0) || (state > (pr->throttling.state_count - 1)))
111 return_VALUE(-EINVAL); 109 return -EINVAL;
112 110
113 if (!pr->flags.throttling) 111 if (!pr->flags.throttling)
114 return_VALUE(-ENODEV); 112 return -ENODEV;
115 113
116 if (state == pr->throttling.state) 114 if (state == pr->throttling.state)
117 return_VALUE(0); 115 return 0;
118 116
119 /* 117 /*
120 * Calculate the duty_value and duty_mask. 118 * Calculate the duty_value and duty_mask.
@@ -165,7 +163,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
165 (pr->throttling.states[state].performance ? pr-> 163 (pr->throttling.states[state].performance ? pr->
166 throttling.states[state].performance / 10 : 0))); 164 throttling.states[state].performance / 10 : 0)));
167 165
168 return_VALUE(0); 166 return 0;
169} 167}
170 168
171int acpi_processor_get_throttling_info(struct acpi_processor *pr) 169int acpi_processor_get_throttling_info(struct acpi_processor *pr)
@@ -174,7 +172,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
174 int step = 0; 172 int step = 0;
175 int i = 0; 173 int i = 0;
176 174
177 ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info");
178 175
179 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 176 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
180 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", 177 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
@@ -183,21 +180,21 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
183 pr->throttling.duty_width)); 180 pr->throttling.duty_width));
184 181
185 if (!pr) 182 if (!pr)
186 return_VALUE(-EINVAL); 183 return -EINVAL;
187 184
188 /* TBD: Support ACPI 2.0 objects */ 185 /* TBD: Support ACPI 2.0 objects */
189 186
190 if (!pr->throttling.address) { 187 if (!pr->throttling.address) {
191 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); 188 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
192 return_VALUE(0); 189 return 0;
193 } else if (!pr->throttling.duty_width) { 190 } else if (!pr->throttling.duty_width) {
194 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); 191 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
195 return_VALUE(0); 192 return 0;
196 } 193 }
197 /* TBD: Support duty_cycle values that span bit 4. */ 194 /* TBD: Support duty_cycle values that span bit 4. */
198 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { 195 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
199 printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); 196 printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
200 return_VALUE(0); 197 return 0;
201 } 198 }
202 199
203 /* 200 /*
@@ -208,7 +205,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
208 if (errata.piix4.throttle) { 205 if (errata.piix4.throttle) {
209 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 206 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
210 "Throttling not supported on PIIX4 A- or B-step\n")); 207 "Throttling not supported on PIIX4 A- or B-step\n"));
211 return_VALUE(0); 208 return 0;
212 } 209 }
213 210
214 pr->throttling.state_count = 1 << acpi_fadt.duty_width; 211 pr->throttling.state_count = 1 << acpi_fadt.duty_width;
@@ -254,7 +251,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
254 if (result) 251 if (result)
255 pr->flags.throttling = 0; 252 pr->flags.throttling = 0;
256 253
257 return_VALUE(result); 254 return result;
258} 255}
259 256
260/* proc interface */ 257/* proc interface */
@@ -266,7 +263,6 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq,
266 int i = 0; 263 int i = 0;
267 int result = 0; 264 int result = 0;
268 265
269 ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show");
270 266
271 if (!pr) 267 if (!pr)
272 goto end; 268 goto end;
@@ -296,7 +292,7 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq,
296 throttling.states[i].performance / 10 : 0)); 292 throttling.states[i].performance / 10 : 0));
297 293
298 end: 294 end:
299 return_VALUE(0); 295 return 0;
300} 296}
301 297
302static int acpi_processor_throttling_open_fs(struct inode *inode, 298static int acpi_processor_throttling_open_fs(struct inode *inode,
@@ -315,13 +311,12 @@ static ssize_t acpi_processor_write_throttling(struct file * file,
315 struct acpi_processor *pr = (struct acpi_processor *)m->private; 311 struct acpi_processor *pr = (struct acpi_processor *)m->private;
316 char state_string[12] = { '\0' }; 312 char state_string[12] = { '\0' };
317 313
318 ACPI_FUNCTION_TRACE("acpi_processor_write_throttling");
319 314
320 if (!pr || (count > sizeof(state_string) - 1)) 315 if (!pr || (count > sizeof(state_string) - 1))
321 return_VALUE(-EINVAL); 316 return -EINVAL;
322 317
323 if (copy_from_user(state_string, buffer, count)) 318 if (copy_from_user(state_string, buffer, count))
324 return_VALUE(-EFAULT); 319 return -EFAULT;
325 320
326 state_string[count] = '\0'; 321 state_string[count] = '\0';
327 322
@@ -329,9 +324,9 @@ static ssize_t acpi_processor_write_throttling(struct file * file,
329 simple_strtoul(state_string, 324 simple_strtoul(state_string,
330 NULL, 0)); 325 NULL, 0));
331 if (result) 326 if (result)
332 return_VALUE(result); 327 return result;
333 328
334 return_VALUE(count); 329 return count;
335} 330}
336 331
337struct file_operations acpi_processor_throttling_fops = { 332struct file_operations acpi_processor_throttling_fops = {
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 18c8e3e2fbad..a7b1fda572cf 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -162,11 +162,10 @@ static void acpi_device_unregister(struct acpi_device *device, int type)
162 162
163void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) 163void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
164{ 164{
165 ACPI_FUNCTION_TRACE("acpi_bus_data_handler");
166 165
167 /* TBD */ 166 /* TBD */
168 167
169 return_VOID; 168 return;
170} 169}
171 170
172static int acpi_bus_get_power_flags(struct acpi_device *device) 171static int acpi_bus_get_power_flags(struct acpi_device *device)
@@ -175,7 +174,6 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
175 acpi_handle handle = NULL; 174 acpi_handle handle = NULL;
176 u32 i = 0; 175 u32 i = 0;
177 176
178 ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags");
179 177
180 /* 178 /*
181 * Power Management Flags 179 * Power Management Flags
@@ -228,7 +226,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
228 226
229 device->power.state = ACPI_STATE_UNKNOWN; 227 device->power.state = ACPI_STATE_UNKNOWN;
230 228
231 return_VALUE(0); 229 return 0;
232} 230}
233 231
234int acpi_match_ids(struct acpi_device *device, char *ids) 232int acpi_match_ids(struct acpi_device *device, char *ids)
@@ -306,7 +304,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
306 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 304 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
307 union acpi_object *package = NULL; 305 union acpi_object *package = NULL;
308 306
309 ACPI_FUNCTION_TRACE("acpi_bus_get_wakeup_flags");
310 307
311 /* _PRW */ 308 /* _PRW */
312 status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); 309 status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer);
@@ -332,7 +329,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
332 end: 329 end:
333 if (ACPI_FAILURE(status)) 330 if (ACPI_FAILURE(status))
334 device->flags.wake_capable = 0; 331 device->flags.wake_capable = 0;
335 return_VALUE(0); 332 return 0;
336} 333}
337 334
338/* -------------------------------------------------------------------------- 335/* --------------------------------------------------------------------------
@@ -488,19 +485,18 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
488{ 485{
489 int result = 0; 486 int result = 0;
490 487
491 ACPI_FUNCTION_TRACE("acpi_bus_driver_init");
492 488
493 if (!device || !driver) 489 if (!device || !driver)
494 return_VALUE(-EINVAL); 490 return -EINVAL;
495 491
496 if (!driver->ops.add) 492 if (!driver->ops.add)
497 return_VALUE(-ENOSYS); 493 return -ENOSYS;
498 494
499 result = driver->ops.add(device); 495 result = driver->ops.add(device);
500 if (result) { 496 if (result) {
501 device->driver = NULL; 497 device->driver = NULL;
502 acpi_driver_data(device) = NULL; 498 acpi_driver_data(device) = NULL;
503 return_VALUE(result); 499 return result;
504 } 500 }
505 501
506 device->driver = driver; 502 device->driver = driver;
@@ -512,7 +508,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
512 508
513 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 509 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
514 "Driver successfully bound to device\n")); 510 "Driver successfully bound to device\n"));
515 return_VALUE(0); 511 return 0;
516} 512}
517 513
518static int acpi_start_single_object(struct acpi_device *device) 514static int acpi_start_single_object(struct acpi_device *device)
@@ -520,10 +516,9 @@ static int acpi_start_single_object(struct acpi_device *device)
520 int result = 0; 516 int result = 0;
521 struct acpi_driver *driver; 517 struct acpi_driver *driver;
522 518
523 ACPI_FUNCTION_TRACE("acpi_start_single_object");
524 519
525 if (!(driver = device->driver)) 520 if (!(driver = device->driver))
526 return_VALUE(0); 521 return 0;
527 522
528 if (driver->ops.start) { 523 if (driver->ops.start) {
529 result = driver->ops.start(device); 524 result = driver->ops.start(device);
@@ -531,14 +526,13 @@ static int acpi_start_single_object(struct acpi_device *device)
531 driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); 526 driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
532 } 527 }
533 528
534 return_VALUE(result); 529 return result;
535} 530}
536 531
537static void acpi_driver_attach(struct acpi_driver *drv) 532static void acpi_driver_attach(struct acpi_driver *drv)
538{ 533{
539 struct list_head *node, *next; 534 struct list_head *node, *next;
540 535
541 ACPI_FUNCTION_TRACE("acpi_driver_attach");
542 536
543 spin_lock(&acpi_device_lock); 537 spin_lock(&acpi_device_lock);
544 list_for_each_safe(node, next, &acpi_device_list) { 538 list_for_each_safe(node, next, &acpi_device_list) {
@@ -567,7 +561,6 @@ static void acpi_driver_detach(struct acpi_driver *drv)
567{ 561{
568 struct list_head *node, *next; 562 struct list_head *node, *next;
569 563
570 ACPI_FUNCTION_TRACE("acpi_driver_detach");
571 564
572 spin_lock(&acpi_device_lock); 565 spin_lock(&acpi_device_lock);
573 list_for_each_safe(node, next, &acpi_device_list) { 566 list_for_each_safe(node, next, &acpi_device_list) {
@@ -597,17 +590,16 @@ static void acpi_driver_detach(struct acpi_driver *drv)
597 */ 590 */
598int acpi_bus_register_driver(struct acpi_driver *driver) 591int acpi_bus_register_driver(struct acpi_driver *driver)
599{ 592{
600 ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
601 593
602 if (acpi_disabled) 594 if (acpi_disabled)
603 return_VALUE(-ENODEV); 595 return -ENODEV;
604 596
605 spin_lock(&acpi_device_lock); 597 spin_lock(&acpi_device_lock);
606 list_add_tail(&driver->node, &acpi_bus_drivers); 598 list_add_tail(&driver->node, &acpi_bus_drivers);
607 spin_unlock(&acpi_device_lock); 599 spin_unlock(&acpi_device_lock);
608 acpi_driver_attach(driver); 600 acpi_driver_attach(driver);
609 601
610 return_VALUE(0); 602 return 0;
611} 603}
612 604
613EXPORT_SYMBOL(acpi_bus_register_driver); 605EXPORT_SYMBOL(acpi_bus_register_driver);
@@ -645,7 +637,6 @@ static int acpi_bus_find_driver(struct acpi_device *device)
645 int result = 0; 637 int result = 0;
646 struct list_head *node, *next; 638 struct list_head *node, *next;
647 639
648 ACPI_FUNCTION_TRACE("acpi_bus_find_driver");
649 640
650 spin_lock(&acpi_device_lock); 641 spin_lock(&acpi_device_lock);
651 list_for_each_safe(node, next, &acpi_bus_drivers) { 642 list_for_each_safe(node, next, &acpi_bus_drivers) {
@@ -665,7 +656,7 @@ static int acpi_bus_find_driver(struct acpi_device *device)
665 spin_unlock(&acpi_device_lock); 656 spin_unlock(&acpi_device_lock);
666 657
667 Done: 658 Done:
668 return_VALUE(result); 659 return result;
669} 660}
670 661
671/* -------------------------------------------------------------------------- 662/* --------------------------------------------------------------------------
@@ -677,7 +668,6 @@ static int acpi_bus_get_flags(struct acpi_device *device)
677 acpi_status status = AE_OK; 668 acpi_status status = AE_OK;
678 acpi_handle temp = NULL; 669 acpi_handle temp = NULL;
679 670
680 ACPI_FUNCTION_TRACE("acpi_bus_get_flags");
681 671
682 /* Presence of _STA indicates 'dynamic_status' */ 672 /* Presence of _STA indicates 'dynamic_status' */
683 status = acpi_get_handle(device->handle, "_STA", &temp); 673 status = acpi_get_handle(device->handle, "_STA", &temp);
@@ -723,7 +713,7 @@ static int acpi_bus_get_flags(struct acpi_device *device)
723 713
724 /* TBD: Peformance management */ 714 /* TBD: Peformance management */
725 715
726 return_VALUE(0); 716 return 0;
727} 717}
728 718
729static void acpi_device_get_busid(struct acpi_device *device, 719static void acpi_device_get_busid(struct acpi_device *device,
@@ -917,10 +907,9 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
917 int result = 0; 907 int result = 0;
918 struct acpi_driver *driver; 908 struct acpi_driver *driver;
919 909
920 ACPI_FUNCTION_TRACE("acpi_bus_remove");
921 910
922 if (!dev) 911 if (!dev)
923 return_VALUE(-EINVAL); 912 return -EINVAL;
924 913
925 driver = dev->driver; 914 driver = dev->driver;
926 915
@@ -929,12 +918,12 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
929 if (driver->ops.stop) { 918 if (driver->ops.stop) {
930 result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT); 919 result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT);
931 if (result) 920 if (result)
932 return_VALUE(result); 921 return result;
933 } 922 }
934 923
935 result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT); 924 result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT);
936 if (result) { 925 if (result) {
937 return_VALUE(result); 926 return result;
938 } 927 }
939 928
940 atomic_dec(&dev->driver->references); 929 atomic_dec(&dev->driver->references);
@@ -943,7 +932,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
943 } 932 }
944 933
945 if (!rmdevice) 934 if (!rmdevice)
946 return_VALUE(0); 935 return 0;
947 936
948 if (dev->flags.bus_address) { 937 if (dev->flags.bus_address) {
949 if ((dev->parent) && (dev->parent->ops.unbind)) 938 if ((dev->parent) && (dev->parent->ops.unbind))
@@ -952,7 +941,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
952 941
953 acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); 942 acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT);
954 943
955 return_VALUE(0); 944 return 0;
956} 945}
957 946
958static int 947static int
@@ -962,15 +951,14 @@ acpi_add_single_object(struct acpi_device **child,
962 int result = 0; 951 int result = 0;
963 struct acpi_device *device = NULL; 952 struct acpi_device *device = NULL;
964 953
965 ACPI_FUNCTION_TRACE("acpi_add_single_object");
966 954
967 if (!child) 955 if (!child)
968 return_VALUE(-EINVAL); 956 return -EINVAL;
969 957
970 device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); 958 device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL);
971 if (!device) { 959 if (!device) {
972 printk(KERN_ERR PREFIX "Memory allocation error\n"); 960 printk(KERN_ERR PREFIX "Memory allocation error\n");
973 return_VALUE(-ENOMEM); 961 return -ENOMEM;
974 } 962 }
975 memset(device, 0, sizeof(struct acpi_device)); 963 memset(device, 0, sizeof(struct acpi_device));
976 964
@@ -1095,7 +1083,7 @@ acpi_add_single_object(struct acpi_device **child,
1095 kfree(device); 1083 kfree(device);
1096 } 1084 }
1097 1085
1098 return_VALUE(result); 1086 return result;
1099} 1087}
1100 1088
1101static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) 1089static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
@@ -1108,10 +1096,9 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
1108 acpi_object_type type = 0; 1096 acpi_object_type type = 0;
1109 u32 level = 1; 1097 u32 level = 1;
1110 1098
1111 ACPI_FUNCTION_TRACE("acpi_bus_scan");
1112 1099
1113 if (!start) 1100 if (!start)
1114 return_VALUE(-EINVAL); 1101 return -EINVAL;
1115 1102
1116 parent = start; 1103 parent = start;
1117 phandle = start->handle; 1104 phandle = start->handle;
@@ -1208,7 +1195,7 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
1208 } 1195 }
1209 } 1196 }
1210 1197
1211 return_VALUE(0); 1198 return 0;
1212} 1199}
1213 1200
1214int 1201int
@@ -1218,7 +1205,6 @@ acpi_bus_add(struct acpi_device **child,
1218 int result; 1205 int result;
1219 struct acpi_bus_ops ops; 1206 struct acpi_bus_ops ops;
1220 1207
1221 ACPI_FUNCTION_TRACE("acpi_bus_add");
1222 1208
1223 result = acpi_add_single_object(child, parent, handle, type); 1209 result = acpi_add_single_object(child, parent, handle, type);
1224 if (!result) { 1210 if (!result) {
@@ -1226,7 +1212,7 @@ acpi_bus_add(struct acpi_device **child,
1226 ops.acpi_op_add = 1; 1212 ops.acpi_op_add = 1;
1227 result = acpi_bus_scan(*child, &ops); 1213 result = acpi_bus_scan(*child, &ops);
1228 } 1214 }
1229 return_VALUE(result); 1215 return result;
1230} 1216}
1231 1217
1232EXPORT_SYMBOL(acpi_bus_add); 1218EXPORT_SYMBOL(acpi_bus_add);
@@ -1236,10 +1222,9 @@ int acpi_bus_start(struct acpi_device *device)
1236 int result; 1222 int result;
1237 struct acpi_bus_ops ops; 1223 struct acpi_bus_ops ops;
1238 1224
1239 ACPI_FUNCTION_TRACE("acpi_bus_start");
1240 1225
1241 if (!device) 1226 if (!device)
1242 return_VALUE(-EINVAL); 1227 return -EINVAL;
1243 1228
1244 result = acpi_start_single_object(device); 1229 result = acpi_start_single_object(device);
1245 if (!result) { 1230 if (!result) {
@@ -1247,7 +1232,7 @@ int acpi_bus_start(struct acpi_device *device)
1247 ops.acpi_op_start = 1; 1232 ops.acpi_op_start = 1;
1248 result = acpi_bus_scan(device, &ops); 1233 result = acpi_bus_scan(device, &ops);
1249 } 1234 }
1250 return_VALUE(result); 1235 return result;
1251} 1236}
1252 1237
1253EXPORT_SYMBOL(acpi_bus_start); 1238EXPORT_SYMBOL(acpi_bus_start);
@@ -1313,10 +1298,9 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
1313 int result = 0; 1298 int result = 0;
1314 struct acpi_device *device = NULL; 1299 struct acpi_device *device = NULL;
1315 1300
1316 ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
1317 1301
1318 if (!root) 1302 if (!root)
1319 return_VALUE(-ENODEV); 1303 return -ENODEV;
1320 1304
1321 /* 1305 /*
1322 * Enumerate all fixed-feature devices. 1306 * Enumerate all fixed-feature devices.
@@ -1337,7 +1321,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
1337 result = acpi_start_single_object(device); 1321 result = acpi_start_single_object(device);
1338 } 1322 }
1339 1323
1340 return_VALUE(result); 1324 return result;
1341} 1325}
1342 1326
1343 1327
@@ -1439,10 +1423,9 @@ static int __init acpi_scan_init(void)
1439 int result; 1423 int result;
1440 struct acpi_bus_ops ops; 1424 struct acpi_bus_ops ops;
1441 1425
1442 ACPI_FUNCTION_TRACE("acpi_scan_init");
1443 1426
1444 if (acpi_disabled) 1427 if (acpi_disabled)
1445 return_VALUE(0); 1428 return 0;
1446 1429
1447 kset_register(&acpi_namespace_kset); 1430 kset_register(&acpi_namespace_kset);
1448 1431
@@ -1487,7 +1470,7 @@ static int __init acpi_scan_init(void)
1487 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); 1470 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
1488 1471
1489 Done: 1472 Done:
1490 return_VALUE(result); 1473 return result;
1491} 1474}
1492 1475
1493subsys_initcall(acpi_scan_init); 1476subsys_initcall(acpi_scan_init);
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index 56a746bad495..c90bd2f70b3f 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -47,10 +47,9 @@ extern struct fadt_descriptor acpi_fadt;
47 47
48static int acpi_system_read_info(struct seq_file *seq, void *offset) 48static int acpi_system_read_info(struct seq_file *seq, void *offset)
49{ 49{
50 ACPI_FUNCTION_TRACE("acpi_system_read_info");
51 50
52 seq_printf(seq, "version: %x\n", ACPI_CA_VERSION); 51 seq_printf(seq, "version: %x\n", ACPI_CA_VERSION);
53 return_VALUE(0); 52 return 0;
54} 53}
55 54
56static int acpi_system_info_open_fs(struct inode *inode, struct file *file) 55static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
@@ -80,17 +79,16 @@ acpi_system_read_dsdt(struct file *file,
80 struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; 79 struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
81 ssize_t res; 80 ssize_t res;
82 81
83 ACPI_FUNCTION_TRACE("acpi_system_read_dsdt");
84 82
85 status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); 83 status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
86 if (ACPI_FAILURE(status)) 84 if (ACPI_FAILURE(status))
87 return_VALUE(-ENODEV); 85 return -ENODEV;
88 86
89 res = simple_read_from_buffer(buffer, count, ppos, 87 res = simple_read_from_buffer(buffer, count, ppos,
90 dsdt.pointer, dsdt.length); 88 dsdt.pointer, dsdt.length);
91 acpi_os_free(dsdt.pointer); 89 acpi_os_free(dsdt.pointer);
92 90
93 return_VALUE(res); 91 return res;
94} 92}
95 93
96static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, 94static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t,
@@ -108,17 +106,16 @@ acpi_system_read_fadt(struct file *file,
108 struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL }; 106 struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL };
109 ssize_t res; 107 ssize_t res;
110 108
111 ACPI_FUNCTION_TRACE("acpi_system_read_fadt");
112 109
113 status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); 110 status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt);
114 if (ACPI_FAILURE(status)) 111 if (ACPI_FAILURE(status))
115 return_VALUE(-ENODEV); 112 return -ENODEV;
116 113
117 res = simple_read_from_buffer(buffer, count, ppos, 114 res = simple_read_from_buffer(buffer, count, ppos,
118 fadt.pointer, fadt.length); 115 fadt.pointer, fadt.length);
119 acpi_os_free(fadt.pointer); 116 acpi_os_free(fadt.pointer);
120 117
121 return_VALUE(res); 118 return res;
122} 119}
123 120
124static int __init acpi_system_init(void) 121static int __init acpi_system_init(void)
@@ -127,10 +124,9 @@ static int __init acpi_system_init(void)
127 int error = 0; 124 int error = 0;
128 char *name; 125 char *name;
129 126
130 ACPI_FUNCTION_TRACE("acpi_system_init");
131 127
132 if (acpi_disabled) 128 if (acpi_disabled)
133 return_VALUE(0); 129 return 0;
134 130
135 /* 'info' [R] */ 131 /* 'info' [R] */
136 name = ACPI_SYSTEM_FILE_INFO; 132 name = ACPI_SYSTEM_FILE_INFO;
@@ -158,7 +154,7 @@ static int __init acpi_system_init(void)
158 goto Error; 154 goto Error;
159 155
160 Done: 156 Done:
161 return_VALUE(error); 157 return error;
162 158
163 Error: 159 Error:
164 remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); 160 remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir);
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 1b9754919f72..c855f4446b5f 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -222,51 +222,48 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
222{ 222{
223 acpi_status status = AE_OK; 223 acpi_status status = AE_OK;
224 224
225 ACPI_FUNCTION_TRACE("acpi_thermal_get_temperature");
226 225
227 if (!tz) 226 if (!tz)
228 return_VALUE(-EINVAL); 227 return -EINVAL;
229 228
230 tz->last_temperature = tz->temperature; 229 tz->last_temperature = tz->temperature;
231 230
232 status = 231 status =
233 acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); 232 acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature);
234 if (ACPI_FAILURE(status)) 233 if (ACPI_FAILURE(status))
235 return_VALUE(-ENODEV); 234 return -ENODEV;
236 235
237 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", 236 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n",
238 tz->temperature)); 237 tz->temperature));
239 238
240 return_VALUE(0); 239 return 0;
241} 240}
242 241
243static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) 242static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
244{ 243{
245 acpi_status status = AE_OK; 244 acpi_status status = AE_OK;
246 245
247 ACPI_FUNCTION_TRACE("acpi_thermal_get_polling_frequency");
248 246
249 if (!tz) 247 if (!tz)
250 return_VALUE(-EINVAL); 248 return -EINVAL;
251 249
252 status = 250 status =
253 acpi_evaluate_integer(tz->handle, "_TZP", NULL, 251 acpi_evaluate_integer(tz->handle, "_TZP", NULL,
254 &tz->polling_frequency); 252 &tz->polling_frequency);
255 if (ACPI_FAILURE(status)) 253 if (ACPI_FAILURE(status))
256 return_VALUE(-ENODEV); 254 return -ENODEV;
257 255
258 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", 256 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n",
259 tz->polling_frequency)); 257 tz->polling_frequency));
260 258
261 return_VALUE(0); 259 return 0;
262} 260}
263 261
264static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) 262static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
265{ 263{
266 ACPI_FUNCTION_TRACE("acpi_thermal_set_polling");
267 264
268 if (!tz) 265 if (!tz)
269 return_VALUE(-EINVAL); 266 return -EINVAL;
270 267
271 tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ 268 tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */
272 269
@@ -274,7 +271,7 @@ static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
274 "Polling frequency set to %lu seconds\n", 271 "Polling frequency set to %lu seconds\n",
275 tz->polling_frequency)); 272 tz->polling_frequency));
276 273
277 return_VALUE(0); 274 return 0;
278} 275}
279 276
280static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) 277static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
@@ -284,29 +281,28 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
284 struct acpi_object_list arg_list = { 1, &arg0 }; 281 struct acpi_object_list arg_list = { 1, &arg0 };
285 acpi_handle handle = NULL; 282 acpi_handle handle = NULL;
286 283
287 ACPI_FUNCTION_TRACE("acpi_thermal_set_cooling_mode");
288 284
289 if (!tz) 285 if (!tz)
290 return_VALUE(-EINVAL); 286 return -EINVAL;
291 287
292 status = acpi_get_handle(tz->handle, "_SCP", &handle); 288 status = acpi_get_handle(tz->handle, "_SCP", &handle);
293 if (ACPI_FAILURE(status)) { 289 if (ACPI_FAILURE(status)) {
294 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); 290 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
295 return_VALUE(-ENODEV); 291 return -ENODEV;
296 } 292 }
297 293
298 arg0.integer.value = mode; 294 arg0.integer.value = mode;
299 295
300 status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); 296 status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
301 if (ACPI_FAILURE(status)) 297 if (ACPI_FAILURE(status))
302 return_VALUE(-ENODEV); 298 return -ENODEV;
303 299
304 tz->cooling_mode = mode; 300 tz->cooling_mode = mode;
305 301
306 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", 302 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n",
307 mode ? "passive" : "active")); 303 mode ? "passive" : "active"));
308 304
309 return_VALUE(0); 305 return 0;
310} 306}
311 307
312static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) 308static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
@@ -314,10 +310,9 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
314 acpi_status status = AE_OK; 310 acpi_status status = AE_OK;
315 int i = 0; 311 int i = 0;
316 312
317 ACPI_FUNCTION_TRACE("acpi_thermal_get_trip_points");
318 313
319 if (!tz) 314 if (!tz)
320 return_VALUE(-EINVAL); 315 return -EINVAL;
321 316
322 /* Critical Shutdown (required) */ 317 /* Critical Shutdown (required) */
323 318
@@ -326,7 +321,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
326 if (ACPI_FAILURE(status)) { 321 if (ACPI_FAILURE(status)) {
327 tz->trips.critical.flags.valid = 0; 322 tz->trips.critical.flags.valid = 0;
328 ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); 323 ACPI_EXCEPTION((AE_INFO, status, "No critical threshold"));
329 return_VALUE(-ENODEV); 324 return -ENODEV;
330 } else { 325 } else {
331 tz->trips.critical.flags.valid = 1; 326 tz->trips.critical.flags.valid = 1;
332 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 327 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -417,24 +412,23 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
417 "Invalid active threshold [%d]", i)); 412 "Invalid active threshold [%d]", i));
418 } 413 }
419 414
420 return_VALUE(0); 415 return 0;
421} 416}
422 417
423static int acpi_thermal_get_devices(struct acpi_thermal *tz) 418static int acpi_thermal_get_devices(struct acpi_thermal *tz)
424{ 419{
425 acpi_status status = AE_OK; 420 acpi_status status = AE_OK;
426 421
427 ACPI_FUNCTION_TRACE("acpi_thermal_get_devices");
428 422
429 if (!tz) 423 if (!tz)
430 return_VALUE(-EINVAL); 424 return -EINVAL;
431 425
432 status = 426 status =
433 acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); 427 acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices);
434 if (ACPI_FAILURE(status)) 428 if (ACPI_FAILURE(status))
435 return_VALUE(-ENODEV); 429 return -ENODEV;
436 430
437 return_VALUE(0); 431 return 0;
438} 432}
439 433
440static int acpi_thermal_call_usermode(char *path) 434static int acpi_thermal_call_usermode(char *path)
@@ -442,10 +436,9 @@ static int acpi_thermal_call_usermode(char *path)
442 char *argv[2] = { NULL, NULL }; 436 char *argv[2] = { NULL, NULL };
443 char *envp[3] = { NULL, NULL, NULL }; 437 char *envp[3] = { NULL, NULL, NULL };
444 438
445 ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode");
446 439
447 if (!path) 440 if (!path)
448 return_VALUE(-EINVAL); 441 return -EINVAL;
449 442
450 argv[0] = path; 443 argv[0] = path;
451 444
@@ -455,7 +448,7 @@ static int acpi_thermal_call_usermode(char *path)
455 448
456 call_usermodehelper(argv[0], argv, envp, 0); 449 call_usermodehelper(argv[0], argv, envp, 0);
457 450
458 return_VALUE(0); 451 return 0;
459} 452}
460 453
461static int acpi_thermal_critical(struct acpi_thermal *tz) 454static int acpi_thermal_critical(struct acpi_thermal *tz)
@@ -463,10 +456,9 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
463 int result = 0; 456 int result = 0;
464 struct acpi_device *device = NULL; 457 struct acpi_device *device = NULL;
465 458
466 ACPI_FUNCTION_TRACE("acpi_thermal_critical");
467 459
468 if (!tz || !tz->trips.critical.flags.valid) 460 if (!tz || !tz->trips.critical.flags.valid)
469 return_VALUE(-EINVAL); 461 return -EINVAL;
470 462
471 if (tz->temperature >= tz->trips.critical.temperature) { 463 if (tz->temperature >= tz->trips.critical.temperature) {
472 printk(KERN_WARNING PREFIX "Critical trip point\n"); 464 printk(KERN_WARNING PREFIX "Critical trip point\n");
@@ -476,7 +468,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
476 468
477 result = acpi_bus_get_device(tz->handle, &device); 469 result = acpi_bus_get_device(tz->handle, &device);
478 if (result) 470 if (result)
479 return_VALUE(result); 471 return result;
480 472
481 printk(KERN_EMERG 473 printk(KERN_EMERG
482 "Critical temperature reached (%ld C), shutting down.\n", 474 "Critical temperature reached (%ld C), shutting down.\n",
@@ -486,7 +478,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
486 478
487 acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); 479 acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
488 480
489 return_VALUE(0); 481 return 0;
490} 482}
491 483
492static int acpi_thermal_hot(struct acpi_thermal *tz) 484static int acpi_thermal_hot(struct acpi_thermal *tz)
@@ -494,10 +486,9 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
494 int result = 0; 486 int result = 0;
495 struct acpi_device *device = NULL; 487 struct acpi_device *device = NULL;
496 488
497 ACPI_FUNCTION_TRACE("acpi_thermal_hot");
498 489
499 if (!tz || !tz->trips.hot.flags.valid) 490 if (!tz || !tz->trips.hot.flags.valid)
500 return_VALUE(-EINVAL); 491 return -EINVAL;
501 492
502 if (tz->temperature >= tz->trips.hot.temperature) { 493 if (tz->temperature >= tz->trips.hot.temperature) {
503 printk(KERN_WARNING PREFIX "Hot trip point\n"); 494 printk(KERN_WARNING PREFIX "Hot trip point\n");
@@ -507,14 +498,14 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
507 498
508 result = acpi_bus_get_device(tz->handle, &device); 499 result = acpi_bus_get_device(tz->handle, &device);
509 if (result) 500 if (result)
510 return_VALUE(result); 501 return result;
511 502
512 acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, 503 acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT,
513 tz->trips.hot.flags.enabled); 504 tz->trips.hot.flags.enabled);
514 505
515 /* TBD: Call user-mode "sleep(S4)" function */ 506 /* TBD: Call user-mode "sleep(S4)" function */
516 507
517 return_VALUE(0); 508 return 0;
518} 509}
519 510
520static void acpi_thermal_passive(struct acpi_thermal *tz) 511static void acpi_thermal_passive(struct acpi_thermal *tz)
@@ -524,7 +515,6 @@ static void acpi_thermal_passive(struct acpi_thermal *tz)
524 int trend = 0; 515 int trend = 0;
525 int i = 0; 516 int i = 0;
526 517
527 ACPI_FUNCTION_TRACE("acpi_thermal_passive");
528 518
529 if (!tz || !tz->trips.passive.flags.valid) 519 if (!tz || !tz->trips.passive.flags.valid)
530 return; 520 return;
@@ -613,7 +603,6 @@ static void acpi_thermal_active(struct acpi_thermal *tz)
613 int j = 0; 603 int j = 0;
614 unsigned long maxtemp = 0; 604 unsigned long maxtemp = 0;
615 605
616 ACPI_FUNCTION_TRACE("acpi_thermal_active");
617 606
618 if (!tz) 607 if (!tz)
619 return; 608 return;
@@ -695,18 +684,17 @@ static void acpi_thermal_check(void *data)
695 int i = 0; 684 int i = 0;
696 struct acpi_thermal_state state; 685 struct acpi_thermal_state state;
697 686
698 ACPI_FUNCTION_TRACE("acpi_thermal_check");
699 687
700 if (!tz) { 688 if (!tz) {
701 printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); 689 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
702 return_VOID; 690 return;
703 } 691 }
704 692
705 state = tz->state; 693 state = tz->state;
706 694
707 result = acpi_thermal_get_temperature(tz); 695 result = acpi_thermal_get_temperature(tz);
708 if (result) 696 if (result)
709 return_VOID; 697 return;
710 698
711 memset(&tz->state, 0, sizeof(tz->state)); 699 memset(&tz->state, 0, sizeof(tz->state));
712 700
@@ -795,7 +783,7 @@ static void acpi_thermal_check(void *data)
795 } 783 }
796 } 784 }
797 785
798 return_VOID; 786 return;
799} 787}
800 788
801/* -------------------------------------------------------------------------- 789/* --------------------------------------------------------------------------
@@ -808,7 +796,6 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
808{ 796{
809 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; 797 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
810 798
811 ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show");
812 799
813 if (!tz) 800 if (!tz)
814 goto end; 801 goto end;
@@ -831,7 +818,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
831 } 818 }
832 819
833 end: 820 end:
834 return_VALUE(0); 821 return 0;
835} 822}
836 823
837static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) 824static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file)
@@ -844,7 +831,6 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
844 int result = 0; 831 int result = 0;
845 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; 832 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
846 833
847 ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show");
848 834
849 if (!tz) 835 if (!tz)
850 goto end; 836 goto end;
@@ -857,7 +843,7 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
857 KELVIN_TO_CELSIUS(tz->temperature)); 843 KELVIN_TO_CELSIUS(tz->temperature));
858 844
859 end: 845 end:
860 return_VALUE(0); 846 return 0;
861} 847}
862 848
863static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) 849static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file)
@@ -871,7 +857,6 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
871 int i = 0; 857 int i = 0;
872 int j = 0; 858 int j = 0;
873 859
874 ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show");
875 860
876 if (!tz) 861 if (!tz)
877 goto end; 862 goto end;
@@ -911,7 +896,7 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
911 } 896 }
912 897
913 end: 898 end:
914 return_VALUE(0); 899 return 0;
915} 900}
916 901
917static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) 902static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file)
@@ -932,18 +917,17 @@ acpi_thermal_write_trip_points(struct file *file,
932 int *active; 917 int *active;
933 int i = 0; 918 int i = 0;
934 919
935 ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points");
936 920
937 limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); 921 limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
938 if (!limit_string) 922 if (!limit_string)
939 return_VALUE(-ENOMEM); 923 return -ENOMEM;
940 924
941 memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); 925 memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
942 926
943 active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); 927 active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
944 if (!active) { 928 if (!active) {
945 kfree(limit_string); 929 kfree(limit_string);
946 return_VALUE(-ENOMEM); 930 return -ENOMEM;
947 } 931 }
948 932
949 if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { 933 if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
@@ -980,14 +964,13 @@ acpi_thermal_write_trip_points(struct file *file,
980 end: 964 end:
981 kfree(active); 965 kfree(active);
982 kfree(limit_string); 966 kfree(limit_string);
983 return_VALUE(count); 967 return count;
984} 968}
985 969
986static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) 970static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
987{ 971{
988 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; 972 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
989 973
990 ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show");
991 974
992 if (!tz) 975 if (!tz)
993 goto end; 976 goto end;
@@ -1003,7 +986,7 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
1003 tz->cooling_mode ? "passive" : "active"); 986 tz->cooling_mode ? "passive" : "active");
1004 987
1005 end: 988 end:
1006 return_VALUE(0); 989 return 0;
1007} 990}
1008 991
1009static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) 992static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file)
@@ -1022,16 +1005,15 @@ acpi_thermal_write_cooling_mode(struct file *file,
1022 int result = 0; 1005 int result = 0;
1023 char mode_string[12] = { '\0' }; 1006 char mode_string[12] = { '\0' };
1024 1007
1025 ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode");
1026 1008
1027 if (!tz || (count > sizeof(mode_string) - 1)) 1009 if (!tz || (count > sizeof(mode_string) - 1))
1028 return_VALUE(-EINVAL); 1010 return -EINVAL;
1029 1011
1030 if (!tz->flags.cooling_mode) 1012 if (!tz->flags.cooling_mode)
1031 return_VALUE(-ENODEV); 1013 return -ENODEV;
1032 1014
1033 if (copy_from_user(mode_string, buffer, count)) 1015 if (copy_from_user(mode_string, buffer, count))
1034 return_VALUE(-EFAULT); 1016 return -EFAULT;
1035 1017
1036 mode_string[count] = '\0'; 1018 mode_string[count] = '\0';
1037 1019
@@ -1039,18 +1021,17 @@ acpi_thermal_write_cooling_mode(struct file *file,
1039 simple_strtoul(mode_string, NULL, 1021 simple_strtoul(mode_string, NULL,
1040 0)); 1022 0));
1041 if (result) 1023 if (result)
1042 return_VALUE(result); 1024 return result;
1043 1025
1044 acpi_thermal_check(tz); 1026 acpi_thermal_check(tz);
1045 1027
1046 return_VALUE(count); 1028 return count;
1047} 1029}
1048 1030
1049static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) 1031static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
1050{ 1032{
1051 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; 1033 struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
1052 1034
1053 ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show");
1054 1035
1055 if (!tz) 1036 if (!tz)
1056 goto end; 1037 goto end;
@@ -1064,7 +1045,7 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
1064 (tz->polling_frequency / 10)); 1045 (tz->polling_frequency / 10));
1065 1046
1066 end: 1047 end:
1067 return_VALUE(0); 1048 return 0;
1068} 1049}
1069 1050
1070static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) 1051static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file)
@@ -1084,13 +1065,12 @@ acpi_thermal_write_polling(struct file *file,
1084 char polling_string[12] = { '\0' }; 1065 char polling_string[12] = { '\0' };
1085 int seconds = 0; 1066 int seconds = 0;
1086 1067
1087 ACPI_FUNCTION_TRACE("acpi_thermal_write_polling");
1088 1068
1089 if (!tz || (count > sizeof(polling_string) - 1)) 1069 if (!tz || (count > sizeof(polling_string) - 1))
1090 return_VALUE(-EINVAL); 1070 return -EINVAL;
1091 1071
1092 if (copy_from_user(polling_string, buffer, count)) 1072 if (copy_from_user(polling_string, buffer, count))
1093 return_VALUE(-EFAULT); 1073 return -EFAULT;
1094 1074
1095 polling_string[count] = '\0'; 1075 polling_string[count] = '\0';
1096 1076
@@ -1098,24 +1078,23 @@ acpi_thermal_write_polling(struct file *file,
1098 1078
1099 result = acpi_thermal_set_polling(tz, seconds); 1079 result = acpi_thermal_set_polling(tz, seconds);
1100 if (result) 1080 if (result)
1101 return_VALUE(result); 1081 return result;
1102 1082
1103 acpi_thermal_check(tz); 1083 acpi_thermal_check(tz);
1104 1084
1105 return_VALUE(count); 1085 return count;
1106} 1086}
1107 1087
1108static int acpi_thermal_add_fs(struct acpi_device *device) 1088static int acpi_thermal_add_fs(struct acpi_device *device)
1109{ 1089{
1110 struct proc_dir_entry *entry = NULL; 1090 struct proc_dir_entry *entry = NULL;
1111 1091
1112 ACPI_FUNCTION_TRACE("acpi_thermal_add_fs");
1113 1092
1114 if (!acpi_device_dir(device)) { 1093 if (!acpi_device_dir(device)) {
1115 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 1094 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1116 acpi_thermal_dir); 1095 acpi_thermal_dir);
1117 if (!acpi_device_dir(device)) 1096 if (!acpi_device_dir(device))
1118 return_VALUE(-ENODEV); 1097 return -ENODEV;
1119 acpi_device_dir(device)->owner = THIS_MODULE; 1098 acpi_device_dir(device)->owner = THIS_MODULE;
1120 } 1099 }
1121 1100
@@ -1123,7 +1102,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1123 entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, 1102 entry = create_proc_entry(ACPI_THERMAL_FILE_STATE,
1124 S_IRUGO, acpi_device_dir(device)); 1103 S_IRUGO, acpi_device_dir(device));
1125 if (!entry) 1104 if (!entry)
1126 return_VALUE(-ENODEV); 1105 return -ENODEV;
1127 else { 1106 else {
1128 entry->proc_fops = &acpi_thermal_state_fops; 1107 entry->proc_fops = &acpi_thermal_state_fops;
1129 entry->data = acpi_driver_data(device); 1108 entry->data = acpi_driver_data(device);
@@ -1134,7 +1113,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1134 entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, 1113 entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
1135 S_IRUGO, acpi_device_dir(device)); 1114 S_IRUGO, acpi_device_dir(device));
1136 if (!entry) 1115 if (!entry)
1137 return_VALUE(-ENODEV); 1116 return -ENODEV;
1138 else { 1117 else {
1139 entry->proc_fops = &acpi_thermal_temp_fops; 1118 entry->proc_fops = &acpi_thermal_temp_fops;
1140 entry->data = acpi_driver_data(device); 1119 entry->data = acpi_driver_data(device);
@@ -1146,7 +1125,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1146 S_IFREG | S_IRUGO | S_IWUSR, 1125 S_IFREG | S_IRUGO | S_IWUSR,
1147 acpi_device_dir(device)); 1126 acpi_device_dir(device));
1148 if (!entry) 1127 if (!entry)
1149 return_VALUE(-ENODEV); 1128 return -ENODEV;
1150 else { 1129 else {
1151 entry->proc_fops = &acpi_thermal_trip_fops; 1130 entry->proc_fops = &acpi_thermal_trip_fops;
1152 entry->data = acpi_driver_data(device); 1131 entry->data = acpi_driver_data(device);
@@ -1158,7 +1137,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1158 S_IFREG | S_IRUGO | S_IWUSR, 1137 S_IFREG | S_IRUGO | S_IWUSR,
1159 acpi_device_dir(device)); 1138 acpi_device_dir(device));
1160 if (!entry) 1139 if (!entry)
1161 return_VALUE(-ENODEV); 1140 return -ENODEV;
1162 else { 1141 else {
1163 entry->proc_fops = &acpi_thermal_cooling_fops; 1142 entry->proc_fops = &acpi_thermal_cooling_fops;
1164 entry->data = acpi_driver_data(device); 1143 entry->data = acpi_driver_data(device);
@@ -1170,19 +1149,18 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1170 S_IFREG | S_IRUGO | S_IWUSR, 1149 S_IFREG | S_IRUGO | S_IWUSR,
1171 acpi_device_dir(device)); 1150 acpi_device_dir(device));
1172 if (!entry) 1151 if (!entry)
1173 return_VALUE(-ENODEV); 1152 return -ENODEV;
1174 else { 1153 else {
1175 entry->proc_fops = &acpi_thermal_polling_fops; 1154 entry->proc_fops = &acpi_thermal_polling_fops;
1176 entry->data = acpi_driver_data(device); 1155 entry->data = acpi_driver_data(device);
1177 entry->owner = THIS_MODULE; 1156 entry->owner = THIS_MODULE;
1178 } 1157 }
1179 1158
1180 return_VALUE(0); 1159 return 0;
1181} 1160}
1182 1161
1183static int acpi_thermal_remove_fs(struct acpi_device *device) 1162static int acpi_thermal_remove_fs(struct acpi_device *device)
1184{ 1163{
1185 ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
1186 1164
1187 if (acpi_device_dir(device)) { 1165 if (acpi_device_dir(device)) {
1188 remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, 1166 remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
@@ -1199,7 +1177,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device)
1199 acpi_device_dir(device) = NULL; 1177 acpi_device_dir(device) = NULL;
1200 } 1178 }
1201 1179
1202 return_VALUE(0); 1180 return 0;
1203} 1181}
1204 1182
1205/* -------------------------------------------------------------------------- 1183/* --------------------------------------------------------------------------
@@ -1211,13 +1189,12 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
1211 struct acpi_thermal *tz = (struct acpi_thermal *)data; 1189 struct acpi_thermal *tz = (struct acpi_thermal *)data;
1212 struct acpi_device *device = NULL; 1190 struct acpi_device *device = NULL;
1213 1191
1214 ACPI_FUNCTION_TRACE("acpi_thermal_notify");
1215 1192
1216 if (!tz) 1193 if (!tz)
1217 return_VOID; 1194 return;
1218 1195
1219 if (acpi_bus_get_device(tz->handle, &device)) 1196 if (acpi_bus_get_device(tz->handle, &device))
1220 return_VOID; 1197 return;
1221 1198
1222 switch (event) { 1199 switch (event) {
1223 case ACPI_THERMAL_NOTIFY_TEMPERATURE: 1200 case ACPI_THERMAL_NOTIFY_TEMPERATURE:
@@ -1239,27 +1216,26 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
1239 break; 1216 break;
1240 } 1217 }
1241 1218
1242 return_VOID; 1219 return;
1243} 1220}
1244 1221
1245static int acpi_thermal_get_info(struct acpi_thermal *tz) 1222static int acpi_thermal_get_info(struct acpi_thermal *tz)
1246{ 1223{
1247 int result = 0; 1224 int result = 0;
1248 1225
1249 ACPI_FUNCTION_TRACE("acpi_thermal_get_info");
1250 1226
1251 if (!tz) 1227 if (!tz)
1252 return_VALUE(-EINVAL); 1228 return -EINVAL;
1253 1229
1254 /* Get temperature [_TMP] (required) */ 1230 /* Get temperature [_TMP] (required) */
1255 result = acpi_thermal_get_temperature(tz); 1231 result = acpi_thermal_get_temperature(tz);
1256 if (result) 1232 if (result)
1257 return_VALUE(result); 1233 return result;
1258 1234
1259 /* Get trip points [_CRT, _PSV, etc.] (required) */ 1235 /* Get trip points [_CRT, _PSV, etc.] (required) */
1260 result = acpi_thermal_get_trip_points(tz); 1236 result = acpi_thermal_get_trip_points(tz);
1261 if (result) 1237 if (result)
1262 return_VALUE(result); 1238 return result;
1263 1239
1264 /* Set the cooling mode [_SCP] to active cooling (default) */ 1240 /* Set the cooling mode [_SCP] to active cooling (default) */
1265 result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); 1241 result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
@@ -1299,7 +1275,7 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
1299 if (!result) 1275 if (!result)
1300 tz->flags.devices = 1; 1276 tz->flags.devices = 1;
1301 1277
1302 return_VALUE(0); 1278 return 0;
1303} 1279}
1304 1280
1305static int acpi_thermal_add(struct acpi_device *device) 1281static int acpi_thermal_add(struct acpi_device *device)
@@ -1308,14 +1284,13 @@ static int acpi_thermal_add(struct acpi_device *device)
1308 acpi_status status = AE_OK; 1284 acpi_status status = AE_OK;
1309 struct acpi_thermal *tz = NULL; 1285 struct acpi_thermal *tz = NULL;
1310 1286
1311 ACPI_FUNCTION_TRACE("acpi_thermal_add");
1312 1287
1313 if (!device) 1288 if (!device)
1314 return_VALUE(-EINVAL); 1289 return -EINVAL;
1315 1290
1316 tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); 1291 tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL);
1317 if (!tz) 1292 if (!tz)
1318 return_VALUE(-ENOMEM); 1293 return -ENOMEM;
1319 memset(tz, 0, sizeof(struct acpi_thermal)); 1294 memset(tz, 0, sizeof(struct acpi_thermal));
1320 1295
1321 tz->handle = device->handle; 1296 tz->handle = device->handle;
@@ -1354,7 +1329,7 @@ static int acpi_thermal_add(struct acpi_device *device)
1354 kfree(tz); 1329 kfree(tz);
1355 } 1330 }
1356 1331
1357 return_VALUE(result); 1332 return result;
1358} 1333}
1359 1334
1360static int acpi_thermal_remove(struct acpi_device *device, int type) 1335static int acpi_thermal_remove(struct acpi_device *device, int type)
@@ -1362,10 +1337,9 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1362 acpi_status status = AE_OK; 1337 acpi_status status = AE_OK;
1363 struct acpi_thermal *tz = NULL; 1338 struct acpi_thermal *tz = NULL;
1364 1339
1365 ACPI_FUNCTION_TRACE("acpi_thermal_remove");
1366 1340
1367 if (!device || !acpi_driver_data(device)) 1341 if (!device || !acpi_driver_data(device))
1368 return_VALUE(-EINVAL); 1342 return -EINVAL;
1369 1343
1370 tz = (struct acpi_thermal *)acpi_driver_data(device); 1344 tz = (struct acpi_thermal *)acpi_driver_data(device);
1371 1345
@@ -1396,7 +1370,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1396 acpi_thermal_remove_fs(device); 1370 acpi_thermal_remove_fs(device);
1397 1371
1398 kfree(tz); 1372 kfree(tz);
1399 return_VALUE(0); 1373 return 0;
1400} 1374}
1401 1375
1402static int acpi_thermal_resume(struct acpi_device *device, int state) 1376static int acpi_thermal_resume(struct acpi_device *device, int state)
@@ -1404,7 +1378,7 @@ static int acpi_thermal_resume(struct acpi_device *device, int state)
1404 struct acpi_thermal *tz = NULL; 1378 struct acpi_thermal *tz = NULL;
1405 1379
1406 if (!device || !acpi_driver_data(device)) 1380 if (!device || !acpi_driver_data(device))
1407 return_VALUE(-EINVAL); 1381 return -EINVAL;
1408 1382
1409 tz = (struct acpi_thermal *)acpi_driver_data(device); 1383 tz = (struct acpi_thermal *)acpi_driver_data(device);
1410 1384
@@ -1417,31 +1391,29 @@ static int __init acpi_thermal_init(void)
1417{ 1391{
1418 int result = 0; 1392 int result = 0;
1419 1393
1420 ACPI_FUNCTION_TRACE("acpi_thermal_init");
1421 1394
1422 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); 1395 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
1423 if (!acpi_thermal_dir) 1396 if (!acpi_thermal_dir)
1424 return_VALUE(-ENODEV); 1397 return -ENODEV;
1425 acpi_thermal_dir->owner = THIS_MODULE; 1398 acpi_thermal_dir->owner = THIS_MODULE;
1426 1399
1427 result = acpi_bus_register_driver(&acpi_thermal_driver); 1400 result = acpi_bus_register_driver(&acpi_thermal_driver);
1428 if (result < 0) { 1401 if (result < 0) {
1429 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); 1402 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
1430 return_VALUE(-ENODEV); 1403 return -ENODEV;
1431 } 1404 }
1432 1405
1433 return_VALUE(0); 1406 return 0;
1434} 1407}
1435 1408
1436static void __exit acpi_thermal_exit(void) 1409static void __exit acpi_thermal_exit(void)
1437{ 1410{
1438 ACPI_FUNCTION_TRACE("acpi_thermal_exit");
1439 1411
1440 acpi_bus_unregister_driver(&acpi_thermal_driver); 1412 acpi_bus_unregister_driver(&acpi_thermal_driver);
1441 1413
1442 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); 1414 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
1443 1415
1444 return_VOID; 1416 return;
1445} 1417}
1446 1418
1447module_init(acpi_thermal_init); 1419module_init(acpi_thermal_init);
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index a5da4efab063..1930e1a75b22 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -58,22 +58,21 @@ acpi_extract_package(union acpi_object *package,
58 u8 *head = NULL; 58 u8 *head = NULL;
59 u8 *tail = NULL; 59 u8 *tail = NULL;
60 60
61 ACPI_FUNCTION_TRACE("acpi_extract_package");
62 61
63 if (!package || (package->type != ACPI_TYPE_PACKAGE) 62 if (!package || (package->type != ACPI_TYPE_PACKAGE)
64 || (package->package.count < 1)) { 63 || (package->package.count < 1)) {
65 printk(KERN_WARNING PREFIX "Invalid package argument\n"); 64 printk(KERN_WARNING PREFIX "Invalid package argument\n");
66 return_ACPI_STATUS(AE_BAD_PARAMETER); 65 return AE_BAD_PARAMETER;
67 } 66 }
68 67
69 if (!format || !format->pointer || (format->length < 1)) { 68 if (!format || !format->pointer || (format->length < 1)) {
70 printk(KERN_WARNING PREFIX "Invalid format argument\n"); 69 printk(KERN_WARNING PREFIX "Invalid format argument\n");
71 return_ACPI_STATUS(AE_BAD_PARAMETER); 70 return AE_BAD_PARAMETER;
72 } 71 }
73 72
74 if (!buffer) { 73 if (!buffer) {
75 printk(KERN_WARNING PREFIX "Invalid buffer argument\n"); 74 printk(KERN_WARNING PREFIX "Invalid buffer argument\n");
76 return_ACPI_STATUS(AE_BAD_PARAMETER); 75 return AE_BAD_PARAMETER;
77 } 76 }
78 77
79 format_count = (format->length / sizeof(char)) - 1; 78 format_count = (format->length / sizeof(char)) - 1;
@@ -81,7 +80,7 @@ acpi_extract_package(union acpi_object *package,
81 printk(KERN_WARNING PREFIX "Format specifies more objects [%d]" 80 printk(KERN_WARNING PREFIX "Format specifies more objects [%d]"
82 " than exist in package [%d].\n", 81 " than exist in package [%d].\n",
83 format_count, package->package.count); 82 format_count, package->package.count);
84 return_ACPI_STATUS(AE_BAD_DATA); 83 return AE_BAD_DATA;
85 } 84 }
86 85
87 format_string = (char *)format->pointer; 86 format_string = (char *)format->pointer;
@@ -94,7 +93,7 @@ acpi_extract_package(union acpi_object *package,
94 union acpi_object *element = &(package->package.elements[i]); 93 union acpi_object *element = &(package->package.elements[i]);
95 94
96 if (!element) { 95 if (!element) {
97 return_ACPI_STATUS(AE_BAD_DATA); 96 return AE_BAD_DATA;
98 } 97 }
99 98
100 switch (element->type) { 99 switch (element->type) {
@@ -116,7 +115,7 @@ acpi_extract_package(union acpi_object *package,
116 " [%d]: got number, expecing" 115 " [%d]: got number, expecing"
117 " [%c]\n", 116 " [%c]\n",
118 i, format_string[i]); 117 i, format_string[i]);
119 return_ACPI_STATUS(AE_BAD_DATA); 118 return AE_BAD_DATA;
120 break; 119 break;
121 } 120 }
122 break; 121 break;
@@ -142,7 +141,7 @@ acpi_extract_package(union acpi_object *package,
142 " [%d] got string/buffer," 141 " [%d] got string/buffer,"
143 " expecing [%c]\n", 142 " expecing [%c]\n",
144 i, format_string[i]); 143 i, format_string[i]);
145 return_ACPI_STATUS(AE_BAD_DATA); 144 return AE_BAD_DATA;
146 break; 145 break;
147 } 146 }
148 break; 147 break;
@@ -153,7 +152,7 @@ acpi_extract_package(union acpi_object *package,
153 "Found unsupported element at index=%d\n", 152 "Found unsupported element at index=%d\n",
154 i)); 153 i));
155 /* TBD: handle nested packages... */ 154 /* TBD: handle nested packages... */
156 return_ACPI_STATUS(AE_SUPPORT); 155 return AE_SUPPORT;
157 break; 156 break;
158 } 157 }
159 } 158 }
@@ -163,9 +162,9 @@ acpi_extract_package(union acpi_object *package,
163 */ 162 */
164 if (buffer->length < size_required) { 163 if (buffer->length < size_required) {
165 buffer->length = size_required; 164 buffer->length = size_required;
166 return_ACPI_STATUS(AE_BUFFER_OVERFLOW); 165 return AE_BUFFER_OVERFLOW;
167 } else if (buffer->length != size_required || !buffer->pointer) { 166 } else if (buffer->length != size_required || !buffer->pointer) {
168 return_ACPI_STATUS(AE_BAD_PARAMETER); 167 return AE_BAD_PARAMETER;
169 } 168 }
170 169
171 head = buffer->pointer; 170 head = buffer->pointer;
@@ -180,7 +179,7 @@ acpi_extract_package(union acpi_object *package,
180 union acpi_object *element = &(package->package.elements[i]); 179 union acpi_object *element = &(package->package.elements[i]);
181 180
182 if (!element) { 181 if (!element) {
183 return_ACPI_STATUS(AE_BAD_DATA); 182 return AE_BAD_DATA;
184 } 183 }
185 184
186 switch (element->type) { 185 switch (element->type) {
@@ -245,7 +244,7 @@ acpi_extract_package(union acpi_object *package,
245 } 244 }
246 } 245 }
247 246
248 return_ACPI_STATUS(AE_OK); 247 return AE_OK;
249} 248}
250 249
251EXPORT_SYMBOL(acpi_extract_package); 250EXPORT_SYMBOL(acpi_extract_package);
@@ -259,14 +258,13 @@ acpi_evaluate_integer(acpi_handle handle,
259 union acpi_object *element; 258 union acpi_object *element;
260 struct acpi_buffer buffer = { 0, NULL }; 259 struct acpi_buffer buffer = { 0, NULL };
261 260
262 ACPI_FUNCTION_TRACE("acpi_evaluate_integer");
263 261
264 if (!data) 262 if (!data)
265 return_ACPI_STATUS(AE_BAD_PARAMETER); 263 return AE_BAD_PARAMETER;
266 264
267 element = kmalloc(sizeof(union acpi_object), GFP_KERNEL); 265 element = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
268 if (!element) 266 if (!element)
269 return_ACPI_STATUS(AE_NO_MEMORY); 267 return AE_NO_MEMORY;
270 268
271 memset(element, 0, sizeof(union acpi_object)); 269 memset(element, 0, sizeof(union acpi_object));
272 buffer.length = sizeof(union acpi_object); 270 buffer.length = sizeof(union acpi_object);
@@ -275,13 +273,13 @@ acpi_evaluate_integer(acpi_handle handle,
275 if (ACPI_FAILURE(status)) { 273 if (ACPI_FAILURE(status)) {
276 acpi_util_eval_error(handle, pathname, status); 274 acpi_util_eval_error(handle, pathname, status);
277 kfree(element); 275 kfree(element);
278 return_ACPI_STATUS(status); 276 return status;
279 } 277 }
280 278
281 if (element->type != ACPI_TYPE_INTEGER) { 279 if (element->type != ACPI_TYPE_INTEGER) {
282 acpi_util_eval_error(handle, pathname, AE_BAD_DATA); 280 acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
283 kfree(element); 281 kfree(element);
284 return_ACPI_STATUS(AE_BAD_DATA); 282 return AE_BAD_DATA;
285 } 283 }
286 284
287 *data = element->integer.value; 285 *data = element->integer.value;
@@ -289,7 +287,7 @@ acpi_evaluate_integer(acpi_handle handle,
289 287
290 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data)); 288 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data));
291 289
292 return_ACPI_STATUS(AE_OK); 290 return AE_OK;
293} 291}
294 292
295EXPORT_SYMBOL(acpi_evaluate_integer); 293EXPORT_SYMBOL(acpi_evaluate_integer);
@@ -304,15 +302,14 @@ acpi_evaluate_string(acpi_handle handle,
304 acpi_object *element = NULL; 302 acpi_object *element = NULL;
305 acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 303 acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
306 304
307 ACPI_FUNCTION_TRACE("acpi_evaluate_string");
308 305
309 if (!data) 306 if (!data)
310 return_ACPI_STATUS(AE_BAD_PARAMETER); 307 return AE_BAD_PARAMETER;
311 308
312 status = acpi_evaluate_object(handle, pathname, arguments, &buffer); 309 status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
313 if (ACPI_FAILURE(status)) { 310 if (ACPI_FAILURE(status)) {
314 acpi_util_eval_error(handle, pathname, status); 311 acpi_util_eval_error(handle, pathname, status);
315 return_ACPI_STATUS(status); 312 return status;
316 } 313 }
317 314
318 element = (acpi_object *) buffer.pointer; 315 element = (acpi_object *) buffer.pointer;
@@ -321,13 +318,13 @@ acpi_evaluate_string(acpi_handle handle,
321 || (element->type != ACPI_TYPE_BUFFER) 318 || (element->type != ACPI_TYPE_BUFFER)
322 || !element->string.length) { 319 || !element->string.length) {
323 acpi_util_eval_error(handle, pathname, AE_BAD_DATA); 320 acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
324 return_ACPI_STATUS(AE_BAD_DATA); 321 return AE_BAD_DATA;
325 } 322 }
326 323
327 *data = kmalloc(element->string.length + 1, GFP_KERNEL); 324 *data = kmalloc(element->string.length + 1, GFP_KERNEL);
328 if (!data) { 325 if (!data) {
329 printk(KERN_ERR PREFIX "Memory allocation\n"); 326 printk(KERN_ERR PREFIX "Memory allocation\n");
330 return_VALUE(-ENOMEM); 327 return -ENOMEM;
331 } 328 }
332 memset(*data, 0, element->string.length + 1); 329 memset(*data, 0, element->string.length + 1);
333 330
@@ -337,7 +334,7 @@ acpi_evaluate_string(acpi_handle handle,
337 334
338 acpi_os_free(buffer.pointer); 335 acpi_os_free(buffer.pointer);
339 336
340 return_ACPI_STATUS(AE_OK); 337 return AE_OK;
341} 338}
342#endif 339#endif
343 340
@@ -353,10 +350,9 @@ acpi_evaluate_reference(acpi_handle handle,
353 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 350 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
354 u32 i = 0; 351 u32 i = 0;
355 352
356 ACPI_FUNCTION_TRACE("acpi_evaluate_reference");
357 353
358 if (!list) { 354 if (!list) {
359 return_ACPI_STATUS(AE_BAD_PARAMETER); 355 return AE_BAD_PARAMETER;
360 } 356 }
361 357
362 /* Evaluate object. */ 358 /* Evaluate object. */
@@ -390,7 +386,7 @@ acpi_evaluate_reference(acpi_handle handle,
390 } 386 }
391 387
392 if (package->package.count > ACPI_MAX_HANDLES) { 388 if (package->package.count > ACPI_MAX_HANDLES) {
393 return_ACPI_STATUS(AE_NO_MEMORY); 389 return AE_NO_MEMORY;
394 } 390 }
395 list->count = package->package.count; 391 list->count = package->package.count;
396 392
@@ -424,7 +420,7 @@ acpi_evaluate_reference(acpi_handle handle,
424 420
425 acpi_os_free(buffer.pointer); 421 acpi_os_free(buffer.pointer);
426 422
427 return_ACPI_STATUS(status); 423 return status;
428} 424}
429 425
430EXPORT_SYMBOL(acpi_evaluate_reference); 426EXPORT_SYMBOL(acpi_evaluate_reference);
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index ca37da537bd6..9feb633087a9 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -272,10 +272,9 @@ static int
272acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) 272acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
273{ 273{
274 int status; 274 int status;
275 ACPI_FUNCTION_TRACE("acpi_video_device_query");
276 status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); 275 status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
277 276
278 return_VALUE(status); 277 return status;
279} 278}
280 279
281static int 280static int
@@ -284,11 +283,10 @@ acpi_video_device_get_state(struct acpi_video_device *device,
284{ 283{
285 int status; 284 int status;
286 285
287 ACPI_FUNCTION_TRACE("acpi_video_device_get_state");
288 286
289 status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state); 287 status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state);
290 288
291 return_VALUE(status); 289 return status;
292} 290}
293 291
294static int 292static int
@@ -299,12 +297,11 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state)
299 struct acpi_object_list args = { 1, &arg0 }; 297 struct acpi_object_list args = { 1, &arg0 };
300 unsigned long ret; 298 unsigned long ret;
301 299
302 ACPI_FUNCTION_TRACE("acpi_video_device_set_state");
303 300
304 arg0.integer.value = state; 301 arg0.integer.value = state;
305 status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret); 302 status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret);
306 303
307 return_VALUE(status); 304 return status;
308} 305}
309 306
310static int 307static int
@@ -315,13 +312,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
315 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 312 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
316 union acpi_object *obj; 313 union acpi_object *obj;
317 314
318 ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels");
319 315
320 *levels = NULL; 316 *levels = NULL;
321 317
322 status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); 318 status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
323 if (!ACPI_SUCCESS(status)) 319 if (!ACPI_SUCCESS(status))
324 return_VALUE(status); 320 return status;
325 obj = (union acpi_object *)buffer.pointer; 321 obj = (union acpi_object *)buffer.pointer;
326 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { 322 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
327 printk(KERN_ERR PREFIX "Invalid _BCL data\n"); 323 printk(KERN_ERR PREFIX "Invalid _BCL data\n");
@@ -331,12 +327,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
331 327
332 *levels = obj; 328 *levels = obj;
333 329
334 return_VALUE(0); 330 return 0;
335 331
336 err: 332 err:
337 kfree(buffer.pointer); 333 kfree(buffer.pointer);
338 334
339 return_VALUE(status); 335 return status;
340} 336}
341 337
342static int 338static int
@@ -346,13 +342,12 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
346 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 342 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
347 struct acpi_object_list args = { 1, &arg0 }; 343 struct acpi_object_list args = { 1, &arg0 };
348 344
349 ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level");
350 345
351 arg0.integer.value = level; 346 arg0.integer.value = level;
352 status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL); 347 status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL);
353 348
354 printk(KERN_DEBUG "set_level status: %x\n", status); 349 printk(KERN_DEBUG "set_level status: %x\n", status);
355 return_VALUE(status); 350 return status;
356} 351}
357 352
358static int 353static int
@@ -360,11 +355,10 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
360 unsigned long *level) 355 unsigned long *level)
361{ 356{
362 int status; 357 int status;
363 ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current");
364 358
365 status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); 359 status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level);
366 360
367 return_VALUE(status); 361 return status;
368} 362}
369 363
370static int 364static int
@@ -377,22 +371,21 @@ acpi_video_device_EDID(struct acpi_video_device *device,
377 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 371 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
378 struct acpi_object_list args = { 1, &arg0 }; 372 struct acpi_object_list args = { 1, &arg0 };
379 373
380 ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID");
381 374
382 *edid = NULL; 375 *edid = NULL;
383 376
384 if (!device) 377 if (!device)
385 return_VALUE(-ENODEV); 378 return -ENODEV;
386 if (length == 128) 379 if (length == 128)
387 arg0.integer.value = 1; 380 arg0.integer.value = 1;
388 else if (length == 256) 381 else if (length == 256)
389 arg0.integer.value = 2; 382 arg0.integer.value = 2;
390 else 383 else
391 return_VALUE(-EINVAL); 384 return -EINVAL;
392 385
393 status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer); 386 status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer);
394 if (ACPI_FAILURE(status)) 387 if (ACPI_FAILURE(status))
395 return_VALUE(-ENODEV); 388 return -ENODEV;
396 389
397 obj = (union acpi_object *)buffer.pointer; 390 obj = (union acpi_object *)buffer.pointer;
398 391
@@ -404,7 +397,7 @@ acpi_video_device_EDID(struct acpi_video_device *device,
404 kfree(obj); 397 kfree(obj);
405 } 398 }
406 399
407 return_VALUE(status); 400 return status;
408} 401}
409 402
410/* bus */ 403/* bus */
@@ -417,7 +410,6 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
417 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 410 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
418 struct acpi_object_list args = { 1, &arg0 }; 411 struct acpi_object_list args = { 1, &arg0 };
419 412
420 ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST");
421 413
422 arg0.integer.value = option; 414 arg0.integer.value = option;
423 415
@@ -425,7 +417,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
425 if (ACPI_SUCCESS(status)) 417 if (ACPI_SUCCESS(status))
426 status = tmp ? (-EINVAL) : (AE_OK); 418 status = tmp ? (-EINVAL) : (AE_OK);
427 419
428 return_VALUE(status); 420 return status;
429} 421}
430 422
431static int 423static int
@@ -433,11 +425,10 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
433{ 425{
434 int status; 426 int status;
435 427
436 ACPI_FUNCTION_TRACE("acpi_video_bus_get_POST");
437 428
438 status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id); 429 status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id);
439 430
440 return_VALUE(status); 431 return status;
441} 432}
442 433
443static int 434static int
@@ -445,12 +436,11 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
445 unsigned long *options) 436 unsigned long *options)
446{ 437{
447 int status; 438 int status;
448 ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options");
449 439
450 status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); 440 status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options);
451 *options &= 3; 441 *options &= 3;
452 442
453 return_VALUE(status); 443 return status;
454} 444}
455 445
456/* 446/*
@@ -481,7 +471,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
481 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 471 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
482 struct acpi_object_list args = { 1, &arg0 }; 472 struct acpi_object_list args = { 1, &arg0 };
483 473
484 ACPI_FUNCTION_TRACE("acpi_video_bus_DOS");
485 474
486 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) { 475 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) {
487 status = -1; 476 status = -1;
@@ -492,7 +481,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
492 acpi_evaluate_object(video->handle, "_DOS", &args, NULL); 481 acpi_evaluate_object(video->handle, "_DOS", &args, NULL);
493 482
494 Failed: 483 Failed:
495 return_VALUE(status); 484 return status;
496} 485}
497 486
498/* 487/*
@@ -514,7 +503,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
514 union acpi_object *obj = NULL; 503 union acpi_object *obj = NULL;
515 struct acpi_video_device_brightness *br = NULL; 504 struct acpi_video_device_brightness *br = NULL;
516 505
517 ACPI_FUNCTION_TRACE("acpi_video_device_find_cap");
518 506
519 memset(&device->cap, 0, 4); 507 memset(&device->cap, 0, 4);
520 508
@@ -582,7 +570,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
582 570
583 kfree(obj); 571 kfree(obj);
584 572
585 return_VOID; 573 return;
586} 574}
587 575
588/* 576/*
@@ -629,10 +617,9 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
629{ 617{
630 acpi_status status = -ENOENT; 618 acpi_status status = -ENOENT;
631 619
632 ACPI_FUNCTION_TRACE("acpi_video_bus_check");
633 620
634 if (!video) 621 if (!video)
635 return_VALUE(-EINVAL); 622 return -EINVAL;
636 623
637 /* Since there is no HID, CID and so on for VGA driver, we have 624 /* Since there is no HID, CID and so on for VGA driver, we have
638 * to check well known required nodes. 625 * to check well known required nodes.
@@ -656,7 +643,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
656 status = 0; 643 status = 0;
657 } 644 }
658 645
659 return_VALUE(status); 646 return status;
660} 647}
661 648
662/* -------------------------------------------------------------------------- 649/* --------------------------------------------------------------------------
@@ -672,7 +659,6 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
672 struct acpi_video_device *dev = 659 struct acpi_video_device *dev =
673 (struct acpi_video_device *)seq->private; 660 (struct acpi_video_device *)seq->private;
674 661
675 ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show");
676 662
677 if (!dev) 663 if (!dev)
678 goto end; 664 goto end;
@@ -691,7 +677,7 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
691 seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); 677 seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no");
692 678
693 end: 679 end:
694 return_VALUE(0); 680 return 0;
695} 681}
696 682
697static int 683static int
@@ -708,7 +694,6 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
708 (struct acpi_video_device *)seq->private; 694 (struct acpi_video_device *)seq->private;
709 unsigned long state; 695 unsigned long state;
710 696
711 ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show");
712 697
713 if (!dev) 698 if (!dev)
714 goto end; 699 goto end;
@@ -728,7 +713,7 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
728 seq_printf(seq, "<not supported>\n"); 713 seq_printf(seq, "<not supported>\n");
729 714
730 end: 715 end:
731 return_VALUE(0); 716 return 0;
732} 717}
733 718
734static int 719static int
@@ -749,13 +734,12 @@ acpi_video_device_write_state(struct file *file,
749 char str[12] = { 0 }; 734 char str[12] = { 0 };
750 u32 state = 0; 735 u32 state = 0;
751 736
752 ACPI_FUNCTION_TRACE("acpi_video_device_write_state");
753 737
754 if (!dev || count + 1 > sizeof str) 738 if (!dev || count + 1 > sizeof str)
755 return_VALUE(-EINVAL); 739 return -EINVAL;
756 740
757 if (copy_from_user(str, buffer, count)) 741 if (copy_from_user(str, buffer, count))
758 return_VALUE(-EFAULT); 742 return -EFAULT;
759 743
760 str[count] = 0; 744 str[count] = 0;
761 state = simple_strtoul(str, NULL, 0); 745 state = simple_strtoul(str, NULL, 0);
@@ -764,9 +748,9 @@ acpi_video_device_write_state(struct file *file,
764 status = acpi_video_device_set_state(dev, state); 748 status = acpi_video_device_set_state(dev, state);
765 749
766 if (status) 750 if (status)
767 return_VALUE(-EFAULT); 751 return -EFAULT;
768 752
769 return_VALUE(count); 753 return count;
770} 754}
771 755
772static int 756static int
@@ -776,11 +760,10 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
776 (struct acpi_video_device *)seq->private; 760 (struct acpi_video_device *)seq->private;
777 int i; 761 int i;
778 762
779 ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show");
780 763
781 if (!dev || !dev->brightness) { 764 if (!dev || !dev->brightness) {
782 seq_printf(seq, "<not supported>\n"); 765 seq_printf(seq, "<not supported>\n");
783 return_VALUE(0); 766 return 0;
784 } 767 }
785 768
786 seq_printf(seq, "levels: "); 769 seq_printf(seq, "levels: ");
@@ -788,7 +771,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
788 seq_printf(seq, " %d", dev->brightness->levels[i]); 771 seq_printf(seq, " %d", dev->brightness->levels[i]);
789 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); 772 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
790 773
791 return_VALUE(0); 774 return 0;
792} 775}
793 776
794static int 777static int
@@ -809,19 +792,18 @@ acpi_video_device_write_brightness(struct file *file,
809 unsigned int level = 0; 792 unsigned int level = 0;
810 int i; 793 int i;
811 794
812 ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness");
813 795
814 if (!dev || !dev->brightness || count + 1 > sizeof str) 796 if (!dev || !dev->brightness || count + 1 > sizeof str)
815 return_VALUE(-EINVAL); 797 return -EINVAL;
816 798
817 if (copy_from_user(str, buffer, count)) 799 if (copy_from_user(str, buffer, count))
818 return_VALUE(-EFAULT); 800 return -EFAULT;
819 801
820 str[count] = 0; 802 str[count] = 0;
821 level = simple_strtoul(str, NULL, 0); 803 level = simple_strtoul(str, NULL, 0);
822 804
823 if (level > 100) 805 if (level > 100)
824 return_VALUE(-EFAULT); 806 return -EFAULT;
825 807
826 /* validate though the list of available levels */ 808 /* validate though the list of available levels */
827 for (i = 0; i < dev->brightness->count; i++) 809 for (i = 0; i < dev->brightness->count; i++)
@@ -832,7 +814,7 @@ acpi_video_device_write_brightness(struct file *file,
832 break; 814 break;
833 } 815 }
834 816
835 return_VALUE(count); 817 return count;
836} 818}
837 819
838static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) 820static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
@@ -843,7 +825,6 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
843 int i; 825 int i;
844 union acpi_object *edid = NULL; 826 union acpi_object *edid = NULL;
845 827
846 ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show");
847 828
848 if (!dev) 829 if (!dev)
849 goto out; 830 goto out;
@@ -868,7 +849,7 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
868 else 849 else
869 kfree(edid); 850 kfree(edid);
870 851
871 return_VALUE(0); 852 return 0;
872} 853}
873 854
874static int 855static int
@@ -883,27 +864,26 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
883 struct proc_dir_entry *entry = NULL; 864 struct proc_dir_entry *entry = NULL;
884 struct acpi_video_device *vid_dev; 865 struct acpi_video_device *vid_dev;
885 866
886 ACPI_FUNCTION_TRACE("acpi_video_device_add_fs");
887 867
888 if (!device) 868 if (!device)
889 return_VALUE(-ENODEV); 869 return -ENODEV;
890 870
891 vid_dev = (struct acpi_video_device *)acpi_driver_data(device); 871 vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
892 if (!vid_dev) 872 if (!vid_dev)
893 return_VALUE(-ENODEV); 873 return -ENODEV;
894 874
895 if (!acpi_device_dir(device)) { 875 if (!acpi_device_dir(device)) {
896 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 876 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
897 vid_dev->video->dir); 877 vid_dev->video->dir);
898 if (!acpi_device_dir(device)) 878 if (!acpi_device_dir(device))
899 return_VALUE(-ENODEV); 879 return -ENODEV;
900 acpi_device_dir(device)->owner = THIS_MODULE; 880 acpi_device_dir(device)->owner = THIS_MODULE;
901 } 881 }
902 882
903 /* 'info' [R] */ 883 /* 'info' [R] */
904 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); 884 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
905 if (!entry) 885 if (!entry)
906 return_VALUE(-ENODEV); 886 return -ENODEV;
907 else { 887 else {
908 entry->proc_fops = &acpi_video_device_info_fops; 888 entry->proc_fops = &acpi_video_device_info_fops;
909 entry->data = acpi_driver_data(device); 889 entry->data = acpi_driver_data(device);
@@ -915,7 +895,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
915 create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, 895 create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR,
916 acpi_device_dir(device)); 896 acpi_device_dir(device));
917 if (!entry) 897 if (!entry)
918 return_VALUE(-ENODEV); 898 return -ENODEV;
919 else { 899 else {
920 acpi_video_device_state_fops.write = acpi_video_device_write_state; 900 acpi_video_device_state_fops.write = acpi_video_device_write_state;
921 entry->proc_fops = &acpi_video_device_state_fops; 901 entry->proc_fops = &acpi_video_device_state_fops;
@@ -928,7 +908,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
928 create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, 908 create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR,
929 acpi_device_dir(device)); 909 acpi_device_dir(device));
930 if (!entry) 910 if (!entry)
931 return_VALUE(-ENODEV); 911 return -ENODEV;
932 else { 912 else {
933 acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; 913 acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
934 entry->proc_fops = &acpi_video_device_brightness_fops; 914 entry->proc_fops = &acpi_video_device_brightness_fops;
@@ -939,24 +919,23 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
939 /* 'EDID' [R] */ 919 /* 'EDID' [R] */
940 entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); 920 entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device));
941 if (!entry) 921 if (!entry)
942 return_VALUE(-ENODEV); 922 return -ENODEV;
943 else { 923 else {
944 entry->proc_fops = &acpi_video_device_EDID_fops; 924 entry->proc_fops = &acpi_video_device_EDID_fops;
945 entry->data = acpi_driver_data(device); 925 entry->data = acpi_driver_data(device);
946 entry->owner = THIS_MODULE; 926 entry->owner = THIS_MODULE;
947 } 927 }
948 928
949 return_VALUE(0); 929 return 0;
950} 930}
951 931
952static int acpi_video_device_remove_fs(struct acpi_device *device) 932static int acpi_video_device_remove_fs(struct acpi_device *device)
953{ 933{
954 struct acpi_video_device *vid_dev; 934 struct acpi_video_device *vid_dev;
955 ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs");
956 935
957 vid_dev = (struct acpi_video_device *)acpi_driver_data(device); 936 vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
958 if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) 937 if (!vid_dev || !vid_dev->video || !vid_dev->video->dir)
959 return_VALUE(-ENODEV); 938 return -ENODEV;
960 939
961 if (acpi_device_dir(device)) { 940 if (acpi_device_dir(device)) {
962 remove_proc_entry("info", acpi_device_dir(device)); 941 remove_proc_entry("info", acpi_device_dir(device));
@@ -967,7 +946,7 @@ static int acpi_video_device_remove_fs(struct acpi_device *device)
967 acpi_device_dir(device) = NULL; 946 acpi_device_dir(device) = NULL;
968 } 947 }
969 948
970 return_VALUE(0); 949 return 0;
971} 950}
972 951
973/* video bus */ 952/* video bus */
@@ -975,7 +954,6 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
975{ 954{
976 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; 955 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
977 956
978 ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show");
979 957
980 if (!video) 958 if (!video)
981 goto end; 959 goto end;
@@ -988,7 +966,7 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
988 video->flags.post ? "yes" : "no"); 966 video->flags.post ? "yes" : "no");
989 967
990 end: 968 end:
991 return_VALUE(0); 969 return 0;
992} 970}
993 971
994static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) 972static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file)
@@ -1001,7 +979,6 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
1001{ 979{
1002 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; 980 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
1003 981
1004 ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show");
1005 982
1006 if (!video) 983 if (!video)
1007 goto end; 984 goto end;
@@ -1010,7 +987,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
1010 seq_printf(seq, "<TODO>\n"); 987 seq_printf(seq, "<TODO>\n");
1011 988
1012 end: 989 end:
1013 return_VALUE(0); 990 return 0;
1014} 991}
1015 992
1016static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) 993static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
@@ -1024,7 +1001,6 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
1024 unsigned long options; 1001 unsigned long options;
1025 int status; 1002 int status;
1026 1003
1027 ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show");
1028 1004
1029 if (!video) 1005 if (!video)
1030 goto end; 1006 goto end;
@@ -1047,7 +1023,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
1047 } else 1023 } else
1048 seq_printf(seq, "<not supported>\n"); 1024 seq_printf(seq, "<not supported>\n");
1049 end: 1025 end:
1050 return_VALUE(0); 1026 return 0;
1051} 1027}
1052 1028
1053static int 1029static int
@@ -1063,7 +1039,6 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
1063 int status; 1039 int status;
1064 unsigned long id; 1040 unsigned long id;
1065 1041
1066 ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show");
1067 1042
1068 if (!video) 1043 if (!video)
1069 goto end; 1044 goto end;
@@ -1076,18 +1051,17 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
1076 seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); 1051 seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
1077 1052
1078 end: 1053 end:
1079 return_VALUE(0); 1054 return 0;
1080} 1055}
1081 1056
1082static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) 1057static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset)
1083{ 1058{
1084 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; 1059 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
1085 1060
1086 ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show");
1087 1061
1088 seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); 1062 seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting);
1089 1063
1090 return_VALUE(0); 1064 return 0;
1091} 1065}
1092 1066
1093static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) 1067static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file)
@@ -1112,22 +1086,21 @@ acpi_video_bus_write_POST(struct file *file,
1112 char str[12] = { 0 }; 1086 char str[12] = { 0 };
1113 unsigned long opt, options; 1087 unsigned long opt, options;
1114 1088
1115 ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST");
1116 1089
1117 if (!video || count + 1 > sizeof str) 1090 if (!video || count + 1 > sizeof str)
1118 return_VALUE(-EINVAL); 1091 return -EINVAL;
1119 1092
1120 status = acpi_video_bus_POST_options(video, &options); 1093 status = acpi_video_bus_POST_options(video, &options);
1121 if (!ACPI_SUCCESS(status)) 1094 if (!ACPI_SUCCESS(status))
1122 return_VALUE(-EINVAL); 1095 return -EINVAL;
1123 1096
1124 if (copy_from_user(str, buffer, count)) 1097 if (copy_from_user(str, buffer, count))
1125 return_VALUE(-EFAULT); 1098 return -EFAULT;
1126 1099
1127 str[count] = 0; 1100 str[count] = 0;
1128 opt = strtoul(str, NULL, 0); 1101 opt = strtoul(str, NULL, 0);
1129 if (opt > 3) 1102 if (opt > 3)
1130 return_VALUE(-EFAULT); 1103 return -EFAULT;
1131 1104
1132 /* just in case an OEM 'forget' the motherboard... */ 1105 /* just in case an OEM 'forget' the motherboard... */
1133 options |= 1; 1106 options |= 1;
@@ -1135,11 +1108,11 @@ acpi_video_bus_write_POST(struct file *file,
1135 if (options & (1ul << opt)) { 1108 if (options & (1ul << opt)) {
1136 status = acpi_video_bus_set_POST(video, opt); 1109 status = acpi_video_bus_set_POST(video, opt);
1137 if (!ACPI_SUCCESS(status)) 1110 if (!ACPI_SUCCESS(status))
1138 return_VALUE(-EFAULT); 1111 return -EFAULT;
1139 1112
1140 } 1113 }
1141 1114
1142 return_VALUE(count); 1115 return count;
1143} 1116}
1144 1117
1145static ssize_t 1118static ssize_t
@@ -1153,25 +1126,24 @@ acpi_video_bus_write_DOS(struct file *file,
1153 char str[12] = { 0 }; 1126 char str[12] = { 0 };
1154 unsigned long opt; 1127 unsigned long opt;
1155 1128
1156 ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS");
1157 1129
1158 if (!video || count + 1 > sizeof str) 1130 if (!video || count + 1 > sizeof str)
1159 return_VALUE(-EINVAL); 1131 return -EINVAL;
1160 1132
1161 if (copy_from_user(str, buffer, count)) 1133 if (copy_from_user(str, buffer, count))
1162 return_VALUE(-EFAULT); 1134 return -EFAULT;
1163 1135
1164 str[count] = 0; 1136 str[count] = 0;
1165 opt = strtoul(str, NULL, 0); 1137 opt = strtoul(str, NULL, 0);
1166 if (opt > 7) 1138 if (opt > 7)
1167 return_VALUE(-EFAULT); 1139 return -EFAULT;
1168 1140
1169 status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); 1141 status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2);
1170 1142
1171 if (!ACPI_SUCCESS(status)) 1143 if (!ACPI_SUCCESS(status))
1172 return_VALUE(-EFAULT); 1144 return -EFAULT;
1173 1145
1174 return_VALUE(count); 1146 return count;
1175} 1147}
1176 1148
1177static int acpi_video_bus_add_fs(struct acpi_device *device) 1149static int acpi_video_bus_add_fs(struct acpi_device *device)
@@ -1179,7 +1151,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1179 struct proc_dir_entry *entry = NULL; 1151 struct proc_dir_entry *entry = NULL;
1180 struct acpi_video_bus *video; 1152 struct acpi_video_bus *video;
1181 1153
1182 ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs");
1183 1154
1184 video = (struct acpi_video_bus *)acpi_driver_data(device); 1155 video = (struct acpi_video_bus *)acpi_driver_data(device);
1185 1156
@@ -1187,7 +1158,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1187 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 1158 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1188 acpi_video_dir); 1159 acpi_video_dir);
1189 if (!acpi_device_dir(device)) 1160 if (!acpi_device_dir(device))
1190 return_VALUE(-ENODEV); 1161 return -ENODEV;
1191 video->dir = acpi_device_dir(device); 1162 video->dir = acpi_device_dir(device);
1192 acpi_device_dir(device)->owner = THIS_MODULE; 1163 acpi_device_dir(device)->owner = THIS_MODULE;
1193 } 1164 }
@@ -1195,7 +1166,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1195 /* 'info' [R] */ 1166 /* 'info' [R] */
1196 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); 1167 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
1197 if (!entry) 1168 if (!entry)
1198 return_VALUE(-ENODEV); 1169 return -ENODEV;
1199 else { 1170 else {
1200 entry->proc_fops = &acpi_video_bus_info_fops; 1171 entry->proc_fops = &acpi_video_bus_info_fops;
1201 entry->data = acpi_driver_data(device); 1172 entry->data = acpi_driver_data(device);
@@ -1205,7 +1176,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1205 /* 'ROM' [R] */ 1176 /* 'ROM' [R] */
1206 entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); 1177 entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device));
1207 if (!entry) 1178 if (!entry)
1208 return_VALUE(-ENODEV); 1179 return -ENODEV;
1209 else { 1180 else {
1210 entry->proc_fops = &acpi_video_bus_ROM_fops; 1181 entry->proc_fops = &acpi_video_bus_ROM_fops;
1211 entry->data = acpi_driver_data(device); 1182 entry->data = acpi_driver_data(device);
@@ -1216,7 +1187,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1216 entry = 1187 entry =
1217 create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); 1188 create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
1218 if (!entry) 1189 if (!entry)
1219 return_VALUE(-ENODEV); 1190 return -ENODEV;
1220 else { 1191 else {
1221 entry->proc_fops = &acpi_video_bus_POST_info_fops; 1192 entry->proc_fops = &acpi_video_bus_POST_info_fops;
1222 entry->data = acpi_driver_data(device); 1193 entry->data = acpi_driver_data(device);
@@ -1228,7 +1199,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1228 create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, 1199 create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR,
1229 acpi_device_dir(device)); 1200 acpi_device_dir(device));
1230 if (!entry) 1201 if (!entry)
1231 return_VALUE(-ENODEV); 1202 return -ENODEV;
1232 else { 1203 else {
1233 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; 1204 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
1234 entry->proc_fops = &acpi_video_bus_POST_fops; 1205 entry->proc_fops = &acpi_video_bus_POST_fops;
@@ -1241,7 +1212,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1241 create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, 1212 create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR,
1242 acpi_device_dir(device)); 1213 acpi_device_dir(device));
1243 if (!entry) 1214 if (!entry)
1244 return_VALUE(-ENODEV); 1215 return -ENODEV;
1245 else { 1216 else {
1246 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; 1217 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
1247 entry->proc_fops = &acpi_video_bus_DOS_fops; 1218 entry->proc_fops = &acpi_video_bus_DOS_fops;
@@ -1249,14 +1220,13 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1249 entry->owner = THIS_MODULE; 1220 entry->owner = THIS_MODULE;
1250 } 1221 }
1251 1222
1252 return_VALUE(0); 1223 return 0;
1253} 1224}
1254 1225
1255static int acpi_video_bus_remove_fs(struct acpi_device *device) 1226static int acpi_video_bus_remove_fs(struct acpi_device *device)
1256{ 1227{
1257 struct acpi_video_bus *video; 1228 struct acpi_video_bus *video;
1258 1229
1259 ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs");
1260 1230
1261 video = (struct acpi_video_bus *)acpi_driver_data(device); 1231 video = (struct acpi_video_bus *)acpi_driver_data(device);
1262 1232
@@ -1270,7 +1240,7 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device)
1270 acpi_device_dir(device) = NULL; 1240 acpi_device_dir(device) = NULL;
1271 } 1241 }
1272 1242
1273 return_VALUE(0); 1243 return 0;
1274} 1244}
1275 1245
1276/* -------------------------------------------------------------------------- 1246/* --------------------------------------------------------------------------
@@ -1287,10 +1257,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1287 int status; 1257 int status;
1288 struct acpi_video_device *data; 1258 struct acpi_video_device *data;
1289 1259
1290 ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device");
1291 1260
1292 if (!device || !video) 1261 if (!device || !video)
1293 return_VALUE(-EINVAL); 1262 return -EINVAL;
1294 1263
1295 status = 1264 status =
1296 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); 1265 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
@@ -1298,7 +1267,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1298 1267
1299 data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); 1268 data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
1300 if (!data) 1269 if (!data)
1301 return_VALUE(-ENOMEM); 1270 return -ENOMEM;
1302 1271
1303 memset(data, 0, sizeof(struct acpi_video_device)); 1272 memset(data, 0, sizeof(struct acpi_video_device));
1304 1273
@@ -1349,10 +1318,10 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1349 1318
1350 acpi_video_device_add_fs(device); 1319 acpi_video_device_add_fs(device);
1351 1320
1352 return_VALUE(0); 1321 return 0;
1353 } 1322 }
1354 1323
1355 return_VALUE(-ENOENT); 1324 return -ENOENT;
1356} 1325}
1357 1326
1358/* 1327/*
@@ -1395,7 +1364,6 @@ acpi_video_device_bind(struct acpi_video_bus *video,
1395 struct acpi_video_device *device) 1364 struct acpi_video_device *device)
1396{ 1365{
1397 int i; 1366 int i;
1398 ACPI_FUNCTION_TRACE("acpi_video_device_bind");
1399 1367
1400#define IDS_VAL(i) video->attached_array[i].value.int_val 1368#define IDS_VAL(i) video->attached_array[i].value.int_val
1401#define IDS_BIND(i) video->attached_array[i].bind_info 1369#define IDS_BIND(i) video->attached_array[i].bind_info
@@ -1432,12 +1400,11 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1432 union acpi_object *dod = NULL; 1400 union acpi_object *dod = NULL;
1433 union acpi_object *obj; 1401 union acpi_object *obj;
1434 1402
1435 ACPI_FUNCTION_TRACE("acpi_video_device_enumerate");
1436 1403
1437 status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); 1404 status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer);
1438 if (!ACPI_SUCCESS(status)) { 1405 if (!ACPI_SUCCESS(status)) {
1439 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); 1406 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
1440 return_VALUE(status); 1407 return status;
1441 } 1408 }
1442 1409
1443 dod = (union acpi_object *)buffer.pointer; 1410 dod = (union acpi_object *)buffer.pointer;
@@ -1484,7 +1451,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1484 video->attached_count = count; 1451 video->attached_count = count;
1485 out: 1452 out:
1486 acpi_os_free(buffer.pointer); 1453 acpi_os_free(buffer.pointer);
1487 return_VALUE(status); 1454 return status;
1488} 1455}
1489 1456
1490/* 1457/*
@@ -1509,7 +1476,6 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1509 unsigned long state; 1476 unsigned long state;
1510 int status = 0; 1477 int status = 0;
1511 1478
1512 ACPI_FUNCTION_TRACE("acpi_video_switch_output");
1513 1479
1514 list_for_each_safe(node, next, &video->video_device_list) { 1480 list_for_each_safe(node, next, &video->video_device_list) {
1515 dev = container_of(node, struct acpi_video_device, entry); 1481 dev = container_of(node, struct acpi_video_device, entry);
@@ -1540,7 +1506,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1540 break; 1506 break;
1541 } 1507 }
1542 1508
1543 return_VALUE(status); 1509 return status;
1544} 1510}
1545 1511
1546static int 1512static int
@@ -1567,7 +1533,6 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1567 int status = 0; 1533 int status = 0;
1568 struct list_head *node, *next; 1534 struct list_head *node, *next;
1569 1535
1570 ACPI_FUNCTION_TRACE("acpi_video_get_devices");
1571 1536
1572 acpi_video_device_enumerate(video); 1537 acpi_video_device_enumerate(video);
1573 1538
@@ -1585,7 +1550,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1585 } 1550 }
1586 1551
1587 } 1552 }
1588 return_VALUE(status); 1553 return status;
1589} 1554}
1590 1555
1591static int acpi_video_bus_put_one_device(struct acpi_video_device *device) 1556static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
@@ -1593,10 +1558,9 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1593 acpi_status status; 1558 acpi_status status;
1594 struct acpi_video_bus *video; 1559 struct acpi_video_bus *video;
1595 1560
1596 ACPI_FUNCTION_TRACE("acpi_video_bus_put_one_device");
1597 1561
1598 if (!device || !device->video) 1562 if (!device || !device->video)
1599 return_VALUE(-ENOENT); 1563 return -ENOENT;
1600 1564
1601 video = device->video; 1565 video = device->video;
1602 1566
@@ -1609,7 +1573,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1609 ACPI_DEVICE_NOTIFY, 1573 ACPI_DEVICE_NOTIFY,
1610 acpi_video_device_notify); 1574 acpi_video_device_notify);
1611 1575
1612 return_VALUE(0); 1576 return 0;
1613} 1577}
1614 1578
1615static int acpi_video_bus_put_devices(struct acpi_video_bus *video) 1579static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
@@ -1617,7 +1581,6 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1617 int status; 1581 int status;
1618 struct list_head *node, *next; 1582 struct list_head *node, *next;
1619 1583
1620 ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices");
1621 1584
1622 list_for_each_safe(node, next, &video->video_device_list) { 1585 list_for_each_safe(node, next, &video->video_device_list) {
1623 struct acpi_video_device *data = 1586 struct acpi_video_device *data =
@@ -1636,7 +1599,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1636 kfree(data); 1599 kfree(data);
1637 } 1600 }
1638 1601
1639 return_VALUE(0); 1602 return 0;
1640} 1603}
1641 1604
1642/* acpi_video interface */ 1605/* acpi_video interface */
@@ -1656,14 +1619,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1656 struct acpi_video_bus *video = (struct acpi_video_bus *)data; 1619 struct acpi_video_bus *video = (struct acpi_video_bus *)data;
1657 struct acpi_device *device = NULL; 1620 struct acpi_device *device = NULL;
1658 1621
1659 ACPI_FUNCTION_TRACE("acpi_video_bus_notify");
1660 printk("video bus notify\n"); 1622 printk("video bus notify\n");
1661 1623
1662 if (!video) 1624 if (!video)
1663 return_VOID; 1625 return;
1664 1626
1665 if (acpi_bus_get_device(handle, &device)) 1627 if (acpi_bus_get_device(handle, &device))
1666 return_VOID; 1628 return;
1667 1629
1668 switch (event) { 1630 switch (event) {
1669 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, 1631 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur,
@@ -1692,7 +1654,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1692 break; 1654 break;
1693 } 1655 }
1694 1656
1695 return_VOID; 1657 return;
1696} 1658}
1697 1659
1698static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) 1660static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
@@ -1701,14 +1663,13 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1701 (struct acpi_video_device *)data; 1663 (struct acpi_video_device *)data;
1702 struct acpi_device *device = NULL; 1664 struct acpi_device *device = NULL;
1703 1665
1704 ACPI_FUNCTION_TRACE("acpi_video_device_notify");
1705 1666
1706 printk("video device notify\n"); 1667 printk("video device notify\n");
1707 if (!video_device) 1668 if (!video_device)
1708 return_VOID; 1669 return;
1709 1670
1710 if (acpi_bus_get_device(handle, &device)) 1671 if (acpi_bus_get_device(handle, &device))
1711 return_VOID; 1672 return;
1712 1673
1713 switch (event) { 1674 switch (event) {
1714 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ 1675 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
@@ -1728,7 +1689,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1728 "Unsupported event [0x%x]\n", event)); 1689 "Unsupported event [0x%x]\n", event));
1729 break; 1690 break;
1730 } 1691 }
1731 return_VOID; 1692 return;
1732} 1693}
1733 1694
1734static int acpi_video_bus_add(struct acpi_device *device) 1695static int acpi_video_bus_add(struct acpi_device *device)
@@ -1737,14 +1698,13 @@ static int acpi_video_bus_add(struct acpi_device *device)
1737 acpi_status status = 0; 1698 acpi_status status = 0;
1738 struct acpi_video_bus *video = NULL; 1699 struct acpi_video_bus *video = NULL;
1739 1700
1740 ACPI_FUNCTION_TRACE("acpi_video_bus_add");
1741 1701
1742 if (!device) 1702 if (!device)
1743 return_VALUE(-EINVAL); 1703 return -EINVAL;
1744 1704
1745 video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); 1705 video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
1746 if (!video) 1706 if (!video)
1747 return_VALUE(-ENOMEM); 1707 return -ENOMEM;
1748 memset(video, 0, sizeof(struct acpi_video_bus)); 1708 memset(video, 0, sizeof(struct acpi_video_bus));
1749 1709
1750 video->handle = device->handle; 1710 video->handle = device->handle;
@@ -1791,7 +1751,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
1791 if (result) 1751 if (result)
1792 kfree(video); 1752 kfree(video);
1793 1753
1794 return_VALUE(result); 1754 return result;
1795} 1755}
1796 1756
1797static int acpi_video_bus_remove(struct acpi_device *device, int type) 1757static int acpi_video_bus_remove(struct acpi_device *device, int type)
@@ -1799,10 +1759,9 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1799 acpi_status status = 0; 1759 acpi_status status = 0;
1800 struct acpi_video_bus *video = NULL; 1760 struct acpi_video_bus *video = NULL;
1801 1761
1802 ACPI_FUNCTION_TRACE("acpi_video_bus_remove");
1803 1762
1804 if (!device || !acpi_driver_data(device)) 1763 if (!device || !acpi_driver_data(device))
1805 return_VALUE(-EINVAL); 1764 return -EINVAL;
1806 1765
1807 video = (struct acpi_video_bus *)acpi_driver_data(device); 1766 video = (struct acpi_video_bus *)acpi_driver_data(device);
1808 1767
@@ -1818,7 +1777,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1818 kfree(video->attached_array); 1777 kfree(video->attached_array);
1819 kfree(video); 1778 kfree(video);
1820 1779
1821 return_VALUE(0); 1780 return 0;
1822} 1781}
1823 1782
1824static int 1783static int
@@ -1828,10 +1787,9 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
1828 acpi_handle h_dummy2; 1787 acpi_handle h_dummy2;
1829 acpi_handle h_dummy3; 1788 acpi_handle h_dummy3;
1830 1789
1831 ACPI_FUNCTION_TRACE("acpi_video_bus_match");
1832 1790
1833 if (!device || !driver) 1791 if (!device || !driver)
1834 return_VALUE(-EINVAL); 1792 return -EINVAL;
1835 1793
1836 /* Since there is no HID, CID for ACPI Video drivers, we have 1794 /* Since there is no HID, CID for ACPI Video drivers, we have
1837 * to check well known required nodes for each feature we support. 1795 * to check well known required nodes for each feature we support.
@@ -1840,26 +1798,25 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
1840 /* Does this device able to support video switching ? */ 1798 /* Does this device able to support video switching ? */
1841 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && 1799 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
1842 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) 1800 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
1843 return_VALUE(0); 1801 return 0;
1844 1802
1845 /* Does this device able to retrieve a video ROM ? */ 1803 /* Does this device able to retrieve a video ROM ? */
1846 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) 1804 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
1847 return_VALUE(0); 1805 return 0;
1848 1806
1849 /* Does this device able to configure which video head to be POSTed ? */ 1807 /* Does this device able to configure which video head to be POSTed ? */
1850 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && 1808 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
1851 ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && 1809 ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
1852 ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) 1810 ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
1853 return_VALUE(0); 1811 return 0;
1854 1812
1855 return_VALUE(-ENODEV); 1813 return -ENODEV;
1856} 1814}
1857 1815
1858static int __init acpi_video_init(void) 1816static int __init acpi_video_init(void)
1859{ 1817{
1860 int result = 0; 1818 int result = 0;
1861 1819
1862 ACPI_FUNCTION_TRACE("acpi_video_init");
1863 1820
1864 /* 1821 /*
1865 acpi_dbg_level = 0xFFFFFFFF; 1822 acpi_dbg_level = 0xFFFFFFFF;
@@ -1868,27 +1825,26 @@ static int __init acpi_video_init(void)
1868 1825
1869 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); 1826 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
1870 if (!acpi_video_dir) 1827 if (!acpi_video_dir)
1871 return_VALUE(-ENODEV); 1828 return -ENODEV;
1872 acpi_video_dir->owner = THIS_MODULE; 1829 acpi_video_dir->owner = THIS_MODULE;
1873 1830
1874 result = acpi_bus_register_driver(&acpi_video_bus); 1831 result = acpi_bus_register_driver(&acpi_video_bus);
1875 if (result < 0) { 1832 if (result < 0) {
1876 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); 1833 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1877 return_VALUE(-ENODEV); 1834 return -ENODEV;
1878 } 1835 }
1879 1836
1880 return_VALUE(0); 1837 return 0;
1881} 1838}
1882 1839
1883static void __exit acpi_video_exit(void) 1840static void __exit acpi_video_exit(void)
1884{ 1841{
1885 ACPI_FUNCTION_TRACE("acpi_video_exit");
1886 1842
1887 acpi_bus_unregister_driver(&acpi_video_bus); 1843 acpi_bus_unregister_driver(&acpi_video_bus);
1888 1844
1889 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); 1845 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1890 1846
1891 return_VOID; 1847 return;
1892} 1848}
1893 1849
1894module_init(acpi_video_init); 1850module_init(acpi_video_init);