diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-02-17 16:00:40 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-03-17 01:51:36 -0400 |
commit | 1c9ca3a7d41b5db884033900b539b9aeb61a399e (patch) | |
tree | 8fe2bac60d57b0f1d90d0fb139fa455ed216b212 /drivers | |
parent | c15d8a6499d04e5d2cac07f8120f207bb275f60f (diff) |
ACPI: pci_link: clean up whitespace
This patch makes whitespace and indentation more consistent.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/pci_link.c | 73 |
1 files changed, 27 insertions, 46 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 6c772ca76bd1..19bc3bcda602 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -43,13 +43,14 @@ | |||
43 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
44 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
45 | 45 | ||
46 | #define _COMPONENT ACPI_PCI_COMPONENT | 46 | #define _COMPONENT ACPI_PCI_COMPONENT |
47 | ACPI_MODULE_NAME("pci_link"); | 47 | ACPI_MODULE_NAME("pci_link"); |
48 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" | 48 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" |
49 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" | 49 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" |
50 | #define ACPI_PCI_LINK_FILE_INFO "info" | 50 | #define ACPI_PCI_LINK_FILE_INFO "info" |
51 | #define ACPI_PCI_LINK_FILE_STATUS "state" | 51 | #define ACPI_PCI_LINK_FILE_STATUS "state" |
52 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 | 52 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 |
53 | |||
53 | static int acpi_pci_link_add(struct acpi_device *device); | 54 | static int acpi_pci_link_add(struct acpi_device *device); |
54 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 55 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
55 | 56 | ||
@@ -66,7 +67,7 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
66 | .ops = { | 67 | .ops = { |
67 | .add = acpi_pci_link_add, | 68 | .add = acpi_pci_link_add, |
68 | .remove = acpi_pci_link_remove, | 69 | .remove = acpi_pci_link_remove, |
69 | }, | 70 | }, |
70 | }; | 71 | }; |
71 | 72 | ||
72 | /* | 73 | /* |
@@ -76,7 +77,7 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
76 | struct acpi_pci_link_irq { | 77 | struct acpi_pci_link_irq { |
77 | u8 active; /* Current IRQ */ | 78 | u8 active; /* Current IRQ */ |
78 | u8 triggering; /* All IRQs */ | 79 | u8 triggering; /* All IRQs */ |
79 | u8 polarity; /* All IRQs */ | 80 | u8 polarity; /* All IRQs */ |
80 | u8 resource_type; | 81 | u8 resource_type; |
81 | u8 possible_count; | 82 | u8 possible_count; |
82 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 83 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
@@ -85,15 +86,15 @@ struct acpi_pci_link_irq { | |||
85 | }; | 86 | }; |
86 | 87 | ||
87 | struct acpi_pci_link { | 88 | struct acpi_pci_link { |
88 | struct list_head node; | 89 | struct list_head node; |
89 | struct acpi_device *device; | 90 | struct acpi_device *device; |
90 | struct acpi_pci_link_irq irq; | 91 | struct acpi_pci_link_irq irq; |
91 | int refcnt; | 92 | int refcnt; |
92 | }; | 93 | }; |
93 | 94 | ||
94 | static struct { | 95 | static struct { |
95 | int count; | 96 | int count; |
96 | struct list_head entries; | 97 | struct list_head entries; |
97 | } acpi_link; | 98 | } acpi_link; |
98 | static DEFINE_MUTEX(acpi_link_lock); | 99 | static DEFINE_MUTEX(acpi_link_lock); |
99 | 100 | ||
@@ -104,13 +105,12 @@ static DEFINE_MUTEX(acpi_link_lock); | |||
104 | /* | 105 | /* |
105 | * set context (link) possible list from resource list | 106 | * set context (link) possible list from resource list |
106 | */ | 107 | */ |
107 | static acpi_status | 108 | static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource, |
108 | acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | 109 | void *context) |
109 | { | 110 | { |
110 | struct acpi_pci_link *link = context; | 111 | struct acpi_pci_link *link = context; |
111 | u32 i = 0; | 112 | u32 i = 0; |
112 | 113 | ||
113 | |||
114 | switch (resource->type) { | 114 | switch (resource->type) { |
115 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 115 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
116 | case ACPI_RESOURCE_TYPE_END_TAG: | 116 | case ACPI_RESOURCE_TYPE_END_TAG: |
@@ -179,7 +179,6 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) | |||
179 | { | 179 | { |
180 | acpi_status status; | 180 | acpi_status status; |
181 | 181 | ||
182 | |||
183 | if (!link) | 182 | if (!link) |
184 | return -EINVAL; | 183 | return -EINVAL; |
185 | 184 | ||
@@ -197,12 +196,11 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) | |||
197 | return 0; | 196 | return 0; |
198 | } | 197 | } |
199 | 198 | ||
200 | static acpi_status | 199 | static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource, |
201 | acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | 200 | void *context) |
202 | { | 201 | { |
203 | int *irq = (int *)context; | 202 | int *irq = (int *)context; |
204 | 203 | ||
205 | |||
206 | switch (resource->type) { | 204 | switch (resource->type) { |
207 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 205 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
208 | case ACPI_RESOURCE_TYPE_END_TAG: | 206 | case ACPI_RESOURCE_TYPE_END_TAG: |
@@ -316,7 +314,6 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
316 | } *resource; | 314 | } *resource; |
317 | struct acpi_buffer buffer = { 0, NULL }; | 315 | struct acpi_buffer buffer = { 0, NULL }; |
318 | 316 | ||
319 | |||
320 | if (!link || !irq) | 317 | if (!link || !irq) |
321 | return -EINVAL; | 318 | return -EINVAL; |
322 | 319 | ||
@@ -479,10 +476,10 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { | |||
479 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */ | 476 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */ |
480 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */ | 477 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */ |
481 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */ | 478 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */ |
482 | PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */ | 479 | PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */ |
483 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ | 480 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ |
484 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ | 481 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ |
485 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ | 482 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ |
486 | /* >IRQ15 */ | 483 | /* >IRQ15 */ |
487 | }; | 484 | }; |
488 | 485 | ||
@@ -492,12 +489,10 @@ int __init acpi_irq_penalty_init(void) | |||
492 | struct acpi_pci_link *link = NULL; | 489 | struct acpi_pci_link *link = NULL; |
493 | int i = 0; | 490 | int i = 0; |
494 | 491 | ||
495 | |||
496 | /* | 492 | /* |
497 | * Update penalties to facilitate IRQ balancing. | 493 | * Update penalties to facilitate IRQ balancing. |
498 | */ | 494 | */ |
499 | list_for_each(node, &acpi_link.entries) { | 495 | list_for_each(node, &acpi_link.entries) { |
500 | |||
501 | link = list_entry(node, struct acpi_pci_link, node); | 496 | link = list_entry(node, struct acpi_pci_link, node); |
502 | if (!link) { | 497 | if (!link) { |
503 | printk(KERN_ERR PREFIX "Invalid link context\n"); | 498 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
@@ -527,7 +522,6 @@ int __init acpi_irq_penalty_init(void) | |||
527 | } | 522 | } |
528 | /* Add a penalty for the SCI */ | 523 | /* Add a penalty for the SCI */ |
529 | acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING; | 524 | acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING; |
530 | |||
531 | return 0; | 525 | return 0; |
532 | } | 526 | } |
533 | 527 | ||
@@ -538,7 +532,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
538 | int irq; | 532 | int irq; |
539 | int i; | 533 | int i; |
540 | 534 | ||
541 | |||
542 | if (link->irq.initialized) { | 535 | if (link->irq.initialized) { |
543 | if (link->refcnt == 0) | 536 | if (link->refcnt == 0) |
544 | /* This means the link is disabled but initialized */ | 537 | /* This means the link is disabled but initialized */ |
@@ -566,11 +559,10 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
566 | /* | 559 | /* |
567 | * if active found, use it; else pick entry from end of possible list. | 560 | * if active found, use it; else pick entry from end of possible list. |
568 | */ | 561 | */ |
569 | if (link->irq.active) { | 562 | if (link->irq.active) |
570 | irq = link->irq.active; | 563 | irq = link->irq.active; |
571 | } else { | 564 | else |
572 | irq = link->irq.possible[link->irq.possible_count - 1]; | 565 | irq = link->irq.possible[link->irq.possible_count - 1]; |
573 | } | ||
574 | 566 | ||
575 | if (acpi_irq_balance || !link->irq.active) { | 567 | if (acpi_irq_balance || !link->irq.active) { |
576 | /* | 568 | /* |
@@ -599,7 +591,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
599 | } | 591 | } |
600 | 592 | ||
601 | link->irq.initialized = 1; | 593 | link->irq.initialized = 1; |
602 | |||
603 | return 0; | 594 | return 0; |
604 | } | 595 | } |
605 | 596 | ||
@@ -608,17 +599,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
608 | * success: return IRQ >= 0 | 599 | * success: return IRQ >= 0 |
609 | * failure: return -1 | 600 | * failure: return -1 |
610 | */ | 601 | */ |
611 | 602 | int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, | |
612 | int | 603 | int *polarity, char **name) |
613 | acpi_pci_link_allocate_irq(acpi_handle handle, | ||
614 | int index, | ||
615 | int *triggering, int *polarity, char **name) | ||
616 | { | 604 | { |
617 | int result = 0; | 605 | int result = 0; |
618 | struct acpi_device *device = NULL; | 606 | struct acpi_device *device = NULL; |
619 | struct acpi_pci_link *link = NULL; | 607 | struct acpi_pci_link *link = NULL; |
620 | 608 | ||
621 | |||
622 | result = acpi_bus_get_device(handle, &device); | 609 | result = acpi_bus_get_device(handle, &device); |
623 | if (result) { | 610 | if (result) { |
624 | printk(KERN_ERR PREFIX "Invalid link device\n"); | 611 | printk(KERN_ERR PREFIX "Invalid link device\n"); |
@@ -673,7 +660,6 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
673 | struct acpi_pci_link *link = NULL; | 660 | struct acpi_pci_link *link = NULL; |
674 | acpi_status result; | 661 | acpi_status result; |
675 | 662 | ||
676 | |||
677 | result = acpi_bus_get_device(handle, &device); | 663 | result = acpi_bus_get_device(handle, &device); |
678 | if (result) { | 664 | if (result) { |
679 | printk(KERN_ERR PREFIX "Invalid link device\n"); | 665 | printk(KERN_ERR PREFIX "Invalid link device\n"); |
@@ -708,9 +694,9 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
708 | "Link %s is dereferenced\n", | 694 | "Link %s is dereferenced\n", |
709 | acpi_device_bid(link->device))); | 695 | acpi_device_bid(link->device))); |
710 | 696 | ||
711 | if (link->refcnt == 0) { | 697 | if (link->refcnt == 0) |
712 | acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); | 698 | acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); |
713 | } | 699 | |
714 | mutex_unlock(&acpi_link_lock); | 700 | mutex_unlock(&acpi_link_lock); |
715 | return (link->irq.active); | 701 | return (link->irq.active); |
716 | } | 702 | } |
@@ -726,7 +712,6 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
726 | int i = 0; | 712 | int i = 0; |
727 | int found = 0; | 713 | int found = 0; |
728 | 714 | ||
729 | |||
730 | if (!device) | 715 | if (!device) |
731 | return -EINVAL; | 716 | return -EINVAL; |
732 | 717 | ||
@@ -784,11 +769,10 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
784 | 769 | ||
785 | static int acpi_pci_link_resume(struct acpi_pci_link *link) | 770 | static int acpi_pci_link_resume(struct acpi_pci_link *link) |
786 | { | 771 | { |
787 | |||
788 | if (link->refcnt && link->irq.active && link->irq.initialized) | 772 | if (link->refcnt && link->irq.active && link->irq.initialized) |
789 | return (acpi_pci_link_set(link, link->irq.active)); | 773 | return (acpi_pci_link_set(link, link->irq.active)); |
790 | else | 774 | |
791 | return 0; | 775 | return 0; |
792 | } | 776 | } |
793 | 777 | ||
794 | static int irqrouter_resume(struct sys_device *dev) | 778 | static int irqrouter_resume(struct sys_device *dev) |
@@ -811,7 +795,6 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) | |||
811 | { | 795 | { |
812 | struct acpi_pci_link *link = NULL; | 796 | struct acpi_pci_link *link = NULL; |
813 | 797 | ||
814 | |||
815 | if (!device || !acpi_driver_data(device)) | 798 | if (!device || !acpi_driver_data(device)) |
816 | return -EINVAL; | 799 | return -EINVAL; |
817 | 800 | ||
@@ -822,7 +805,6 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) | |||
822 | mutex_unlock(&acpi_link_lock); | 805 | mutex_unlock(&acpi_link_lock); |
823 | 806 | ||
824 | kfree(link); | 807 | kfree(link); |
825 | |||
826 | return 0; | 808 | return 0; |
827 | } | 809 | } |
828 | 810 | ||
@@ -931,7 +913,6 @@ static int __init irqrouter_init_sysfs(void) | |||
931 | { | 913 | { |
932 | int error; | 914 | int error; |
933 | 915 | ||
934 | |||
935 | if (acpi_disabled || acpi_noirq) | 916 | if (acpi_disabled || acpi_noirq) |
936 | return 0; | 917 | return 0; |
937 | 918 | ||