vserver 1.9.3
[linux-2.6.git] / drivers / pcmcia / cistpl.c
index d975ad3..317ca50 100644 (file)
@@ -85,13 +85,15 @@ INT_MODULE_PARM(cis_width,  0);             /* 16-bit CIS? */
 
 void release_cis_mem(struct pcmcia_socket *s)
 {
-    if (s->cis_mem.sys_start != 0) {
+    if (s->cis_mem.flags & MAP_ACTIVE) {
        s->cis_mem.flags &= ~MAP_ACTIVE;
        s->ops->set_mem_map(s, &s->cis_mem);
-       if (!(s->features & SS_CAP_STATIC_MAP))
-           release_mem_region(s->cis_mem.sys_start, s->map_size);
+       if (s->cis_mem.res) {
+           release_resource(s->cis_mem.res);
+           kfree(s->cis_mem.res);
+           s->cis_mem.res = NULL;
+       }
        iounmap(s->cis_virt);
-       s->cis_mem.sys_start = 0;
        s->cis_virt = NULL;
     }
 }
@@ -101,21 +103,18 @@ void release_cis_mem(struct pcmcia_socket *s)
  * If flags & MAP_ATTRIB, map the attribute space, otherwise
  * map the memory space.
  */
-static unsigned char *
+static void __iomem *
 set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
 {
     pccard_mem_map *mem = &s->cis_mem;
-    if (!(s->features & SS_CAP_STATIC_MAP) &&
-       mem->sys_start == 0) {
-       validate_mem(s);
-       mem->sys_start = 0;
-       if (find_mem_region(&mem->sys_start, s->map_size,
-                           s->map_size, 0, "card services", s)) {
+    if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) {
+       mem->res = find_mem_region(0, s->map_size, s->map_size, 0,
+                                  "card services", s);
+       if (mem->res == NULL) {
            printk(KERN_NOTICE "cs: unable to map card memory!\n");
            return NULL;
        }
-       mem->sys_stop = mem->sys_start+s->map_size-1;
-       s->cis_virt = ioremap(mem->sys_start, s->map_size);
+       s->cis_virt = ioremap(mem->res->start, s->map_size);
     }
     mem->card_start = card_offset;
     mem->flags = flags;
@@ -123,7 +122,7 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
     if (s->features & SS_CAP_STATIC_MAP) {
        if (s->cis_virt)
            iounmap(s->cis_virt);
-       s->cis_virt = ioremap(mem->sys_start, s->map_size);
+       s->cis_virt = ioremap(mem->static_start, s->map_size);
     }
     return s->cis_virt;
 }
@@ -142,7 +141,8 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
 int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
                 u_int len, void *ptr)
 {
-    u_char *sys, *end, *buf = ptr;
+    void __iomem *sys, *end;
+    unsigned char *buf = ptr;
     
     cs_dbg(s, 3, "read_cis_mem(%d, %#x, %u)\n", attr, addr, len);
 
@@ -205,7 +205,8 @@ int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
 void write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
                   u_int len, void *ptr)
 {
-    u_char *sys, *end, *buf = ptr;
+    void __iomem *sys, *end;
+    unsigned char *buf = ptr;
     
     cs_dbg(s, 3, "write_cis_mem(%d, %#x, %u)\n", attr, addr, len);