aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/bus.c
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@linux.intel.com>2006-06-27 00:41:40 -0400
committerLen Brown <len.brown@intel.com>2006-06-27 00:41:40 -0400
commitd550d98d3317378d93a4869db204725d270ec812 (patch)
tree958a8578babc6f9955f91e21253d1d1b847985ff /drivers/acpi/bus.c
parentd7fa2589bbe7ab53fd5eb20e8c7e388d5aff6f16 (diff)
ACPI: delete tracing macros from drivers/acpi/*.c
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/bus.c')
-rw-r--r--drivers/acpi/bus.c105
1 files changed, 46 insertions, 59 deletions
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);