diff options
author | Alex Chiang <achiang@hp.com> | 2008-09-02 11:40:51 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-10-20 13:53:52 -0400 |
commit | cef354db0d7a7207ea78c716753d9216a9c2b7e1 (patch) | |
tree | bd8c0c6356f852b10117a166b67d2b017445ce2b /drivers/pci/probe.c | |
parent | 93ff68a55aa92180a765d6c51c3303f6200167a6 (diff) |
PCI: connect struct pci_dev to struct pci_slot
The introduction of struct pci_slot (f46753c5e354b857b20ab8e0fe7b25)
added a struct pci_slot pointer to struct pci_dev, but we forgot to
associate the two.
Connect the two structs together; the interesting portions of the object
lifetimes are:
- when a new pci_slot is created, connect it to the appropriate
pci_dev's. A single pci_slot may be associated with multiple
pci_dev's, e.g. any multi-function PCI device.
- when a pci_slot is released, look for all the pci_dev's it was
associated with, and set their pci_slot pointers to NULL
- when a pci_dev is created, look for slots to associate with.
Note -- when a pci_dev is released, we don't need to do any bookkeeping,
since pci_slot's do not have pointers to pci_dev's.
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 578d15f49e02..7aa71636dd3c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -949,6 +949,7 @@ EXPORT_SYMBOL(alloc_pci_dev); | |||
949 | static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) | 949 | static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) |
950 | { | 950 | { |
951 | struct pci_dev *dev; | 951 | struct pci_dev *dev; |
952 | struct pci_slot *slot; | ||
952 | u32 l; | 953 | u32 l; |
953 | u8 hdr_type; | 954 | u8 hdr_type; |
954 | int delay = 1; | 955 | int delay = 1; |
@@ -997,6 +998,10 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) | |||
997 | dev->error_state = pci_channel_io_normal; | 998 | dev->error_state = pci_channel_io_normal; |
998 | set_pcie_port_type(dev); | 999 | set_pcie_port_type(dev); |
999 | 1000 | ||
1001 | list_for_each_entry(slot, &bus->slots, list) | ||
1002 | if (PCI_SLOT(devfn) == slot->number) | ||
1003 | dev->slot = slot; | ||
1004 | |||
1000 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) | 1005 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) |
1001 | set this higher, assuming the system even supports it. */ | 1006 | set this higher, assuming the system even supports it. */ |
1002 | dev->dma_mask = 0xffffffff; | 1007 | dev->dma_mask = 0xffffffff; |