aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
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/pcmcia
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/pcmcia')
-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
10 files changed, 48 insertions, 125 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;