aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.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/battery.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/battery.c')
-rw-r--r--drivers/acpi/battery.c97
1 files changed, 41 insertions, 56 deletions
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);