Commit 5f0dccaa authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Len Brown

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: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 6eca4b4c
...@@ -86,16 +86,13 @@ struct acpi_pci_link_irq { ...@@ -86,16 +86,13 @@ struct acpi_pci_link_irq {
}; };
struct acpi_pci_link { struct acpi_pci_link {
struct list_head node; struct list_head list;
struct acpi_device *device; struct acpi_device *device;
struct acpi_pci_link_irq irq; struct acpi_pci_link_irq irq;
int refcnt; int refcnt;
}; };
static struct { static LIST_HEAD(acpi_link_list);
int count;
struct list_head entries;
} acpi_link;
static DEFINE_MUTEX(acpi_link_lock); static DEFINE_MUTEX(acpi_link_lock);
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -479,19 +476,13 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { ...@@ -479,19 +476,13 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
int __init acpi_irq_penalty_init(void) int __init acpi_irq_penalty_init(void)
{ {
struct list_head *node;
struct acpi_pci_link *link; struct acpi_pci_link *link;
int i; int i;
/* /*
* Update penalties to facilitate IRQ balancing. * Update penalties to facilitate IRQ balancing.
*/ */
list_for_each(node, &acpi_link.entries) { list_for_each_entry(link, &acpi_link_list, list) {
link = list_entry(node, struct acpi_pci_link, node);
if (!link) {
printk(KERN_ERR PREFIX "Invalid link context\n");
continue;
}
/* /*
* reflect the possible and active irqs in the penalty table -- * 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,9 +734,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
printk("\n"); printk("\n");
/* TBD: Acquire/release lock */ list_add_tail(&link->list, &acpi_link_list);
list_add_tail(&link->node, &acpi_link.entries);
acpi_link.count++;
end: end:
/* disable all links -- to be activated on use */ /* disable all links -- to be activated on use */
...@@ -768,15 +757,9 @@ static int acpi_pci_link_resume(struct acpi_pci_link *link) ...@@ -768,15 +757,9 @@ static int acpi_pci_link_resume(struct acpi_pci_link *link)
static int irqrouter_resume(struct sys_device *dev) static int irqrouter_resume(struct sys_device *dev)
{ {
struct list_head *node;
struct acpi_pci_link *link; struct acpi_pci_link *link;
list_for_each(node, &acpi_link.entries) { list_for_each_entry(link, &acpi_link_list, list) {
link = list_entry(node, struct acpi_pci_link, node);
if (!link) {
printk(KERN_ERR PREFIX "Invalid link context\n");
continue;
}
acpi_pci_link_resume(link); acpi_pci_link_resume(link);
} }
return 0; return 0;
...@@ -789,7 +772,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) ...@@ -789,7 +772,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type)
link = acpi_driver_data(device); link = acpi_driver_data(device);
mutex_lock(&acpi_link_lock); mutex_lock(&acpi_link_lock);
list_del(&link->node); list_del(&link->list);
mutex_unlock(&acpi_link_lock); mutex_unlock(&acpi_link_lock);
kfree(link); kfree(link);
...@@ -926,9 +909,6 @@ static int __init acpi_pci_link_init(void) ...@@ -926,9 +909,6 @@ static int __init acpi_pci_link_init(void)
acpi_irq_balance = 0; acpi_irq_balance = 0;
} }
acpi_link.count = 0;
INIT_LIST_HEAD(&acpi_link.entries);
if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0)
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment