aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/rsrc_nonstatic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/rsrc_nonstatic.c')
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c67
1 files changed, 38 insertions, 29 deletions
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 203e579ebbd2..17f4ecf1c0c5 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -122,19 +122,22 @@ static void free_region(struct resource *res)
122 122
123static int add_interval(struct resource_map *map, u_long base, u_long num) 123static int add_interval(struct resource_map *map, u_long base, u_long num)
124{ 124{
125 struct resource_map *p, *q; 125 struct resource_map *p, *q;
126 126
127 for (p = map; ; p = p->next) { 127 for (p = map; ; p = p->next) {
128 if ((p != map) && (p->base+p->num-1 >= base)) 128 if ((p != map) && (p->base+p->num-1 >= base))
129 return -1; 129 return -1;
130 if ((p->next == map) || (p->next->base > base+num-1)) 130 if ((p->next == map) || (p->next->base > base+num-1))
131 break; 131 break;
132 } 132 }
133 q = kmalloc(sizeof(struct resource_map), GFP_KERNEL); 133 q = kmalloc(sizeof(struct resource_map), GFP_KERNEL);
134 if (!q) return CS_OUT_OF_RESOURCE; 134 if (!q) {
135 q->base = base; q->num = num; 135 printk(KERN_WARNING "out of memory to update resources\n");
136 q->next = p->next; p->next = q; 136 return -ENOMEM;
137 return CS_SUCCESS; 137 }
138 q->base = base; q->num = num;
139 q->next = p->next; p->next = q;
140 return 0;
138} 141}
139 142
140/*====================================================================*/ 143/*====================================================================*/
@@ -166,7 +169,10 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num)
166 } else { 169 } else {
167 /* Split the block into two pieces */ 170 /* Split the block into two pieces */
168 p = kmalloc(sizeof(struct resource_map), GFP_KERNEL); 171 p = kmalloc(sizeof(struct resource_map), GFP_KERNEL);
169 if (!p) return CS_OUT_OF_RESOURCE; 172 if (!p) {
173 printk(KERN_WARNING "out of memory to update resources\n");
174 return -ENOMEM;
175 }
170 p->base = base+num; 176 p->base = base+num;
171 p->num = q->base+q->num - p->base; 177 p->num = q->base+q->num - p->base;
172 q->num = base - q->base; 178 q->num = base - q->base;
@@ -174,7 +180,7 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num)
174 } 180 }
175 } 181 }
176 } 182 }
177 return CS_SUCCESS; 183 return 0;
178} 184}
179 185
180/*====================================================================== 186/*======================================================================
@@ -194,13 +200,14 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
194 int any; 200 int any;
195 u_char *b, hole, most; 201 u_char *b, hole, most;
196 202
197 printk(KERN_INFO "cs: IO port probe %#x-%#x:", 203 dev_printk(KERN_INFO, &s->dev, "cs: IO port probe %#x-%#x:",
198 base, base+num-1); 204 base, base+num-1);
199 205
200 /* First, what does a floating port look like? */ 206 /* First, what does a floating port look like? */
201 b = kzalloc(256, GFP_KERNEL); 207 b = kzalloc(256, GFP_KERNEL);
202 if (!b) { 208 if (!b) {
203 printk(KERN_ERR "do_io_probe: unable to kmalloc 256 bytes"); 209 dev_printk(KERN_ERR, &s->dev,
210 "do_io_probe: unable to kmalloc 256 bytes");
204 return; 211 return;
205 } 212 }
206 for (i = base, most = 0; i < base+num; i += 8) { 213 for (i = base, most = 0; i < base+num; i += 8) {
@@ -366,8 +373,8 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s)
366 struct socket_data *s_data = s->resource_data; 373 struct socket_data *s_data = s->resource_data;
367 u_long i, j, bad, fail, step; 374 u_long i, j, bad, fail, step;
368 375
369 printk(KERN_INFO "cs: memory probe 0x%06lx-0x%06lx:", 376 dev_printk(KERN_INFO, &s->dev, "cs: memory probe 0x%06lx-0x%06lx:",
370 base, base+num-1); 377 base, base+num-1);
371 bad = fail = 0; 378 bad = fail = 0;
372 step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); 379 step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff);
373 /* don't allow too large steps */ 380 /* don't allow too large steps */
@@ -431,8 +438,8 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
431 if (probe_mask & MEM_PROBE_HIGH) { 438 if (probe_mask & MEM_PROBE_HIGH) {
432 if (inv_probe(s_data->mem_db.next, s) > 0) 439 if (inv_probe(s_data->mem_db.next, s) > 0)
433 return 0; 440 return 0;
434 printk(KERN_NOTICE "cs: warning: no high memory space " 441 dev_printk(KERN_NOTICE, &s->dev,
435 "available!\n"); 442 "cs: warning: no high memory space available!\n");
436 return -ENODEV; 443 return -ENODEV;
437 } 444 }
438 445
@@ -794,10 +801,11 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
794 if (res->flags & IORESOURCE_IO) { 801 if (res->flags & IORESOURCE_IO) {
795 if (res == &ioport_resource) 802 if (res == &ioport_resource)
796 continue; 803 continue;
797 printk(KERN_INFO "pcmcia: parent PCI bridge I/O " 804 dev_printk(KERN_INFO, &s->cb_dev->dev,
798 "window: 0x%llx - 0x%llx\n", 805 "pcmcia: parent PCI bridge I/O "
799 (unsigned long long)res->start, 806 "window: 0x%llx - 0x%llx\n",
800 (unsigned long long)res->end); 807 (unsigned long long)res->start,
808 (unsigned long long)res->end);
801 if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 809 if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end))
802 done |= IORESOURCE_IO; 810 done |= IORESOURCE_IO;
803 811
@@ -806,10 +814,11 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
806 if (res->flags & IORESOURCE_MEM) { 814 if (res->flags & IORESOURCE_MEM) {
807 if (res == &iomem_resource) 815 if (res == &iomem_resource)
808 continue; 816 continue;
809 printk(KERN_INFO "pcmcia: parent PCI bridge Memory " 817 dev_printk(KERN_INFO, &s->cb_dev->dev,
810 "window: 0x%llx - 0x%llx\n", 818 "pcmcia: parent PCI bridge Memory "
811 (unsigned long long)res->start, 819 "window: 0x%llx - 0x%llx\n",
812 (unsigned long long)res->end); 820 (unsigned long long)res->start,
821 (unsigned long long)res->end);
813 if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 822 if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end))
814 done |= IORESOURCE_MEM; 823 done |= IORESOURCE_MEM;
815 } 824 }