aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-01 18:09:29 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:33 -0500
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/isdn
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
[PATCH] pcmcia: use bitfield instead of p_state and state
Instead of the two status values struct pcmcia_device->p_state and state, use descriptive bitfields. Most value-checking in drivers was invalid, as the core now only calls the ->remove() (a.k.a. detach) function in case the attachement _and_ configuration was successful. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c12
-rw-r--r--drivers/isdn/hisax/avma1_cs.c17
-rw-r--r--drivers/isdn/hisax/elsa_cs.c19
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c18
-rw-r--r--drivers/isdn/hisax/teles_cs.c19
5 files changed, 21 insertions, 64 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 28f9211726c5..7bbfd85ab793 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -127,7 +127,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
127 memset(local, 0, sizeof(local_info_t)); 127 memset(local, 0, sizeof(local_info_t));
128 p_dev->priv = local; 128 p_dev->priv = local;
129 129
130 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
131 return avmcs_config(p_dev); 130 return avmcs_config(p_dev);
132 131
133 err: 132 err:
@@ -145,10 +144,8 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
145 144
146static void avmcs_detach(struct pcmcia_device *link) 145static void avmcs_detach(struct pcmcia_device *link)
147{ 146{
148 if (link->state & DEV_CONFIG)
149 avmcs_release(link); 147 avmcs_release(link);
150 148 kfree(link->priv);
151 kfree(link->priv);
152} /* avmcs_detach */ 149} /* avmcs_detach */
153 150
154/*====================================================================== 151/*======================================================================
@@ -216,12 +213,8 @@ static int avmcs_config(struct pcmcia_device *link)
216 } while (0); 213 } while (0);
217 if (i != CS_SUCCESS) { 214 if (i != CS_SUCCESS) {
218 cs_error(link, ParseTuple, i); 215 cs_error(link, ParseTuple, i);
219 link->state &= ~DEV_CONFIG_PENDING;
220 return -ENODEV; 216 return -ENODEV;
221 } 217 }
222
223 /* Configure card */
224 link->state |= DEV_CONFIG;
225 218
226 do { 219 do {
227 220
@@ -312,8 +305,7 @@ found_port:
312 dev->node.major = 64; 305 dev->node.major = 64;
313 dev->node.minor = 0; 306 dev->node.minor = 0;
314 link->dev_node = &dev->node; 307 link->dev_node = &dev->node;
315 308
316 link->state &= ~DEV_CONFIG_PENDING;
317 /* If any step failed, release any partially configured state */ 309 /* If any step failed, release any partially configured state */
318 if (i != 0) { 310 if (i != 0) {
319 avmcs_release(link); 311 avmcs_release(link);
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 11c7c4f09e7e..ac28e3278ad9 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -149,7 +149,6 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
149 p_dev->conf.ConfigIndex = 1; 149 p_dev->conf.ConfigIndex = 1;
150 p_dev->conf.Present = PRESENT_OPTION; 150 p_dev->conf.Present = PRESENT_OPTION;
151 151
152 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
153 return avma1cs_config(p_dev); 152 return avma1cs_config(p_dev);
154} /* avma1cs_attach */ 153} /* avma1cs_attach */
155 154
@@ -164,12 +163,9 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
164 163
165static void avma1cs_detach(struct pcmcia_device *link) 164static void avma1cs_detach(struct pcmcia_device *link)
166{ 165{
167 DEBUG(0, "avma1cs_detach(0x%p)\n", link); 166 DEBUG(0, "avma1cs_detach(0x%p)\n", link);
168 167 avma1cs_release(link);
169 if (link->state & DEV_CONFIG) 168 kfree(link->priv);
170 avma1cs_release(link);
171
172 kfree(link->priv);
173} /* avma1cs_detach */ 169} /* avma1cs_detach */
174 170
175/*====================================================================== 171/*======================================================================
@@ -239,12 +235,8 @@ static int avma1cs_config(struct pcmcia_device *link)
239 } while (0); 235 } while (0);
240 if (i != CS_SUCCESS) { 236 if (i != CS_SUCCESS) {
241 cs_error(link, ParseTuple, i); 237 cs_error(link, ParseTuple, i);
242 link->state &= ~DEV_CONFIG_PENDING;
243 return -ENODEV; 238 return -ENODEV;
244 } 239 }
245
246 /* Configure card */
247 link->state |= DEV_CONFIG;
248 240
249 do { 241 do {
250 242
@@ -318,8 +310,7 @@ found_port:
318 dev->node.major = 45; 310 dev->node.major = 45;
319 dev->node.minor = 0; 311 dev->node.minor = 0;
320 link->dev_node = &dev->node; 312 link->dev_node = &dev->node;
321 313
322 link->state &= ~DEV_CONFIG_PENDING;
323 /* If any step failed, release any partially configured state */ 314 /* If any step failed, release any partially configured state */
324 if (i != 0) { 315 if (i != 0) {
325 avma1cs_release(link); 316 avma1cs_release(link);
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 4856680ce761..e18e75be8ed3 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -174,7 +174,6 @@ static int elsa_cs_probe(struct pcmcia_device *link)
174 link->conf.Attributes = CONF_ENABLE_IRQ; 174 link->conf.Attributes = CONF_ENABLE_IRQ;
175 link->conf.IntType = INT_MEMORY_AND_IO; 175 link->conf.IntType = INT_MEMORY_AND_IO;
176 176
177 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
178 return elsa_cs_config(link); 177 return elsa_cs_config(link);
179} /* elsa_cs_attach */ 178} /* elsa_cs_attach */
180 179
@@ -189,17 +188,14 @@ static int elsa_cs_probe(struct pcmcia_device *link)
189 188
190static void elsa_cs_detach(struct pcmcia_device *link) 189static void elsa_cs_detach(struct pcmcia_device *link)
191{ 190{
192 local_info_t *info = link->priv; 191 local_info_t *info = link->priv;
193 192
194 DEBUG(0, "elsa_cs_detach(0x%p)\n", link); 193 DEBUG(0, "elsa_cs_detach(0x%p)\n", link);
195 194
196 if (link->state & DEV_CONFIG) { 195 info->busy = 1;
197 info->busy = 1; 196 elsa_cs_release(link);
198 elsa_cs_release(link);
199 }
200
201 kfree(info);
202 197
198 kfree(info);
203} /* elsa_cs_detach */ 199} /* elsa_cs_detach */
204 200
205/*====================================================================== 201/*======================================================================
@@ -263,9 +259,6 @@ static int elsa_cs_config(struct pcmcia_device *link)
263 link->conf.ConfigBase = parse.config.base; 259 link->conf.ConfigBase = parse.config.base;
264 link->conf.Present = parse.config.rmask[0]; 260 link->conf.Present = parse.config.rmask[0];
265 261
266 /* Configure card */
267 link->state |= DEV_CONFIG;
268
269 tuple.TupleData = (cisdata_t *)buf; 262 tuple.TupleData = (cisdata_t *)buf;
270 tuple.TupleOffset = 0; tuple.TupleDataMax = 255; 263 tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
271 tuple.Attributes = 0; 264 tuple.Attributes = 0;
@@ -329,8 +322,6 @@ static int elsa_cs_config(struct pcmcia_device *link)
329 link->io.BasePort2+link->io.NumPorts2-1); 322 link->io.BasePort2+link->io.NumPorts2-1);
330 printk("\n"); 323 printk("\n");
331 324
332 link->state &= ~DEV_CONFIG_PENDING;
333
334 icard.para[0] = link->irq.AssignedIRQ; 325 icard.para[0] = link->irq.AssignedIRQ;
335 icard.para[1] = link->io.BasePort1; 326 icard.para[1] = link->io.BasePort1;
336 icard.protocol = protocol; 327 icard.protocol = protocol;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index a35a29586a62..9bb18f3f7829 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -186,7 +186,6 @@ static int sedlbauer_probe(struct pcmcia_device *link)
186 link->conf.Attributes = 0; 186 link->conf.Attributes = 0;
187 link->conf.IntType = INT_MEMORY_AND_IO; 187 link->conf.IntType = INT_MEMORY_AND_IO;
188 188
189 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
190 return sedlbauer_config(link); 189 return sedlbauer_config(link);
191} /* sedlbauer_attach */ 190} /* sedlbauer_attach */
192 191
@@ -201,15 +200,13 @@ static int sedlbauer_probe(struct pcmcia_device *link)
201 200
202static void sedlbauer_detach(struct pcmcia_device *link) 201static void sedlbauer_detach(struct pcmcia_device *link)
203{ 202{
204 DEBUG(0, "sedlbauer_detach(0x%p)\n", link); 203 DEBUG(0, "sedlbauer_detach(0x%p)\n", link);
205 204
206 if (link->state & DEV_CONFIG) { 205 ((local_info_t *)link->priv)->stop = 1;
207 ((local_info_t *)link->priv)->stop = 1; 206 sedlbauer_release(link);
208 sedlbauer_release(link);
209 }
210 207
211 /* This points to the parent local_info_t struct */ 208 /* This points to the parent local_info_t struct */
212 kfree(link->priv); 209 kfree(link->priv);
213} /* sedlbauer_detach */ 210} /* sedlbauer_detach */
214 211
215/*====================================================================== 212/*======================================================================
@@ -250,9 +247,6 @@ static int sedlbauer_config(struct pcmcia_device *link)
250 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 247 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
251 link->conf.ConfigBase = parse.config.base; 248 link->conf.ConfigBase = parse.config.base;
252 link->conf.Present = parse.config.rmask[0]; 249 link->conf.Present = parse.config.rmask[0];
253
254 /* Configure card */
255 link->state |= DEV_CONFIG;
256 250
257 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); 251 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
258 252
@@ -408,8 +402,6 @@ static int sedlbauer_config(struct pcmcia_device *link)
408 printk(", mem 0x%06lx-0x%06lx", req.Base, 402 printk(", mem 0x%06lx-0x%06lx", req.Base,
409 req.Base+req.Size-1); 403 req.Base+req.Size-1);
410 printk("\n"); 404 printk("\n");
411
412 link->state &= ~DEV_CONFIG_PENDING;
413 405
414 icard.para[0] = link->irq.AssignedIRQ; 406 icard.para[0] = link->irq.AssignedIRQ;
415 icard.para[1] = link->io.BasePort1; 407 icard.para[1] = link->io.BasePort1;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 7b66038096f3..afcc2aeadb34 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -164,7 +164,6 @@ static int teles_probe(struct pcmcia_device *link)
164 link->conf.Attributes = CONF_ENABLE_IRQ; 164 link->conf.Attributes = CONF_ENABLE_IRQ;
165 link->conf.IntType = INT_MEMORY_AND_IO; 165 link->conf.IntType = INT_MEMORY_AND_IO;
166 166
167 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
168 return teles_cs_config(link); 167 return teles_cs_config(link);
169} /* teles_attach */ 168} /* teles_attach */
170 169
@@ -179,17 +178,14 @@ static int teles_probe(struct pcmcia_device *link)
179 178
180static void teles_detach(struct pcmcia_device *link) 179static void teles_detach(struct pcmcia_device *link)
181{ 180{
182 local_info_t *info = link->priv; 181 local_info_t *info = link->priv;
183 182
184 DEBUG(0, "teles_detach(0x%p)\n", link); 183 DEBUG(0, "teles_detach(0x%p)\n", link);
185 184
186 if (link->state & DEV_CONFIG) { 185 info->busy = 1;
187 info->busy = 1; 186 teles_cs_release(link);
188 teles_cs_release(link);
189 }
190
191 kfree(info);
192 187
188 kfree(info);
193} /* teles_detach */ 189} /* teles_detach */
194 190
195/*====================================================================== 191/*======================================================================
@@ -253,9 +249,6 @@ static int teles_cs_config(struct pcmcia_device *link)
253 link->conf.ConfigBase = parse.config.base; 249 link->conf.ConfigBase = parse.config.base;
254 link->conf.Present = parse.config.rmask[0]; 250 link->conf.Present = parse.config.rmask[0];
255 251
256 /* Configure card */
257 link->state |= DEV_CONFIG;
258
259 tuple.TupleData = (cisdata_t *)buf; 252 tuple.TupleData = (cisdata_t *)buf;
260 tuple.TupleOffset = 0; tuple.TupleDataMax = 255; 253 tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
261 tuple.Attributes = 0; 254 tuple.Attributes = 0;
@@ -319,8 +312,6 @@ static int teles_cs_config(struct pcmcia_device *link)
319 link->io.BasePort2+link->io.NumPorts2-1); 312 link->io.BasePort2+link->io.NumPorts2-1);
320 printk("\n"); 313 printk("\n");
321 314
322 link->state &= ~DEV_CONFIG_PENDING;
323
324 icard.para[0] = link->irq.AssignedIRQ; 315 icard.para[0] = link->irq.AssignedIRQ;
325 icard.para[1] = link->io.BasePort1; 316 icard.para[1] = link->io.BasePort1;
326 icard.protocol = protocol; 317 icard.protocol = protocol;