aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/rsrc_mgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/rsrc_mgr.c')
-rw-r--r--drivers/pcmcia/rsrc_mgr.c64
1 files changed, 8 insertions, 56 deletions
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c
index 52db17263d8b..452c83b512c4 100644
--- a/drivers/pcmcia/rsrc_mgr.c
+++ b/drivers/pcmcia/rsrc_mgr.c
@@ -21,60 +21,12 @@
21#include <pcmcia/cistpl.h> 21#include <pcmcia/cistpl.h>
22#include "cs_internal.h" 22#include "cs_internal.h"
23 23
24
25int pcmcia_validate_mem(struct pcmcia_socket *s)
26{
27 if (s->resource_ops->validate_mem)
28 return s->resource_ops->validate_mem(s);
29 /* if there is no callback, we can assume that everything is OK */
30 return 0;
31}
32EXPORT_SYMBOL(pcmcia_validate_mem);
33
34int pcmcia_adjust_io_region(struct resource *res, unsigned long r_start,
35 unsigned long r_end, struct pcmcia_socket *s)
36{
37 if (s->resource_ops->adjust_io_region)
38 return s->resource_ops->adjust_io_region(res, r_start, r_end, s);
39 return -ENOMEM;
40}
41EXPORT_SYMBOL(pcmcia_adjust_io_region);
42
43struct resource *pcmcia_find_io_region(unsigned long base, int num,
44 unsigned long align, struct pcmcia_socket *s)
45{
46 if (s->resource_ops->find_io)
47 return s->resource_ops->find_io(base, num, align, s);
48 return NULL;
49}
50EXPORT_SYMBOL(pcmcia_find_io_region);
51
52struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
53 int low, struct pcmcia_socket *s)
54{
55 if (s->resource_ops->find_mem)
56 return s->resource_ops->find_mem(base, num, align, low, s);
57 return NULL;
58}
59EXPORT_SYMBOL(pcmcia_find_mem_region);
60
61void release_resource_db(struct pcmcia_socket *s)
62{
63 if (s->resource_ops->exit)
64 s->resource_ops->exit(s);
65}
66
67
68static int static_init(struct pcmcia_socket *s) 24static int static_init(struct pcmcia_socket *s)
69{ 25{
70 unsigned long flags;
71
72 /* the good thing about SS_CAP_STATIC_MAP sockets is 26 /* the good thing about SS_CAP_STATIC_MAP sockets is
73 * that they don't need a resource database */ 27 * that they don't need a resource database */
74 28
75 spin_lock_irqsave(&s->lock, flags);
76 s->resource_setup_done = 1; 29 s->resource_setup_done = 1;
77 spin_unlock_irqrestore(&s->lock, flags);
78 30
79 return 0; 31 return 0;
80} 32}
@@ -114,32 +66,32 @@ struct pcmcia_align_data {
114 unsigned long offset; 66 unsigned long offset;
115}; 67};
116 68
117static void pcmcia_align(void *align_data, struct resource *res, 69static resource_size_t pcmcia_align(void *align_data,
118 unsigned long size, unsigned long align) 70 const struct resource *res,
71 resource_size_t size, resource_size_t align)
119{ 72{
120 struct pcmcia_align_data *data = align_data; 73 struct pcmcia_align_data *data = align_data;
121 unsigned long start; 74 resource_size_t start;
122 75
123 start = (res->start & ~data->mask) + data->offset; 76 start = (res->start & ~data->mask) + data->offset;
124 if (start < res->start) 77 if (start < res->start)
125 start += data->mask + 1; 78 start += data->mask + 1;
126 res->start = start;
127 79
128#ifdef CONFIG_X86 80#ifdef CONFIG_X86
129 if (res->flags & IORESOURCE_IO) { 81 if (res->flags & IORESOURCE_IO) {
130 if (start & 0x300) { 82 if (start & 0x300)
131 start = (start + 0x3ff) & ~0x3ff; 83 start = (start + 0x3ff) & ~0x3ff;
132 res->start = start;
133 }
134 } 84 }
135#endif 85#endif
136 86
137#ifdef CONFIG_M68K 87#ifdef CONFIG_M68K
138 if (res->flags & IORESOURCE_IO) { 88 if (res->flags & IORESOURCE_IO) {
139 if ((res->start + size - 1) >= 1024) 89 if ((res->start + size - 1) >= 1024)
140 res->start = res->end; 90 start = res->end;
141 } 91 }
142#endif 92#endif
93
94 return start;
143} 95}
144 96
145 97