aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/at91_cf.c28
-rw-r--r--drivers/pcmcia/au1000_generic.c25
-rw-r--r--drivers/pcmcia/ds.c29
-rw-r--r--drivers/pcmcia/i82092.c9
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c12
-rw-r--r--drivers/pcmcia/omap_cf.c3
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c11
-rw-r--r--drivers/pcmcia/pcmcia_resource.c2
-rw-r--r--drivers/pcmcia/pd6729.c4
-rw-r--r--drivers/pcmcia/soc_common.c1
-rw-r--r--drivers/pcmcia/yenta_socket.c22
11 files changed, 98 insertions, 48 deletions
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 7f5df9a9f393..3bcb7dc32995 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -241,12 +241,6 @@ static int __init at91_cf_probe(struct platform_device *pdev)
241 csa = at91_sys_read(AT91_EBI_CSA); 241 csa = at91_sys_read(AT91_EBI_CSA);
242 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH); 242 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
243 243
244 /* force poweron defaults for these pins ... */
245 (void) at91_set_A_periph(AT91_PIN_PC9, 0); /* A25/CFRNW */
246 (void) at91_set_A_periph(AT91_PIN_PC10, 0); /* NCS4/CFCS */
247 (void) at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */
248 (void) at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */
249
250 /* nWAIT is _not_ a default setting */ 244 /* nWAIT is _not_ a default setting */
251 (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */ 245 (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
252 246
@@ -316,12 +310,14 @@ static int __init at91_cf_probe(struct platform_device *pdev)
316 return 0; 310 return 0;
317 311
318fail2: 312fail2:
319 iounmap((void __iomem *) cf->socket.io_offset);
320 release_mem_region(io->start, io->end + 1 - io->start); 313 release_mem_region(io->start, io->end + 1 - io->start);
321fail1: 314fail1:
315 if (cf->socket.io_offset)
316 iounmap((void __iomem *) cf->socket.io_offset);
322 if (board->irq_pin) 317 if (board->irq_pin)
323 free_irq(board->irq_pin, cf); 318 free_irq(board->irq_pin, cf);
324fail0a: 319fail0a:
320 device_init_wakeup(&pdev->dev, 0);
325 free_irq(board->det_pin, cf); 321 free_irq(board->det_pin, cf);
326 device_init_wakeup(&pdev->dev, 0); 322 device_init_wakeup(&pdev->dev, 0);
327fail0: 323fail0:
@@ -360,26 +356,20 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
360 struct at91_cf_data *board = cf->board; 356 struct at91_cf_data *board = cf->board;
361 357
362 pcmcia_socket_dev_suspend(&pdev->dev, mesg); 358 pcmcia_socket_dev_suspend(&pdev->dev, mesg);
363 if (device_may_wakeup(&pdev->dev)) 359 if (device_may_wakeup(&pdev->dev)) {
364 enable_irq_wake(board->det_pin); 360 enable_irq_wake(board->det_pin);
365 else { 361 if (board->irq_pin)
362 enable_irq_wake(board->irq_pin);
363 } else {
366 disable_irq_wake(board->det_pin); 364 disable_irq_wake(board->det_pin);
367 disable_irq(board->det_pin); 365 if (board->irq_pin)
366 disable_irq_wake(board->irq_pin);
368 } 367 }
369 if (board->irq_pin)
370 disable_irq(board->irq_pin);
371 return 0; 368 return 0;
372} 369}
373 370
374static int at91_cf_resume(struct platform_device *pdev) 371static int at91_cf_resume(struct platform_device *pdev)
375{ 372{
376 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
377 struct at91_cf_data *board = cf->board;
378
379 if (board->irq_pin)
380 enable_irq(board->irq_pin);
381 if (!device_may_wakeup(&pdev->dev))
382 enable_irq(board->det_pin);
383 pcmcia_socket_dev_resume(&pdev->dev); 373 pcmcia_socket_dev_resume(&pdev->dev);
384 return 0; 374 return 0;
385} 375}
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index d5dd0ce65536..551bde5d9430 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -351,6 +351,7 @@ struct skt_dev_info {
351int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) 351int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
352{ 352{
353 struct skt_dev_info *sinfo; 353 struct skt_dev_info *sinfo;
354 struct au1000_pcmcia_socket *skt;
354 int ret, i; 355 int ret, i;
355 356
356 sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL); 357 sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
@@ -365,7 +366,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
365 * Initialise the per-socket structure. 366 * Initialise the per-socket structure.
366 */ 367 */
367 for (i = 0; i < nr; i++) { 368 for (i = 0; i < nr; i++) {
368 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 369 skt = PCMCIA_SOCKET(i);
369 memset(skt, 0, sizeof(*skt)); 370 memset(skt, 0, sizeof(*skt));
370 371
371 skt->socket.resource_ops = &pccard_static_ops; 372 skt->socket.resource_ops = &pccard_static_ops;
@@ -438,17 +439,29 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
438 dev_set_drvdata(dev, sinfo); 439 dev_set_drvdata(dev, sinfo);
439 return 0; 440 return 0;
440 441
441 do { 442
442 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 443out_err:
444 flush_scheduled_work();
445 ops->hw_shutdown(skt);
446 while (i-- > 0) {
447 skt = PCMCIA_SOCKET(i);
443 448
444 del_timer_sync(&skt->poll_timer); 449 del_timer_sync(&skt->poll_timer);
445 pcmcia_unregister_socket(&skt->socket); 450 pcmcia_unregister_socket(&skt->socket);
446out_err:
447 flush_scheduled_work(); 451 flush_scheduled_work();
452 if (i == 0) {
453 iounmap(skt->virt_io + (u32)mips_io_port_base);
454 skt->virt_io = NULL;
455 }
456#ifndef CONFIG_MIPS_XXS1500
457 else {
458 iounmap(skt->virt_io + (u32)mips_io_port_base);
459 skt->virt_io = NULL;
460 }
461#endif
448 ops->hw_shutdown(skt); 462 ops->hw_shutdown(skt);
449 463
450 i--; 464 }
451 } while (i > 0);
452 kfree(sinfo); 465 kfree(sinfo);
453out: 466out:
454 return ret; 467 return ret;
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 74b3124e8247..0f701921c13e 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -717,6 +717,7 @@ static int pcmcia_requery(struct device *dev, void * _data)
717static void pcmcia_bus_rescan(struct pcmcia_socket *skt) 717static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
718{ 718{
719 int no_devices=0; 719 int no_devices=0;
720 int ret = 0;
720 unsigned long flags; 721 unsigned long flags;
721 722
722 /* must be called with skt_mutex held */ 723 /* must be called with skt_mutex held */
@@ -729,7 +730,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
729 * missing resource information or other trouble, we need to 730 * missing resource information or other trouble, we need to
730 * do this now. */ 731 * do this now. */
731 if (no_devices) { 732 if (no_devices) {
732 int ret = pcmcia_card_add(skt); 733 ret = pcmcia_card_add(skt);
733 if (ret) 734 if (ret)
734 return; 735 return;
735 } 736 }
@@ -741,7 +742,9 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
741 742
742 /* we re-scan all devices, not just the ones connected to this 743 /* we re-scan all devices, not just the ones connected to this
743 * socket. This does not matter, though. */ 744 * socket. This does not matter, though. */
744 bus_rescan_devices(&pcmcia_bus_type); 745 ret = bus_rescan_devices(&pcmcia_bus_type);
746 if (ret)
747 printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n");
745} 748}
746 749
747static inline int pcmcia_devmatch(struct pcmcia_device *dev, 750static inline int pcmcia_devmatch(struct pcmcia_device *dev,
@@ -1001,6 +1004,7 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
1001 struct device_attribute *attr, const char *buf, size_t count) 1004 struct device_attribute *attr, const char *buf, size_t count)
1002{ 1005{
1003 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1006 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1007 int ret;
1004 1008
1005 if (!count) 1009 if (!count)
1006 return -EINVAL; 1010 return -EINVAL;
@@ -1009,7 +1013,10 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
1009 p_dev->allow_func_id_match = 1; 1013 p_dev->allow_func_id_match = 1;
1010 mutex_unlock(&p_dev->socket->skt_mutex); 1014 mutex_unlock(&p_dev->socket->skt_mutex);
1011 1015
1012 bus_rescan_devices(&pcmcia_bus_type); 1016 ret = bus_rescan_devices(&pcmcia_bus_type);
1017 if (ret)
1018 printk(KERN_INFO "pcmcia: bus_rescan_devices failed after "
1019 "allowing func_id matches\n");
1013 1020
1014 return count; 1021 return count;
1015} 1022}
@@ -1292,10 +1299,22 @@ struct bus_type pcmcia_bus_type = {
1292 1299
1293static int __init init_pcmcia_bus(void) 1300static int __init init_pcmcia_bus(void)
1294{ 1301{
1302 int ret;
1303
1295 spin_lock_init(&pcmcia_dev_list_lock); 1304 spin_lock_init(&pcmcia_dev_list_lock);
1296 1305
1297 bus_register(&pcmcia_bus_type); 1306 ret = bus_register(&pcmcia_bus_type);
1298 class_interface_register(&pcmcia_bus_interface); 1307 if (ret < 0) {
1308 printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret);
1309 return ret;
1310 }
1311 ret = class_interface_register(&pcmcia_bus_interface);
1312 if (ret < 0) {
1313 printk(KERN_WARNING
1314 "pcmcia: class_interface_register error: %d\n", ret);
1315 bus_unregister(&pcmcia_bus_type);
1316 return ret;
1317 }
1299 1318
1300 pcmcia_setup_ioctl(); 1319 pcmcia_setup_ioctl();
1301 1320
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 82715f448957..c2ea07aa7a12 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -41,6 +41,7 @@ static struct pci_device_id i82092aa_pci_ids[] = {
41}; 41};
42MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids); 42MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
43 43
44#ifdef CONFIG_PM
44static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state) 45static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
45{ 46{
46 return pcmcia_socket_dev_suspend(&dev->dev, state); 47 return pcmcia_socket_dev_suspend(&dev->dev, state);
@@ -50,14 +51,17 @@ static int i82092aa_socket_resume (struct pci_dev *dev)
50{ 51{
51 return pcmcia_socket_dev_resume(&dev->dev); 52 return pcmcia_socket_dev_resume(&dev->dev);
52} 53}
54#endif
53 55
54static struct pci_driver i82092aa_pci_drv = { 56static struct pci_driver i82092aa_pci_drv = {
55 .name = "i82092aa", 57 .name = "i82092aa",
56 .id_table = i82092aa_pci_ids, 58 .id_table = i82092aa_pci_ids,
57 .probe = i82092aa_pci_probe, 59 .probe = i82092aa_pci_probe,
58 .remove = __devexit_p(i82092aa_pci_remove), 60 .remove = __devexit_p(i82092aa_pci_remove),
61#ifdef CONFIG_PM
59 .suspend = i82092aa_socket_suspend, 62 .suspend = i82092aa_socket_suspend,
60 .resume = i82092aa_socket_resume, 63 .resume = i82092aa_socket_resume,
64#endif
61}; 65};
62 66
63 67
@@ -705,10 +709,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
705 709
706static int i82092aa_module_init(void) 710static int i82092aa_module_init(void)
707{ 711{
708 enter("i82092aa_module_init"); 712 return pci_register_driver(&i82092aa_pci_drv);
709 pci_register_driver(&i82092aa_pci_drv);
710 leave("i82092aa_module_init");
711 return 0;
712} 713}
713 714
714static void i82092aa_module_exit(void) 715static void i82092aa_module_exit(void)
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index e070a2896769..3b72be880401 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -427,7 +427,7 @@ static int voltage_set(int slot, int vcc, int vpp)
427 reg |= BCSR1_PCCVCC1; 427 reg |= BCSR1_PCCVCC1;
428 break; 428 break;
429 default: 429 default:
430 return 1; 430 goto out_unmap;
431 } 431 }
432 432
433 switch(vpp) { 433 switch(vpp) {
@@ -438,15 +438,15 @@ static int voltage_set(int slot, int vcc, int vpp)
438 if(vcc == vpp) 438 if(vcc == vpp)
439 reg |= BCSR1_PCCVPP1; 439 reg |= BCSR1_PCCVPP1;
440 else 440 else
441 return 1; 441 goto out_unmap;
442 break; 442 break;
443 case 120: 443 case 120:
444 if ((vcc == 33) || (vcc == 50)) 444 if ((vcc == 33) || (vcc == 50))
445 reg |= BCSR1_PCCVPP0; 445 reg |= BCSR1_PCCVPP0;
446 else 446 else
447 return 1; 447 goto out_unmap;
448 default: 448 default:
449 return 1; 449 goto out_unmap;
450 } 450 }
451 451
452 /* first, turn off all power */ 452 /* first, turn off all power */
@@ -457,6 +457,10 @@ static int voltage_set(int slot, int vcc, int vpp)
457 457
458 iounmap(bcsr_io); 458 iounmap(bcsr_io);
459 return 0; 459 return 0;
460
461out_unmap:
462 iounmap(bcsr_io);
463 return 1;
460} 464}
461 465
462#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V 466#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index c8e838c69766..06bf7f48836e 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -309,9 +309,10 @@ static int __devinit omap_cf_probe(struct device *dev)
309 return 0; 309 return 0;
310 310
311fail2: 311fail2:
312 iounmap((void __iomem *) cf->socket.io_offset);
313 release_mem_region(cf->phys_cf, SZ_8K); 312 release_mem_region(cf->phys_cf, SZ_8K);
314fail1: 313fail1:
314 if (cf->socket.io_offset)
315 iounmap((void __iomem *) cf->socket.io_offset);
315 free_irq(irq, cf); 316 free_irq(irq, cf);
316fail0: 317fail0:
317 kfree(cf); 318 kfree(cf);
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 9ad18e62658d..310ede575caa 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -128,9 +128,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos,
128 int count, int *eof, void *data) 128 int count, int *eof, void *data)
129{ 129{
130 char *p = buf; 130 char *p = buf;
131 int rc;
131 132
132 bus_for_each_drv(&pcmcia_bus_type, NULL, 133 rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
133 (void *) &p, proc_read_drivers_callback); 134 (void *) &p, proc_read_drivers_callback);
135 if (rc < 0)
136 return rc;
134 137
135 return (p - buf); 138 return (p - buf);
136} 139}
@@ -269,8 +272,10 @@ rescan:
269 * Prevent this racing with a card insertion. 272 * Prevent this racing with a card insertion.
270 */ 273 */
271 mutex_lock(&s->skt_mutex); 274 mutex_lock(&s->skt_mutex);
272 bus_rescan_devices(&pcmcia_bus_type); 275 ret = bus_rescan_devices(&pcmcia_bus_type);
273 mutex_unlock(&s->skt_mutex); 276 mutex_unlock(&s->skt_mutex);
277 if (ret)
278 goto err_put_module;
274 279
275 /* check whether the driver indeed matched. I don't care if this 280 /* check whether the driver indeed matched. I don't care if this
276 * is racy or not, because it can only happen on cardmgr access 281 * is racy or not, because it can only happen on cardmgr access
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 74cebd424032..b9201c2ec38b 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -95,7 +95,7 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
95 * potential conflicts, just the most obvious ones. 95 * potential conflicts, just the most obvious ones.
96 */ 96 */
97 for (i = 0; i < MAX_IO_WIN; i++) 97 for (i = 0; i < MAX_IO_WIN; i++)
98 if ((s->io[i].res) && 98 if ((s->io[i].res) && *base &&
99 ((s->io[i].res->start & (align-1)) == *base)) 99 ((s->io[i].res->start & (align-1)) == *base))
100 return 1; 100 return 1;
101 for (i = 0; i < MAX_IO_WIN; i++) { 101 for (i = 0; i < MAX_IO_WIN; i++) {
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index c83a0a6b158f..a70f97fdbbdd 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -755,6 +755,7 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev)
755 kfree(socket); 755 kfree(socket);
756} 756}
757 757
758#ifdef CONFIG_PM
758static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state) 759static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state)
759{ 760{
760 return pcmcia_socket_dev_suspend(&dev->dev, state); 761 return pcmcia_socket_dev_suspend(&dev->dev, state);
@@ -764,6 +765,7 @@ static int pd6729_socket_resume(struct pci_dev *dev)
764{ 765{
765 return pcmcia_socket_dev_resume(&dev->dev); 766 return pcmcia_socket_dev_resume(&dev->dev);
766} 767}
768#endif
767 769
768static struct pci_device_id pd6729_pci_ids[] = { 770static struct pci_device_id pd6729_pci_ids[] = {
769 { 771 {
@@ -781,8 +783,10 @@ static struct pci_driver pd6729_pci_drv = {
781 .id_table = pd6729_pci_ids, 783 .id_table = pd6729_pci_ids,
782 .probe = pd6729_pci_probe, 784 .probe = pd6729_pci_probe,
783 .remove = __devexit_p(pd6729_pci_remove), 785 .remove = __devexit_p(pd6729_pci_remove),
786#ifdef CONFIG_PM
784 .suspend = pd6729_socket_suspend, 787 .suspend = pd6729_socket_suspend,
785 .resume = pd6729_socket_resume, 788 .resume = pd6729_socket_resume,
789#endif
786}; 790};
787 791
788static int pd6729_module_init(void) 792static int pd6729_module_init(void)
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 3627e52e0c27..e433704e026a 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -824,3 +824,4 @@ int soc_common_drv_pcmcia_remove(struct device *dev)
824 824
825 return 0; 825 return 0;
826} 826}
827EXPORT_SYMBOL(soc_common_drv_pcmcia_remove);
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 26229d9da762..da471bddc972 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1197,8 +1197,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1197 ret = pcmcia_register_socket(&socket->socket); 1197 ret = pcmcia_register_socket(&socket->socket);
1198 if (ret == 0) { 1198 if (ret == 0) {
1199 /* Add the yenta register attributes */ 1199 /* Add the yenta register attributes */
1200 device_create_file(&dev->dev, &dev_attr_yenta_registers); 1200 ret = device_create_file(&dev->dev, &dev_attr_yenta_registers);
1201 goto out; 1201 if (ret == 0)
1202 goto out;
1203
1204 /* error path... */
1205 pcmcia_unregister_socket(&socket->socket);
1202 } 1206 }
1203 1207
1204 unmap: 1208 unmap:
@@ -1213,7 +1217,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1213 return ret; 1217 return ret;
1214} 1218}
1215 1219
1216 1220#ifdef CONFIG_PM
1217static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) 1221static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
1218{ 1222{
1219 struct yenta_socket *socket = pci_get_drvdata(dev); 1223 struct yenta_socket *socket = pci_get_drvdata(dev);
@@ -1248,12 +1252,18 @@ static int yenta_dev_resume (struct pci_dev *dev)
1248 struct yenta_socket *socket = pci_get_drvdata(dev); 1252 struct yenta_socket *socket = pci_get_drvdata(dev);
1249 1253
1250 if (socket) { 1254 if (socket) {
1255 int rc;
1256
1251 pci_set_power_state(dev, 0); 1257 pci_set_power_state(dev, 0);
1252 /* FIXME: pci_restore_state needs to have a better interface */ 1258 /* FIXME: pci_restore_state needs to have a better interface */
1253 pci_restore_state(dev); 1259 pci_restore_state(dev);
1254 pci_write_config_dword(dev, 16*4, socket->saved_state[0]); 1260 pci_write_config_dword(dev, 16*4, socket->saved_state[0]);
1255 pci_write_config_dword(dev, 17*4, socket->saved_state[1]); 1261 pci_write_config_dword(dev, 17*4, socket->saved_state[1]);
1256 pci_enable_device(dev); 1262
1263 rc = pci_enable_device(dev);
1264 if (rc)
1265 return rc;
1266
1257 pci_set_master(dev); 1267 pci_set_master(dev);
1258 1268
1259 if (socket->type && socket->type->restore_state) 1269 if (socket->type && socket->type->restore_state)
@@ -1262,7 +1272,7 @@ static int yenta_dev_resume (struct pci_dev *dev)
1262 1272
1263 return pcmcia_socket_dev_resume(&dev->dev); 1273 return pcmcia_socket_dev_resume(&dev->dev);
1264} 1274}
1265 1275#endif
1266 1276
1267#define CB_ID(vend,dev,type) \ 1277#define CB_ID(vend,dev,type) \
1268 { \ 1278 { \
@@ -1359,8 +1369,10 @@ static struct pci_driver yenta_cardbus_driver = {
1359 .id_table = yenta_table, 1369 .id_table = yenta_table,
1360 .probe = yenta_probe, 1370 .probe = yenta_probe,
1361 .remove = __devexit_p(yenta_close), 1371 .remove = __devexit_p(yenta_close),
1372#ifdef CONFIG_PM
1362 .suspend = yenta_dev_suspend, 1373 .suspend = yenta_dev_suspend,
1363 .resume = yenta_dev_resume, 1374 .resume = yenta_dev_resume,
1375#endif
1364}; 1376};
1365 1377
1366 1378