aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel_cs.c
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/net/wireless/atmel_cs.c
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/net/wireless/atmel_cs.c')
-rw-r--r--drivers/net/wireless/atmel_cs.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index d09b1472e673..25fb919b3791 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -181,7 +181,6 @@ static int atmel_probe(struct pcmcia_device *p_dev)
181 } 181 }
182 p_dev->priv = local; 182 p_dev->priv = local;
183 183
184 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
185 return atmel_config(p_dev); 184 return atmel_config(p_dev);
186} /* atmel_attach */ 185} /* atmel_attach */
187 186
@@ -198,8 +197,7 @@ static void atmel_detach(struct pcmcia_device *link)
198{ 197{
199 DEBUG(0, "atmel_detach(0x%p)\n", link); 198 DEBUG(0, "atmel_detach(0x%p)\n", link);
200 199
201 if (link->state & DEV_CONFIG) 200 atmel_release(link);
202 atmel_release(link);
203 201
204 kfree(link->priv); 202 kfree(link->priv);
205} 203}
@@ -222,7 +220,7 @@ static int card_present(void *arg)
222 struct pcmcia_device *link = (struct pcmcia_device *)arg; 220 struct pcmcia_device *link = (struct pcmcia_device *)arg;
223 if (link->suspended) 221 if (link->suspended)
224 return 0; 222 return 0;
225 else if (link->state & DEV_PRESENT) 223 else if (pcmcia_dev_present(link))
226 return 1; 224 return 1;
227 225
228 return 0; 226 return 0;
@@ -257,10 +255,7 @@ static int atmel_config(struct pcmcia_device *link)
257 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 255 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
258 link->conf.ConfigBase = parse.config.base; 256 link->conf.ConfigBase = parse.config.base;
259 link->conf.Present = parse.config.rmask[0]; 257 link->conf.Present = parse.config.rmask[0];
260 258
261 /* Configure card */
262 link->state |= DEV_CONFIG;
263
264 /* 259 /*
265 In this loop, we scan the CIS for configuration table entries, 260 In this loop, we scan the CIS for configuration table entries,
266 each of which describes a valid card configuration, including 261 each of which describes a valid card configuration, including
@@ -373,10 +368,9 @@ static int atmel_config(struct pcmcia_device *link)
373 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); 368 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name );
374 dev->node.major = dev->node.minor = 0; 369 dev->node.major = dev->node.minor = 0;
375 link->dev_node = &dev->node; 370 link->dev_node = &dev->node;
376 371
377 link->state &= ~DEV_CONFIG_PENDING;
378 return 0; 372 return 0;
379 373
380 cs_failed: 374 cs_failed:
381 cs_error(link, last_fn, last_ret); 375 cs_error(link, last_fn, last_ret);
382 atmel_release(link); 376 atmel_release(link);
@@ -408,8 +402,7 @@ static int atmel_suspend(struct pcmcia_device *link)
408{ 402{
409 local_info_t *local = link->priv; 403 local_info_t *local = link->priv;
410 404
411 if (link->state & DEV_CONFIG) 405 netif_device_detach(local->eth_dev);
412 netif_device_detach(local->eth_dev);
413 406
414 return 0; 407 return 0;
415} 408}
@@ -418,10 +411,8 @@ static int atmel_resume(struct pcmcia_device *link)
418{ 411{
419 local_info_t *local = link->priv; 412 local_info_t *local = link->priv;
420 413
421 if (link->state & DEV_CONFIG) { 414 atmel_open(local->eth_dev);
422 atmel_open(local->eth_dev); 415 netif_device_attach(local->eth_dev);
423 netif_device_attach(local->eth_dev);
424 }
425 416
426 return 0; 417 return 0;
427} 418}