aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-01 18:02:33 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:52 -0500
commit8661bb5b4af1849c1f5a4e80c4e275fd13c155d6 (patch)
treead99d85ea8d6f5c4c99b93f869bfd412994fb4ee /drivers/net
parent50db3fdbbc98260fb538c1cc3f8cc597ba7bffe7 (diff)
[PATCH] pcmcia: default suspend and resume handling
In all but one case, the suspend and resume functions of PCMCIA drivers contain mostly of calls to pcmcia_release_configuration() and pcmcia_request_configuration(). Therefore, move this code out of the drivers and into the core. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c18
-rw-r--r--drivers/net/pcmcia/3c589_cs.c18
-rw-r--r--drivers/net/pcmcia/axnet_cs.c18
-rw-r--r--drivers/net/pcmcia/com20020_cs.c23
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c19
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c20
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c19
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c20
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c16
-rw-r--r--drivers/net/wireless/airo_cs.c9
-rw-r--r--drivers/net/wireless/atmel_cs.c7
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c6
-rw-r--r--drivers/net/wireless/netwave_cs.c18
-rw-r--r--drivers/net/wireless/orinoco_cs.c8
-rw-r--r--drivers/net/wireless/ray_cs.c22
-rw-r--r--drivers/net/wireless/spectrum_cs.c7
-rw-r--r--drivers/net/wireless/wavelan_cs.c24
-rw-r--r--drivers/net/wireless/wl3501_cs.c18
19 files changed, 73 insertions, 219 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 1799660bdc67..8dfa30b3c70a 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -519,12 +519,8 @@ static int tc574_suspend(struct pcmcia_device *p_dev)
519 dev_link_t *link = dev_to_instance(p_dev); 519 dev_link_t *link = dev_to_instance(p_dev);
520 struct net_device *dev = link->priv; 520 struct net_device *dev = link->priv;
521 521
522 link->state |= DEV_SUSPEND; 522 if ((link->state & DEV_CONFIG) && (link->open))
523 if (link->state & DEV_CONFIG) { 523 netif_device_detach(dev);
524 if (link->open)
525 netif_device_detach(dev);
526 pcmcia_release_configuration(link->handle);
527 }
528 524
529 return 0; 525 return 0;
530} 526}
@@ -534,13 +530,9 @@ static int tc574_resume(struct pcmcia_device *p_dev)
534 dev_link_t *link = dev_to_instance(p_dev); 530 dev_link_t *link = dev_to_instance(p_dev);
535 struct net_device *dev = link->priv; 531 struct net_device *dev = link->priv;
536 532
537 link->state &= ~DEV_SUSPEND; 533 if ((link->state & DEV_CONFIG) && (link->open)) {
538 if (link->state & DEV_CONFIG) { 534 tc574_reset(dev);
539 pcmcia_request_configuration(link->handle, &link->conf); 535 netif_device_attach(dev);
540 if (link->open) {
541 tc574_reset(dev);
542 netif_device_attach(dev);
543 }
544 } 536 }
545 537
546 return 0; 538 return 0;
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index e36153851793..b15066be26f8 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -394,12 +394,8 @@ static int tc589_suspend(struct pcmcia_device *p_dev)
394 dev_link_t *link = dev_to_instance(p_dev); 394 dev_link_t *link = dev_to_instance(p_dev);
395 struct net_device *dev = link->priv; 395 struct net_device *dev = link->priv;
396 396
397 link->state |= DEV_SUSPEND; 397 if ((link->state & DEV_CONFIG) && (link->open))
398 if (link->state & DEV_CONFIG) { 398 netif_device_detach(dev);
399 if (link->open)
400 netif_device_detach(dev);
401 pcmcia_release_configuration(link->handle);
402 }
403 399
404 return 0; 400 return 0;
405} 401}
@@ -409,13 +405,9 @@ static int tc589_resume(struct pcmcia_device *p_dev)
409 dev_link_t *link = dev_to_instance(p_dev); 405 dev_link_t *link = dev_to_instance(p_dev);
410 struct net_device *dev = link->priv; 406 struct net_device *dev = link->priv;
411 407
412 link->state &= ~DEV_SUSPEND; 408 if ((link->state & DEV_CONFIG) && (link->open)) {
413 if (link->state & DEV_CONFIG) { 409 tc589_reset(dev);
414 pcmcia_request_configuration(link->handle, &link->conf); 410 netif_device_attach(dev);
415 if (link->open) {
416 tc589_reset(dev);
417 netif_device_attach(dev);
418 }
419 } 411 }
420 412
421 return 0; 413 return 0;
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 9b9c0f19b21c..c34547c79245 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -464,12 +464,8 @@ static int axnet_suspend(struct pcmcia_device *p_dev)
464 dev_link_t *link = dev_to_instance(p_dev); 464 dev_link_t *link = dev_to_instance(p_dev);
465 struct net_device *dev = link->priv; 465 struct net_device *dev = link->priv;
466 466
467 link->state |= DEV_SUSPEND; 467 if ((link->state & DEV_CONFIG) && (link->open))
468 if (link->state & DEV_CONFIG) {
469 if (link->open)
470 netif_device_detach(dev); 468 netif_device_detach(dev);
471 pcmcia_release_configuration(link->handle);
472 }
473 469
474 return 0; 470 return 0;
475} 471}
@@ -479,14 +475,10 @@ static int axnet_resume(struct pcmcia_device *p_dev)
479 dev_link_t *link = dev_to_instance(p_dev); 475 dev_link_t *link = dev_to_instance(p_dev);
480 struct net_device *dev = link->priv; 476 struct net_device *dev = link->priv;
481 477
482 link->state &= ~DEV_SUSPEND; 478 if ((link->state & DEV_CONFIG) && (link->open)) {
483 if (link->state & DEV_CONFIG) { 479 axnet_reset_8390(dev);
484 pcmcia_request_configuration(link->handle, &link->conf); 480 AX88190_init(dev, 1);
485 if (link->open) { 481 netif_device_attach(dev);
486 axnet_reset_8390(dev);
487 AX88190_init(dev, 1);
488 netif_device_attach(dev);
489 }
490 } 482 }
491 483
492 return 0; 484 return 0;
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index a0ec5e7aacc6..0748c3d49544 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -387,13 +387,8 @@ static int com20020_suspend(struct pcmcia_device *p_dev)
387 com20020_dev_t *info = link->priv; 387 com20020_dev_t *info = link->priv;
388 struct net_device *dev = info->dev; 388 struct net_device *dev = info->dev;
389 389
390 link->state |= DEV_SUSPEND; 390 if ((link->state & DEV_CONFIG) && (link->open))
391 if (link->state & DEV_CONFIG) { 391 netif_device_detach(dev);
392 if (link->open) {
393 netif_device_detach(dev);
394 }
395 pcmcia_release_configuration(link->handle);
396 }
397 392
398 return 0; 393 return 0;
399} 394}
@@ -404,15 +399,11 @@ static int com20020_resume(struct pcmcia_device *p_dev)
404 com20020_dev_t *info = link->priv; 399 com20020_dev_t *info = link->priv;
405 struct net_device *dev = info->dev; 400 struct net_device *dev = info->dev;
406 401
407 link->state &= ~DEV_SUSPEND; 402 if ((link->state & DEV_CONFIG) && (link->open)) {
408 if (link->state & DEV_CONFIG) { 403 int ioaddr = dev->base_addr;
409 pcmcia_request_configuration(link->handle, &link->conf); 404 struct arcnet_local *lp = dev->priv;
410 if (link->open) { 405 ARCRESET;
411 int ioaddr = dev->base_addr; 406 }
412 struct arcnet_local *lp = dev->priv;
413 ARCRESET;
414 }
415 }
416 407
417 return 0; 408 return 0;
418} 409}
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 6b435e940607..62efbc7c2dca 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -683,13 +683,8 @@ static int fmvj18x_suspend(struct pcmcia_device *p_dev)
683 dev_link_t *link = dev_to_instance(p_dev); 683 dev_link_t *link = dev_to_instance(p_dev);
684 struct net_device *dev = link->priv; 684 struct net_device *dev = link->priv;
685 685
686 link->state |= DEV_SUSPEND; 686 if ((link->state & DEV_CONFIG) && (link->open))
687 if (link->state & DEV_CONFIG) { 687 netif_device_detach(dev);
688 if (link->open)
689 netif_device_detach(dev);
690 pcmcia_release_configuration(link->handle);
691 }
692
693 688
694 return 0; 689 return 0;
695} 690}
@@ -699,13 +694,9 @@ static int fmvj18x_resume(struct pcmcia_device *p_dev)
699 dev_link_t *link = dev_to_instance(p_dev); 694 dev_link_t *link = dev_to_instance(p_dev);
700 struct net_device *dev = link->priv; 695 struct net_device *dev = link->priv;
701 696
702 link->state &= ~DEV_SUSPEND; 697 if ((link->state & DEV_CONFIG) && (link->open)) {
703 if (link->state & DEV_CONFIG) { 698 fjn_reset(dev);
704 pcmcia_request_configuration(link->handle, &link->conf); 699 netif_device_attach(dev);
705 if (link->open) {
706 fjn_reset(dev);
707 netif_device_attach(dev);
708 }
709 } 700 }
710 701
711 return 0; 702 return 0;
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 1948a0bc198d..6d7f8f52e175 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -367,12 +367,8 @@ static int ibmtr_suspend(struct pcmcia_device *p_dev)
367 ibmtr_dev_t *info = link->priv; 367 ibmtr_dev_t *info = link->priv;
368 struct net_device *dev = info->dev; 368 struct net_device *dev = info->dev;
369 369
370 link->state |= DEV_SUSPEND; 370 if ((link->state & DEV_CONFIG) && (link->open))
371 if (link->state & DEV_CONFIG) { 371 netif_device_detach(dev);
372 if (link->open)
373 netif_device_detach(dev);
374 pcmcia_release_configuration(link->handle);
375 }
376 372
377 return 0; 373 return 0;
378} 374}
@@ -383,14 +379,10 @@ static int ibmtr_resume(struct pcmcia_device *p_dev)
383 ibmtr_dev_t *info = link->priv; 379 ibmtr_dev_t *info = link->priv;
384 struct net_device *dev = info->dev; 380 struct net_device *dev = info->dev;
385 381
386 link->state &= ~DEV_SUSPEND; 382 if ((link->state & DEV_CONFIG) && (link->open)) {
387 if (link->state & DEV_CONFIG) { 383 ibmtr_probe(dev); /* really? */
388 pcmcia_request_configuration(link->handle, &link->conf); 384 netif_device_attach(dev);
389 if (link->open) { 385 }
390 ibmtr_probe(dev); /* really? */
391 netif_device_attach(dev);
392 }
393 }
394 386
395 return 0; 387 return 0;
396} 388}
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 76ef453d172d..cf2a50c015da 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -774,13 +774,8 @@ static int nmclan_suspend(struct pcmcia_device *p_dev)
774 dev_link_t *link = dev_to_instance(p_dev); 774 dev_link_t *link = dev_to_instance(p_dev);
775 struct net_device *dev = link->priv; 775 struct net_device *dev = link->priv;
776 776
777 link->state |= DEV_SUSPEND; 777 if ((link->state & DEV_CONFIG) && (link->open))
778 if (link->state & DEV_CONFIG) { 778 netif_device_detach(dev);
779 if (link->open)
780 netif_device_detach(dev);
781 pcmcia_release_configuration(link->handle);
782 }
783
784 779
785 return 0; 780 return 0;
786} 781}
@@ -790,13 +785,9 @@ static int nmclan_resume(struct pcmcia_device *p_dev)
790 dev_link_t *link = dev_to_instance(p_dev); 785 dev_link_t *link = dev_to_instance(p_dev);
791 struct net_device *dev = link->priv; 786 struct net_device *dev = link->priv;
792 787
793 link->state &= ~DEV_SUSPEND; 788 if ((link->state & DEV_CONFIG) && (link->open)) {
794 if (link->state & DEV_CONFIG) { 789 nmclan_reset(dev);
795 pcmcia_request_configuration(link->handle, &link->conf); 790 netif_device_attach(dev);
796 if (link->open) {
797 nmclan_reset(dev);
798 netif_device_attach(dev);
799 }
800 } 791 }
801 792
802 return 0; 793 return 0;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 52f44bdff1f7..3a2b731eeb3c 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -756,12 +756,8 @@ static int pcnet_suspend(struct pcmcia_device *p_dev)
756 dev_link_t *link = dev_to_instance(p_dev); 756 dev_link_t *link = dev_to_instance(p_dev);
757 struct net_device *dev = link->priv; 757 struct net_device *dev = link->priv;
758 758
759 link->state |= DEV_SUSPEND; 759 if ((link->state & DEV_CONFIG) && (link->open))
760 if (link->state & DEV_CONFIG) { 760 netif_device_detach(dev);
761 if (link->open)
762 netif_device_detach(dev);
763 pcmcia_release_configuration(link->handle);
764 }
765 761
766 return 0; 762 return 0;
767} 763}
@@ -771,14 +767,10 @@ static int pcnet_resume(struct pcmcia_device *p_dev)
771 dev_link_t *link = dev_to_instance(p_dev); 767 dev_link_t *link = dev_to_instance(p_dev);
772 struct net_device *dev = link->priv; 768 struct net_device *dev = link->priv;
773 769
774 link->state &= ~DEV_SUSPEND; 770 if ((link->state & DEV_CONFIG) && (link->open)) {
775 if (link->state & DEV_CONFIG) { 771 pcnet_reset_8390(dev);
776 pcmcia_request_configuration(link->handle, &link->conf); 772 NS8390_init(dev, 1);
777 if (link->open) { 773 netif_device_attach(dev);
778 pcnet_reset_8390(dev);
779 NS8390_init(dev, 1);
780 netif_device_attach(dev);
781 }
782 } 774 }
783 775
784 return 0; 776 return 0;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 03b1d8fbe7b7..84e18bbed9d2 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -874,7 +874,6 @@ static int smc91c92_suspend(struct pcmcia_device *p_dev)
874 dev_link_t *link = dev_to_instance(p_dev); 874 dev_link_t *link = dev_to_instance(p_dev);
875 struct net_device *dev = link->priv; 875 struct net_device *dev = link->priv;
876 876
877 link->state |= DEV_SUSPEND;
878 if (link->state & DEV_CONFIG) { 877 if (link->state & DEV_CONFIG) {
879 if (link->open) 878 if (link->open)
880 netif_device_detach(dev); 879 netif_device_detach(dev);
@@ -891,7 +890,6 @@ static int smc91c92_resume(struct pcmcia_device *p_dev)
891 struct smc_private *smc = netdev_priv(dev); 890 struct smc_private *smc = netdev_priv(dev);
892 int i; 891 int i;
893 892
894 link->state &= ~DEV_SUSPEND;
895 if (link->state & DEV_CONFIG) { 893 if (link->state & DEV_CONFIG) {
896 if ((smc->manfid == MANFID_MEGAHERTZ) && 894 if ((smc->manfid == MANFID_MEGAHERTZ) &&
897 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 895 (smc->cardid == PRODID_MEGAHERTZ_EM3288))
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 2b57a87371f3..19347bcb2f15 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1109,13 +1109,9 @@ static int xirc2ps_suspend(struct pcmcia_device *p_dev)
1109 dev_link_t *link = dev_to_instance(p_dev); 1109 dev_link_t *link = dev_to_instance(p_dev);
1110 struct net_device *dev = link->priv; 1110 struct net_device *dev = link->priv;
1111 1111
1112 link->state |= DEV_SUSPEND; 1112 if ((link->state & DEV_CONFIG) && (link->open)) {
1113 if (link->state & DEV_CONFIG) {
1114 if (link->open) {
1115 netif_device_detach(dev); 1113 netif_device_detach(dev);
1116 do_powerdown(dev); 1114 do_powerdown(dev);
1117 }
1118 pcmcia_release_configuration(link->handle);
1119 } 1115 }
1120 1116
1121 return 0; 1117 return 0;
@@ -1126,13 +1122,9 @@ static int xirc2ps_resume(struct pcmcia_device *p_dev)
1126 dev_link_t *link = dev_to_instance(p_dev); 1122 dev_link_t *link = dev_to_instance(p_dev);
1127 struct net_device *dev = link->priv; 1123 struct net_device *dev = link->priv;
1128 1124
1129 link->state &= ~DEV_SUSPEND; 1125 if ((link->state & DEV_CONFIG) && (link->open)) {
1130 if (link->state & DEV_CONFIG) { 1126 do_reset(dev,1);
1131 pcmcia_request_configuration(link->handle, &link->conf); 1127 netif_device_attach(dev);
1132 if (link->open) {
1133 do_reset(dev,1);
1134 netif_device_attach(dev);
1135 }
1136 } 1128 }
1137 1129
1138 return 0; 1130 return 0;
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 489ef7f3d950..adb90b679d7d 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -437,11 +437,8 @@ static int airo_suspend(struct pcmcia_device *p_dev)
437 dev_link_t *link = dev_to_instance(p_dev); 437 dev_link_t *link = dev_to_instance(p_dev);
438 local_info_t *local = link->priv; 438 local_info_t *local = link->priv;
439 439
440 link->state |= DEV_SUSPEND; 440 if (link->state & DEV_CONFIG)
441 if (link->state & DEV_CONFIG) {
442 netif_device_detach(local->eth_dev); 441 netif_device_detach(local->eth_dev);
443 pcmcia_release_configuration(link->handle);
444 }
445 442
446 return 0; 443 return 0;
447} 444}
@@ -451,9 +448,7 @@ static int airo_resume(struct pcmcia_device *p_dev)
451 dev_link_t *link = dev_to_instance(p_dev); 448 dev_link_t *link = dev_to_instance(p_dev);
452 local_info_t *local = link->priv; 449 local_info_t *local = link->priv;
453 450
454 link->state &= ~DEV_SUSPEND; 451 if ((link->state & DEV_CONFIG) && (link->open)) {
455 if (link->state & DEV_CONFIG) {
456 pcmcia_request_configuration(link->handle, &link->conf);
457 reset_airo_card(local->eth_dev); 452 reset_airo_card(local->eth_dev);
458 netif_device_attach(local->eth_dev); 453 netif_device_attach(local->eth_dev);
459 } 454 }
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 1da8e6197ffb..89dbc783ff80 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -433,11 +433,8 @@ static int atmel_suspend(struct pcmcia_device *dev)
433 dev_link_t *link = dev_to_instance(dev); 433 dev_link_t *link = dev_to_instance(dev);
434 local_info_t *local = link->priv; 434 local_info_t *local = link->priv;
435 435
436 link->state |= DEV_SUSPEND; 436 if (link->state & DEV_CONFIG)
437 if (link->state & DEV_CONFIG) {
438 netif_device_detach(local->eth_dev); 437 netif_device_detach(local->eth_dev);
439 pcmcia_release_configuration(link->handle);
440 }
441 438
442 return 0; 439 return 0;
443} 440}
@@ -447,9 +444,7 @@ static int atmel_resume(struct pcmcia_device *dev)
447 dev_link_t *link = dev_to_instance(dev); 444 dev_link_t *link = dev_to_instance(dev);
448 local_info_t *local = link->priv; 445 local_info_t *local = link->priv;
449 446
450 link->state &= ~DEV_SUSPEND;
451 if (link->state & DEV_CONFIG) { 447 if (link->state & DEV_CONFIG) {
452 pcmcia_request_configuration(link->handle, &link->conf);
453 atmel_open(local->eth_dev); 448 atmel_open(local->eth_dev);
454 netif_device_attach(local->eth_dev); 449 netif_device_attach(local->eth_dev);
455 } 450 }
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 7a1023f3875b..0fb625185452 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -816,8 +816,6 @@ static int hostap_cs_suspend(struct pcmcia_device *p_dev)
816 816
817 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info); 817 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
818 818
819 link->state |= DEV_SUSPEND;
820
821 if (link->state & DEV_CONFIG) { 819 if (link->state & DEV_CONFIG) {
822 struct hostap_interface *iface = netdev_priv(dev); 820 struct hostap_interface *iface = netdev_priv(dev);
823 if (iface && iface->local) 821 if (iface && iface->local)
@@ -827,7 +825,6 @@ static int hostap_cs_suspend(struct pcmcia_device *p_dev)
827 netif_device_detach(dev); 825 netif_device_detach(dev);
828 } 826 }
829 prism2_suspend(dev); 827 prism2_suspend(dev);
830 pcmcia_release_configuration(link->handle);
831 } 828 }
832 829
833 return 0; 830 return 0;
@@ -841,14 +838,11 @@ static int hostap_cs_resume(struct pcmcia_device *p_dev)
841 838
842 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info); 839 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
843 840
844 link->state &= ~DEV_SUSPEND;
845 if (link->state & DEV_CONFIG) { 841 if (link->state & DEV_CONFIG) {
846 struct hostap_interface *iface = netdev_priv(dev); 842 struct hostap_interface *iface = netdev_priv(dev);
847 if (iface && iface->local) 843 if (iface && iface->local)
848 dev_open = iface->local->num_dev_open > 0; 844 dev_open = iface->local->num_dev_open > 0;
849 845
850 pcmcia_request_configuration(link->handle, &link->conf);
851
852 prism2_hw_shutdown(dev, 1); 846 prism2_hw_shutdown(dev, 1);
853 prism2_hw_config(dev, dev_open ? 0 : 1); 847 prism2_hw_config(dev, dev_open ? 0 : 1);
854 if (dev_open) { 848 if (dev_open) {
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index dfb47ac9da50..545717b5e1e5 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -884,12 +884,8 @@ static int netwave_suspend(struct pcmcia_device *p_dev)
884 dev_link_t *link = dev_to_instance(p_dev); 884 dev_link_t *link = dev_to_instance(p_dev);
885 struct net_device *dev = link->priv; 885 struct net_device *dev = link->priv;
886 886
887 link->state |= DEV_SUSPEND; 887 if ((link->state & DEV_CONFIG) && (link->open))
888 if (link->state & DEV_CONFIG) { 888 netif_device_detach(dev);
889 if (link->open)
890 netif_device_detach(dev);
891 pcmcia_release_configuration(link->handle);
892 }
893 889
894 return 0; 890 return 0;
895} 891}
@@ -899,13 +895,9 @@ static int netwave_resume(struct pcmcia_device *p_dev)
899 dev_link_t *link = dev_to_instance(p_dev); 895 dev_link_t *link = dev_to_instance(p_dev);
900 struct net_device *dev = link->priv; 896 struct net_device *dev = link->priv;
901 897
902 link->state &= ~DEV_SUSPEND; 898 if ((link->state & DEV_CONFIG) && (link->open)) {
903 if (link->state & DEV_CONFIG) { 899 netwave_reset(dev);
904 pcmcia_request_configuration(link->handle, &link->conf); 900 netif_device_attach(dev);
905 if (link->open) {
906 netwave_reset(dev);
907 netif_device_attach(dev);
908 }
909 } 901 }
910 902
911 return 0; 903 return 0;
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 0ce4165efc8f..89e16cd1be8c 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -429,7 +429,6 @@ static int orinoco_cs_suspend(struct pcmcia_device *p_dev)
429 int err = 0; 429 int err = 0;
430 unsigned long flags; 430 unsigned long flags;
431 431
432 link->state |= DEV_SUSPEND;
433 if (link->state & DEV_CONFIG) { 432 if (link->state & DEV_CONFIG) {
434 /* This is probably racy, but I can't think of 433 /* This is probably racy, but I can't think of
435 a better way, short of rewriting the PCMCIA 434 a better way, short of rewriting the PCMCIA
@@ -447,8 +446,6 @@ static int orinoco_cs_suspend(struct pcmcia_device *p_dev)
447 446
448 spin_unlock_irqrestore(&priv->lock, flags); 447 spin_unlock_irqrestore(&priv->lock, flags);
449 } 448 }
450
451 pcmcia_release_configuration(link->handle);
452 } 449 }
453 450
454 return 0; 451 return 0;
@@ -463,12 +460,7 @@ static int orinoco_cs_resume(struct pcmcia_device *p_dev)
463 int err = 0; 460 int err = 0;
464 unsigned long flags; 461 unsigned long flags;
465 462
466 link->state &= ~DEV_SUSPEND;
467 if (link->state & DEV_CONFIG) { 463 if (link->state & DEV_CONFIG) {
468 /* FIXME: should we double check that this is
469 * the same card as we had before */
470 pcmcia_request_configuration(link->handle, &link->conf);
471
472 if (! test_bit(0, &card->hard_reset_in_progress)) { 464 if (! test_bit(0, &card->hard_reset_in_progress)) {
473 err = orinoco_reinit_firmware(dev); 465 err = orinoco_reinit_firmware(dev);
474 if (err) { 466 if (err) {
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index fc81ac67009d..ed4bf5013f1a 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -868,14 +868,8 @@ static int ray_suspend(struct pcmcia_device *p_dev)
868 dev_link_t *link = dev_to_instance(p_dev); 868 dev_link_t *link = dev_to_instance(p_dev);
869 struct net_device *dev = link->priv; 869 struct net_device *dev = link->priv;
870 870
871 link->state |= DEV_SUSPEND; 871 if ((link->state & DEV_CONFIG) && (link->open))
872 if (link->state & DEV_CONFIG) { 872 netif_device_detach(dev);
873 if (link->open)
874 netif_device_detach(dev);
875
876 pcmcia_release_configuration(link->handle);
877 }
878
879 873
880 return 0; 874 return 0;
881} 875}
@@ -885,14 +879,10 @@ static int ray_resume(struct pcmcia_device *p_dev)
885 dev_link_t *link = dev_to_instance(p_dev); 879 dev_link_t *link = dev_to_instance(p_dev);
886 struct net_device *dev = link->priv; 880 struct net_device *dev = link->priv;
887 881
888 link->state &= ~DEV_SUSPEND; 882 if ((link->state & DEV_CONFIG) && (link->open)) {
889 if (link->state & DEV_CONFIG) { 883 ray_reset(dev);
890 pcmcia_request_configuration(link->handle, &link->conf); 884 netif_device_attach(dev);
891 if (link->open) { 885 }
892 ray_reset(dev);
893 netif_device_attach(dev);
894 }
895 }
896 886
897 return 0; 887 return 0;
898} 888}
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index b7ed99f8d319..0429f1dc7fad 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -908,7 +908,6 @@ spectrum_cs_suspend(struct pcmcia_device *p_dev)
908 unsigned long flags; 908 unsigned long flags;
909 int err = 0; 909 int err = 0;
910 910
911 link->state |= DEV_SUSPEND;
912 /* Mark the device as stopped, to block IO until later */ 911 /* Mark the device as stopped, to block IO until later */
913 if (link->state & DEV_CONFIG) { 912 if (link->state & DEV_CONFIG) {
914 spin_lock_irqsave(&priv->lock, flags); 913 spin_lock_irqsave(&priv->lock, flags);
@@ -922,8 +921,6 @@ spectrum_cs_suspend(struct pcmcia_device *p_dev)
922 priv->hw_unavailable++; 921 priv->hw_unavailable++;
923 922
924 spin_unlock_irqrestore(&priv->lock, flags); 923 spin_unlock_irqrestore(&priv->lock, flags);
925
926 pcmcia_release_configuration(link->handle);
927 } 924 }
928 925
929 return 0; 926 return 0;
@@ -936,11 +933,7 @@ spectrum_cs_resume(struct pcmcia_device *p_dev)
936 struct net_device *dev = link->priv; 933 struct net_device *dev = link->priv;
937 struct orinoco_private *priv = netdev_priv(dev); 934 struct orinoco_private *priv = netdev_priv(dev);
938 935
939 link->state &= ~DEV_SUSPEND;
940 if (link->state & DEV_CONFIG) { 936 if (link->state & DEV_CONFIG) {
941 /* FIXME: should we double check that this is
942 * the same card as we had before */
943 pcmcia_request_configuration(link->handle, &link->conf);
944 netif_device_attach(dev); 937 netif_device_attach(dev);
945 priv->hw_unavailable--; 938 priv->hw_unavailable--;
946 schedule_work(&priv->reset_work); 939 schedule_work(&priv->reset_work);
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 696aeb9d8f52..8cabcfe3a654 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -4742,19 +4742,12 @@ static int wavelan_suspend(struct pcmcia_device *p_dev)
4742 /* Stop receiving new messages and wait end of transmission */ 4742 /* Stop receiving new messages and wait end of transmission */
4743 wv_ru_stop(dev); 4743 wv_ru_stop(dev);
4744 4744
4745 if ((link->state & DEV_CONFIG) && (link->open))
4746 netif_device_detach(dev);
4747
4745 /* Power down the module */ 4748 /* Power down the module */
4746 hacr_write(dev->base_addr, HACR_DEFAULT & (~HACR_PWR_STAT)); 4749 hacr_write(dev->base_addr, HACR_DEFAULT & (~HACR_PWR_STAT));
4747 4750
4748 /* The card is now suspended */
4749 link->state |= DEV_SUSPEND;
4750
4751 if(link->state & DEV_CONFIG)
4752 {
4753 if(link->open)
4754 netif_device_detach(dev);
4755 pcmcia_release_configuration(link->handle);
4756 }
4757
4758 return 0; 4751 return 0;
4759} 4752}
4760 4753
@@ -4764,14 +4757,9 @@ static int wavelan_resume(struct pcmcia_device *p_dev)
4764 struct net_device * dev = (struct net_device *) link->priv; 4757 struct net_device * dev = (struct net_device *) link->priv;
4765 4758
4766 link->state &= ~DEV_SUSPEND; 4759 link->state &= ~DEV_SUSPEND;
4767 if(link->state & DEV_CONFIG) 4760 if ((link->state & DEV_CONFIG) && (link->open)) {
4768 { 4761 wv_hw_reset(dev);
4769 pcmcia_request_configuration(link->handle, &link->conf); 4762 netif_device_attach(dev);
4770 if(link->open) /* If RESET -> True, If RESUME -> False ? */
4771 {
4772 wv_hw_reset(dev);
4773 netif_device_attach(dev);
4774 }
4775 } 4763 }
4776 4764
4777 return 0; 4765 return 0;
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 0c81b3e7d7ff..3a93a8bb2e1f 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -2160,14 +2160,9 @@ static int wl3501_suspend(struct pcmcia_device *p_dev)
2160 dev_link_t *link = dev_to_instance(p_dev); 2160 dev_link_t *link = dev_to_instance(p_dev);
2161 struct net_device *dev = link->priv; 2161 struct net_device *dev = link->priv;
2162 2162
2163 link->state |= DEV_SUSPEND;
2164
2165 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); 2163 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND);
2166 if (link->state & DEV_CONFIG) { 2164 if ((link->state & DEV_CONFIG) && (link->open))
2167 if (link->open) 2165 netif_device_detach(dev);
2168 netif_device_detach(dev);
2169 pcmcia_release_configuration(link->handle);
2170 }
2171 2166
2172 return 0; 2167 return 0;
2173} 2168}
@@ -2178,12 +2173,9 @@ static int wl3501_resume(struct pcmcia_device *p_dev)
2178 struct net_device *dev = link->priv; 2173 struct net_device *dev = link->priv;
2179 2174
2180 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); 2175 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME);
2181 if (link->state & DEV_CONFIG) { 2176 if ((link->state & DEV_CONFIG) && (link->open)) {
2182 pcmcia_request_configuration(link->handle, &link->conf); 2177 wl3501_reset(dev);
2183 if (link->open) { 2178 netif_device_attach(dev);
2184 wl3501_reset(dev);
2185 netif_device_attach(dev);
2186 }
2187 } 2179 }
2188 2180
2189 return 0; 2181 return 0;