aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-01-01 11:40:49 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-02-22 19:16:56 -0500
commitb26b2d494b659f988b4d75eb394dfa0ddac415c9 (patch)
treed262f333e529a21017dc072e604a626b38520515 /arch
parent93da6202264ce1256b04db8008a43882ae62d060 (diff)
resource/PCI: align functions now return start of resource
As suggested by Linus, align functions should return the start of a resource, not void. An update of "res->start" is no longer necessary. Cc: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c4
-rw-r--r--arch/arm/kernel/bios32.c8
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c14
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c14
-rw-r--r--arch/ia64/pci/pci.c3
-rw-r--r--arch/mips/pci/pci.c4
-rw-r--r--arch/mips/pmc-sierra/yosemite/ht.c10
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.c16
-rw-r--r--arch/parisc/kernel/pci.c10
-rw-r--r--arch/powerpc/kernel/pci-common.c13
-rw-r--r--arch/sh/drivers/pci/pci.c6
-rw-r--r--arch/sparc/kernel/pci.c5
-rw-r--r--arch/sparc/kernel/pcic.c5
-rw-r--r--arch/x86/pci/i386.c12
-rw-r--r--arch/xtensa/kernel/pci.c11
15 files changed, 65 insertions, 70 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index a91ba28999b5..5cf111ed851c 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -126,7 +126,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_final);
126#define MB (1024*KB) 126#define MB (1024*KB)
127#define GB (1024*MB) 127#define GB (1024*MB)
128 128
129void 129resource_size_t
130pcibios_align_resource(void *data, struct resource *res, 130pcibios_align_resource(void *data, struct resource *res,
131 resource_size_t size, resource_size_t align) 131 resource_size_t size, resource_size_t align)
132{ 132{
@@ -184,7 +184,7 @@ pcibios_align_resource(void *data, struct resource *res,
184 } 184 }
185 } 185 }
186 186
187 res->start = start; 187 return start;
188} 188}
189#undef KB 189#undef KB
190#undef MB 190#undef MB
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 809681900ec8..a7c85f84f06c 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -616,15 +616,17 @@ char * __init pcibios_setup(char *str)
616 * but we want to try to avoid allocating at 0x2900-0x2bff 616 * but we want to try to avoid allocating at 0x2900-0x2bff
617 * which might be mirrored at 0x0100-0x03ff.. 617 * which might be mirrored at 0x0100-0x03ff..
618 */ 618 */
619void pcibios_align_resource(void *data, struct resource *res, 619resource_size_t pcibios_align_resource(void *data, struct resource *res,
620 resource_size_t size, resource_size_t align) 620 resource_size_t size, resource_size_t align)
621{ 621{
622 resource_size_t start = res->start; 622 resource_size_t start = res->start;
623 623
624 if (res->flags & IORESOURCE_IO && start & 0x300) 624 if (res->flags & IORESOURCE_IO && start & 0x300)
625 start = (start + 0x3ff) & ~0x3ff; 625 start = (start + 0x3ff) & ~0x3ff;
626 626
627 res->start = (start + align - 1) & ~(align - 1); 627 start = (start + align - 1) & ~(align - 1);
628
629 return start;
628} 630}
629 631
630/** 632/**
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
index 77ee319193c3..5811e2f8945c 100644
--- a/arch/cris/arch-v32/drivers/pci/bios.c
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -41,18 +41,16 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
41 return 0; 41 return 0;
42} 42}
43 43
44void 44resource_size_t
45pcibios_align_resource(void *data, struct resource *res, 45pcibios_align_resource(void *data, struct resource *res,
46 resource_size_t size, resource_size_t align) 46 resource_size_t size, resource_size_t align)
47{ 47{
48 if (res->flags & IORESOURCE_IO) { 48 resource_size_t start = res->start;
49 resource_size_t start = res->start;
50 49
51 if (start & 0x300) { 50 if ((res->flags & IORESOURCE_IO) && (start & 0x300))
52 start = (start + 0x3ff) & ~0x3ff; 51 start = (start + 0x3ff) & ~0x3ff;
53 res->start = start; 52
54 } 53 return start
55 }
56} 54}
57 55
58int pcibios_enable_resources(struct pci_dev *dev, int mask) 56int pcibios_enable_resources(struct pci_dev *dev, int mask)
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index 566bdeb499d1..c947aa43f2a9 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -32,18 +32,16 @@
32 * but we want to try to avoid allocating at 0x2900-0x2bff 32 * but we want to try to avoid allocating at 0x2900-0x2bff
33 * which might have be mirrored at 0x0100-0x03ff.. 33 * which might have be mirrored at 0x0100-0x03ff..
34 */ 34 */
35void 35resource_size_t
36pcibios_align_resource(void *data, struct resource *res, 36pcibios_align_resource(void *data, struct resource *res,
37 resource_size_t size, resource_size_t align) 37 resource_size_t size, resource_size_t align)
38{ 38{
39 if (res->flags & IORESOURCE_IO) { 39 resource_size_t start = res->start;
40 resource_size_t start = res->start;
41 40
42 if (start & 0x300) { 41 if ((res->flags & IORESOURCE_IO) && (start & 0x300))
43 start = (start + 0x3ff) & ~0x3ff; 42 start = (start + 0x3ff) & ~0x3ff;
44 res->start = start; 43
45 } 44 return start
46 }
47} 45}
48 46
49 47
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index df639db779f9..ef574cd311d1 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -547,10 +547,11 @@ pcibios_disable_device (struct pci_dev *dev)
547 acpi_pci_irq_disable(dev); 547 acpi_pci_irq_disable(dev);
548} 548}
549 549
550void 550resource_size_t
551pcibios_align_resource (void *data, struct resource *res, 551pcibios_align_resource (void *data, struct resource *res,
552 resource_size_t size, resource_size_t align) 552 resource_size_t size, resource_size_t align)
553{ 553{
554 return res->start;
554} 555}
555 556
556/* 557/*
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9a11c2226891..9085988f7cf3 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -49,7 +49,7 @@ static int pci_initialized;
49 * but we want to try to avoid allocating at 0x2900-0x2bff 49 * but we want to try to avoid allocating at 0x2900-0x2bff
50 * which might have be mirrored at 0x0100-0x03ff.. 50 * which might have be mirrored at 0x0100-0x03ff..
51 */ 51 */
52void 52resource_size_t
53pcibios_align_resource(void *data, struct resource *res, 53pcibios_align_resource(void *data, struct resource *res,
54 resource_size_t size, resource_size_t align) 54 resource_size_t size, resource_size_t align)
55{ 55{
@@ -73,7 +73,7 @@ pcibios_align_resource(void *data, struct resource *res,
73 start = PCIBIOS_MIN_MEM + hose->mem_resource->start; 73 start = PCIBIOS_MIN_MEM + hose->mem_resource->start;
74 } 74 }
75 75
76 res->start = start; 76 return start;
77} 77}
78 78
79static void __devinit pcibios_scanbus(struct pci_controller *hose) 79static void __devinit pcibios_scanbus(struct pci_controller *hose)
diff --git a/arch/mips/pmc-sierra/yosemite/ht.c b/arch/mips/pmc-sierra/yosemite/ht.c
index 678388fd34b1..5e410087b628 100644
--- a/arch/mips/pmc-sierra/yosemite/ht.c
+++ b/arch/mips/pmc-sierra/yosemite/ht.c
@@ -345,14 +345,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
345 return pcibios_enable_resources(dev); 345 return pcibios_enable_resources(dev);
346} 346}
347 347
348void pcibios_align_resource(void *data, struct resource *res, 348resource_size_t pcibios_align_resource(void *data, struct resource *res,
349 resource_size_t size, resource_size_t align) 349 resource_size_t size, resource_size_t align)
350{ 350{
351 struct pci_dev *dev = data; 351 struct pci_dev *dev = data;
352 resource_size_t start = res->start;
352 353
353 if (res->flags & IORESOURCE_IO) { 354 if (res->flags & IORESOURCE_IO) {
354 resource_size_t start = res->start;
355
356 /* We need to avoid collisions with `mirrored' VGA ports 355 /* We need to avoid collisions with `mirrored' VGA ports
357 and other strange ISA hardware, so we always want the 356 and other strange ISA hardware, so we always want the
358 addresses kilobyte aligned. */ 357 addresses kilobyte aligned. */
@@ -363,8 +362,9 @@ void pcibios_align_resource(void *data, struct resource *res,
363 } 362 }
364 363
365 start = (start + 1024 - 1) & ~(1024 - 1); 364 start = (start + 1024 - 1) & ~(1024 - 1);
366 res->start = start;
367 } 365 }
366
367 return start;
368} 368}
369 369
370struct pci_ops titan_pci_ops = { 370struct pci_ops titan_pci_ops = {
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index 78cd134ddf7d..b0b3758fba08 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -31,9 +31,11 @@
31 * but we want to try to avoid allocating at 0x2900-0x2bff 31 * but we want to try to avoid allocating at 0x2900-0x2bff
32 * which might have be mirrored at 0x0100-0x03ff.. 32 * which might have be mirrored at 0x0100-0x03ff..
33 */ 33 */
34void pcibios_align_resource(void *data, struct resource *res, 34resource_size_t pcibios_align_resource(void *data, struct resource *res,
35 resource_size_t size, resource_size_t align) 35 resource_size_t size, resource_size_t align)
36{ 36{
37 resource_size_t start = res->start;
38
37#if 0 39#if 0
38 struct pci_dev *dev = data; 40 struct pci_dev *dev = data;
39 41
@@ -47,14 +49,10 @@ void pcibios_align_resource(void *data, struct resource *res,
47 ); 49 );
48#endif 50#endif
49 51
50 if (res->flags & IORESOURCE_IO) { 52 if ((res->flags & IORESOURCE_IO) && (start & 0x300))
51 unsigned long start = res->start; 53 start = (start + 0x3ff) & ~0x3ff;
52 54
53 if (start & 0x300) { 55 return start;
54 start = (start + 0x3ff) & ~0x3ff;
55 res->start = start;
56 }
57 }
58} 56}
59 57
60 58
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index f7064abc3bb6..4463a31973ba 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -254,10 +254,10 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
254 * Since we are just checking candidates, don't use any fields other 254 * Since we are just checking candidates, don't use any fields other
255 * than res->start. 255 * than res->start.
256 */ 256 */
257void pcibios_align_resource(void *data, struct resource *res, 257resource_size_t pcibios_align_resource(void *data, struct resource *res,
258 resource_size_t size, resource_size_t alignment) 258 resource_size_t size, resource_size_t alignment)
259{ 259{
260 resource_size_t mask, align; 260 resource_size_t mask, align, start = res->start;
261 261
262 DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx, 0x%lx)\n", 262 DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx, 0x%lx)\n",
263 pci_name(((struct pci_dev *) data)), 263 pci_name(((struct pci_dev *) data)),
@@ -269,10 +269,10 @@ void pcibios_align_resource(void *data, struct resource *res,
269 269
270 /* Align to largest of MIN or input size */ 270 /* Align to largest of MIN or input size */
271 mask = max(alignment, align) - 1; 271 mask = max(alignment, align) - 1;
272 res->start += mask; 272 start += mask;
273 res->start &= ~mask; 273 start &= ~mask;
274 274
275 /* The caller updates the end field, we don't. */ 275 return start;
276} 276}
277 277
278 278
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index cadbed679fbb..d7eebbaf01f1 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1181,21 +1181,20 @@ static int skip_isa_ioresource_align(struct pci_dev *dev)
1181 * but we want to try to avoid allocating at 0x2900-0x2bff 1181 * but we want to try to avoid allocating at 0x2900-0x2bff
1182 * which might have be mirrored at 0x0100-0x03ff.. 1182 * which might have be mirrored at 0x0100-0x03ff..
1183 */ 1183 */
1184void pcibios_align_resource(void *data, struct resource *res, 1184resource_size_t pcibios_align_resource(void *data, struct resource *res,
1185 resource_size_t size, resource_size_t align) 1185 resource_size_t size, resource_size_t align)
1186{ 1186{
1187 struct pci_dev *dev = data; 1187 struct pci_dev *dev = data;
1188 resource_size_t start = res->start;
1188 1189
1189 if (res->flags & IORESOURCE_IO) { 1190 if (res->flags & IORESOURCE_IO) {
1190 resource_size_t start = res->start;
1191
1192 if (skip_isa_ioresource_align(dev)) 1191 if (skip_isa_ioresource_align(dev))
1193 return; 1192 return start;
1194 if (start & 0x300) { 1193 if (start & 0x300)
1195 start = (start + 0x3ff) & ~0x3ff; 1194 start = (start + 0x3ff) & ~0x3ff;
1196 res->start = start;
1197 }
1198 } 1195 }
1196
1197 return start;
1199} 1198}
1200EXPORT_SYMBOL(pcibios_align_resource); 1199EXPORT_SYMBOL(pcibios_align_resource);
1201 1200
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index c481df639022..b36ca825b3d3 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -148,8 +148,8 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
148 * addresses to be allocated in the 0x000-0x0ff region 148 * addresses to be allocated in the 0x000-0x0ff region
149 * modulo 0x400. 149 * modulo 0x400.
150 */ 150 */
151void pcibios_align_resource(void *data, struct resource *res, 151resource_size_t pcibios_align_resource(void *data, struct resource *res,
152 resource_size_t size, resource_size_t align) 152 resource_size_t size, resource_size_t align)
153{ 153{
154 struct pci_dev *dev = data; 154 struct pci_dev *dev = data;
155 struct pci_channel *chan = dev->sysdata; 155 struct pci_channel *chan = dev->sysdata;
@@ -171,7 +171,7 @@ void pcibios_align_resource(void *data, struct resource *res,
171 start = PCIBIOS_MIN_MEM + chan->mem_resource->start; 171 start = PCIBIOS_MIN_MEM + chan->mem_resource->start;
172 } 172 }
173 173
174 res->start = start; 174 return start;
175} 175}
176 176
177void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 177void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 592b03d85167..d56c1f34689e 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -722,9 +722,10 @@ void pcibios_update_irq(struct pci_dev *pdev, int irq)
722{ 722{
723} 723}
724 724
725void pcibios_align_resource(void *data, struct resource *res, 725resource_size_t pcibios_align_resource(void *data, struct resource *res,
726 resource_size_t size, resource_size_t align) 726 resource_size_t size, resource_size_t align)
727{ 727{
728 return res->start;
728} 729}
729 730
730int pcibios_enable_device(struct pci_dev *dev, int mask) 731int pcibios_enable_device(struct pci_dev *dev, int mask)
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 4e2724ec2bb6..46fda64ff163 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -768,9 +768,10 @@ char * __devinit pcibios_setup(char *str)
768 return str; 768 return str;
769} 769}
770 770
771void pcibios_align_resource(void *data, struct resource *res, 771resource_size_t pcibios_align_resource(void *data, struct resource *res,
772 resource_size_t size, resource_size_t align) 772 resource_size_t size, resource_size_t align)
773{ 773{
774 return res->start;
774} 775}
775 776
776int pcibios_enable_device(struct pci_dev *pdev, int mask) 777int pcibios_enable_device(struct pci_dev *pdev, int mask)
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 5dc9e8c63fcd..924e40c916d3 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -60,22 +60,20 @@ skip_isa_ioresource_align(struct pci_dev *dev) {
60 * but we want to try to avoid allocating at 0x2900-0x2bff 60 * but we want to try to avoid allocating at 0x2900-0x2bff
61 * which might have be mirrored at 0x0100-0x03ff.. 61 * which might have be mirrored at 0x0100-0x03ff..
62 */ 62 */
63void 63resource_size_t
64pcibios_align_resource(void *data, struct resource *res, 64pcibios_align_resource(void *data, struct resource *res,
65 resource_size_t size, resource_size_t align) 65 resource_size_t size, resource_size_t align)
66{ 66{
67 struct pci_dev *dev = data; 67 struct pci_dev *dev = data;
68 resource_size_t start = res->start;
68 69
69 if (res->flags & IORESOURCE_IO) { 70 if (res->flags & IORESOURCE_IO) {
70 resource_size_t start = res->start;
71
72 if (skip_isa_ioresource_align(dev)) 71 if (skip_isa_ioresource_align(dev))
73 return; 72 return start;
74 if (start & 0x300) { 73 if (start & 0x300)
75 start = (start + 0x3ff) & ~0x3ff; 74 start = (start + 0x3ff) & ~0x3ff;
76 res->start = start;
77 }
78 } 75 }
76 return start;
79} 77}
80EXPORT_SYMBOL(pcibios_align_resource); 78EXPORT_SYMBOL(pcibios_align_resource);
81 79
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index b7c073484e01..d7efab03164e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -69,26 +69,25 @@ static int pci_bus_count;
69 * but we want to try to avoid allocating at 0x2900-0x2bff 69 * but we want to try to avoid allocating at 0x2900-0x2bff
70 * which might have be mirrored at 0x0100-0x03ff.. 70 * which might have be mirrored at 0x0100-0x03ff..
71 */ 71 */
72void 72resource_size_t
73pcibios_align_resource(void *data, struct resource *res, resource_size_t size, 73pcibios_align_resource(void *data, struct resource *res, resource_size_t size,
74 resource_size_t align) 74 resource_size_t align)
75{ 75{
76 struct pci_dev *dev = data; 76 struct pci_dev *dev = data;
77 resource_size_t start = res->start;
77 78
78 if (res->flags & IORESOURCE_IO) { 79 if (res->flags & IORESOURCE_IO) {
79 resource_size_t start = res->start;
80
81 if (size > 0x100) { 80 if (size > 0x100) {
82 printk(KERN_ERR "PCI: I/O Region %s/%d too large" 81 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
83 " (%ld bytes)\n", pci_name(dev), 82 " (%ld bytes)\n", pci_name(dev),
84 dev->resource - res, size); 83 dev->resource - res, size);
85 } 84 }
86 85
87 if (start & 0x300) { 86 if (start & 0x300)
88 start = (start + 0x3ff) & ~0x3ff; 87 start = (start + 0x3ff) & ~0x3ff;
89 res->start = start;
90 }
91 } 88 }
89
90 return start;
92} 91}
93 92
94int 93int