aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pcmcia/cistpl.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index dd7651ff5b43..3afb682255a0 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -88,31 +88,38 @@ EXPORT_SYMBOL(release_cis_mem);
88static void __iomem * 88static void __iomem *
89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) 89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
90{ 90{
91 pccard_mem_map *mem = &s->cis_mem; 91 pccard_mem_map *mem = &s->cis_mem;
92 int ret; 92 int ret;
93
94 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s);
96 if (mem->res == NULL) {
97 printk(KERN_NOTICE "cs: unable to map card memory!\n");
98 return NULL;
99 }
100 s->cis_virt = NULL;
101 }
93 102
94 if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { 103 if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt))
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 104 s->cis_virt = ioremap(mem->res->start, s->map_size);
96 if (mem->res == NULL) { 105
97 printk(KERN_NOTICE "cs: unable to map card memory!\n"); 106 mem->card_start = card_offset;
98 return NULL; 107 mem->flags = flags;
108
109 ret = s->ops->set_mem_map(s, mem);
110 if (ret) {
111 iounmap(s->cis_virt);
112 s->cis_virt = NULL;
113 return NULL;
99 } 114 }
100 s->cis_virt = ioremap(mem->res->start, s->map_size);
101 }
102 mem->card_start = card_offset;
103 mem->flags = flags;
104 ret = s->ops->set_mem_map(s, mem);
105 if (ret) {
106 iounmap(s->cis_virt);
107 return NULL;
108 }
109 115
110 if (s->features & SS_CAP_STATIC_MAP) { 116 if (s->features & SS_CAP_STATIC_MAP) {
111 if (s->cis_virt) 117 if (s->cis_virt)
112 iounmap(s->cis_virt); 118 iounmap(s->cis_virt);
113 s->cis_virt = ioremap(mem->static_start, s->map_size); 119 s->cis_virt = ioremap(mem->static_start, s->map_size);
114 } 120 }
115 return s->cis_virt; 121
122 return s->cis_virt;
116} 123}
117 124
118/*====================================================================== 125/*======================================================================