aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_link.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/pci_link.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/pci_link.c')
-rw-r--r--drivers/acpi/pci_link.c105
1 files changed, 45 insertions, 60 deletions
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);