aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
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/pcmcia
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/pcmcia')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c12
-rw-r--r--drivers/net/pcmcia/3c589_cs.c12
-rw-r--r--drivers/net/pcmcia/axnet_cs.c15
-rw-r--r--drivers/net/pcmcia/com20020_cs.c12
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c13
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c14
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c13
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c13
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c59
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c18
10 files changed, 56 insertions, 125 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 4611469fdff9..70e3cca09787 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -296,7 +296,6 @@ static int tc574_probe(struct pcmcia_device *link)
296 dev->watchdog_timeo = TX_TIMEOUT; 296 dev->watchdog_timeo = TX_TIMEOUT;
297#endif 297#endif
298 298
299 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
300 return tc574_config(link); 299 return tc574_config(link);
301} /* tc574_attach */ 300} /* tc574_attach */
302 301
@@ -318,8 +317,7 @@ static void tc574_detach(struct pcmcia_device *link)
318 if (link->dev_node) 317 if (link->dev_node)
319 unregister_netdev(dev); 318 unregister_netdev(dev);
320 319
321 if (link->state & DEV_CONFIG) 320 tc574_release(link);
322 tc574_release(link);
323 321
324 free_netdev(dev); 322 free_netdev(dev);
325} /* tc574_detach */ 323} /* tc574_detach */
@@ -363,9 +361,6 @@ static int tc574_config(struct pcmcia_device *link)
363 link->conf.ConfigBase = parse.config.base; 361 link->conf.ConfigBase = parse.config.base;
364 link->conf.Present = parse.config.rmask[0]; 362 link->conf.Present = parse.config.rmask[0];
365 363
366 /* Configure card */
367 link->state |= DEV_CONFIG;
368
369 link->io.IOAddrLines = 16; 364 link->io.IOAddrLines = 16;
370 for (i = j = 0; j < 0x400; j += 0x20) { 365 for (i = j = 0; j < 0x400; j += 0x20) {
371 link->io.BasePort1 = j ^ 0x300; 366 link->io.BasePort1 = j ^ 0x300;
@@ -464,7 +459,6 @@ static int tc574_config(struct pcmcia_device *link)
464 } 459 }
465 } 460 }
466 461
467 link->state &= ~DEV_CONFIG_PENDING;
468 link->dev_node = &lp->node; 462 link->dev_node = &lp->node;
469 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 463 SET_NETDEV_DEV(dev, &handle_to_dev(link));
470 464
@@ -509,7 +503,7 @@ static int tc574_suspend(struct pcmcia_device *link)
509{ 503{
510 struct net_device *dev = link->priv; 504 struct net_device *dev = link->priv;
511 505
512 if ((link->state & DEV_CONFIG) && (link->open)) 506 if (link->open)
513 netif_device_detach(dev); 507 netif_device_detach(dev);
514 508
515 return 0; 509 return 0;
@@ -519,7 +513,7 @@ static int tc574_resume(struct pcmcia_device *link)
519{ 513{
520 struct net_device *dev = link->priv; 514 struct net_device *dev = link->priv;
521 515
522 if ((link->state & DEV_CONFIG) && (link->open)) { 516 if (link->open) {
523 tc574_reset(dev); 517 tc574_reset(dev);
524 netif_device_attach(dev); 518 netif_device_attach(dev);
525 } 519 }
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 160d48a8ed88..3d05f66e9c70 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -211,7 +211,6 @@ static int tc589_probe(struct pcmcia_device *link)
211#endif 211#endif
212 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 212 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
213 213
214 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
215 return tc589_config(link); 214 return tc589_config(link);
216} /* tc589_attach */ 215} /* tc589_attach */
217 216
@@ -233,8 +232,7 @@ static void tc589_detach(struct pcmcia_device *link)
233 if (link->dev_node) 232 if (link->dev_node)
234 unregister_netdev(dev); 233 unregister_netdev(dev);
235 234
236 if (link->state & DEV_CONFIG) 235 tc589_release(link);
237 tc589_release(link);
238 236
239 free_netdev(dev); 237 free_netdev(dev);
240} /* tc589_detach */ 238} /* tc589_detach */
@@ -285,9 +283,6 @@ static int tc589_config(struct pcmcia_device *link)
285 "3Com card??\n"); 283 "3Com card??\n");
286 multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562); 284 multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562);
287 } 285 }
288
289 /* Configure card */
290 link->state |= DEV_CONFIG;
291 286
292 /* For the 3c562, the base address must be xx00-xx7f */ 287 /* For the 3c562, the base address must be xx00-xx7f */
293 link->io.IOAddrLines = 16; 288 link->io.IOAddrLines = 16;
@@ -338,7 +333,6 @@ static int tc589_config(struct pcmcia_device *link)
338 printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); 333 printk(KERN_ERR "3c589_cs: invalid if_port requested\n");
339 334
340 link->dev_node = &lp->node; 335 link->dev_node = &lp->node;
341 link->state &= ~DEV_CONFIG_PENDING;
342 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 336 SET_NETDEV_DEV(dev, &handle_to_dev(link));
343 337
344 if (register_netdev(dev) != 0) { 338 if (register_netdev(dev) != 0) {
@@ -383,7 +377,7 @@ static int tc589_suspend(struct pcmcia_device *link)
383{ 377{
384 struct net_device *dev = link->priv; 378 struct net_device *dev = link->priv;
385 379
386 if ((link->state & DEV_CONFIG) && (link->open)) 380 if (link->open)
387 netif_device_detach(dev); 381 netif_device_detach(dev);
388 382
389 return 0; 383 return 0;
@@ -393,7 +387,7 @@ static int tc589_resume(struct pcmcia_device *link)
393{ 387{
394 struct net_device *dev = link->priv; 388 struct net_device *dev = link->priv;
395 389
396 if ((link->state & DEV_CONFIG) && (link->open)) { 390 if (link->open) {
397 tc589_reset(dev); 391 tc589_reset(dev);
398 netif_device_attach(dev); 392 netif_device_attach(dev);
399 } 393 }
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index f6ca85d77c7d..0f1219c11853 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -168,7 +168,6 @@ static int axnet_probe(struct pcmcia_device *link)
168 dev->do_ioctl = &axnet_ioctl; 168 dev->do_ioctl = &axnet_ioctl;
169 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 169 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
170 170
171 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
172 return axnet_config(link); 171 return axnet_config(link);
173} /* axnet_attach */ 172} /* axnet_attach */
174 173
@@ -190,8 +189,7 @@ static void axnet_detach(struct pcmcia_device *link)
190 if (link->dev_node) 189 if (link->dev_node)
191 unregister_netdev(dev); 190 unregister_netdev(dev);
192 191
193 if (link->state & DEV_CONFIG) 192 axnet_release(link);
194 axnet_release(link);
195 193
196 free_netdev(dev); 194 free_netdev(dev);
197} /* axnet_detach */ 195} /* axnet_detach */
@@ -309,9 +307,6 @@ static int axnet_config(struct pcmcia_device *link)
309 /* don't trust the CIS on this; Linksys got it wrong */ 307 /* don't trust the CIS on this; Linksys got it wrong */
310 link->conf.Present = 0x63; 308 link->conf.Present = 0x63;
311 309
312 /* Configure card */
313 link->state |= DEV_CONFIG;
314
315 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 310 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
316 tuple.Attributes = 0; 311 tuple.Attributes = 0;
317 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); 312 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
@@ -402,7 +397,6 @@ static int axnet_config(struct pcmcia_device *link)
402 397
403 info->phy_id = (i < 32) ? i : -1; 398 info->phy_id = (i < 32) ? i : -1;
404 link->dev_node = &info->node; 399 link->dev_node = &info->node;
405 link->state &= ~DEV_CONFIG_PENDING;
406 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 400 SET_NETDEV_DEV(dev, &handle_to_dev(link));
407 401
408 if (register_netdev(dev) != 0) { 402 if (register_netdev(dev) != 0) {
@@ -429,7 +423,6 @@ cs_failed:
429 cs_error(link, last_fn, last_ret); 423 cs_error(link, last_fn, last_ret);
430failed: 424failed:
431 axnet_release(link); 425 axnet_release(link);
432 link->state &= ~DEV_CONFIG_PENDING;
433 return -ENODEV; 426 return -ENODEV;
434} /* axnet_config */ 427} /* axnet_config */
435 428
@@ -450,8 +443,8 @@ static int axnet_suspend(struct pcmcia_device *link)
450{ 443{
451 struct net_device *dev = link->priv; 444 struct net_device *dev = link->priv;
452 445
453 if ((link->state & DEV_CONFIG) && (link->open)) 446 if (link->open)
454 netif_device_detach(dev); 447 netif_device_detach(dev);
455 448
456 return 0; 449 return 0;
457} 450}
@@ -460,7 +453,7 @@ static int axnet_resume(struct pcmcia_device *link)
460{ 453{
461 struct net_device *dev = link->priv; 454 struct net_device *dev = link->priv;
462 455
463 if ((link->state & DEV_CONFIG) && (link->open)) { 456 if (link->open) {
464 axnet_reset_8390(dev); 457 axnet_reset_8390(dev);
465 AX88190_init(dev, 1); 458 AX88190_init(dev, 1);
466 netif_device_attach(dev); 459 netif_device_attach(dev);
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index a7d675bc6051..441de824ab6b 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -178,7 +178,6 @@ static int com20020_probe(struct pcmcia_device *p_dev)
178 p_dev->irq.Instance = info->dev = dev; 178 p_dev->irq.Instance = info->dev = dev;
179 p_dev->priv = info; 179 p_dev->priv = info;
180 180
181 p_dev->state |= DEV_PRESENT;
182 return com20020_config(p_dev); 181 return com20020_config(p_dev);
183 182
184fail_alloc_dev: 183fail_alloc_dev:
@@ -218,8 +217,7 @@ static void com20020_detach(struct pcmcia_device *link)
218 free_irq(dev->irq, dev); 217 free_irq(dev->irq, dev);
219 } 218 }
220 219
221 if (link->state & DEV_CONFIG) 220 com20020_release(link);
222 com20020_release(link);
223 221
224 /* Unlink device structure, free bits */ 222 /* Unlink device structure, free bits */
225 DEBUG(1,"unlinking...\n"); 223 DEBUG(1,"unlinking...\n");
@@ -276,9 +274,6 @@ static int com20020_config(struct pcmcia_device *link)
276 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 274 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
277 link->conf.ConfigBase = parse.config.base; 275 link->conf.ConfigBase = parse.config.base;
278 276
279 /* Configure card */
280 link->state |= DEV_CONFIG;
281
282 DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); 277 DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1);
283 i = !CS_SUCCESS; 278 i = !CS_SUCCESS;
284 if (!link->io.BasePort1) 279 if (!link->io.BasePort1)
@@ -328,7 +323,6 @@ static int com20020_config(struct pcmcia_device *link)
328 lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ 323 lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */
329 324
330 link->dev_node = &info->node; 325 link->dev_node = &info->node;
331 link->state &= ~DEV_CONFIG_PENDING;
332 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 326 SET_NETDEV_DEV(dev, &handle_to_dev(link));
333 327
334 i = com20020_found(dev, 0); /* calls register_netdev */ 328 i = com20020_found(dev, 0); /* calls register_netdev */
@@ -372,7 +366,7 @@ static int com20020_suspend(struct pcmcia_device *link)
372 com20020_dev_t *info = link->priv; 366 com20020_dev_t *info = link->priv;
373 struct net_device *dev = info->dev; 367 struct net_device *dev = info->dev;
374 368
375 if ((link->state & DEV_CONFIG) && (link->open)) 369 if (link->open)
376 netif_device_detach(dev); 370 netif_device_detach(dev);
377 371
378 return 0; 372 return 0;
@@ -383,7 +377,7 @@ static int com20020_resume(struct pcmcia_device *link)
383 com20020_dev_t *info = link->priv; 377 com20020_dev_t *info = link->priv;
384 struct net_device *dev = info->dev; 378 struct net_device *dev = info->dev;
385 379
386 if ((link->state & DEV_CONFIG) && (link->open)) { 380 if (link->open) {
387 int ioaddr = dev->base_addr; 381 int ioaddr = dev->base_addr;
388 struct arcnet_local *lp = dev->priv; 382 struct arcnet_local *lp = dev->priv;
389 ARCRESET; 383 ARCRESET;
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index d9c83b290095..7cb20b6b9348 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -272,7 +272,6 @@ static int fmvj18x_probe(struct pcmcia_device *link)
272#endif 272#endif
273 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 273 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
274 274
275 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
276 return fmvj18x_config(link); 275 return fmvj18x_config(link);
277} /* fmvj18x_attach */ 276} /* fmvj18x_attach */
278 277
@@ -287,8 +286,7 @@ static void fmvj18x_detach(struct pcmcia_device *link)
287 if (link->dev_node) 286 if (link->dev_node)
288 unregister_netdev(dev); 287 unregister_netdev(dev);
289 288
290 if (link->state & DEV_CONFIG) 289 fmvj18x_release(link);
291 fmvj18x_release(link);
292 290
293 free_netdev(dev); 291 free_netdev(dev);
294} /* fmvj18x_detach */ 292} /* fmvj18x_detach */
@@ -363,9 +361,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
363 tuple.TupleOffset = 0; 361 tuple.TupleOffset = 0;
364 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); 362 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
365 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 363 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
366
367 /* Configure card */
368 link->state |= DEV_CONFIG;
369 364
370 link->conf.ConfigBase = parse.config.base; 365 link->conf.ConfigBase = parse.config.base;
371 link->conf.Present = parse.config.rmask[0]; 366 link->conf.Present = parse.config.rmask[0];
@@ -532,7 +527,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
532 527
533 lp->cardtype = cardtype; 528 lp->cardtype = cardtype;
534 link->dev_node = &lp->node; 529 link->dev_node = &lp->node;
535 link->state &= ~DEV_CONFIG_PENDING;
536 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 530 SET_NETDEV_DEV(dev, &handle_to_dev(link));
537 531
538 if (register_netdev(dev) != 0) { 532 if (register_netdev(dev) != 0) {
@@ -557,7 +551,6 @@ cs_failed:
557 cs_error(link, last_fn, last_ret); 551 cs_error(link, last_fn, last_ret);
558failed: 552failed:
559 fmvj18x_release(link); 553 fmvj18x_release(link);
560 link->state &= ~DEV_CONFIG_PENDING;
561 return -ENODEV; 554 return -ENODEV;
562} /* fmvj18x_config */ 555} /* fmvj18x_config */
563/*====================================================================*/ 556/*====================================================================*/
@@ -668,7 +661,7 @@ static int fmvj18x_suspend(struct pcmcia_device *link)
668{ 661{
669 struct net_device *dev = link->priv; 662 struct net_device *dev = link->priv;
670 663
671 if ((link->state & DEV_CONFIG) && (link->open)) 664 if (link->open)
672 netif_device_detach(dev); 665 netif_device_detach(dev);
673 666
674 return 0; 667 return 0;
@@ -678,7 +671,7 @@ static int fmvj18x_resume(struct pcmcia_device *link)
678{ 671{
679 struct net_device *dev = link->priv; 672 struct net_device *dev = link->priv;
680 673
681 if ((link->state & DEV_CONFIG) && (link->open)) { 674 if (link->open) {
682 fjn_reset(dev); 675 fjn_reset(dev);
683 netif_device_attach(dev); 676 netif_device_attach(dev);
684 } 677 }
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index e038d9278a59..b8fe70b85641 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -173,7 +173,6 @@ static int ibmtr_attach(struct pcmcia_device *link)
173 173
174 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 174 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
175 175
176 link->state |= DEV_PRESENT;
177 return ibmtr_config(link); 176 return ibmtr_config(link);
178} /* ibmtr_attach */ 177} /* ibmtr_attach */
179 178
@@ -200,8 +199,8 @@ static void ibmtr_detach(struct pcmcia_device *link)
200 struct tok_info *ti = netdev_priv(dev); 199 struct tok_info *ti = netdev_priv(dev);
201 del_timer_sync(&(ti->tr_timer)); 200 del_timer_sync(&(ti->tr_timer));
202 } 201 }
203 if (link->state & DEV_CONFIG) 202
204 ibmtr_release(link); 203 ibmtr_release(link);
205 204
206 free_netdev(dev); 205 free_netdev(dev);
207 kfree(info); 206 kfree(info);
@@ -241,10 +240,6 @@ static int ibmtr_config(struct pcmcia_device *link)
241 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); 240 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
242 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 241 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
243 link->conf.ConfigBase = parse.config.base; 242 link->conf.ConfigBase = parse.config.base;
244
245 /* Configure card */
246 link->state |= DEV_CONFIG;
247
248 link->conf.ConfigIndex = 0x61; 243 link->conf.ConfigIndex = 0x61;
249 244
250 /* Determine if this is PRIMARY or ALTERNATE. */ 245 /* Determine if this is PRIMARY or ALTERNATE. */
@@ -301,7 +296,6 @@ static int ibmtr_config(struct pcmcia_device *link)
301 ibmtr_hw_setup(dev, mmiobase); 296 ibmtr_hw_setup(dev, mmiobase);
302 297
303 link->dev_node = &info->node; 298 link->dev_node = &info->node;
304 link->state &= ~DEV_CONFIG_PENDING;
305 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 299 SET_NETDEV_DEV(dev, &handle_to_dev(link));
306 300
307 i = ibmtr_probe_card(dev); 301 i = ibmtr_probe_card(dev);
@@ -358,7 +352,7 @@ static int ibmtr_suspend(struct pcmcia_device *link)
358 ibmtr_dev_t *info = link->priv; 352 ibmtr_dev_t *info = link->priv;
359 struct net_device *dev = info->dev; 353 struct net_device *dev = info->dev;
360 354
361 if ((link->state & DEV_CONFIG) && (link->open)) 355 if (link->open)
362 netif_device_detach(dev); 356 netif_device_detach(dev);
363 357
364 return 0; 358 return 0;
@@ -369,7 +363,7 @@ static int ibmtr_resume(struct pcmcia_device *link)
369 ibmtr_dev_t *info = link->priv; 363 ibmtr_dev_t *info = link->priv;
370 struct net_device *dev = info->dev; 364 struct net_device *dev = info->dev;
371 365
372 if ((link->state & DEV_CONFIG) && (link->open)) { 366 if (link->open) {
373 ibmtr_probe(dev); /* really? */ 367 ibmtr_probe(dev); /* really? */
374 netif_device_attach(dev); 368 netif_device_attach(dev);
375 } 369 }
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index ea8a62e629a4..fd191143cb2f 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -487,7 +487,6 @@ static int nmclan_probe(struct pcmcia_device *link)
487 dev->watchdog_timeo = TX_TIMEOUT; 487 dev->watchdog_timeo = TX_TIMEOUT;
488#endif 488#endif
489 489
490 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
491 return nmclan_config(link); 490 return nmclan_config(link);
492} /* nmclan_attach */ 491} /* nmclan_attach */
493 492
@@ -508,8 +507,7 @@ static void nmclan_detach(struct pcmcia_device *link)
508 if (link->dev_node) 507 if (link->dev_node)
509 unregister_netdev(dev); 508 unregister_netdev(dev);
510 509
511 if (link->state & DEV_CONFIG) 510 nmclan_release(link);
512 nmclan_release(link);
513 511
514 free_netdev(dev); 512 free_netdev(dev);
515} /* nmclan_detach */ 513} /* nmclan_detach */
@@ -675,9 +673,6 @@ static int nmclan_config(struct pcmcia_device *link)
675 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 673 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
676 link->conf.ConfigBase = parse.config.base; 674 link->conf.ConfigBase = parse.config.base;
677 675
678 /* Configure card */
679 link->state |= DEV_CONFIG;
680
681 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 676 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
682 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 677 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
683 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 678 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
@@ -707,7 +702,6 @@ static int nmclan_config(struct pcmcia_device *link)
707 } else { 702 } else {
708 printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" 703 printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should"
709 " be 0x40 0x?9\n", sig[0], sig[1]); 704 " be 0x40 0x?9\n", sig[0], sig[1]);
710 link->state &= ~DEV_CONFIG_PENDING;
711 return -ENODEV; 705 return -ENODEV;
712 } 706 }
713 } 707 }
@@ -722,7 +716,6 @@ static int nmclan_config(struct pcmcia_device *link)
722 printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); 716 printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n");
723 717
724 link->dev_node = &lp->node; 718 link->dev_node = &lp->node;
725 link->state &= ~DEV_CONFIG_PENDING;
726 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 719 SET_NETDEV_DEV(dev, &handle_to_dev(link));
727 720
728 i = register_netdev(dev); 721 i = register_netdev(dev);
@@ -763,7 +756,7 @@ static int nmclan_suspend(struct pcmcia_device *link)
763{ 756{
764 struct net_device *dev = link->priv; 757 struct net_device *dev = link->priv;
765 758
766 if ((link->state & DEV_CONFIG) && (link->open)) 759 if (link->open)
767 netif_device_detach(dev); 760 netif_device_detach(dev);
768 761
769 return 0; 762 return 0;
@@ -773,7 +766,7 @@ static int nmclan_resume(struct pcmcia_device *link)
773{ 766{
774 struct net_device *dev = link->priv; 767 struct net_device *dev = link->priv;
775 768
776 if ((link->state & DEV_CONFIG) && (link->open)) { 769 if (link->open) {
777 nmclan_reset(dev); 770 nmclan_reset(dev);
778 netif_device_attach(dev); 771 netif_device_attach(dev);
779 } 772 }
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index d840c0f03ea9..d9661410f2ff 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -264,7 +264,6 @@ static int pcnet_probe(struct pcmcia_device *link)
264 dev->stop = &pcnet_close; 264 dev->stop = &pcnet_close;
265 dev->set_config = &set_config; 265 dev->set_config = &set_config;
266 266
267 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
268 return pcnet_config(link); 267 return pcnet_config(link);
269} /* pcnet_attach */ 268} /* pcnet_attach */
270 269
@@ -286,8 +285,7 @@ static void pcnet_detach(struct pcmcia_device *link)
286 if (link->dev_node) 285 if (link->dev_node)
287 unregister_netdev(dev); 286 unregister_netdev(dev);
288 287
289 if (link->state & DEV_CONFIG) 288 pcnet_release(link);
290 pcnet_release(link);
291 289
292 free_netdev(dev); 290 free_netdev(dev);
293} /* pcnet_detach */ 291} /* pcnet_detach */
@@ -538,9 +536,6 @@ static int pcnet_config(struct pcmcia_device *link)
538 link->conf.ConfigBase = parse.config.base; 536 link->conf.ConfigBase = parse.config.base;
539 link->conf.Present = parse.config.rmask[0]; 537 link->conf.Present = parse.config.rmask[0];
540 538
541 /* Configure card */
542 link->state |= DEV_CONFIG;
543
544 tuple.DesiredTuple = CISTPL_MANFID; 539 tuple.DesiredTuple = CISTPL_MANFID;
545 tuple.Attributes = TUPLE_RETURN_COMMON; 540 tuple.Attributes = TUPLE_RETURN_COMMON;
546 if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && 541 if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
@@ -667,7 +662,6 @@ static int pcnet_config(struct pcmcia_device *link)
667 } 662 }
668 663
669 link->dev_node = &info->node; 664 link->dev_node = &info->node;
670 link->state &= ~DEV_CONFIG_PENDING;
671 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 665 SET_NETDEV_DEV(dev, &handle_to_dev(link));
672 666
673#ifdef CONFIG_NET_POLL_CONTROLLER 667#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -705,7 +699,6 @@ cs_failed:
705 cs_error(link, last_fn, last_ret); 699 cs_error(link, last_fn, last_ret);
706failed: 700failed:
707 pcnet_release(link); 701 pcnet_release(link);
708 link->state &= ~DEV_CONFIG_PENDING;
709 return -ENODEV; 702 return -ENODEV;
710} /* pcnet_config */ 703} /* pcnet_config */
711 704
@@ -742,7 +735,7 @@ static int pcnet_suspend(struct pcmcia_device *link)
742{ 735{
743 struct net_device *dev = link->priv; 736 struct net_device *dev = link->priv;
744 737
745 if ((link->state & DEV_CONFIG) && (link->open)) 738 if (link->open)
746 netif_device_detach(dev); 739 netif_device_detach(dev);
747 740
748 return 0; 741 return 0;
@@ -752,7 +745,7 @@ static int pcnet_resume(struct pcmcia_device *link)
752{ 745{
753 struct net_device *dev = link->priv; 746 struct net_device *dev = link->priv;
754 747
755 if ((link->state & DEV_CONFIG) && (link->open)) { 748 if (link->open) {
756 pcnet_reset_8390(dev); 749 pcnet_reset_8390(dev);
757 NS8390_init(dev, 1); 750 NS8390_init(dev, 1);
758 netif_device_attach(dev); 751 netif_device_attach(dev);
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 3252c1dc9ee7..7d565f26a3bf 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -356,7 +356,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
356 smc->mii_if.phy_id_mask = 0x1f; 356 smc->mii_if.phy_id_mask = 0x1f;
357 smc->mii_if.reg_num_mask = 0x1f; 357 smc->mii_if.reg_num_mask = 0x1f;
358 358
359 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
360 return smc91c92_config(link); 359 return smc91c92_config(link);
361} /* smc91c92_attach */ 360} /* smc91c92_attach */
362 361
@@ -378,8 +377,7 @@ static void smc91c92_detach(struct pcmcia_device *link)
378 if (link->dev_node) 377 if (link->dev_node)
379 unregister_netdev(dev); 378 unregister_netdev(dev);
380 379
381 if (link->state & DEV_CONFIG) 380 smc91c92_release(link);
382 smc91c92_release(link);
383 381
384 free_netdev(dev); 382 free_netdev(dev);
385} /* smc91c92_detach */ 383} /* smc91c92_detach */
@@ -862,7 +860,7 @@ static int smc91c92_suspend(struct pcmcia_device *link)
862{ 860{
863 struct net_device *dev = link->priv; 861 struct net_device *dev = link->priv;
864 862
865 if ((link->state & DEV_CONFIG) && (link->open)) 863 if (link->open)
866 netif_device_detach(dev); 864 netif_device_detach(dev);
867 865
868 return 0; 866 return 0;
@@ -874,33 +872,31 @@ static int smc91c92_resume(struct pcmcia_device *link)
874 struct smc_private *smc = netdev_priv(dev); 872 struct smc_private *smc = netdev_priv(dev);
875 int i; 873 int i;
876 874
877 if (link->state & DEV_CONFIG) { 875 if ((smc->manfid == MANFID_MEGAHERTZ) &&
878 if ((smc->manfid == MANFID_MEGAHERTZ) && 876 (smc->cardid == PRODID_MEGAHERTZ_EM3288))
879 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 877 mhz_3288_power(link);
880 mhz_3288_power(link); 878 if (smc->manfid == MANFID_MOTOROLA)
881 if (smc->manfid == MANFID_MOTOROLA) 879 mot_config(link);
882 mot_config(link); 880 if ((smc->manfid == MANFID_OSITECH) &&
883 if ((smc->manfid == MANFID_OSITECH) && 881 (smc->cardid != PRODID_OSITECH_SEVEN)) {
884 (smc->cardid != PRODID_OSITECH_SEVEN)) { 882 /* Power up the card and enable interrupts */
885 /* Power up the card and enable interrupts */ 883 set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR);
886 set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR); 884 set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR);
887 set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR); 885 }
888 } 886 if (((smc->manfid == MANFID_OSITECH) &&
889 if (((smc->manfid == MANFID_OSITECH) && 887 (smc->cardid == PRODID_OSITECH_SEVEN)) ||
890 (smc->cardid == PRODID_OSITECH_SEVEN)) || 888 ((smc->manfid == MANFID_PSION) &&
891 ((smc->manfid == MANFID_PSION) && 889 (smc->cardid == PRODID_PSION_NET100))) {
892 (smc->cardid == PRODID_PSION_NET100))) { 890 /* Download the Seven of Diamonds firmware */
893 /* Download the Seven of Diamonds firmware */ 891 for (i = 0; i < sizeof(__Xilinx7OD); i++) {
894 for (i = 0; i < sizeof(__Xilinx7OD); i++) { 892 outb(__Xilinx7OD[i], link->io.BasePort1+2);
895 outb(__Xilinx7OD[i], link->io.BasePort1+2); 893 udelay(50);
896 udelay(50);
897 }
898 }
899 if (link->open) {
900 smc_reset(dev);
901 netif_device_attach(dev);
902 } 894 }
903 } 895 }
896 if (link->open) {
897 smc_reset(dev);
898 netif_device_attach(dev);
899 }
904 900
905 return 0; 901 return 0;
906} 902}
@@ -1010,9 +1006,6 @@ static int smc91c92_config(struct pcmcia_device *link)
1010 smc->cardid = parse->manfid.card; 1006 smc->cardid = parse->manfid.card;
1011 } 1007 }
1012 1008
1013 /* Configure card */
1014 link->state |= DEV_CONFIG;
1015
1016 if ((smc->manfid == MANFID_OSITECH) && 1009 if ((smc->manfid == MANFID_OSITECH) &&
1017 (smc->cardid != PRODID_OSITECH_SEVEN)) { 1010 (smc->cardid != PRODID_OSITECH_SEVEN)) {
1018 i = osi_config(link); 1011 i = osi_config(link);
@@ -1108,7 +1101,6 @@ static int smc91c92_config(struct pcmcia_device *link)
1108 } 1101 }
1109 1102
1110 link->dev_node = &smc->node; 1103 link->dev_node = &smc->node;
1111 link->state &= ~DEV_CONFIG_PENDING;
1112 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 1104 SET_NETDEV_DEV(dev, &handle_to_dev(link));
1113 1105
1114 if (register_netdev(dev) != 0) { 1106 if (register_netdev(dev) != 0) {
@@ -1149,7 +1141,6 @@ config_undo:
1149 unregister_netdev(dev); 1141 unregister_netdev(dev);
1150config_failed: /* CS_EXIT_TEST() calls jump to here... */ 1142config_failed: /* CS_EXIT_TEST() calls jump to here... */
1151 smc91c92_release(link); 1143 smc91c92_release(link);
1152 link->state &= ~DEV_CONFIG_PENDING;
1153 kfree(cfg_mem); 1144 kfree(cfg_mem);
1154 return -ENODEV; 1145 return -ENODEV;
1155} /* smc91c92_config */ 1146} /* smc91c92_config */
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 77bf4e3a6139..0141c5037f41 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -591,7 +591,6 @@ xirc2ps_probe(struct pcmcia_device *link)
591 dev->watchdog_timeo = TX_TIMEOUT; 591 dev->watchdog_timeo = TX_TIMEOUT;
592#endif 592#endif
593 593
594 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
595 return xirc2ps_config(link); 594 return xirc2ps_config(link);
596} /* xirc2ps_attach */ 595} /* xirc2ps_attach */
597 596
@@ -612,8 +611,7 @@ xirc2ps_detach(struct pcmcia_device *link)
612 if (link->dev_node) 611 if (link->dev_node)
613 unregister_netdev(dev); 612 unregister_netdev(dev);
614 613
615 if (link->state & DEV_CONFIG) 614 xirc2ps_release(link);
616 xirc2ps_release(link);
617 615
618 free_netdev(dev); 616 free_netdev(dev);
619} /* xirc2ps_detach */ 617} /* xirc2ps_detach */
@@ -843,9 +841,6 @@ xirc2ps_config(struct pcmcia_device * link)
843 for (i=0; i < 6; i++) 841 for (i=0; i < 6; i++)
844 dev->dev_addr[i] = node_id->id[i]; 842 dev->dev_addr[i] = node_id->id[i];
845 843
846 /* Configure card */
847 link->state |= DEV_CONFIG;
848
849 link->io.IOAddrLines =10; 844 link->io.IOAddrLines =10;
850 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 845 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
851 link->irq.Attributes = IRQ_HANDLE_PRESENT; 846 link->irq.Attributes = IRQ_HANDLE_PRESENT;
@@ -1041,7 +1036,6 @@ xirc2ps_config(struct pcmcia_device * link)
1041 do_reset(dev, 1); /* a kludge to make the cem56 work */ 1036 do_reset(dev, 1); /* a kludge to make the cem56 work */
1042 1037
1043 link->dev_node = &local->node; 1038 link->dev_node = &local->node;
1044 link->state &= ~DEV_CONFIG_PENDING;
1045 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 1039 SET_NETDEV_DEV(dev, &handle_to_dev(link));
1046 1040
1047 if ((err=register_netdev(dev))) { 1041 if ((err=register_netdev(dev))) {
@@ -1062,14 +1056,12 @@ xirc2ps_config(struct pcmcia_device * link)
1062 return 0; 1056 return 0;
1063 1057
1064 config_error: 1058 config_error:
1065 link->state &= ~DEV_CONFIG_PENDING;
1066 xirc2ps_release(link); 1059 xirc2ps_release(link);
1067 return -ENODEV; 1060 return -ENODEV;
1068 1061
1069 cis_error: 1062 cis_error:
1070 printk(KNOT_XIRC "unable to parse CIS\n"); 1063 printk(KNOT_XIRC "unable to parse CIS\n");
1071 failure: 1064 failure:
1072 link->state &= ~DEV_CONFIG_PENDING;
1073 return -ENODEV; 1065 return -ENODEV;
1074} /* xirc2ps_config */ 1066} /* xirc2ps_config */
1075 1067
@@ -1099,9 +1091,9 @@ static int xirc2ps_suspend(struct pcmcia_device *link)
1099{ 1091{
1100 struct net_device *dev = link->priv; 1092 struct net_device *dev = link->priv;
1101 1093
1102 if ((link->state & DEV_CONFIG) && (link->open)) { 1094 if (link->open) {
1103 netif_device_detach(dev); 1095 netif_device_detach(dev);
1104 do_powerdown(dev); 1096 do_powerdown(dev);
1105 } 1097 }
1106 1098
1107 return 0; 1099 return 0;
@@ -1111,7 +1103,7 @@ static int xirc2ps_resume(struct pcmcia_device *link)
1111{ 1103{
1112 struct net_device *dev = link->priv; 1104 struct net_device *dev = link->priv;
1113 1105
1114 if ((link->state & DEV_CONFIG) && (link->open)) { 1106 if (link->open) {
1115 do_reset(dev,1); 1107 do_reset(dev,1);
1116 netif_device_attach(dev); 1108 netif_device_attach(dev);
1117 } 1109 }