aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2013-12-10 01:54:40 -0500
committerBjorn Helgaas <bhelgaas@google.com>2013-12-21 12:06:10 -0500
commitfc2798502f860b18f3c7121e4dc659d3d9d28d74 (patch)
treed15d6addb41d305e33c6f6d8e363b7272dc29a38
parent0a5ef7b914be91dd257ae4f35223dd822dd3703a (diff)
PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev
These interfaces: pcibios_resource_to_bus(struct pci_dev *dev, *bus_region, *resource) pcibios_bus_to_resource(struct pci_dev *dev, *resource, *bus_region) took a pci_dev, but they really depend only on the pci_bus. And we want to use them in resource allocation paths where we have the bus but not a device, so this patch converts them to take the pci_bus instead of the pci_dev: pcibios_resource_to_bus(struct pci_bus *bus, *bus_region, *resource) pcibios_bus_to_resource(struct pci_bus *bus, *resource, *bus_region) In fact, with standard PCI-PCI bridges, they only depend on the host bridge, because that's the only place address translation occurs, but we aren't going that far yet. [bhelgaas: changelog] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--arch/alpha/kernel/pci-sysfs.c4
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c4
-rw-r--r--arch/sparc/kernel/pci.c6
-rw-r--r--drivers/pci/host-bridge.c19
-rw-r--r--drivers/pci/probe.c18
-rw-r--r--drivers/pci/quirks.c2
-rw-r--r--drivers/pci/rom.c2
-rw-r--r--drivers/pci/setup-bus.c16
-rw-r--r--drivers/pci/setup-res.c2
-rw-r--r--drivers/pcmcia/i82092.c2
-rw-r--r--drivers/pcmcia/yenta_socket.c6
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c5
-rw-r--r--drivers/video/arkfb.c2
-rw-r--r--drivers/video/s3fb.c2
-rw-r--r--drivers/video/vt8623fb.c2
-rw-r--r--include/linux/pci.h4
17 files changed, 49 insertions, 51 deletions
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
index 2b183b0d3207..99e8d4796c96 100644
--- a/arch/alpha/kernel/pci-sysfs.c
+++ b/arch/alpha/kernel/pci-sysfs.c
@@ -83,7 +83,7 @@ static int pci_mmap_resource(struct kobject *kobj,
83 if (iomem_is_exclusive(res->start)) 83 if (iomem_is_exclusive(res->start))
84 return -EINVAL; 84 return -EINVAL;
85 85
86 pcibios_resource_to_bus(pdev, &bar, res); 86 pcibios_resource_to_bus(pdev->bus, &bar, res);
87 vma->vm_pgoff += bar.start >> (PAGE_SHIFT - (sparse ? 5 : 0)); 87 vma->vm_pgoff += bar.start >> (PAGE_SHIFT - (sparse ? 5 : 0));
88 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; 88 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
89 89
@@ -139,7 +139,7 @@ static int sparse_mem_mmap_fits(struct pci_dev *pdev, int num)
139 long dense_offset; 139 long dense_offset;
140 unsigned long sparse_size; 140 unsigned long sparse_size;
141 141
142 pcibios_resource_to_bus(pdev, &bar, &pdev->resource[num]); 142 pcibios_resource_to_bus(pdev->bus, &bar, &pdev->resource[num]);
143 143
144 /* All core logic chips have 4G sparse address space, except 144 /* All core logic chips have 4G sparse address space, except
145 CIA which has 16G (see xxx_SPARSE_MEM and xxx_DENSE_MEM 145 CIA which has 16G (see xxx_SPARSE_MEM and xxx_DENSE_MEM
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index a1e3e40ca3fd..d9476c1fc959 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -835,7 +835,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
835 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set 835 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set
836 * since in that case, we don't want to re-assign anything 836 * since in that case, we don't want to re-assign anything
837 */ 837 */
838 pcibios_resource_to_bus(dev, &reg, res); 838 pcibios_resource_to_bus(dev->bus, &reg, res);
839 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) || 839 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) ||
840 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { 840 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
841 /* Only print message if not re-assigning */ 841 /* Only print message if not re-assigning */
@@ -886,7 +886,7 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
886 886
887 /* Job is a bit different between memory and IO */ 887 /* Job is a bit different between memory and IO */
888 if (res->flags & IORESOURCE_MEM) { 888 if (res->flags & IORESOURCE_MEM) {
889 pcibios_resource_to_bus(dev, &region, res); 889 pcibios_resource_to_bus(dev->bus, &region, res);
890 890
891 /* If the BAR is non-0 then it's probably been initialized */ 891 /* If the BAR is non-0 then it's probably been initialized */
892 if (region.start != 0) 892 if (region.start != 0)
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index ac0b034f9ae0..83c26d829991 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -111,7 +111,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
111 res->name = pci_name(dev); 111 res->name = pci_name(dev);
112 region.start = base; 112 region.start = base;
113 region.end = base + size - 1; 113 region.end = base + size - 1;
114 pcibios_bus_to_resource(dev, res, &region); 114 pcibios_bus_to_resource(dev->bus, res, &region);
115 } 115 }
116} 116}
117 117
@@ -280,7 +280,7 @@ void of_scan_pci_bridge(struct pci_dev *dev)
280 res->flags = flags; 280 res->flags = flags;
281 region.start = of_read_number(&ranges[1], 2); 281 region.start = of_read_number(&ranges[1], 2);
282 region.end = region.start + size - 1; 282 region.end = region.start + size - 1;
283 pcibios_bus_to_resource(dev, res, &region); 283 pcibios_bus_to_resource(dev->bus, res, &region);
284 } 284 }
285 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 285 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
286 bus->number); 286 bus->number);
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index cb021453de2a..7de8d1f590b7 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -392,7 +392,7 @@ static void apb_fake_ranges(struct pci_dev *dev,
392 res->flags = IORESOURCE_IO; 392 res->flags = IORESOURCE_IO;
393 region.start = (first << 21); 393 region.start = (first << 21);
394 region.end = (last << 21) + ((1 << 21) - 1); 394 region.end = (last << 21) + ((1 << 21) - 1);
395 pcibios_bus_to_resource(dev, res, &region); 395 pcibios_bus_to_resource(dev->bus, res, &region);
396 396
397 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); 397 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map);
398 apb_calc_first_last(map, &first, &last); 398 apb_calc_first_last(map, &first, &last);
@@ -400,7 +400,7 @@ static void apb_fake_ranges(struct pci_dev *dev,
400 res->flags = IORESOURCE_MEM; 400 res->flags = IORESOURCE_MEM;
401 region.start = (first << 29); 401 region.start = (first << 29);
402 region.end = (last << 29) + ((1 << 29) - 1); 402 region.end = (last << 29) + ((1 << 29) - 1);
403 pcibios_bus_to_resource(dev, res, &region); 403 pcibios_bus_to_resource(dev->bus, res, &region);
404} 404}
405 405
406static void pci_of_scan_bus(struct pci_pbm_info *pbm, 406static void pci_of_scan_bus(struct pci_pbm_info *pbm,
@@ -491,7 +491,7 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
491 res->flags = flags; 491 res->flags = flags;
492 region.start = GET_64BIT(ranges, 1); 492 region.start = GET_64BIT(ranges, 1);
493 region.end = region.start + size - 1; 493 region.end = region.start + size - 1;
494 pcibios_bus_to_resource(dev, res, &region); 494 pcibios_bus_to_resource(dev->bus, res, &region);
495 } 495 }
496after_ranges: 496after_ranges:
497 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 497 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index a68dc613a5be..06ace6248c61 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -9,22 +9,19 @@
9 9
10#include "pci.h" 10#include "pci.h"
11 11
12static struct pci_bus *find_pci_root_bus(struct pci_dev *dev) 12static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
13{ 13{
14 struct pci_bus *bus;
15
16 bus = dev->bus;
17 while (bus->parent) 14 while (bus->parent)
18 bus = bus->parent; 15 bus = bus->parent;
19 16
20 return bus; 17 return bus;
21} 18}
22 19
23static struct pci_host_bridge *find_pci_host_bridge(struct pci_dev *dev) 20static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
24{ 21{
25 struct pci_bus *bus = find_pci_root_bus(dev); 22 struct pci_bus *root_bus = find_pci_root_bus(bus);
26 23
27 return to_pci_host_bridge(bus->bridge); 24 return to_pci_host_bridge(root_bus->bridge);
28} 25}
29 26
30void pci_set_host_bridge_release(struct pci_host_bridge *bridge, 27void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
@@ -40,10 +37,10 @@ static bool resource_contains(struct resource *res1, struct resource *res2)
40 return res1->start <= res2->start && res1->end >= res2->end; 37 return res1->start <= res2->start && res1->end >= res2->end;
41} 38}
42 39
43void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 40void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region,
44 struct resource *res) 41 struct resource *res)
45{ 42{
46 struct pci_host_bridge *bridge = find_pci_host_bridge(dev); 43 struct pci_host_bridge *bridge = find_pci_host_bridge(bus);
47 struct pci_host_bridge_window *window; 44 struct pci_host_bridge_window *window;
48 resource_size_t offset = 0; 45 resource_size_t offset = 0;
49 46
@@ -68,10 +65,10 @@ static bool region_contains(struct pci_bus_region *region1,
68 return region1->start <= region2->start && region1->end >= region2->end; 65 return region1->start <= region2->start && region1->end >= region2->end;
69} 66}
70 67
71void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 68void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
72 struct pci_bus_region *region) 69 struct pci_bus_region *region)
73{ 70{
74 struct pci_host_bridge *bridge = find_pci_host_bridge(dev); 71 struct pci_host_bridge *bridge = find_pci_host_bridge(bus);
75 struct pci_host_bridge_window *window; 72 struct pci_host_bridge_window *window;
76 resource_size_t offset = 0; 73 resource_size_t offset = 0;
77 74
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 38e403dddf6e..f049e3f53fcc 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -269,8 +269,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
269 region.end = l + sz; 269 region.end = l + sz;
270 } 270 }
271 271
272 pcibios_bus_to_resource(dev, res, &region); 272 pcibios_bus_to_resource(dev->bus, res, &region);
273 pcibios_resource_to_bus(dev, &inverted_region, res); 273 pcibios_resource_to_bus(dev->bus, &inverted_region, res);
274 274
275 /* 275 /*
276 * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is 276 * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is
@@ -364,7 +364,7 @@ static void pci_read_bridge_io(struct pci_bus *child)
364 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; 364 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
365 region.start = base; 365 region.start = base;
366 region.end = limit + io_granularity - 1; 366 region.end = limit + io_granularity - 1;
367 pcibios_bus_to_resource(dev, res, &region); 367 pcibios_bus_to_resource(dev->bus, res, &region);
368 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 368 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
369 } 369 }
370} 370}
@@ -386,7 +386,7 @@ static void pci_read_bridge_mmio(struct pci_bus *child)
386 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 386 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
387 region.start = base; 387 region.start = base;
388 region.end = limit + 0xfffff; 388 region.end = limit + 0xfffff;
389 pcibios_bus_to_resource(dev, res, &region); 389 pcibios_bus_to_resource(dev->bus, res, &region);
390 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 390 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
391 } 391 }
392} 392}
@@ -436,7 +436,7 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child)
436 res->flags |= IORESOURCE_MEM_64; 436 res->flags |= IORESOURCE_MEM_64;
437 region.start = base; 437 region.start = base;
438 region.end = limit + 0xfffff; 438 region.end = limit + 0xfffff;
439 pcibios_bus_to_resource(dev, res, &region); 439 pcibios_bus_to_resource(dev->bus, res, &region);
440 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 440 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
441 } 441 }
442} 442}
@@ -1084,24 +1084,24 @@ int pci_setup_device(struct pci_dev *dev)
1084 region.end = 0x1F7; 1084 region.end = 0x1F7;
1085 res = &dev->resource[0]; 1085 res = &dev->resource[0];
1086 res->flags = LEGACY_IO_RESOURCE; 1086 res->flags = LEGACY_IO_RESOURCE;
1087 pcibios_bus_to_resource(dev, res, &region); 1087 pcibios_bus_to_resource(dev->bus, res, &region);
1088 region.start = 0x3F6; 1088 region.start = 0x3F6;
1089 region.end = 0x3F6; 1089 region.end = 0x3F6;
1090 res = &dev->resource[1]; 1090 res = &dev->resource[1];
1091 res->flags = LEGACY_IO_RESOURCE; 1091 res->flags = LEGACY_IO_RESOURCE;
1092 pcibios_bus_to_resource(dev, res, &region); 1092 pcibios_bus_to_resource(dev->bus, res, &region);
1093 } 1093 }
1094 if ((progif & 4) == 0) { 1094 if ((progif & 4) == 0) {
1095 region.start = 0x170; 1095 region.start = 0x170;
1096 region.end = 0x177; 1096 region.end = 0x177;
1097 res = &dev->resource[2]; 1097 res = &dev->resource[2];
1098 res->flags = LEGACY_IO_RESOURCE; 1098 res->flags = LEGACY_IO_RESOURCE;
1099 pcibios_bus_to_resource(dev, res, &region); 1099 pcibios_bus_to_resource(dev->bus, res, &region);
1100 region.start = 0x376; 1100 region.start = 0x376;
1101 region.end = 0x376; 1101 region.end = 0x376;
1102 res = &dev->resource[3]; 1102 res = &dev->resource[3];
1103 res->flags = LEGACY_IO_RESOURCE; 1103 res->flags = LEGACY_IO_RESOURCE;
1104 pcibios_bus_to_resource(dev, res, &region); 1104 pcibios_bus_to_resource(dev->bus, res, &region);
1105 } 1105 }
1106 } 1106 }
1107 break; 1107 break;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index b3b1b9aa8863..4ad6bf6c107b 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -343,7 +343,7 @@ static void quirk_io_region(struct pci_dev *dev, int port,
343 /* Convert from PCI bus to resource space */ 343 /* Convert from PCI bus to resource space */
344 bus_region.start = region; 344 bus_region.start = region;
345 bus_region.end = region + size - 1; 345 bus_region.end = region + size - 1;
346 pcibios_bus_to_resource(dev, res, &bus_region); 346 pcibios_bus_to_resource(dev->bus, res, &bus_region);
347 347
348 if (!pci_claim_resource(dev, nr)) 348 if (!pci_claim_resource(dev, nr))
349 dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name); 349 dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name);
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index c5d0a08a8747..5d595724e5f4 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -31,7 +31,7 @@ int pci_enable_rom(struct pci_dev *pdev)
31 if (!res->flags) 31 if (!res->flags)
32 return -1; 32 return -1;
33 33
34 pcibios_resource_to_bus(pdev, &region, res); 34 pcibios_resource_to_bus(pdev->bus, &region, res);
35 pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr); 35 pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr);
36 rom_addr &= ~PCI_ROM_ADDRESS_MASK; 36 rom_addr &= ~PCI_ROM_ADDRESS_MASK;
37 rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE; 37 rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE;
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 219a4106480a..79339822d80e 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -475,7 +475,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
475 &bus->busn_res); 475 &bus->busn_res);
476 476
477 res = bus->resource[0]; 477 res = bus->resource[0];
478 pcibios_resource_to_bus(bridge, &region, res); 478 pcibios_resource_to_bus(bridge->bus, &region, res);
479 if (res->flags & IORESOURCE_IO) { 479 if (res->flags & IORESOURCE_IO) {
480 /* 480 /*
481 * The IO resource is allocated a range twice as large as it 481 * The IO resource is allocated a range twice as large as it
@@ -489,7 +489,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
489 } 489 }
490 490
491 res = bus->resource[1]; 491 res = bus->resource[1];
492 pcibios_resource_to_bus(bridge, &region, res); 492 pcibios_resource_to_bus(bridge->bus, &region, res);
493 if (res->flags & IORESOURCE_IO) { 493 if (res->flags & IORESOURCE_IO) {
494 dev_info(&bridge->dev, " bridge window %pR\n", res); 494 dev_info(&bridge->dev, " bridge window %pR\n", res);
495 pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, 495 pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
@@ -499,7 +499,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
499 } 499 }
500 500
501 res = bus->resource[2]; 501 res = bus->resource[2];
502 pcibios_resource_to_bus(bridge, &region, res); 502 pcibios_resource_to_bus(bridge->bus, &region, res);
503 if (res->flags & IORESOURCE_MEM) { 503 if (res->flags & IORESOURCE_MEM) {
504 dev_info(&bridge->dev, " bridge window %pR\n", res); 504 dev_info(&bridge->dev, " bridge window %pR\n", res);
505 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, 505 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
@@ -509,7 +509,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
509 } 509 }
510 510
511 res = bus->resource[3]; 511 res = bus->resource[3];
512 pcibios_resource_to_bus(bridge, &region, res); 512 pcibios_resource_to_bus(bridge->bus, &region, res);
513 if (res->flags & IORESOURCE_MEM) { 513 if (res->flags & IORESOURCE_MEM) {
514 dev_info(&bridge->dev, " bridge window %pR\n", res); 514 dev_info(&bridge->dev, " bridge window %pR\n", res);
515 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, 515 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
@@ -546,7 +546,7 @@ static void pci_setup_bridge_io(struct pci_bus *bus)
546 546
547 /* Set up the top and bottom of the PCI I/O segment for this bus. */ 547 /* Set up the top and bottom of the PCI I/O segment for this bus. */
548 res = bus->resource[0]; 548 res = bus->resource[0];
549 pcibios_resource_to_bus(bridge, &region, res); 549 pcibios_resource_to_bus(bridge->bus, &region, res);
550 if (res->flags & IORESOURCE_IO) { 550 if (res->flags & IORESOURCE_IO) {
551 pci_read_config_dword(bridge, PCI_IO_BASE, &l); 551 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
552 l &= 0xffff0000; 552 l &= 0xffff0000;
@@ -578,7 +578,7 @@ static void pci_setup_bridge_mmio(struct pci_bus *bus)
578 578
579 /* Set up the top and bottom of the PCI Memory segment for this bus. */ 579 /* Set up the top and bottom of the PCI Memory segment for this bus. */
580 res = bus->resource[1]; 580 res = bus->resource[1];
581 pcibios_resource_to_bus(bridge, &region, res); 581 pcibios_resource_to_bus(bridge->bus, &region, res);
582 if (res->flags & IORESOURCE_MEM) { 582 if (res->flags & IORESOURCE_MEM) {
583 l = (region.start >> 16) & 0xfff0; 583 l = (region.start >> 16) & 0xfff0;
584 l |= region.end & 0xfff00000; 584 l |= region.end & 0xfff00000;
@@ -604,7 +604,7 @@ static void pci_setup_bridge_mmio_pref(struct pci_bus *bus)
604 /* Set up PREF base/limit. */ 604 /* Set up PREF base/limit. */
605 bu = lu = 0; 605 bu = lu = 0;
606 res = bus->resource[2]; 606 res = bus->resource[2];
607 pcibios_resource_to_bus(bridge, &region, res); 607 pcibios_resource_to_bus(bridge->bus, &region, res);
608 if (res->flags & IORESOURCE_PREFETCH) { 608 if (res->flags & IORESOURCE_PREFETCH) {
609 l = (region.start >> 16) & 0xfff0; 609 l = (region.start >> 16) & 0xfff0;
610 l |= region.end & 0xfff00000; 610 l |= region.end & 0xfff00000;
@@ -1422,7 +1422,7 @@ static int iov_resources_unassigned(struct pci_dev *dev, void *data)
1422 if (!r->flags) 1422 if (!r->flags)
1423 continue; 1423 continue;
1424 1424
1425 pcibios_resource_to_bus(dev, &region, r); 1425 pcibios_resource_to_bus(dev->bus, &region, r);
1426 if (!region.start) { 1426 if (!region.start) {
1427 *unassigned = true; 1427 *unassigned = true;
1428 return 1; /* return early from pci_walk_bus() */ 1428 return 1; /* return early from pci_walk_bus() */
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 83c4d3bc47ab..5c060b152ce6 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -52,7 +52,7 @@ void pci_update_resource(struct pci_dev *dev, int resno)
52 if (res->flags & IORESOURCE_PCI_FIXED) 52 if (res->flags & IORESOURCE_PCI_FIXED)
53 return; 53 return;
54 54
55 pcibios_resource_to_bus(dev, &region, res); 55 pcibios_resource_to_bus(dev->bus, &region, res);
56 56
57 new = region.start | (res->flags & PCI_REGION_FLAG_MASK); 57 new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
58 if (res->flags & IORESOURCE_IO) 58 if (res->flags & IORESOURCE_IO)
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 519c4d6003a6..7d47456429a1 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -608,7 +608,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
608 608
609 enter("i82092aa_set_mem_map"); 609 enter("i82092aa_set_mem_map");
610 610
611 pcibios_resource_to_bus(sock_info->dev, &region, mem->res); 611 pcibios_resource_to_bus(sock_info->dev->bus, &region, mem->res);
612 612
613 map = mem->map; 613 map = mem->map;
614 if (map > 4) { 614 if (map > 4) {
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index dc18a3a5e010..8485761e76af 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -445,7 +445,7 @@ static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *
445 unsigned int start, stop, card_start; 445 unsigned int start, stop, card_start;
446 unsigned short word; 446 unsigned short word;
447 447
448 pcibios_resource_to_bus(socket->dev, &region, mem->res); 448 pcibios_resource_to_bus(socket->dev->bus, &region, mem->res);
449 449
450 map = mem->map; 450 map = mem->map;
451 start = region.start; 451 start = region.start;
@@ -709,7 +709,7 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
709 region.start = config_readl(socket, addr_start) & mask; 709 region.start = config_readl(socket, addr_start) & mask;
710 region.end = config_readl(socket, addr_end) | ~mask; 710 region.end = config_readl(socket, addr_end) | ~mask;
711 if (region.start && region.end > region.start && !override_bios) { 711 if (region.start && region.end > region.start && !override_bios) {
712 pcibios_bus_to_resource(dev, res, &region); 712 pcibios_bus_to_resource(dev->bus, res, &region);
713 if (pci_claim_resource(dev, PCI_BRIDGE_RESOURCES + nr) == 0) 713 if (pci_claim_resource(dev, PCI_BRIDGE_RESOURCES + nr) == 0)
714 return 0; 714 return 0;
715 dev_printk(KERN_INFO, &dev->dev, 715 dev_printk(KERN_INFO, &dev->dev,
@@ -1033,7 +1033,7 @@ static void yenta_config_init(struct yenta_socket *socket)
1033 struct pci_dev *dev = socket->dev; 1033 struct pci_dev *dev = socket->dev;
1034 struct pci_bus_region region; 1034 struct pci_bus_region region;
1035 1035
1036 pcibios_resource_to_bus(socket->dev, &region, &dev->resource[0]); 1036 pcibios_resource_to_bus(socket->dev->bus, &region, &dev->resource[0]);
1037 1037
1038 config_writel(socket, CB_LEGACY_MODE_BASE, 0); 1038 config_writel(socket, CB_LEGACY_MODE_BASE, 0);
1039 config_writel(socket, PCI_BASE_ADDRESS_0, region.start); 1039 config_writel(socket, PCI_BASE_ADDRESS_0, region.start);
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index bac55f7f69f9..6d3ee1ab6362 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1531,7 +1531,7 @@ static int sym_iomap_device(struct sym_device *device)
1531 struct pci_bus_region bus_addr; 1531 struct pci_bus_region bus_addr;
1532 int i = 2; 1532 int i = 2;
1533 1533
1534 pcibios_resource_to_bus(pdev, &bus_addr, &pdev->resource[1]); 1534 pcibios_resource_to_bus(pdev->bus, &bus_addr, &pdev->resource[1]);
1535 device->mmio_base = bus_addr.start; 1535 device->mmio_base = bus_addr.start;
1536 1536
1537 if (device->chip.features & FE_RAM) { 1537 if (device->chip.features & FE_RAM) {
@@ -1541,7 +1541,8 @@ static int sym_iomap_device(struct sym_device *device)
1541 */ 1541 */
1542 if (!pdev->resource[i].flags) 1542 if (!pdev->resource[i].flags)
1543 i++; 1543 i++;
1544 pcibios_resource_to_bus(pdev, &bus_addr, &pdev->resource[i]); 1544 pcibios_resource_to_bus(pdev->bus, &bus_addr,
1545 &pdev->resource[i]);
1545 device->ram_base = bus_addr.start; 1546 device->ram_base = bus_addr.start;
1546 } 1547 }
1547 1548
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index a6b29bd4a12a..adc4ea2cc5a0 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -1014,7 +1014,7 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1014 1014
1015 vga_res.flags = IORESOURCE_IO; 1015 vga_res.flags = IORESOURCE_IO;
1016 1016
1017 pcibios_bus_to_resource(dev, &vga_res, &bus_reg); 1017 pcibios_bus_to_resource(dev->bus, &vga_res, &bus_reg);
1018 1018
1019 par->state.vgabase = (void __iomem *) vga_res.start; 1019 par->state.vgabase = (void __iomem *) vga_res.start;
1020 1020
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 968b2997175a..9a3f8f1c6aab 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -1180,7 +1180,7 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1180 1180
1181 vga_res.flags = IORESOURCE_IO; 1181 vga_res.flags = IORESOURCE_IO;
1182 1182
1183 pcibios_bus_to_resource(dev, &vga_res, &bus_reg); 1183 pcibios_bus_to_resource(dev->bus, &vga_res, &bus_reg);
1184 1184
1185 par->state.vgabase = (void __iomem *) vga_res.start; 1185 par->state.vgabase = (void __iomem *) vga_res.start;
1186 1186
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 8bc6e0958a09..5c7cbc6c6236 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -729,7 +729,7 @@ static int vt8623_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
729 729
730 vga_res.flags = IORESOURCE_IO; 730 vga_res.flags = IORESOURCE_IO;
731 731
732 pcibios_bus_to_resource(dev, &vga_res, &bus_reg); 732 pcibios_bus_to_resource(dev->bus, &vga_res, &bus_reg);
733 733
734 par->state.vgabase = (void __iomem *) vga_res.start; 734 par->state.vgabase = (void __iomem *) vga_res.start;
735 735
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7d5555270491..bf32412704a7 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -737,9 +737,9 @@ void pci_fixup_cardbus(struct pci_bus *);
737 737
738/* Generic PCI functions used internally */ 738/* Generic PCI functions used internally */
739 739
740void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 740void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region,
741 struct resource *res); 741 struct resource *res);
742void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 742void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
743 struct pci_bus_region *region); 743 struct pci_bus_region *region);
744void pcibios_scan_specific_bus(int busn); 744void pcibios_scan_specific_bus(int busn);
745struct pci_bus *pci_find_bus(int domain, int busnr); 745struct pci_bus *pci_find_bus(int domain, int busnr);