aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/bluetooth/bluecard_cs.c24
-rw-r--r--drivers/bluetooth/bt3c_cs.c24
-rw-r--r--drivers/bluetooth/btuart_cs.c25
-rw-r--r--drivers/bluetooth/dtl1_cs.c24
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c9
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c24
-rw-r--r--drivers/char/pcmcia/synclink_cs.c6
-rw-r--r--drivers/ide/legacy/ide-cs.c23
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c38
-rw-r--r--drivers/isdn/hisax/avma1_cs.c26
-rw-r--r--drivers/isdn/hisax/elsa_cs.c6
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c6
-rw-r--r--drivers/isdn/hisax/teles_cs.c6
-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
-rw-r--r--drivers/parport/parport_cs.c23
-rw-r--r--drivers/pcmcia/ds.c30
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c18
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c17
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c10
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c13
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c15
-rw-r--r--drivers/serial/serial_cs.c9
-rw-r--r--drivers/telephony/ixj_pcmcia.c24
-rw-r--r--drivers/usb/host/sl811_cs.c24
-rw-r--r--include/pcmcia/ds.h3
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c10
-rw-r--r--sound/pcmcia/vx/vxpocket.c9
45 files changed, 105 insertions, 633 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 128e41609a5d..bb833b251b68 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -1005,28 +1005,6 @@ static void bluecard_release(dev_link_t *link)
1005 pcmcia_disable_device(link->handle); 1005 pcmcia_disable_device(link->handle);
1006} 1006}
1007 1007
1008static int bluecard_suspend(struct pcmcia_device *dev)
1009{
1010 dev_link_t *link = dev_to_instance(dev);
1011
1012 link->state |= DEV_SUSPEND;
1013 if (link->state & DEV_CONFIG)
1014 pcmcia_release_configuration(link->handle);
1015
1016 return 0;
1017}
1018
1019static int bluecard_resume(struct pcmcia_device *dev)
1020{
1021 dev_link_t *link = dev_to_instance(dev);
1022
1023 link->state &= ~DEV_SUSPEND;
1024 if (DEV_OK(link))
1025 pcmcia_request_configuration(link->handle, &link->conf);
1026
1027 return 0;
1028}
1029
1030static struct pcmcia_device_id bluecard_ids[] = { 1008static struct pcmcia_device_id bluecard_ids[] = {
1031 PCMCIA_DEVICE_PROD_ID12("BlueCard", "LSE041", 0xbaf16fbf, 0x657cc15e), 1009 PCMCIA_DEVICE_PROD_ID12("BlueCard", "LSE041", 0xbaf16fbf, 0x657cc15e),
1032 PCMCIA_DEVICE_PROD_ID12("BTCFCARD", "LSE139", 0xe3987764, 0x2524b59c), 1010 PCMCIA_DEVICE_PROD_ID12("BTCFCARD", "LSE139", 0xe3987764, 0x2524b59c),
@@ -1043,8 +1021,6 @@ static struct pcmcia_driver bluecard_driver = {
1043 .probe = bluecard_attach, 1021 .probe = bluecard_attach,
1044 .remove = bluecard_detach, 1022 .remove = bluecard_detach,
1045 .id_table = bluecard_ids, 1023 .id_table = bluecard_ids,
1046 .suspend = bluecard_suspend,
1047 .resume = bluecard_resume,
1048}; 1024};
1049 1025
1050static int __init init_bluecard_cs(void) 1026static int __init init_bluecard_cs(void)
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index ac1410c0a43e..7b0f4f0beada 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -842,28 +842,6 @@ static void bt3c_release(dev_link_t *link)
842 pcmcia_disable_device(link->handle); 842 pcmcia_disable_device(link->handle);
843} 843}
844 844
845static int bt3c_suspend(struct pcmcia_device *dev)
846{
847 dev_link_t *link = dev_to_instance(dev);
848
849 link->state |= DEV_SUSPEND;
850 if (link->state & DEV_CONFIG)
851 pcmcia_release_configuration(link->handle);
852
853 return 0;
854}
855
856static int bt3c_resume(struct pcmcia_device *dev)
857{
858 dev_link_t *link = dev_to_instance(dev);
859
860 link->state &= ~DEV_SUSPEND;
861 if (DEV_OK(link))
862 pcmcia_request_configuration(link->handle, &link->conf);
863
864 return 0;
865}
866
867 845
868static struct pcmcia_device_id bt3c_ids[] = { 846static struct pcmcia_device_id bt3c_ids[] = {
869 PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02), 847 PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02),
@@ -879,8 +857,6 @@ static struct pcmcia_driver bt3c_driver = {
879 .probe = bt3c_attach, 857 .probe = bt3c_attach,
880 .remove = bt3c_detach, 858 .remove = bt3c_detach,
881 .id_table = bt3c_ids, 859 .id_table = bt3c_ids,
882 .suspend = bt3c_suspend,
883 .resume = bt3c_resume,
884}; 860};
885 861
886static int __init init_bt3c_cs(void) 862static int __init init_bt3c_cs(void)
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 8cd54bb199f9..9a507bdb8bc6 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -771,29 +771,6 @@ static void btuart_release(dev_link_t *link)
771 pcmcia_disable_device(link->handle); 771 pcmcia_disable_device(link->handle);
772} 772}
773 773
774static int btuart_suspend(struct pcmcia_device *dev)
775{
776 dev_link_t *link = dev_to_instance(dev);
777
778 link->state |= DEV_SUSPEND;
779 if (link->state & DEV_CONFIG)
780 pcmcia_release_configuration(link->handle);
781
782 return 0;
783}
784
785static int btuart_resume(struct pcmcia_device *dev)
786{
787 dev_link_t *link = dev_to_instance(dev);
788
789 link->state &= ~DEV_SUSPEND;
790 if (DEV_OK(link))
791 pcmcia_request_configuration(link->handle, &link->conf);
792
793 return 0;
794}
795
796
797static struct pcmcia_device_id btuart_ids[] = { 774static struct pcmcia_device_id btuart_ids[] = {
798 /* don't use this driver. Use serial_cs + hci_uart instead */ 775 /* don't use this driver. Use serial_cs + hci_uart instead */
799 PCMCIA_DEVICE_NULL 776 PCMCIA_DEVICE_NULL
@@ -808,8 +785,6 @@ static struct pcmcia_driver btuart_driver = {
808 .probe = btuart_attach, 785 .probe = btuart_attach,
809 .remove = btuart_detach, 786 .remove = btuart_detach,
810 .id_table = btuart_ids, 787 .id_table = btuart_ids,
811 .suspend = btuart_suspend,
812 .resume = btuart_resume,
813}; 788};
814 789
815static int __init init_btuart_cs(void) 790static int __init init_btuart_cs(void)
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index efbc8a543a9a..39dbe7300d0f 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -723,28 +723,6 @@ static void dtl1_release(dev_link_t *link)
723 pcmcia_disable_device(link->handle); 723 pcmcia_disable_device(link->handle);
724} 724}
725 725
726static int dtl1_suspend(struct pcmcia_device *dev)
727{
728 dev_link_t *link = dev_to_instance(dev);
729
730 link->state |= DEV_SUSPEND;
731 if (link->state & DEV_CONFIG)
732 pcmcia_release_configuration(link->handle);
733
734 return 0;
735}
736
737static int dtl1_resume(struct pcmcia_device *dev)
738{
739 dev_link_t *link = dev_to_instance(dev);
740
741 link->state &= ~DEV_SUSPEND;
742 if (DEV_OK(link))
743 pcmcia_request_configuration(link->handle, &link->conf);
744
745 return 0;
746}
747
748 726
749static struct pcmcia_device_id dtl1_ids[] = { 727static struct pcmcia_device_id dtl1_ids[] = {
750 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), 728 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
@@ -762,8 +740,6 @@ static struct pcmcia_driver dtl1_driver = {
762 .probe = dtl1_attach, 740 .probe = dtl1_attach,
763 .remove = dtl1_detach, 741 .remove = dtl1_detach,
764 .id_table = dtl1_ids, 742 .id_table = dtl1_ids,
765 .suspend = dtl1_suspend,
766 .resume = dtl1_resume,
767}; 743};
768 744
769static int __init init_dtl1_cs(void) 745static int __init init_dtl1_cs(void)
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 3ddd3da9e720..870decbdf7ca 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1870,10 +1870,6 @@ static int cm4000_suspend(struct pcmcia_device *p_dev)
1870 struct cm4000_dev *dev; 1870 struct cm4000_dev *dev;
1871 1871
1872 dev = link->priv; 1872 dev = link->priv;
1873
1874 link->state |= DEV_SUSPEND;
1875 if (link->state & DEV_CONFIG)
1876 pcmcia_release_configuration(link->handle);
1877 stop_monitor(dev); 1873 stop_monitor(dev);
1878 1874
1879 return 0; 1875 return 0;
@@ -1885,11 +1881,6 @@ static int cm4000_resume(struct pcmcia_device *p_dev)
1885 struct cm4000_dev *dev; 1881 struct cm4000_dev *dev;
1886 1882
1887 dev = link->priv; 1883 dev = link->priv;
1888
1889 link->state &= ~DEV_SUSPEND;
1890 if (link->state & DEV_CONFIG)
1891 pcmcia_request_configuration(link->handle, &link->conf);
1892
1893 if (link->open) 1884 if (link->open)
1894 start_monitor(dev); 1885 start_monitor(dev);
1895 1886
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 1c355bd2be88..47f10c8b8886 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -629,28 +629,6 @@ cs_release:
629 link->state &= ~DEV_CONFIG_PENDING; 629 link->state &= ~DEV_CONFIG_PENDING;
630} 630}
631 631
632static int reader_suspend(struct pcmcia_device *p_dev)
633{
634 dev_link_t *link = dev_to_instance(p_dev);
635
636 link->state |= DEV_SUSPEND;
637 if (link->state & DEV_CONFIG)
638 pcmcia_release_configuration(link->handle);
639
640 return 0;
641}
642
643static int reader_resume(struct pcmcia_device *p_dev)
644{
645 dev_link_t *link = dev_to_instance(p_dev);
646
647 link->state &= ~DEV_SUSPEND;
648 if (link->state & DEV_CONFIG)
649 pcmcia_request_configuration(link->handle, &link->conf);
650
651 return 0;
652}
653
654static void reader_release(dev_link_t *link) 632static void reader_release(dev_link_t *link)
655{ 633{
656 cm4040_reader_release(link->priv); 634 cm4040_reader_release(link->priv);
@@ -754,8 +732,6 @@ static struct pcmcia_driver reader_driver = {
754 }, 732 },
755 .probe = reader_attach, 733 .probe = reader_attach,
756 .remove = reader_detach, 734 .remove = reader_detach,
757 .suspend = reader_suspend,
758 .resume = reader_resume,
759 .id_table = cm4040_ids, 735 .id_table = cm4040_ids,
760}; 736};
761 737
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 371d10b78004..d3ea53a5a50f 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -733,10 +733,7 @@ static int mgslpc_suspend(struct pcmcia_device *dev)
733 dev_link_t *link = dev_to_instance(dev); 733 dev_link_t *link = dev_to_instance(dev);
734 MGSLPC_INFO *info = link->priv; 734 MGSLPC_INFO *info = link->priv;
735 735
736 link->state |= DEV_SUSPEND;
737 info->stop = 1; 736 info->stop = 1;
738 if (link->state & DEV_CONFIG)
739 pcmcia_release_configuration(link->handle);
740 737
741 return 0; 738 return 0;
742} 739}
@@ -746,9 +743,6 @@ static int mgslpc_resume(struct pcmcia_device *dev)
746 dev_link_t *link = dev_to_instance(dev); 743 dev_link_t *link = dev_to_instance(dev);
747 MGSLPC_INFO *info = link->priv; 744 MGSLPC_INFO *info = link->priv;
748 745
749 link->state &= ~DEV_SUSPEND;
750 if (link->state & DEV_CONFIG)
751 pcmcia_request_configuration(link->handle, &link->conf);
752 info->stop = 0; 746 info->stop = 0;
753 747
754 return 0; 748 return 0;
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 024aad616484..7ad8a95969fb 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -373,27 +373,6 @@ void ide_release(dev_link_t *link)
373 pcmcia_disable_device(link->handle); 373 pcmcia_disable_device(link->handle);
374} /* ide_release */ 374} /* ide_release */
375 375
376static int ide_suspend(struct pcmcia_device *dev)
377{
378 dev_link_t *link = dev_to_instance(dev);
379
380 link->state |= DEV_SUSPEND;
381 if (link->state & DEV_CONFIG)
382 pcmcia_release_configuration(link->handle);
383
384 return 0;
385}
386
387static int ide_resume(struct pcmcia_device *dev)
388{
389 dev_link_t *link = dev_to_instance(dev);
390
391 link->state &= ~DEV_SUSPEND;
392 if (DEV_OK(link))
393 pcmcia_request_configuration(link->handle, &link->conf);
394
395 return 0;
396}
397 376
398/*====================================================================== 377/*======================================================================
399 378
@@ -456,8 +435,6 @@ static struct pcmcia_driver ide_cs_driver = {
456 .probe = ide_attach, 435 .probe = ide_attach,
457 .remove = ide_detach, 436 .remove = ide_detach,
458 .id_table = ide_ids, 437 .id_table = ide_ids,
459 .suspend = ide_suspend,
460 .resume = ide_resume,
461}; 438};
462 439
463static int __init init_ide_cs(void) 440static int __init init_ide_cs(void)
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 5f70661994d8..ae70247d5157 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -371,42 +371,6 @@ static void avmcs_release(dev_link_t *link)
371 pcmcia_disable_device(link->handle); 371 pcmcia_disable_device(link->handle);
372} /* avmcs_release */ 372} /* avmcs_release */
373 373
374static int avmcs_suspend(struct pcmcia_device *dev)
375{
376 dev_link_t *link = dev_to_instance(dev);
377
378 link->state |= DEV_SUSPEND;
379 if (link->state & DEV_CONFIG)
380 pcmcia_release_configuration(link->handle);
381
382 return 0;
383}
384
385static int avmcs_resume(struct pcmcia_device *dev)
386{
387 dev_link_t *link = dev_to_instance(dev);
388
389 link->state &= ~DEV_SUSPEND;
390 if (link->state & DEV_CONFIG)
391 pcmcia_request_configuration(link->handle, &link->conf);
392
393 return 0;
394}
395
396/*======================================================================
397
398 The card status event handler. Mostly, this schedules other
399 stuff to run after an event is received. A CARD_REMOVAL event
400 also sets some flags to discourage the net drivers from trying
401 to talk to the card any more.
402
403 When a CARD_REMOVAL event is received, we immediately set a flag
404 to block future accesses to this device. All the functions that
405 actually access the device should check this flag to make sure
406 the card is still present.
407
408======================================================================*/
409
410 374
411static struct pcmcia_device_id avmcs_ids[] = { 375static struct pcmcia_device_id avmcs_ids[] = {
412 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335), 376 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335),
@@ -424,8 +388,6 @@ static struct pcmcia_driver avmcs_driver = {
424 .probe = avmcs_attach, 388 .probe = avmcs_attach,
425 .remove = avmcs_detach, 389 .remove = avmcs_detach,
426 .id_table = avmcs_ids, 390 .id_table = avmcs_ids,
427 .suspend= avmcs_suspend,
428 .resume = avmcs_resume,
429}; 391};
430 392
431static int __init avmcs_init(void) 393static int __init avmcs_init(void)
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 845fa14e1bae..5e847cfb96f8 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -383,28 +383,6 @@ static void avma1cs_release(dev_link_t *link)
383 pcmcia_disable_device(link->handle); 383 pcmcia_disable_device(link->handle);
384} /* avma1cs_release */ 384} /* avma1cs_release */
385 385
386static int avma1cs_suspend(struct pcmcia_device *dev)
387{
388 dev_link_t *link = dev_to_instance(dev);
389
390 link->state |= DEV_SUSPEND;
391 if (link->state & DEV_CONFIG)
392 pcmcia_release_configuration(link->handle);
393
394 return 0;
395}
396
397static int avma1cs_resume(struct pcmcia_device *dev)
398{
399 dev_link_t *link = dev_to_instance(dev);
400
401 link->state &= ~DEV_SUSPEND;
402 if (link->state & DEV_CONFIG)
403 pcmcia_request_configuration(link->handle, &link->conf);
404
405 return 0;
406}
407
408 386
409static struct pcmcia_device_id avma1cs_ids[] = { 387static struct pcmcia_device_id avma1cs_ids[] = {
410 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), 388 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb),
@@ -421,10 +399,8 @@ static struct pcmcia_driver avma1cs_driver = {
421 .probe = avma1cs_attach, 399 .probe = avma1cs_attach,
422 .remove = avma1cs_detach, 400 .remove = avma1cs_detach,
423 .id_table = avma1cs_ids, 401 .id_table = avma1cs_ids,
424 .suspend = avma1cs_suspend,
425 .resume = avma1cs_resume,
426}; 402};
427 403
428/*====================================================================*/ 404/*====================================================================*/
429 405
430static int __init init_avma1_cs(void) 406static int __init init_avma1_cs(void)
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 60c75c7c016e..b76b303ebf6b 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -389,10 +389,7 @@ static int elsa_suspend(struct pcmcia_device *p_dev)
389 dev_link_t *link = dev_to_instance(p_dev); 389 dev_link_t *link = dev_to_instance(p_dev);
390 local_info_t *dev = link->priv; 390 local_info_t *dev = link->priv;
391 391
392 link->state |= DEV_SUSPEND;
393 dev->busy = 1; 392 dev->busy = 1;
394 if (link->state & DEV_CONFIG)
395 pcmcia_release_configuration(link->handle);
396 393
397 return 0; 394 return 0;
398} 395}
@@ -402,9 +399,6 @@ static int elsa_resume(struct pcmcia_device *p_dev)
402 dev_link_t *link = dev_to_instance(p_dev); 399 dev_link_t *link = dev_to_instance(p_dev);
403 local_info_t *dev = link->priv; 400 local_info_t *dev = link->priv;
404 401
405 link->state &= ~DEV_SUSPEND;
406 if (link->state & DEV_CONFIG)
407 pcmcia_request_configuration(link->handle, &link->conf);
408 dev->busy = 0; 402 dev->busy = 0;
409 403
410 return 0; 404 return 0;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index fd0f127e40ba..5745eb1afe35 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -472,10 +472,7 @@ static int sedlbauer_suspend(struct pcmcia_device *p_dev)
472 dev_link_t *link = dev_to_instance(p_dev); 472 dev_link_t *link = dev_to_instance(p_dev);
473 local_info_t *dev = link->priv; 473 local_info_t *dev = link->priv;
474 474
475 link->state |= DEV_SUSPEND;
476 dev->stop = 1; 475 dev->stop = 1;
477 if (link->state & DEV_CONFIG)
478 pcmcia_release_configuration(link->handle);
479 476
480 return 0; 477 return 0;
481} 478}
@@ -485,9 +482,6 @@ static int sedlbauer_resume(struct pcmcia_device *p_dev)
485 dev_link_t *link = dev_to_instance(p_dev); 482 dev_link_t *link = dev_to_instance(p_dev);
486 local_info_t *dev = link->priv; 483 local_info_t *dev = link->priv;
487 484
488 link->state &= ~DEV_SUSPEND;
489 if (link->state & DEV_CONFIG)
490 pcmcia_request_configuration(link->handle, &link->conf);
491 dev->stop = 0; 485 dev->stop = 0;
492 486
493 return 0; 487 return 0;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 7945fd64621a..929507eb63af 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -380,10 +380,7 @@ static int teles_suspend(struct pcmcia_device *p_dev)
380 dev_link_t *link = dev_to_instance(p_dev); 380 dev_link_t *link = dev_to_instance(p_dev);
381 local_info_t *dev = link->priv; 381 local_info_t *dev = link->priv;
382 382
383 link->state |= DEV_SUSPEND;
384 dev->busy = 1; 383 dev->busy = 1;
385 if (link->state & DEV_CONFIG)
386 pcmcia_release_configuration(link->handle);
387 384
388 return 0; 385 return 0;
389} 386}
@@ -393,9 +390,6 @@ static int teles_resume(struct pcmcia_device *p_dev)
393 dev_link_t *link = dev_to_instance(p_dev); 390 dev_link_t *link = dev_to_instance(p_dev);
394 local_info_t *dev = link->priv; 391 local_info_t *dev = link->priv;
395 392
396 link->state &= ~DEV_SUSPEND;
397 if (link->state & DEV_CONFIG)
398 pcmcia_request_configuration(link->handle, &link->conf);
399 dev->busy = 0; 393 dev->busy = 0;
400 394
401 return 0; 395 return 0;
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;
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 7edd7ef6c31f..5e12ed2f1b6e 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -280,27 +280,6 @@ void parport_cs_release(dev_link_t *link)
280 pcmcia_disable_device(link->handle); 280 pcmcia_disable_device(link->handle);
281} /* parport_cs_release */ 281} /* parport_cs_release */
282 282
283static int parport_suspend(struct pcmcia_device *dev)
284{
285 dev_link_t *link = dev_to_instance(dev);
286
287 link->state |= DEV_SUSPEND;
288 if (link->state & DEV_CONFIG)
289 pcmcia_release_configuration(link->handle);
290
291 return 0;
292}
293
294static int parport_resume(struct pcmcia_device *dev)
295{
296 dev_link_t *link = dev_to_instance(dev);
297
298 link->state &= ~DEV_SUSPEND;
299 if (DEV_OK(link))
300 pcmcia_request_configuration(link->handle, &link->conf);
301
302 return 0;
303}
304 283
305static struct pcmcia_device_id parport_ids[] = { 284static struct pcmcia_device_id parport_ids[] = {
306 PCMCIA_DEVICE_FUNC_ID(3), 285 PCMCIA_DEVICE_FUNC_ID(3),
@@ -317,8 +296,6 @@ static struct pcmcia_driver parport_cs_driver = {
317 .probe = parport_attach, 296 .probe = parport_attach,
318 .remove = parport_detach, 297 .remove = parport_detach,
319 .id_table = parport_ids, 298 .id_table = parport_ids,
320 .suspend = parport_suspend,
321 .resume = parport_resume,
322}; 299};
323 300
324static int __init init_parport_cs(void) 301static int __init init_parport_cs(void)
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 16159e9d1b2b..ec2d4166a2e3 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -10,7 +10,7 @@
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 * 11 *
12 * (C) 1999 David A. Hinds 12 * (C) 1999 David A. Hinds
13 * (C) 2003 - 2005 Dominik Brodowski 13 * (C) 2003 - 2006 Dominik Brodowski
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -1030,12 +1030,22 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1030{ 1030{
1031 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1031 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1032 struct pcmcia_driver *p_drv = NULL; 1032 struct pcmcia_driver *p_drv = NULL;
1033 int ret;
1033 1034
1034 if (dev->driver) 1035 if (dev->driver)
1035 p_drv = to_pcmcia_drv(dev->driver); 1036 p_drv = to_pcmcia_drv(dev->driver);
1036 1037
1037 if (p_drv && p_drv->suspend) 1038 if (p_drv && p_drv->suspend) {
1038 return p_drv->suspend(p_dev); 1039 ret = p_drv->suspend(p_dev);
1040 if (ret)
1041 return ret;
1042 if (p_dev->instance) {
1043 p_dev->instance->state |= DEV_SUSPEND;
1044 if ((p_dev->instance->state & DEV_CONFIG) &&
1045 !(p_dev->instance->state & DEV_SUSPEND_NORELEASE))
1046 pcmcia_release_configuration(p_dev);
1047 }
1048 }
1039 1049
1040 return 0; 1050 return 0;
1041} 1051}
@@ -1045,12 +1055,24 @@ static int pcmcia_dev_resume(struct device * dev)
1045{ 1055{
1046 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1056 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1047 struct pcmcia_driver *p_drv = NULL; 1057 struct pcmcia_driver *p_drv = NULL;
1058 int ret;
1048 1059
1049 if (dev->driver) 1060 if (dev->driver)
1050 p_drv = to_pcmcia_drv(dev->driver); 1061 p_drv = to_pcmcia_drv(dev->driver);
1051 1062
1052 if (p_drv && p_drv->resume) 1063 if (p_drv && p_drv->resume) {
1064 if (p_dev->instance) {
1065 p_dev->instance->state &= ~DEV_SUSPEND;
1066 if ((p_dev->instance->state & DEV_CONFIG) &&
1067 !(p_dev->instance->state & DEV_SUSPEND_NORELEASE)){
1068 ret = pcmcia_request_configuration(p_dev,
1069 &p_dev->instance->conf);
1070 if (ret)
1071 return ret;
1072 }
1073 }
1053 return p_drv->resume(p_dev); 1074 return p_drv->resume(p_dev);
1075 }
1054 1076
1055 return 0; 1077 return 0;
1056} 1078}
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index e7f9d26a0d7c..7fbef1e51685 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -251,27 +251,12 @@ static void aha152x_release_cs(dev_link_t *link)
251 pcmcia_disable_device(link->handle); 251 pcmcia_disable_device(link->handle);
252} 252}
253 253
254static int aha152x_suspend(struct pcmcia_device *dev)
255{
256 dev_link_t *link = dev_to_instance(dev);
257
258 link->state |= DEV_SUSPEND;
259 if (link->state & DEV_CONFIG)
260 pcmcia_release_configuration(link->handle);
261
262 return 0;
263}
264
265static int aha152x_resume(struct pcmcia_device *dev) 254static int aha152x_resume(struct pcmcia_device *dev)
266{ 255{
267 dev_link_t *link = dev_to_instance(dev); 256 dev_link_t *link = dev_to_instance(dev);
268 scsi_info_t *info = link->priv; 257 scsi_info_t *info = link->priv;
269 258
270 link->state &= ~DEV_SUSPEND; 259 aha152x_host_reset_host(info->host);
271 if (link->state & DEV_CONFIG) {
272 pcmcia_request_configuration(link->handle, &link->conf);
273 aha152x_host_reset_host(info->host);
274 }
275 260
276 return 0; 261 return 0;
277} 262}
@@ -294,7 +279,6 @@ static struct pcmcia_driver aha152x_cs_driver = {
294 .probe = aha152x_attach, 279 .probe = aha152x_attach,
295 .remove = aha152x_detach, 280 .remove = aha152x_detach,
296 .id_table = aha152x_ids, 281 .id_table = aha152x_ids,
297 .suspend = aha152x_suspend,
298 .resume = aha152x_resume, 282 .resume = aha152x_resume,
299}; 283};
300 284
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index fb7221cf511f..20b9b27c60dd 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -220,26 +220,12 @@ static void fdomain_release(dev_link_t *link)
220 220
221/*====================================================================*/ 221/*====================================================================*/
222 222
223static int fdomain_suspend(struct pcmcia_device *dev)
224{
225 dev_link_t *link = dev_to_instance(dev);
226
227 link->state |= DEV_SUSPEND;
228 if (link->state & DEV_CONFIG)
229 pcmcia_release_configuration(link->handle);
230
231 return 0;
232}
233
234static int fdomain_resume(struct pcmcia_device *dev) 223static int fdomain_resume(struct pcmcia_device *dev)
235{ 224{
236 dev_link_t *link = dev_to_instance(dev); 225 dev_link_t *link = dev_to_instance(dev);
237 226
238 link->state &= ~DEV_SUSPEND; 227 if (link->state & DEV_CONFIG)
239 if (link->state & DEV_CONFIG) {
240 pcmcia_request_configuration(link->handle, &link->conf);
241 fdomain_16x0_bus_reset(NULL); 228 fdomain_16x0_bus_reset(NULL);
242 }
243 229
244 return 0; 230 return 0;
245} 231}
@@ -260,7 +246,6 @@ static struct pcmcia_driver fdomain_cs_driver = {
260 .probe = fdomain_attach, 246 .probe = fdomain_attach,
261 .remove = fdomain_detach, 247 .remove = fdomain_detach,
262 .id_table = fdomain_ids, 248 .id_table = fdomain_ids,
263 .suspend = fdomain_suspend,
264 .resume = fdomain_resume, 249 .resume = fdomain_resume,
265}; 250};
266 251
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index d469e0d16224..e313b40b7043 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1987,8 +1987,6 @@ static int nsp_cs_suspend(struct pcmcia_device *dev)
1987 scsi_info_t *info = link->priv; 1987 scsi_info_t *info = link->priv;
1988 nsp_hw_data *data; 1988 nsp_hw_data *data;
1989 1989
1990 link->state |= DEV_SUSPEND;
1991
1992 nsp_dbg(NSP_DEBUG_INIT, "event: suspend"); 1990 nsp_dbg(NSP_DEBUG_INIT, "event: suspend");
1993 1991
1994 if (info->host != NULL) { 1992 if (info->host != NULL) {
@@ -2001,9 +1999,6 @@ static int nsp_cs_suspend(struct pcmcia_device *dev)
2001 1999
2002 info->stop = 1; 2000 info->stop = 1;
2003 2001
2004 if (link->state & DEV_CONFIG)
2005 pcmcia_release_configuration(link->handle);
2006
2007 return 0; 2002 return 0;
2008} 2003}
2009 2004
@@ -2015,11 +2010,6 @@ static int nsp_cs_resume(struct pcmcia_device *dev)
2015 2010
2016 nsp_dbg(NSP_DEBUG_INIT, "event: resume"); 2011 nsp_dbg(NSP_DEBUG_INIT, "event: resume");
2017 2012
2018 link->state &= ~DEV_SUSPEND;
2019
2020 if (link->state & DEV_CONFIG)
2021 pcmcia_request_configuration(link->handle, &link->conf);
2022
2023 info->stop = 0; 2013 info->stop = 0;
2024 2014
2025 if (info->host != NULL) { 2015 if (info->host != NULL) {
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 1e27059cd462..5a8da5143bd1 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -311,22 +311,10 @@ static void qlogic_release(dev_link_t *link)
311 311
312/*====================================================================*/ 312/*====================================================================*/
313 313
314static int qlogic_suspend(struct pcmcia_device *dev)
315{
316 dev_link_t *link = dev_to_instance(dev);
317
318 link->state |= DEV_SUSPEND;
319 if (link->state & DEV_CONFIG)
320 pcmcia_release_configuration(link->handle);
321
322 return 0;
323}
324
325static int qlogic_resume(struct pcmcia_device *dev) 314static int qlogic_resume(struct pcmcia_device *dev)
326{ 315{
327 dev_link_t *link = dev_to_instance(dev); 316 dev_link_t *link = dev_to_instance(dev);
328 317
329 link->state &= ~DEV_SUSPEND;
330 if (link->state & DEV_CONFIG) { 318 if (link->state & DEV_CONFIG) {
331 scsi_info_t *info = link->priv; 319 scsi_info_t *info = link->priv;
332 320
@@ -375,7 +363,6 @@ static struct pcmcia_driver qlogic_cs_driver = {
375 .probe = qlogic_attach, 363 .probe = qlogic_attach,
376 .remove = qlogic_detach, 364 .remove = qlogic_detach,
377 .id_table = qlogic_ids, 365 .id_table = qlogic_ids,
378 .suspend = qlogic_suspend,
379 .resume = qlogic_resume, 366 .resume = qlogic_resume,
380}; 367};
381 368
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 42d002b6d1a5..4a6988567de5 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -857,26 +857,12 @@ cs_failed:
857 return; 857 return;
858} /* SYM53C500_config */ 858} /* SYM53C500_config */
859 859
860static int sym53c500_suspend(struct pcmcia_device *dev)
861{
862 dev_link_t *link = dev_to_instance(dev);
863
864 link->state |= DEV_SUSPEND;
865 if (link->state & DEV_CONFIG)
866 pcmcia_release_configuration(link->handle);
867
868 return 0;
869}
870
871static int sym53c500_resume(struct pcmcia_device *dev) 860static int sym53c500_resume(struct pcmcia_device *dev)
872{ 861{
873 dev_link_t *link = dev_to_instance(dev); 862 dev_link_t *link = dev_to_instance(dev);
874 struct scsi_info_t *info = link->priv; 863 struct scsi_info_t *info = link->priv;
875 864
876 link->state &= ~DEV_SUSPEND;
877 if (link->state & DEV_CONFIG) { 865 if (link->state & DEV_CONFIG) {
878 pcmcia_request_configuration(link->handle, &link->conf);
879
880 /* See earlier comment about manufacturer IDs. */ 866 /* See earlier comment about manufacturer IDs. */
881 if ((info->manf_id == MANFID_MACNICA) || 867 if ((info->manf_id == MANFID_MACNICA) ||
882 (info->manf_id == MANFID_PIONEER) || 868 (info->manf_id == MANFID_PIONEER) ||
@@ -963,7 +949,6 @@ static struct pcmcia_driver sym53c500_cs_driver = {
963 .probe = SYM53C500_attach, 949 .probe = SYM53C500_attach,
964 .remove = SYM53C500_detach, 950 .remove = SYM53C500_detach,
965 .id_table = sym53c500_ids, 951 .id_table = sym53c500_ids,
966 .suspend = sym53c500_suspend,
967 .resume = sym53c500_resume, 952 .resume = sym53c500_resume,
968}; 953};
969 954
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index ff38820a03f5..b6b460fa693f 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -151,7 +151,6 @@ static void serial_remove(dev_link_t *link)
151static int serial_suspend(struct pcmcia_device *dev) 151static int serial_suspend(struct pcmcia_device *dev)
152{ 152{
153 dev_link_t *link = dev_to_instance(dev); 153 dev_link_t *link = dev_to_instance(dev);
154 link->state |= DEV_SUSPEND;
155 154
156 if (link->state & DEV_CONFIG) { 155 if (link->state & DEV_CONFIG) {
157 struct serial_info *info = link->priv; 156 struct serial_info *info = link->priv;
@@ -160,8 +159,8 @@ static int serial_suspend(struct pcmcia_device *dev)
160 for (i = 0; i < info->ndev; i++) 159 for (i = 0; i < info->ndev; i++)
161 serial8250_suspend_port(info->line[i]); 160 serial8250_suspend_port(info->line[i]);
162 161
163 if (!info->slave) 162 if (info->slave)
164 pcmcia_release_configuration(link->handle); 163 link->state &= DEV_SUSPEND_NORELEASE;
165 } 164 }
166 165
167 return 0; 166 return 0;
@@ -170,15 +169,11 @@ static int serial_suspend(struct pcmcia_device *dev)
170static int serial_resume(struct pcmcia_device *dev) 169static int serial_resume(struct pcmcia_device *dev)
171{ 170{
172 dev_link_t *link = dev_to_instance(dev); 171 dev_link_t *link = dev_to_instance(dev);
173 link->state &= ~DEV_SUSPEND;
174 172
175 if (DEV_OK(link)) { 173 if (DEV_OK(link)) {
176 struct serial_info *info = link->priv; 174 struct serial_info *info = link->priv;
177 int i; 175 int i;
178 176
179 if (!info->slave)
180 pcmcia_request_configuration(link->handle, &link->conf);
181
182 for (i = 0; i < info->ndev; i++) 177 for (i = 0; i < info->ndev; i++)
183 serial8250_resume_port(info->line[i]); 178 serial8250_resume_port(info->line[i]);
184 } 179 }
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index fe3cde0da84a..509465586ded 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -232,28 +232,6 @@ static void ixj_cs_release(dev_link_t *link)
232 pcmcia_disable_device(link->handle); 232 pcmcia_disable_device(link->handle);
233} 233}
234 234
235static int ixj_suspend(struct pcmcia_device *dev)
236{
237 dev_link_t *link = dev_to_instance(dev);
238
239 link->state |= DEV_SUSPEND;
240 if (link->state & DEV_CONFIG)
241 pcmcia_release_configuration(link->handle);
242
243 return 0;
244}
245
246static int ixj_resume(struct pcmcia_device *dev)
247{
248 dev_link_t *link = dev_to_instance(dev);
249
250 link->state &= ~DEV_SUSPEND;
251 if (DEV_OK(link))
252 pcmcia_request_configuration(link->handle, &link->conf);
253
254 return 0;
255}
256
257static struct pcmcia_device_id ixj_ids[] = { 235static struct pcmcia_device_id ixj_ids[] = {
258 PCMCIA_DEVICE_MANF_CARD(0x0257, 0x0600), 236 PCMCIA_DEVICE_MANF_CARD(0x0257, 0x0600),
259 PCMCIA_DEVICE_NULL 237 PCMCIA_DEVICE_NULL
@@ -268,8 +246,6 @@ static struct pcmcia_driver ixj_driver = {
268 .probe = ixj_attach, 246 .probe = ixj_attach,
269 .remove = ixj_detach, 247 .remove = ixj_detach,
270 .id_table = ixj_ids, 248 .id_table = ixj_ids,
271 .suspend = ixj_suspend,
272 .resume = ixj_resume,
273}; 249};
274 250
275static int __init ixj_pcmcia_init(void) 251static int __init ixj_pcmcia_init(void)
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index ee811673d903..ca3fc336d3d7 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -293,28 +293,6 @@ cs_failed:
293 } 293 }
294} 294}
295 295
296static int sl811_suspend(struct pcmcia_device *dev)
297{
298 dev_link_t *link = dev_to_instance(dev);
299
300 link->state |= DEV_SUSPEND;
301 if (link->state & DEV_CONFIG)
302 pcmcia_release_configuration(link->handle);
303
304 return 0;
305}
306
307static int sl811_resume(struct pcmcia_device *dev)
308{
309 dev_link_t *link = dev_to_instance(dev);
310
311 link->state &= ~DEV_SUSPEND;
312 if (link->state & DEV_CONFIG)
313 pcmcia_request_configuration(link->handle, &link->conf);
314
315 return 0;
316}
317
318static int sl811_cs_attach(struct pcmcia_device *p_dev) 296static int sl811_cs_attach(struct pcmcia_device *p_dev)
319{ 297{
320 local_info_t *local; 298 local_info_t *local;
@@ -359,8 +337,6 @@ static struct pcmcia_driver sl811_cs_driver = {
359 .probe = sl811_cs_attach, 337 .probe = sl811_cs_attach,
360 .remove = sl811_cs_detach, 338 .remove = sl811_cs_detach,
361 .id_table = sl811_ids, 339 .id_table = sl811_ids,
362 .suspend = sl811_suspend,
363 .resume = sl811_resume,
364}; 340};
365 341
366/*====================================================================*/ 342/*====================================================================*/
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index ce76ab587df6..8a6a95ea26ec 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -118,8 +118,7 @@ typedef struct dev_link_t {
118/* Flags for device state */ 118/* Flags for device state */
119#define DEV_PRESENT 0x01 119#define DEV_PRESENT 0x01
120#define DEV_CONFIG 0x02 120#define DEV_CONFIG 0x02
121#define DEV_STALE_CONFIG 0x04 /* release on close */ 121#define DEV_SUSPEND_NORELEASE 0x04
122#define DEV_STALE_LINK 0x08 /* detach on release */
123#define DEV_CONFIG_PENDING 0x10 122#define DEV_CONFIG_PENDING 0x10
124#define DEV_RELEASE_PENDING 0x20 123#define DEV_RELEASE_PENDING 0x20
125#define DEV_SUSPEND 0x40 124#define DEV_SUSPEND 0x40
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 80c53553b815..31f4bdc46ce6 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -284,16 +284,11 @@ static int pdacf_suspend(struct pcmcia_device *dev)
284 struct snd_pdacf *chip = link->priv; 284 struct snd_pdacf *chip = link->priv;
285 285
286 snd_printdd(KERN_DEBUG "SUSPEND\n"); 286 snd_printdd(KERN_DEBUG "SUSPEND\n");
287 link->state |= DEV_SUSPEND;
288 if (chip) { 287 if (chip) {
289 snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n"); 288 snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
290 snd_pdacf_suspend(chip, PMSG_SUSPEND); 289 snd_pdacf_suspend(chip, PMSG_SUSPEND);
291 } 290 }
292 291
293 snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
294 if (link->state & DEV_CONFIG)
295 pcmcia_release_configuration(link->handle);
296
297 return 0; 292 return 0;
298} 293}
299 294
@@ -303,12 +298,7 @@ static int pdacf_resume(struct pcmcia_device *dev)
303 struct snd_pdacf *chip = link->priv; 298 struct snd_pdacf *chip = link->priv;
304 299
305 snd_printdd(KERN_DEBUG "RESUME\n"); 300 snd_printdd(KERN_DEBUG "RESUME\n");
306 link->state &= ~DEV_SUSPEND;
307
308 snd_printdd(KERN_DEBUG "CARD_RESET\n");
309 if (DEV_OK(link)) { 301 if (DEV_OK(link)) {
310 snd_printdd(KERN_DEBUG "requestconfig...\n");
311 pcmcia_request_configuration(link->handle, &link->conf);
312 if (chip) { 302 if (chip) {
313 snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n"); 303 snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
314 snd_pdacf_resume(chip); 304 snd_pdacf_resume(chip);
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 8093e5044956..e101e05afac3 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -284,14 +284,10 @@ static int vxp_suspend(struct pcmcia_device *dev)
284 struct vx_core *chip = link->priv; 284 struct vx_core *chip = link->priv;
285 285
286 snd_printdd(KERN_DEBUG "SUSPEND\n"); 286 snd_printdd(KERN_DEBUG "SUSPEND\n");
287 link->state |= DEV_SUSPEND;
288 if (chip) { 287 if (chip) {
289 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n"); 288 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
290 snd_vx_suspend(chip, PMSG_SUSPEND); 289 snd_vx_suspend(chip, PMSG_SUSPEND);
291 } 290 }
292 snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
293 if (link->state & DEV_CONFIG)
294 pcmcia_release_configuration(link->handle);
295 291
296 return 0; 292 return 0;
297} 293}
@@ -302,13 +298,8 @@ static int vxp_resume(struct pcmcia_device *dev)
302 struct vx_core *chip = link->priv; 298 struct vx_core *chip = link->priv;
303 299
304 snd_printdd(KERN_DEBUG "RESUME\n"); 300 snd_printdd(KERN_DEBUG "RESUME\n");
305 link->state &= ~DEV_SUSPEND;
306
307 snd_printdd(KERN_DEBUG "CARD_RESET\n");
308 if (DEV_OK(link)) { 301 if (DEV_OK(link)) {
309 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; 302 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
310 snd_printdd(KERN_DEBUG "requestconfig...\n");
311 pcmcia_request_configuration(link->handle, &link->conf);
312 if (chip) { 303 if (chip) {
313 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); 304 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n");
314 snd_vx_resume(chip); 305 snd_vx_resume(chip);