aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-03-15 16:46:34 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-03-24 06:00:11 -0400
commitd7646f7632549124fe70fec8af834c7c1246f365 (patch)
treed69cf32f089d84f7a1d7813f7c8dd8b980170b25
parente7176a37d436a214f6a7727ea7986c654cbee8f0 (diff)
pcmcia: use dev_pm_ops for class pcmcia_socket_class
Instead of requiring PCMCIA socket drivers to call various functions during their (bus) resume and suspend functions, register an own dev_pm_ops for this class. This fixes several suspend/resume bugs seen on db1xxx-ss, and probably on some other socket drivers, too. With regard to the asymmetry with only _noirq suspend, but split up resume, please see bug 14334 and commit 9905d1b411946fb3 . Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/pcmcia/at91_cf.c2
-rw-r--r--drivers/pcmcia/au1000_generic.c13
-rw-r--r--drivers/pcmcia/bfin_cf_pcmcia.c12
-rw-r--r--drivers/pcmcia/cs.c124
-rw-r--r--drivers/pcmcia/db1xxx_ss.c27
-rw-r--r--drivers/pcmcia/i82092.c16
-rw-r--r--drivers/pcmcia/i82365.c11
-rw-r--r--drivers/pcmcia/m32r_cfc.c11
-rw-r--r--drivers/pcmcia/m32r_pcc.c12
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c17
-rw-r--r--drivers/pcmcia/omap_cf.c12
-rw-r--r--drivers/pcmcia/pd6729.c16
-rw-r--r--drivers/pcmcia/pxa2xx_base.c8
-rw-r--r--drivers/pcmcia/sa1100_generic.c13
-rw-r--r--drivers/pcmcia/sa1111_generic.c12
-rw-r--r--drivers/pcmcia/tcic.c12
-rw-r--r--drivers/pcmcia/vrc4171_card.c13
-rw-r--r--drivers/pcmcia/yenta_socket.c17
-rw-r--r--include/pcmcia/ss.h6
19 files changed, 66 insertions, 288 deletions
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 5d228071ec69..fb904f444d90 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -361,7 +361,6 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
361 struct at91_cf_socket *cf = platform_get_drvdata(pdev); 361 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
362 struct at91_cf_data *board = cf->board; 362 struct at91_cf_data *board = cf->board;
363 363
364 pcmcia_socket_dev_suspend(&pdev->dev);
365 if (device_may_wakeup(&pdev->dev)) { 364 if (device_may_wakeup(&pdev->dev)) {
366 enable_irq_wake(board->det_pin); 365 enable_irq_wake(board->det_pin);
367 if (board->irq_pin) 366 if (board->irq_pin)
@@ -381,7 +380,6 @@ static int at91_cf_resume(struct platform_device *pdev)
381 disable_irq_wake(board->irq_pin); 380 disable_irq_wake(board->irq_pin);
382 } 381 }
383 382
384 pcmcia_socket_dev_resume(&pdev->dev);
385 return 0; 383 return 0;
386} 384}
387 385
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 171c8a654887..ac4d089430fd 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -510,17 +510,6 @@ static int au1x00_drv_pcmcia_probe(struct platform_device *dev)
510 return ret; 510 return ret;
511} 511}
512 512
513static int au1x00_drv_pcmcia_suspend(struct platform_device *dev,
514 pm_message_t state)
515{
516 return pcmcia_socket_dev_suspend(&dev->dev);
517}
518
519static int au1x00_drv_pcmcia_resume(struct platform_device *dev)
520{
521 return pcmcia_socket_dev_resume(&dev->dev);
522}
523
524static struct platform_driver au1x00_pcmcia_driver = { 513static struct platform_driver au1x00_pcmcia_driver = {
525 .driver = { 514 .driver = {
526 .name = "au1x00-pcmcia", 515 .name = "au1x00-pcmcia",
@@ -528,8 +517,6 @@ static struct platform_driver au1x00_pcmcia_driver = {
528 }, 517 },
529 .probe = au1x00_drv_pcmcia_probe, 518 .probe = au1x00_drv_pcmcia_probe,
530 .remove = au1x00_drv_pcmcia_remove, 519 .remove = au1x00_drv_pcmcia_remove,
531 .suspend = au1x00_drv_pcmcia_suspend,
532 .resume = au1x00_drv_pcmcia_resume,
533}; 520};
534 521
535 522
diff --git a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c
index 2482ce7ac6dc..93f9ddeb0c36 100644
--- a/drivers/pcmcia/bfin_cf_pcmcia.c
+++ b/drivers/pcmcia/bfin_cf_pcmcia.c
@@ -300,16 +300,6 @@ static int __devexit bfin_cf_remove(struct platform_device *pdev)
300 return 0; 300 return 0;
301} 301}
302 302
303static int bfin_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
304{
305 return pcmcia_socket_dev_suspend(&pdev->dev);
306}
307
308static int bfin_cf_resume(struct platform_device *pdev)
309{
310 return pcmcia_socket_dev_resume(&pdev->dev);
311}
312
313static struct platform_driver bfin_cf_driver = { 303static struct platform_driver bfin_cf_driver = {
314 .driver = { 304 .driver = {
315 .name = (char *)driver_name, 305 .name = (char *)driver_name,
@@ -317,8 +307,6 @@ static struct platform_driver bfin_cf_driver = {
317 }, 307 },
318 .probe = bfin_cf_probe, 308 .probe = bfin_cf_probe,
319 .remove = __devexit_p(bfin_cf_remove), 309 .remove = __devexit_p(bfin_cf_remove),
320 .suspend = bfin_cf_suspend,
321 .resume = bfin_cf_resume,
322}; 310};
323 311
324static int __init bfin_cf_init(void) 312static int __init bfin_cf_init(void)
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index e679e708db63..75ed866e6953 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -76,65 +76,6 @@ DECLARE_RWSEM(pcmcia_socket_list_rwsem);
76EXPORT_SYMBOL(pcmcia_socket_list_rwsem); 76EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
77 77
78 78
79/*
80 * Low-level PCMCIA socket drivers need to register with the PCCard
81 * core using pcmcia_register_socket.
82 *
83 * socket drivers are expected to use the following callbacks in their
84 * .drv struct:
85 * - pcmcia_socket_dev_suspend
86 * - pcmcia_socket_dev_resume
87 * These functions check for the appropriate struct pcmcia_soket arrays,
88 * and pass them to the low-level functions pcmcia_{suspend,resume}_socket
89 */
90static int socket_early_resume(struct pcmcia_socket *skt);
91static int socket_late_resume(struct pcmcia_socket *skt);
92static int socket_resume(struct pcmcia_socket *skt);
93static int socket_suspend(struct pcmcia_socket *skt);
94
95static void pcmcia_socket_dev_run(struct device *dev,
96 int (*cb)(struct pcmcia_socket *))
97{
98 struct pcmcia_socket *socket;
99
100 down_read(&pcmcia_socket_list_rwsem);
101 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
102 if (socket->dev.parent != dev)
103 continue;
104 mutex_lock(&socket->skt_mutex);
105 cb(socket);
106 mutex_unlock(&socket->skt_mutex);
107 }
108 up_read(&pcmcia_socket_list_rwsem);
109}
110
111int pcmcia_socket_dev_suspend(struct device *dev)
112{
113 pcmcia_socket_dev_run(dev, socket_suspend);
114 return 0;
115}
116EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
117
118void pcmcia_socket_dev_early_resume(struct device *dev)
119{
120 pcmcia_socket_dev_run(dev, socket_early_resume);
121}
122EXPORT_SYMBOL(pcmcia_socket_dev_early_resume);
123
124void pcmcia_socket_dev_late_resume(struct device *dev)
125{
126 pcmcia_socket_dev_run(dev, socket_late_resume);
127}
128EXPORT_SYMBOL(pcmcia_socket_dev_late_resume);
129
130int pcmcia_socket_dev_resume(struct device *dev)
131{
132 pcmcia_socket_dev_run(dev, socket_resume);
133 return 0;
134}
135EXPORT_SYMBOL(pcmcia_socket_dev_resume);
136
137
138struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt) 79struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
139{ 80{
140 struct device *dev = get_device(&skt->dev); 81 struct device *dev = get_device(&skt->dev);
@@ -578,12 +519,18 @@ static int socket_early_resume(struct pcmcia_socket *skt)
578 519
579static int socket_late_resume(struct pcmcia_socket *skt) 520static int socket_late_resume(struct pcmcia_socket *skt)
580{ 521{
522 int ret;
523
581 mutex_lock(&skt->ops_mutex); 524 mutex_lock(&skt->ops_mutex);
582 skt->state &= ~SOCKET_SUSPEND; 525 skt->state &= ~SOCKET_SUSPEND;
583 mutex_unlock(&skt->ops_mutex); 526 mutex_unlock(&skt->ops_mutex);
584 527
585 if (!(skt->state & SOCKET_PRESENT)) 528 if (!(skt->state & SOCKET_PRESENT)) {
586 return socket_insert(skt); 529 ret = socket_insert(skt);
530 if (ret == -ENODEV)
531 ret = 0;
532 return ret;
533 }
587 534
588 if (skt->resume_status) { 535 if (skt->resume_status) {
589 socket_shutdown(skt); 536 socket_shutdown(skt);
@@ -919,11 +866,66 @@ static void pcmcia_release_socket_class(struct class *data)
919} 866}
920 867
921 868
869#ifdef CONFIG_PM
870
871static int __pcmcia_pm_op(struct device *dev,
872 int (*callback) (struct pcmcia_socket *skt))
873{
874 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
875 int ret;
876
877 mutex_lock(&s->skt_mutex);
878 ret = callback(s);
879 mutex_unlock(&s->skt_mutex);
880
881 return ret;
882}
883
884static int pcmcia_socket_dev_suspend_noirq(struct device *dev)
885{
886 return __pcmcia_pm_op(dev, socket_suspend);
887}
888
889static int pcmcia_socket_dev_resume_noirq(struct device *dev)
890{
891 return __pcmcia_pm_op(dev, socket_early_resume);
892}
893
894static int pcmcia_socket_dev_resume(struct device *dev)
895{
896 return __pcmcia_pm_op(dev, socket_late_resume);
897}
898
899static const struct dev_pm_ops pcmcia_socket_pm_ops = {
900 /* dev_resume may be called with IRQs enabled */
901 SET_SYSTEM_SLEEP_PM_OPS(NULL,
902 pcmcia_socket_dev_resume)
903
904 /* late suspend must be called with IRQs disabled */
905 .suspend_noirq = pcmcia_socket_dev_suspend_noirq,
906 .freeze_noirq = pcmcia_socket_dev_suspend_noirq,
907 .poweroff_noirq = pcmcia_socket_dev_suspend_noirq,
908
909 /* early resume must be called with IRQs disabled */
910 .resume_noirq = pcmcia_socket_dev_resume_noirq,
911 .thaw_noirq = pcmcia_socket_dev_resume_noirq,
912 .restore_noirq = pcmcia_socket_dev_resume_noirq,
913};
914
915#define PCMCIA_SOCKET_CLASS_PM_OPS (&pcmcia_socket_pm_ops)
916
917#else /* CONFIG_PM */
918
919#define PCMCIA_SOCKET_CLASS_PM_OPS NULL
920
921#endif /* CONFIG_PM */
922
922struct class pcmcia_socket_class = { 923struct class pcmcia_socket_class = {
923 .name = "pcmcia_socket", 924 .name = "pcmcia_socket",
924 .dev_uevent = pcmcia_socket_uevent, 925 .dev_uevent = pcmcia_socket_uevent,
925 .dev_release = pcmcia_release_socket, 926 .dev_release = pcmcia_release_socket,
926 .class_release = pcmcia_release_socket_class, 927 .class_release = pcmcia_release_socket_class,
928 .pm = PCMCIA_SOCKET_CLASS_PM_OPS,
927}; 929};
928EXPORT_SYMBOL(pcmcia_socket_class); 930EXPORT_SYMBOL(pcmcia_socket_class);
929 931
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c
index 9254ab0b29b1..a520193b6453 100644
--- a/drivers/pcmcia/db1xxx_ss.c
+++ b/drivers/pcmcia/db1xxx_ss.c
@@ -558,37 +558,10 @@ static int __devexit db1x_pcmcia_socket_remove(struct platform_device *pdev)
558 return 0; 558 return 0;
559} 559}
560 560
561#ifdef CONFIG_PM
562static int db1x_pcmcia_suspend(struct device *dev)
563{
564 return pcmcia_socket_dev_suspend(dev);
565}
566
567static int db1x_pcmcia_resume(struct device *dev)
568{
569 return pcmcia_socket_dev_resume(dev);
570}
571
572static struct dev_pm_ops db1x_pcmcia_pmops = {
573 .resume = db1x_pcmcia_resume,
574 .suspend = db1x_pcmcia_suspend,
575 .thaw = db1x_pcmcia_resume,
576 .freeze = db1x_pcmcia_suspend,
577};
578
579#define DB1XXX_SS_PMOPS &db1x_pcmcia_pmops
580
581#else
582
583#define DB1XXX_SS_PMOPS NULL
584
585#endif
586
587static struct platform_driver db1x_pcmcia_socket_driver = { 561static struct platform_driver db1x_pcmcia_socket_driver = {
588 .driver = { 562 .driver = {
589 .name = "db1xxx_pcmcia", 563 .name = "db1xxx_pcmcia",
590 .owner = THIS_MODULE, 564 .owner = THIS_MODULE,
591 .pm = DB1XXX_SS_PMOPS
592 }, 565 },
593 .probe = db1x_pcmcia_socket_probe, 566 .probe = db1x_pcmcia_socket_probe,
594 .remove = __devexit_p(db1x_pcmcia_socket_remove), 567 .remove = __devexit_p(db1x_pcmcia_socket_remove),
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index f5da62653313..3003bb3dfcc0 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -39,27 +39,11 @@ static struct pci_device_id i82092aa_pci_ids[] = {
39}; 39};
40MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids); 40MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
41 41
42#ifdef CONFIG_PM
43static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
44{
45 return pcmcia_socket_dev_suspend(&dev->dev);
46}
47
48static int i82092aa_socket_resume (struct pci_dev *dev)
49{
50 return pcmcia_socket_dev_resume(&dev->dev);
51}
52#endif
53
54static struct pci_driver i82092aa_pci_driver = { 42static struct pci_driver i82092aa_pci_driver = {
55 .name = "i82092aa", 43 .name = "i82092aa",
56 .id_table = i82092aa_pci_ids, 44 .id_table = i82092aa_pci_ids,
57 .probe = i82092aa_pci_probe, 45 .probe = i82092aa_pci_probe,
58 .remove = __devexit_p(i82092aa_pci_remove), 46 .remove = __devexit_p(i82092aa_pci_remove),
59#ifdef CONFIG_PM
60 .suspend = i82092aa_socket_suspend,
61 .resume = i82092aa_socket_resume,
62#endif
63}; 47};
64 48
65 49
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index c13fd9360511..d53d9b5659c7 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -1223,16 +1223,7 @@ static int pcic_init(struct pcmcia_socket *s)
1223 return 0; 1223 return 0;
1224} 1224}
1225 1225
1226static int i82365_drv_pcmcia_suspend(struct platform_device *dev,
1227 pm_message_t state)
1228{
1229 return pcmcia_socket_dev_suspend(&dev->dev);
1230}
1231 1226
1232static int i82365_drv_pcmcia_resume(struct platform_device *dev)
1233{
1234 return pcmcia_socket_dev_resume(&dev->dev);
1235}
1236static struct pccard_operations pcic_operations = { 1227static struct pccard_operations pcic_operations = {
1237 .init = pcic_init, 1228 .init = pcic_init,
1238 .get_status = pcic_get_status, 1229 .get_status = pcic_get_status,
@@ -1248,8 +1239,6 @@ static struct platform_driver i82365_driver = {
1248 .name = "i82365", 1239 .name = "i82365",
1249 .owner = THIS_MODULE, 1240 .owner = THIS_MODULE,
1250 }, 1241 },
1251 .suspend = i82365_drv_pcmcia_suspend,
1252 .resume = i82365_drv_pcmcia_resume,
1253}; 1242};
1254 1243
1255static struct platform_device *i82365_device; 1244static struct platform_device *i82365_device;
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index 0ece2cd4a85e..ab21264468d6 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -685,16 +685,7 @@ static struct pccard_operations pcc_operations = {
685 .set_mem_map = pcc_set_mem_map, 685 .set_mem_map = pcc_set_mem_map,
686}; 686};
687 687
688static int cfc_drv_pcmcia_suspend(struct platform_device *dev,
689 pm_message_t state)
690{
691 return pcmcia_socket_dev_suspend(&dev->dev);
692}
693 688
694static int cfc_drv_pcmcia_resume(struct platform_device *dev)
695{
696 return pcmcia_socket_dev_resume(&dev->dev);
697}
698/*====================================================================*/ 689/*====================================================================*/
699 690
700static struct platform_driver pcc_driver = { 691static struct platform_driver pcc_driver = {
@@ -702,8 +693,6 @@ static struct platform_driver pcc_driver = {
702 .name = "cfc", 693 .name = "cfc",
703 .owner = THIS_MODULE, 694 .owner = THIS_MODULE,
704 }, 695 },
705 .suspend = cfc_drv_pcmcia_suspend,
706 .resume = cfc_drv_pcmcia_resume,
707}; 696};
708 697
709static struct platform_device pcc_device = { 698static struct platform_device pcc_device = {
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index 72844c5a6d05..0caf3db7c700 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -663,16 +663,6 @@ static struct pccard_operations pcc_operations = {
663 .set_mem_map = pcc_set_mem_map, 663 .set_mem_map = pcc_set_mem_map,
664}; 664};
665 665
666static int pcc_drv_pcmcia_suspend(struct platform_device *dev,
667 pm_message_t state)
668{
669 return pcmcia_socket_dev_suspend(&dev->dev);
670}
671
672static int pcc_drv_pcmcia_resume(struct platform_device *dev)
673{
674 return pcmcia_socket_dev_resume(&dev->dev);
675}
676/*====================================================================*/ 666/*====================================================================*/
677 667
678static struct platform_driver pcc_driver = { 668static struct platform_driver pcc_driver = {
@@ -680,8 +670,6 @@ static struct platform_driver pcc_driver = {
680 .name = "pcc", 670 .name = "pcc",
681 .owner = THIS_MODULE, 671 .owner = THIS_MODULE,
682 }, 672 },
683 .suspend = pcc_drv_pcmcia_suspend,
684 .resume = pcc_drv_pcmcia_resume,
685}; 673};
686 674
687static struct platform_device pcc_device = { 675static struct platform_device pcc_device = {
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 61c215918128..01ef7de15322 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -1288,21 +1288,6 @@ static int m8xx_remove(struct of_device *ofdev)
1288 return 0; 1288 return 0;
1289} 1289}
1290 1290
1291#ifdef CONFIG_PM
1292static int m8xx_suspend(struct platform_device *pdev, pm_message_t state)
1293{
1294 return pcmcia_socket_dev_suspend(&pdev->dev);
1295}
1296
1297static int m8xx_resume(struct platform_device *pdev)
1298{
1299 return pcmcia_socket_dev_resume(&pdev->dev);
1300}
1301#else
1302#define m8xx_suspend NULL
1303#define m8xx_resume NULL
1304#endif
1305
1306static const struct of_device_id m8xx_pcmcia_match[] = { 1291static const struct of_device_id m8xx_pcmcia_match[] = {
1307 { 1292 {
1308 .type = "pcmcia", 1293 .type = "pcmcia",
@@ -1318,8 +1303,6 @@ static struct of_platform_driver m8xx_pcmcia_driver = {
1318 .match_table = m8xx_pcmcia_match, 1303 .match_table = m8xx_pcmcia_match,
1319 .probe = m8xx_probe, 1304 .probe = m8xx_probe,
1320 .remove = m8xx_remove, 1305 .remove = m8xx_remove,
1321 .suspend = m8xx_suspend,
1322 .resume = m8xx_resume,
1323}; 1306};
1324 1307
1325static int __init m8xx_init(void) 1308static int __init m8xx_init(void)
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index 3ef991552398..9edc396577b9 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -330,24 +330,12 @@ static int __exit omap_cf_remove(struct platform_device *pdev)
330 return 0; 330 return 0;
331} 331}
332 332
333static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
334{
335 return pcmcia_socket_dev_suspend(&pdev->dev);
336}
337
338static int omap_cf_resume(struct platform_device *pdev)
339{
340 return pcmcia_socket_dev_resume(&pdev->dev);
341}
342
343static struct platform_driver omap_cf_driver = { 333static struct platform_driver omap_cf_driver = {
344 .driver = { 334 .driver = {
345 .name = (char *) driver_name, 335 .name = (char *) driver_name,
346 .owner = THIS_MODULE, 336 .owner = THIS_MODULE,
347 }, 337 },
348 .remove = __exit_p(omap_cf_remove), 338 .remove = __exit_p(omap_cf_remove),
349 .suspend = omap_cf_suspend,
350 .resume = omap_cf_resume,
351}; 339};
352 340
353static int __init omap_cf_init(void) 341static int __init omap_cf_init(void)
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 47f342f1b0fc..4a34268cc512 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -764,18 +764,6 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev)
764 kfree(socket); 764 kfree(socket);
765} 765}
766 766
767#ifdef CONFIG_PM
768static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state)
769{
770 return pcmcia_socket_dev_suspend(&dev->dev);
771}
772
773static int pd6729_socket_resume(struct pci_dev *dev)
774{
775 return pcmcia_socket_dev_resume(&dev->dev);
776}
777#endif
778
779static struct pci_device_id pd6729_pci_ids[] = { 767static struct pci_device_id pd6729_pci_ids[] = {
780 { 768 {
781 .vendor = PCI_VENDOR_ID_CIRRUS, 769 .vendor = PCI_VENDOR_ID_CIRRUS,
@@ -792,10 +780,6 @@ static struct pci_driver pd6729_pci_driver = {
792 .id_table = pd6729_pci_ids, 780 .id_table = pd6729_pci_ids,
793 .probe = pd6729_pci_probe, 781 .probe = pd6729_pci_probe,
794 .remove = __devexit_p(pd6729_pci_remove), 782 .remove = __devexit_p(pd6729_pci_remove),
795#ifdef CONFIG_PM
796 .suspend = pd6729_socket_suspend,
797 .resume = pd6729_socket_resume,
798#endif
799}; 783};
800 784
801static int pd6729_module_init(void) 785static int pd6729_module_init(void)
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 76e640bccde8..0a876fabfe44 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -325,19 +325,13 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
325 return 0; 325 return 0;
326} 326}
327 327
328static int pxa2xx_drv_pcmcia_suspend(struct device *dev)
329{
330 return pcmcia_socket_dev_suspend(dev);
331}
332
333static int pxa2xx_drv_pcmcia_resume(struct device *dev) 328static int pxa2xx_drv_pcmcia_resume(struct device *dev)
334{ 329{
335 pxa2xx_configure_sockets(dev); 330 pxa2xx_configure_sockets(dev);
336 return pcmcia_socket_dev_resume(dev); 331 return 0;
337} 332}
338 333
339static const struct dev_pm_ops pxa2xx_drv_pcmcia_pm_ops = { 334static const struct dev_pm_ops pxa2xx_drv_pcmcia_pm_ops = {
340 .suspend = pxa2xx_drv_pcmcia_suspend,
341 .resume = pxa2xx_drv_pcmcia_resume, 335 .resume = pxa2xx_drv_pcmcia_resume,
342}; 336};
343 337
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
index 8db86b90c200..518896241429 100644
--- a/drivers/pcmcia/sa1100_generic.c
+++ b/drivers/pcmcia/sa1100_generic.c
@@ -95,17 +95,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
95 return 0; 95 return 0;
96} 96}
97 97
98static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev,
99 pm_message_t state)
100{
101 return pcmcia_socket_dev_suspend(&dev->dev);
102}
103
104static int sa11x0_drv_pcmcia_resume(struct platform_device *dev)
105{
106 return pcmcia_socket_dev_resume(&dev->dev);
107}
108
109static struct platform_driver sa11x0_pcmcia_driver = { 98static struct platform_driver sa11x0_pcmcia_driver = {
110 .driver = { 99 .driver = {
111 .name = "sa11x0-pcmcia", 100 .name = "sa11x0-pcmcia",
@@ -113,8 +102,6 @@ static struct platform_driver sa11x0_pcmcia_driver = {
113 }, 102 },
114 .probe = sa11x0_drv_pcmcia_probe, 103 .probe = sa11x0_drv_pcmcia_probe,
115 .remove = sa11x0_drv_pcmcia_remove, 104 .remove = sa11x0_drv_pcmcia_remove,
116 .suspend = sa11x0_drv_pcmcia_suspend,
117 .resume = sa11x0_drv_pcmcia_resume,
118}; 105};
119 106
120/* sa11x0_pcmcia_init() 107/* sa11x0_pcmcia_init()
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index db79ca61cf96..799e9793e49e 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -213,16 +213,6 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev)
213 return 0; 213 return 0;
214} 214}
215 215
216static int pcmcia_suspend(struct sa1111_dev *dev, pm_message_t state)
217{
218 return pcmcia_socket_dev_suspend(&dev->dev);
219}
220
221static int pcmcia_resume(struct sa1111_dev *dev)
222{
223 return pcmcia_socket_dev_resume(&dev->dev);
224}
225
226static struct sa1111_driver pcmcia_driver = { 216static struct sa1111_driver pcmcia_driver = {
227 .drv = { 217 .drv = {
228 .name = "sa1111-pcmcia", 218 .name = "sa1111-pcmcia",
@@ -230,8 +220,6 @@ static struct sa1111_driver pcmcia_driver = {
230 .devid = SA1111_DEVID_PCMCIA, 220 .devid = SA1111_DEVID_PCMCIA,
231 .probe = pcmcia_probe, 221 .probe = pcmcia_probe,
232 .remove = __devexit_p(pcmcia_remove), 222 .remove = __devexit_p(pcmcia_remove),
233 .suspend = pcmcia_suspend,
234 .resume = pcmcia_resume,
235}; 223};
236 224
237static int __init sa1111_drv_pcmcia_init(void) 225static int __init sa1111_drv_pcmcia_init(void)
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
index 12c49ee135e1..bac85f3236bb 100644
--- a/drivers/pcmcia/tcic.c
+++ b/drivers/pcmcia/tcic.c
@@ -348,16 +348,6 @@ static int __init get_tcic_id(void)
348 return id; 348 return id;
349} 349}
350 350
351static int tcic_drv_pcmcia_suspend(struct platform_device *dev,
352 pm_message_t state)
353{
354 return pcmcia_socket_dev_suspend(&dev->dev);
355}
356
357static int tcic_drv_pcmcia_resume(struct platform_device *dev)
358{
359 return pcmcia_socket_dev_resume(&dev->dev);
360}
361/*====================================================================*/ 351/*====================================================================*/
362 352
363static struct platform_driver tcic_driver = { 353static struct platform_driver tcic_driver = {
@@ -365,8 +355,6 @@ static struct platform_driver tcic_driver = {
365 .name = "tcic-pcmcia", 355 .name = "tcic-pcmcia",
366 .owner = THIS_MODULE, 356 .owner = THIS_MODULE,
367 }, 357 },
368 .suspend = tcic_drv_pcmcia_suspend,
369 .resume = tcic_drv_pcmcia_resume,
370}; 358};
371 359
372static struct platform_device tcic_device = { 360static struct platform_device tcic_device = {
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index aaccdb9f4ba1..86e4a1a3c642 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -705,24 +705,11 @@ static int __devinit vrc4171_card_setup(char *options)
705 705
706__setup("vrc4171_card=", vrc4171_card_setup); 706__setup("vrc4171_card=", vrc4171_card_setup);
707 707
708static int vrc4171_card_suspend(struct platform_device *dev,
709 pm_message_t state)
710{
711 return pcmcia_socket_dev_suspend(&dev->dev);
712}
713
714static int vrc4171_card_resume(struct platform_device *dev)
715{
716 return pcmcia_socket_dev_resume(&dev->dev);
717}
718
719static struct platform_driver vrc4171_card_driver = { 708static struct platform_driver vrc4171_card_driver = {
720 .driver = { 709 .driver = {
721 .name = vrc4171_card_name, 710 .name = vrc4171_card_name,
722 .owner = THIS_MODULE, 711 .owner = THIS_MODULE,
723 }, 712 },
724 .suspend = vrc4171_card_suspend,
725 .resume = vrc4171_card_resume,
726}; 713};
727 714
728static int __devinit vrc4171_card_init(void) 715static int __devinit vrc4171_card_init(void)
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 418988ab6edf..f19ad02374d9 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1290,12 +1290,9 @@ static int yenta_dev_suspend_noirq(struct device *dev)
1290{ 1290{
1291 struct pci_dev *pdev = to_pci_dev(dev); 1291 struct pci_dev *pdev = to_pci_dev(dev);
1292 struct yenta_socket *socket = pci_get_drvdata(pdev); 1292 struct yenta_socket *socket = pci_get_drvdata(pdev);
1293 int ret;
1294
1295 ret = pcmcia_socket_dev_suspend(dev);
1296 1293
1297 if (!socket) 1294 if (!socket)
1298 return ret; 1295 return 0;
1299 1296
1300 if (socket->type && socket->type->save_state) 1297 if (socket->type && socket->type->save_state)
1301 socket->type->save_state(socket); 1298 socket->type->save_state(socket);
@@ -1312,7 +1309,7 @@ static int yenta_dev_suspend_noirq(struct device *dev)
1312 */ 1309 */
1313 /* pci_set_power_state(dev, 3); */ 1310 /* pci_set_power_state(dev, 3); */
1314 1311
1315 return ret; 1312 return 0;
1316} 1313}
1317 1314
1318static int yenta_dev_resume_noirq(struct device *dev) 1315static int yenta_dev_resume_noirq(struct device *dev)
@@ -1336,26 +1333,16 @@ static int yenta_dev_resume_noirq(struct device *dev)
1336 if (socket->type && socket->type->restore_state) 1333 if (socket->type && socket->type->restore_state)
1337 socket->type->restore_state(socket); 1334 socket->type->restore_state(socket);
1338 1335
1339 pcmcia_socket_dev_early_resume(dev);
1340 return 0;
1341}
1342
1343static int yenta_dev_resume(struct device *dev)
1344{
1345 pcmcia_socket_dev_late_resume(dev);
1346 return 0; 1336 return 0;
1347} 1337}
1348 1338
1349static const struct dev_pm_ops yenta_pm_ops = { 1339static const struct dev_pm_ops yenta_pm_ops = {
1350 .suspend_noirq = yenta_dev_suspend_noirq, 1340 .suspend_noirq = yenta_dev_suspend_noirq,
1351 .resume_noirq = yenta_dev_resume_noirq, 1341 .resume_noirq = yenta_dev_resume_noirq,
1352 .resume = yenta_dev_resume,
1353 .freeze_noirq = yenta_dev_suspend_noirq, 1342 .freeze_noirq = yenta_dev_suspend_noirq,
1354 .thaw_noirq = yenta_dev_resume_noirq, 1343 .thaw_noirq = yenta_dev_resume_noirq,
1355 .thaw = yenta_dev_resume,
1356 .poweroff_noirq = yenta_dev_suspend_noirq, 1344 .poweroff_noirq = yenta_dev_suspend_noirq,
1357 .restore_noirq = yenta_dev_resume_noirq, 1345 .restore_noirq = yenta_dev_resume_noirq,
1358 .restore = yenta_dev_resume,
1359}; 1346};
1360 1347
1361#define YENTA_PM_OPS (&yenta_pm_ops) 1348#define YENTA_PM_OPS (&yenta_pm_ops)
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 32896a773910..2e488b60bc76 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -277,12 +277,6 @@ extern struct pccard_resource_ops pccard_nonstatic_ops;
277#endif 277#endif
278 278
279 279
280/* socket drivers are expected to use these callbacks in their .drv struct */
281extern int pcmcia_socket_dev_suspend(struct device *dev);
282extern void pcmcia_socket_dev_early_resume(struct device *dev);
283extern void pcmcia_socket_dev_late_resume(struct device *dev);
284extern int pcmcia_socket_dev_resume(struct device *dev);
285
286/* socket drivers use this callback in their IRQ handler */ 280/* socket drivers use this callback in their IRQ handler */
287extern void pcmcia_parse_events(struct pcmcia_socket *socket, 281extern void pcmcia_parse_events(struct pcmcia_socket *socket,
288 unsigned int events); 282 unsigned int events);