aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cistpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/cistpl.c')
-rw-r--r--drivers/pcmcia/cistpl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 936417c3e79e..9ad66c9848e3 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -64,6 +64,7 @@ module_param(cis_width, int, 0444);
64 64
65void release_cis_mem(struct pcmcia_socket *s) 65void release_cis_mem(struct pcmcia_socket *s)
66{ 66{
67 mutex_lock(&s->ops_mutex);
67 if (s->cis_mem.flags & MAP_ACTIVE) { 68 if (s->cis_mem.flags & MAP_ACTIVE) {
68 s->cis_mem.flags &= ~MAP_ACTIVE; 69 s->cis_mem.flags &= ~MAP_ACTIVE;
69 s->ops->set_mem_map(s, &s->cis_mem); 70 s->ops->set_mem_map(s, &s->cis_mem);
@@ -75,6 +76,7 @@ void release_cis_mem(struct pcmcia_socket *s)
75 iounmap(s->cis_virt); 76 iounmap(s->cis_virt);
76 s->cis_virt = NULL; 77 s->cis_virt = NULL;
77 } 78 }
79 mutex_unlock(&s->ops_mutex);
78} 80}
79 81
80/* 82/*
@@ -88,11 +90,13 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
88 pccard_mem_map *mem = &s->cis_mem; 90 pccard_mem_map *mem = &s->cis_mem;
89 int ret; 91 int ret;
90 92
93 mutex_lock(&s->ops_mutex);
91 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) { 94 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
92 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s);
93 if (mem->res == NULL) { 96 if (mem->res == NULL) {
94 dev_printk(KERN_NOTICE, &s->dev, 97 dev_printk(KERN_NOTICE, &s->dev,
95 "cs: unable to map card memory!\n"); 98 "cs: unable to map card memory!\n");
99 mutex_unlock(&s->ops_mutex);
96 return NULL; 100 return NULL;
97 } 101 }
98 s->cis_virt = NULL; 102 s->cis_virt = NULL;
@@ -108,6 +112,7 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
108 if (ret) { 112 if (ret) {
109 iounmap(s->cis_virt); 113 iounmap(s->cis_virt);
110 s->cis_virt = NULL; 114 s->cis_virt = NULL;
115 mutex_unlock(&s->ops_mutex);
111 return NULL; 116 return NULL;
112 } 117 }
113 118
@@ -117,6 +122,7 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
117 s->cis_virt = ioremap(mem->static_start, s->map_size); 122 s->cis_virt = ioremap(mem->static_start, s->map_size);
118 } 123 }
119 124
125 mutex_unlock(&s->ops_mutex);
120 return s->cis_virt; 126 return s->cis_virt;
121} 127}
122 128