Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46446
b: refs/heads/master
c: db3e1cc
h: refs/heads/master
v: v3
  • Loading branch information
Li Shaohua authored and Len Brown committed Dec 16, 2006
1 parent e080e3a commit 93fe2a6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54a07001b9efb6a3bb9a9d8ac9ddb226e29b5406
refs/heads/master: db3e1cc3257758d8a694d0a6ab29f109fb019853
56 changes: 52 additions & 4 deletions trunk/drivers/acpi/pci_bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ int acpi_pci_bind(struct acpi_device *device)
data->id.segment, data->id.bus,
data->id.device, data->id.function));
data->bus = data->dev->subordinate;
device->ops.bind = acpi_pci_bind;
device->ops.unbind = acpi_pci_unbind;
}

/*
Expand Down Expand Up @@ -354,8 +352,6 @@ acpi_pci_bind_root(struct acpi_device *device,

data->id = *id;
data->bus = bus;
device->ops.bind = acpi_pci_bind;
device->ops.unbind = acpi_pci_unbind;

acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);

Expand All @@ -378,3 +374,55 @@ acpi_pci_bind_root(struct acpi_device *device,

return result;
}

#define ACPI_PCI_BRIDGE_DRIVER_NAME "ACPI PCI Bridge Driver"

static int acpi_pci_bridge_add(struct acpi_device *device);
static int acpi_pci_bridge_remove(struct acpi_device *device, int type);
static int acpi_pci_bridge_match(struct acpi_device *device,
struct acpi_driver *driver);
static struct acpi_driver acpi_pci_bridge_driver = {
.name = ACPI_PCI_BRIDGE_DRIVER_NAME,
.ops = {
.add = acpi_pci_bridge_add,
.remove = acpi_pci_bridge_remove,
.match = acpi_pci_bridge_match,
},
};

static int acpi_pci_bridge_match(struct acpi_device *device,
struct acpi_driver *driver)
{
acpi_status status;
acpi_handle handle;

/* pci bridge has _PRT but isn't PNP0A03 */
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
if (ACPI_FAILURE(status))
return -ENODEV;
if (!acpi_match_ids(device, "PNP0A03"))
return -ENODEV;
return 0;
}

static int acpi_pci_bridge_add(struct acpi_device *device)
{
return acpi_pci_bind(device);
}

static int acpi_pci_bridge_remove(struct acpi_device *device, int type)
{
return acpi_pci_unbind(device);
}

static int __init acpi_pci_bridge_init(void)
{
if (acpi_pci_disabled)
return 0;
if (acpi_bus_register_driver(&acpi_pci_bridge_driver) < 0)
return -ENODEV;
return 0;
}

/* Should be called after ACPI pci root driver */
subsys_initcall(acpi_pci_bridge_init);
5 changes: 0 additions & 5 deletions trunk/drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
acpi_driver_data(device) = root;

/*
* TBD: Doesn't the bus driver automatically set this?
*/
device->ops.bind = acpi_pci_bind;

/*
* Segment
* -------
Expand Down
17 changes: 0 additions & 17 deletions trunk/drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,11 +866,6 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
if (!rmdevice)
return 0;

if (dev->flags.bus_address) {
if ((dev->parent) && (dev->parent->ops.unbind))
dev->parent->ops.unbind(dev);
}

acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT);

return 0;
Expand Down Expand Up @@ -987,18 +982,6 @@ acpi_add_single_object(struct acpi_device **child,

acpi_device_register(device, parent);

/*
* Bind _ADR-Based Devices
* -----------------------
* If there's a a bus address (_ADR) then we utilize the parent's
* 'bind' function (if exists) to bind the ACPI- and natively-
* enumerated device representations.
*/
if (device->flags.bus_address) {
if (device->parent && device->parent->ops.bind)
device->parent->ops.bind(device);
}

end:
if (!result)
*child = device;
Expand Down

0 comments on commit 93fe2a6

Please sign in to comment.