aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/rsrc_mgr.c13
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c25
-rw-r--r--drivers/pcmcia/yenta_socket.c5
3 files changed, 23 insertions, 20 deletions
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c
index aca2cfd02ca5..e6f7d410aed6 100644
--- a/drivers/pcmcia/rsrc_mgr.c
+++ b/drivers/pcmcia/rsrc_mgr.c
@@ -66,22 +66,21 @@ struct pcmcia_align_data {
66 unsigned long offset; 66 unsigned long offset;
67}; 67};
68 68
69static void pcmcia_align(void *align_data, struct resource *res, 69static resource_size_t pcmcia_align(void *align_data,
70 unsigned long size, unsigned long align) 70 const struct resource *res,
71 resource_size_t size, resource_size_t align)
71{ 72{
72 struct pcmcia_align_data *data = align_data; 73 struct pcmcia_align_data *data = align_data;
73 unsigned long start; 74 resource_size_t start;
74 75
75 start = (res->start & ~data->mask) + data->offset; 76 start = (res->start & ~data->mask) + data->offset;
76 if (start < res->start) 77 if (start < res->start)
77 start += data->mask + 1; 78 start += data->mask + 1;
78 res->start = start;
79 79
80#ifdef CONFIG_X86 80#ifdef CONFIG_X86
81 if (res->flags & IORESOURCE_IO) { 81 if (res->flags & IORESOURCE_IO) {
82 if (start & 0x300) { 82 if (start & 0x300) {
83 start = (start + 0x3ff) & ~0x3ff; 83 start = (start + 0x3ff) & ~0x3ff;
84 res->start = start;
85 } 84 }
86 } 85 }
87#endif 86#endif
@@ -89,9 +88,11 @@ static void pcmcia_align(void *align_data, struct resource *res,
89#ifdef CONFIG_M68K 88#ifdef CONFIG_M68K
90 if (res->flags & IORESOURCE_IO) { 89 if (res->flags & IORESOURCE_IO) {
91 if ((res->start + size - 1) >= 1024) 90 if ((res->start + size - 1) >= 1024)
92 res->start = res->end; 91 start = res->end;
93 } 92 }
94#endif 93#endif
94
95 return start;
95} 96}
96 97
97 98
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index a69eed6c5b92..4663b3fa9f96 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -596,8 +596,8 @@ struct pcmcia_align_data {
596 struct resource_map *map; 596 struct resource_map *map;
597}; 597};
598 598
599static void 599static resource_size_t
600pcmcia_common_align(void *align_data, struct resource *res, 600pcmcia_common_align(void *align_data, const struct resource *res,
601 resource_size_t size, resource_size_t align) 601 resource_size_t size, resource_size_t align)
602{ 602{
603 struct pcmcia_align_data *data = align_data; 603 struct pcmcia_align_data *data = align_data;
@@ -608,17 +608,18 @@ pcmcia_common_align(void *align_data, struct resource *res,
608 start = (res->start & ~data->mask) + data->offset; 608 start = (res->start & ~data->mask) + data->offset;
609 if (start < res->start) 609 if (start < res->start)
610 start += data->mask + 1; 610 start += data->mask + 1;
611 res->start = start; 611 return start;
612} 612}
613 613
614static void 614static resource_size_t
615pcmcia_align(void *align_data, struct resource *res, resource_size_t size, 615pcmcia_align(void *align_data, const struct resource *res,
616 resource_size_t align) 616 resource_size_t size, resource_size_t align)
617{ 617{
618 struct pcmcia_align_data *data = align_data; 618 struct pcmcia_align_data *data = align_data;
619 struct resource_map *m; 619 struct resource_map *m;
620 resource_size_t start;
620 621
621 pcmcia_common_align(data, res, size, align); 622 start = pcmcia_common_align(data, res, size, align);
622 623
623 for (m = data->map->next; m != data->map; m = m->next) { 624 for (m = data->map->next; m != data->map; m = m->next) {
624 unsigned long start = m->base; 625 unsigned long start = m->base;
@@ -630,8 +631,7 @@ pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
630 * fit here. 631 * fit here.
631 */ 632 */
632 if (res->start < start) { 633 if (res->start < start) {
633 res->start = start; 634 start = pcmcia_common_align(data, res, size, align);
634 pcmcia_common_align(data, res, size, align);
635 } 635 }
636 636
637 /* 637 /*
@@ -649,7 +649,9 @@ pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
649 * If we failed to find something suitable, ensure we fail. 649 * If we failed to find something suitable, ensure we fail.
650 */ 650 */
651 if (m == data->map) 651 if (m == data->map)
652 res->start = res->end; 652 start = res->end;
653
654 return start;
653} 655}
654 656
655/* 657/*
@@ -857,8 +859,7 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
857 return -EINVAL; 859 return -EINVAL;
858#endif 860#endif
859 861
860 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 862 pci_bus_for_each_resource(s->cb_dev->bus, res, i) {
861 res = s->cb_dev->bus->resource[i];
862 if (!res) 863 if (!res)
863 continue; 864 continue;
864 865
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 041a75a7e55e..b85375f87622 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -654,9 +654,10 @@ static int yenta_search_one_res(struct resource *root, struct resource *res,
654static int yenta_search_res(struct yenta_socket *socket, struct resource *res, 654static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
655 u32 min) 655 u32 min)
656{ 656{
657 struct resource *root;
657 int i; 658 int i;
658 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 659
659 struct resource *root = socket->dev->bus->resource[i]; 660 pci_bus_for_each_resource(socket->dev->bus, root, i) {
660 if (!root) 661 if (!root)
661 continue; 662 continue;
662 663