Skip to content

Commit

Permalink
PCI/ACPI: Use normal list for struct acpi_pci_driver
Browse files Browse the repository at this point in the history
Use normal list for struct acpi_pci_driver to simplify code.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Jiang Liu authored and Bjorn Helgaas committed Sep 24, 2012
1 parent 059e4ba commit 8ee5bdf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
16 changes: 3 additions & 13 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,16 @@ static struct acpi_driver acpi_pci_root_driver = {
};

static LIST_HEAD(acpi_pci_roots);
static LIST_HEAD(acpi_pci_drivers);

static struct acpi_pci_driver *sub_driver;
static DEFINE_MUTEX(osc_lock);

int acpi_pci_register_driver(struct acpi_pci_driver *driver)
{
int n = 0;
struct acpi_pci_root *root;

struct acpi_pci_driver **pptr = &sub_driver;
while (*pptr)
pptr = &(*pptr)->next;
*pptr = driver;
list_add_tail(&driver->node, &acpi_pci_drivers);

if (!driver->add)
return 0;
Expand All @@ -103,14 +100,7 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
{
struct acpi_pci_root *root;

struct acpi_pci_driver **pptr = &sub_driver;
while (*pptr) {
if (*pptr == driver)
break;
pptr = &(*pptr)->next;
}
BUG_ON(!*pptr);
*pptr = (*pptr)->next;
list_del(&driver->node);

if (!driver->remove)
return;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void acpi_penalize_isa_irq(int irq, int active);
void acpi_pci_irq_disable (struct pci_dev *dev);

struct acpi_pci_driver {
struct acpi_pci_driver *next;
struct list_head node;
int (*add)(acpi_handle handle);
void (*remove)(acpi_handle handle);
};
Expand Down

0 comments on commit 8ee5bdf

Please sign in to comment.