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;
}
}
* 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;
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;
}
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);
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);