aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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 /drivers
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 'drivers')
-rw-r--r--drivers/pci/bus.c6
-rw-r--r--drivers/pcmcia/rsrc_mgr.c12
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c16
3 files changed, 19 insertions, 15 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index cef28a79103f..d29d69a37940 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -36,8 +36,10 @@ int
36pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, 36pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
37 resource_size_t size, resource_size_t align, 37 resource_size_t size, resource_size_t align,
38 resource_size_t min, unsigned int type_mask, 38 resource_size_t min, unsigned int type_mask,
39 void (*alignf)(void *, struct resource *, resource_size_t, 39 resource_size_t (*alignf)(void *,
40 resource_size_t), 40 struct resource *,
41 resource_size_t,
42 resource_size_t),
41 void *alignf_data) 43 void *alignf_data)
42{ 44{
43 int i, ret = -ENOMEM; 45 int i, ret = -ENOMEM;
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c
index 52db17263d8b..f92a2dac13a2 100644
--- a/drivers/pcmcia/rsrc_mgr.c
+++ b/drivers/pcmcia/rsrc_mgr.c
@@ -114,22 +114,20 @@ struct pcmcia_align_data {
114 unsigned long offset; 114 unsigned long offset;
115}; 115};
116 116
117static void pcmcia_align(void *align_data, struct resource *res, 117static resource_size_t pcmcia_align(void *align_data, struct resource *res,
118 unsigned long size, unsigned long align) 118 resource_size_t size, resource_size_t align)
119{ 119{
120 struct pcmcia_align_data *data = align_data; 120 struct pcmcia_align_data *data = align_data;
121 unsigned long start; 121 resource_size_t start;
122 122
123 start = (res->start & ~data->mask) + data->offset; 123 start = (res->start & ~data->mask) + data->offset;
124 if (start < res->start) 124 if (start < res->start)
125 start += data->mask + 1; 125 start += data->mask + 1;
126 res->start = start;
127 126
128#ifdef CONFIG_X86 127#ifdef CONFIG_X86
129 if (res->flags & IORESOURCE_IO) { 128 if (res->flags & IORESOURCE_IO) {
130 if (start & 0x300) { 129 if (start & 0x300) {
131 start = (start + 0x3ff) & ~0x3ff; 130 start = (start + 0x3ff) & ~0x3ff;
132 res->start = start;
133 } 131 }
134 } 132 }
135#endif 133#endif
@@ -137,9 +135,11 @@ static void pcmcia_align(void *align_data, struct resource *res,
137#ifdef CONFIG_M68K 135#ifdef CONFIG_M68K
138 if (res->flags & IORESOURCE_IO) { 136 if (res->flags & IORESOURCE_IO) {
139 if ((res->start + size - 1) >= 1024) 137 if ((res->start + size - 1) >= 1024)
140 res->start = res->end; 138 start = res->end;
141 } 139 }
142#endif 140#endif
141
142 return start;
143} 143}
144 144
145 145
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 9b0dc433a8c3..b65902870e44 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -533,7 +533,7 @@ struct pcmcia_align_data {
533 struct resource_map *map; 533 struct resource_map *map;
534}; 534};
535 535
536static void 536static resource_size_t
537pcmcia_common_align(void *align_data, struct resource *res, 537pcmcia_common_align(void *align_data, struct resource *res,
538 resource_size_t size, resource_size_t align) 538 resource_size_t size, resource_size_t align)
539{ 539{
@@ -545,17 +545,18 @@ pcmcia_common_align(void *align_data, struct resource *res,
545 start = (res->start & ~data->mask) + data->offset; 545 start = (res->start & ~data->mask) + data->offset;
546 if (start < res->start) 546 if (start < res->start)
547 start += data->mask + 1; 547 start += data->mask + 1;
548 res->start = start; 548 return start;
549} 549}
550 550
551static void 551static resource_size_t
552pcmcia_align(void *align_data, struct resource *res, resource_size_t size, 552pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
553 resource_size_t align) 553 resource_size_t align)
554{ 554{
555 struct pcmcia_align_data *data = align_data; 555 struct pcmcia_align_data *data = align_data;
556 struct resource_map *m; 556 struct resource_map *m;
557 resource_size_t start;
557 558
558 pcmcia_common_align(data, res, size, align); 559 start = pcmcia_common_align(data, res, size, align);
559 560
560 for (m = data->map->next; m != data->map; m = m->next) { 561 for (m = data->map->next; m != data->map; m = m->next) {
561 unsigned long start = m->base; 562 unsigned long start = m->base;
@@ -567,8 +568,7 @@ pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
567 * fit here. 568 * fit here.
568 */ 569 */
569 if (res->start < start) { 570 if (res->start < start) {
570 res->start = start; 571 start = pcmcia_common_align(data, res, size, align);
571 pcmcia_common_align(data, res, size, align);
572 } 572 }
573 573
574 /* 574 /*
@@ -586,7 +586,9 @@ pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
586 * If we failed to find something suitable, ensure we fail. 586 * If we failed to find something suitable, ensure we fail.
587 */ 587 */
588 if (m == data->map) 588 if (m == data->map)
589 res->start = res->end; 589 start = res->end;
590
591 return start;
590} 592}
591 593
592/* 594/*