diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-22 14:59:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-22 14:59:51 -0400 |
commit | 59ef7a83f1127038a433464597df02e2dc9540e7 (patch) | |
tree | 725d262fc2e68eb9c592d76265f878cec73f8f2d /drivers/pci/bus.c | |
parent | 5165aece0efac6574fc3e32b6f1c2a964820d1c6 (diff) | |
parent | 2af5066f664cb011cf17d2e4414491fe24597e07 (diff) |
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (74 commits)
PCI: make msi_free_irqs() to use msix_mask_irq() instead of open coded write
PCI: Fix the NIU MSI-X problem in a better way
PCI ASPM: remove get_root_port_link
PCI ASPM: cleanup pcie_aspm_sanity_check
PCI ASPM: remove has_switch field
PCI ASPM: cleanup calc_Lx_latency
PCI ASPM: cleanup pcie_aspm_get_cap_device
PCI ASPM: cleanup clkpm checks
PCI ASPM: cleanup __pcie_aspm_check_state_one
PCI ASPM: cleanup initialization
PCI ASPM: cleanup change input argument of aspm functions
PCI ASPM: cleanup misc in struct pcie_link_state
PCI ASPM: cleanup clkpm state in struct pcie_link_state
PCI ASPM: cleanup latency field in struct pcie_link_state
PCI ASPM: cleanup aspm state field in struct pcie_link_state
PCI ASPM: fix typo in struct pcie_link_state
PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS
PCI: remove redundant __msi_set_enable()
PCI PM: consistently use type bool for wake enable variable
x86/ACPI: Correct maximum allowed _CRS returned resources and warn if exceeded
...
Diffstat (limited to 'drivers/pci/bus.c')
-rw-r--r-- | drivers/pci/bus.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 97a8194063b5..cef28a79103f 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -41,9 +41,14 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
41 | void *alignf_data) | 41 | void *alignf_data) |
42 | { | 42 | { |
43 | int i, ret = -ENOMEM; | 43 | int i, ret = -ENOMEM; |
44 | resource_size_t max = -1; | ||
44 | 45 | ||
45 | type_mask |= IORESOURCE_IO | IORESOURCE_MEM; | 46 | type_mask |= IORESOURCE_IO | IORESOURCE_MEM; |
46 | 47 | ||
48 | /* don't allocate too high if the pref mem doesn't support 64bit*/ | ||
49 | if (!(res->flags & IORESOURCE_MEM_64)) | ||
50 | max = PCIBIOS_MAX_MEM_32; | ||
51 | |||
47 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { | 52 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { |
48 | struct resource *r = bus->resource[i]; | 53 | struct resource *r = bus->resource[i]; |
49 | if (!r) | 54 | if (!r) |
@@ -62,7 +67,7 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
62 | /* Ok, try it out.. */ | 67 | /* Ok, try it out.. */ |
63 | ret = allocate_resource(r, res, size, | 68 | ret = allocate_resource(r, res, size, |
64 | r->start ? : min, | 69 | r->start ? : min, |
65 | -1, align, | 70 | max, align, |
66 | alignf, alignf_data); | 71 | alignf, alignf_data); |
67 | if (ret == 0) | 72 | if (ret == 0) |
68 | break; | 73 | break; |
@@ -201,13 +206,18 @@ void pci_enable_bridges(struct pci_bus *bus) | |||
201 | * Walk the given bus, including any bridged devices | 206 | * Walk the given bus, including any bridged devices |
202 | * on buses under this bus. Call the provided callback | 207 | * on buses under this bus. Call the provided callback |
203 | * on each device found. | 208 | * on each device found. |
209 | * | ||
210 | * We check the return of @cb each time. If it returns anything | ||
211 | * other than 0, we break out. | ||
212 | * | ||
204 | */ | 213 | */ |
205 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), | 214 | void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), |
206 | void *userdata) | 215 | void *userdata) |
207 | { | 216 | { |
208 | struct pci_dev *dev; | 217 | struct pci_dev *dev; |
209 | struct pci_bus *bus; | 218 | struct pci_bus *bus; |
210 | struct list_head *next; | 219 | struct list_head *next; |
220 | int retval; | ||
211 | 221 | ||
212 | bus = top; | 222 | bus = top; |
213 | down_read(&pci_bus_sem); | 223 | down_read(&pci_bus_sem); |
@@ -231,8 +241,10 @@ void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), | |||
231 | 241 | ||
232 | /* Run device routines with the device locked */ | 242 | /* Run device routines with the device locked */ |
233 | down(&dev->dev.sem); | 243 | down(&dev->dev.sem); |
234 | cb(dev, userdata); | 244 | retval = cb(dev, userdata); |
235 | up(&dev->dev.sem); | 245 | up(&dev->dev.sem); |
246 | if (retval) | ||
247 | break; | ||
236 | } | 248 | } |
237 | up_read(&pci_bus_sem); | 249 | up_read(&pci_bus_sem); |
238 | } | 250 | } |