aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/au1000_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/au1000_generic.c')
-rw-r--r--drivers/pcmcia/au1000_generic.c25
1 files changed, 19 insertions, 6 deletions
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;