aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_link.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-02-17 16:00:55 -0500
committerLen Brown <len.brown@intel.com>2009-03-17 01:53:29 -0400
commit5f0dccaa81e239477413d0def1133850530f1bbe (patch)
treee1b07674a092d1ba39beada0c333e2be386f07b4 /drivers/acpi/pci_link.c
parent6eca4b4ca168981d7648be371945c2a21f463a45 (diff)
ACPI: pci_link: simplify list of link devices
We don't need a struct containing a count and a list_head; a simple list_head is sufficient. The list iterators handle empty lists fine. Furthermore, we don't need to check for null list entries because we only add non-null entries. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/pci_link.c')
-rw-r--r--drivers/acpi/pci_link.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index dd9ebb9fda42..16e0f9d3d17c 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -86,16 +86,13 @@ struct acpi_pci_link_irq {
86}; 86};
87 87
88struct acpi_pci_link { 88struct acpi_pci_link {
89 struct list_head node; 89 struct list_head list;
90 struct acpi_device *device; 90 struct acpi_device *device;
91 struct acpi_pci_link_irq irq; 91 struct acpi_pci_link_irq irq;
92 int refcnt; 92 int refcnt;
93}; 93};
94 94
95static struct { 95static LIST_HEAD(acpi_link_list);
96 int count;
97 struct list_head entries;
98} acpi_link;
99static DEFINE_MUTEX(acpi_link_lock); 96static DEFINE_MUTEX(acpi_link_lock);
100 97
101/* -------------------------------------------------------------------------- 98/* --------------------------------------------------------------------------
@@ -479,19 +476,13 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
479 476
480int __init acpi_irq_penalty_init(void) 477int __init acpi_irq_penalty_init(void)
481{ 478{
482 struct list_head *node;
483 struct acpi_pci_link *link; 479 struct acpi_pci_link *link;
484 int i; 480 int i;
485 481
486 /* 482 /*
487 * Update penalties to facilitate IRQ balancing. 483 * Update penalties to facilitate IRQ balancing.
488 */ 484 */
489 list_for_each(node, &acpi_link.entries) { 485 list_for_each_entry(link, &acpi_link_list, list) {
490 link = list_entry(node, struct acpi_pci_link, node);
491 if (!link) {
492 printk(KERN_ERR PREFIX "Invalid link context\n");
493 continue;
494 }
495 486
496 /* 487 /*
497 * reflect the possible and active irqs in the penalty table -- 488 * reflect the possible and active irqs in the penalty table --
@@ -743,9 +734,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
743 734
744 printk("\n"); 735 printk("\n");
745 736
746 /* TBD: Acquire/release lock */ 737 list_add_tail(&link->list, &acpi_link_list);
747 list_add_tail(&link->node, &acpi_link.entries);
748 acpi_link.count++;
749 738
750 end: 739 end:
751 /* disable all links -- to be activated on use */ 740 /* disable all links -- to be activated on use */
@@ -768,15 +757,9 @@ static int acpi_pci_link_resume(struct acpi_pci_link *link)
768 757
769static int irqrouter_resume(struct sys_device *dev) 758static int irqrouter_resume(struct sys_device *dev)
770{ 759{
771 struct list_head *node;
772 struct acpi_pci_link *link; 760 struct acpi_pci_link *link;
773 761
774 list_for_each(node, &acpi_link.entries) { 762 list_for_each_entry(link, &acpi_link_list, list) {
775 link = list_entry(node, struct acpi_pci_link, node);
776 if (!link) {
777 printk(KERN_ERR PREFIX "Invalid link context\n");
778 continue;
779 }
780 acpi_pci_link_resume(link); 763 acpi_pci_link_resume(link);
781 } 764 }
782 return 0; 765 return 0;
@@ -789,7 +772,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type)
789 link = acpi_driver_data(device); 772 link = acpi_driver_data(device);
790 773
791 mutex_lock(&acpi_link_lock); 774 mutex_lock(&acpi_link_lock);
792 list_del(&link->node); 775 list_del(&link->list);
793 mutex_unlock(&acpi_link_lock); 776 mutex_unlock(&acpi_link_lock);
794 777
795 kfree(link); 778 kfree(link);
@@ -926,9 +909,6 @@ static int __init acpi_pci_link_init(void)
926 acpi_irq_balance = 0; 909 acpi_irq_balance = 0;
927 } 910 }
928 911
929 acpi_link.count = 0;
930 INIT_LIST_HEAD(&acpi_link.entries);
931
932 if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) 912 if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0)
933 return -ENODEV; 913 return -ENODEV;
934 914