aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/pcmciamtd.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:06 -0500
commit15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch)
treecfb8897487beba502aac2b28bc35066a87e34299 /drivers/mtd/maps/pcmciamtd.c
parentfba395eee7d3f342ca739c20f5b3ee635d0420a0 (diff)
[PATCH] pcmcia: add return value to _config() functions
Most of the driver initialization isn't done in the .probe function, but in the internal _config() functions. Make them return a value, so that .probe can properly report whether the probing of the device succeeded or not. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/mtd/maps/pcmciamtd.c')
-rw-r--r--drivers/mtd/maps/pcmciamtd.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index e9086f0cb2fa..466f558aa7ed 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -487,7 +487,7 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
487#define CS_CHECK(fn, ret) \ 487#define CS_CHECK(fn, ret) \
488do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 488do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
489 489
490static void pcmciamtd_config(struct pcmcia_device *link) 490static int pcmciamtd_config(struct pcmcia_device *link)
491{ 491{
492 struct pcmciamtd_dev *dev = link->priv; 492 struct pcmciamtd_dev *dev = link->priv;
493 struct mtd_info *mtd = NULL; 493 struct mtd_info *mtd = NULL;
@@ -561,7 +561,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
561 if(!dev->win_size) { 561 if(!dev->win_size) {
562 err("Cant allocate memory window"); 562 err("Cant allocate memory window");
563 pcmciamtd_release(link); 563 pcmciamtd_release(link);
564 return; 564 return -ENODEV;
565 } 565 }
566 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); 566 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
567 567
@@ -573,7 +573,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
573 if(!dev->win_base) { 573 if(!dev->win_base) {
574 err("ioremap(%lu, %u) failed", req.Base, req.Size); 574 err("ioremap(%lu, %u) failed", req.Base, req.Size);
575 pcmciamtd_release(link); 575 pcmciamtd_release(link);
576 return; 576 return -ENODEV;
577 } 577 }
578 DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", 578 DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x",
579 dev, req.Base, dev->win_base, req.Size); 579 dev, req.Base, dev->win_base, req.Size);
@@ -605,6 +605,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
605 ret = pcmcia_request_configuration(link, &link->conf); 605 ret = pcmcia_request_configuration(link, &link->conf);
606 if(ret != CS_SUCCESS) { 606 if(ret != CS_SUCCESS) {
607 cs_error(link, RequestConfiguration, ret); 607 cs_error(link, RequestConfiguration, ret);
608 return -ENODEV;
608 } 609 }
609 610
610 if(mem_type == 1) { 611 if(mem_type == 1) {
@@ -625,7 +626,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
625 if(!mtd) { 626 if(!mtd) {
626 DEBUG(1, "Cant find an MTD"); 627 DEBUG(1, "Cant find an MTD");
627 pcmciamtd_release(link); 628 pcmciamtd_release(link);
628 return; 629 return -ENODEV;
629 } 630 }
630 631
631 dev->mtd_info = mtd; 632 dev->mtd_info = mtd;
@@ -668,19 +669,19 @@ static void pcmciamtd_config(struct pcmcia_device *link)
668 dev->mtd_info = NULL; 669 dev->mtd_info = NULL;
669 err("Couldnt register MTD device"); 670 err("Couldnt register MTD device");
670 pcmciamtd_release(link); 671 pcmciamtd_release(link);
671 return; 672 return -ENODEV;
672 } 673 }
673 snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index); 674 snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
674 info("mtd%d: %s", mtd->index, mtd->name); 675 info("mtd%d: %s", mtd->index, mtd->name);
675 link->state &= ~DEV_CONFIG_PENDING; 676 link->state &= ~DEV_CONFIG_PENDING;
676 link->dev_node = &dev->node; 677 link->dev_node = &dev->node;
677 return; 678 return 0;
678 679
679 cs_failed: 680 cs_failed:
680 cs_error(link, last_fn, last_ret); 681 cs_error(link, last_fn, last_ret);
681 err("CS Error, exiting"); 682 err("CS Error, exiting");
682 pcmciamtd_release(link); 683 pcmciamtd_release(link);
683 return; 684 return -ENODEV;
684} 685}
685 686
686 687
@@ -730,7 +731,7 @@ static void pcmciamtd_detach(struct pcmcia_device *link)
730 * with Card Services. 731 * with Card Services.
731 */ 732 */
732 733
733static int pcmciamtd_attach(struct pcmcia_device *link) 734static int pcmciamtd_probe(struct pcmcia_device *link)
734{ 735{
735 struct pcmciamtd_dev *dev; 736 struct pcmciamtd_dev *dev;
736 737
@@ -747,9 +748,7 @@ static int pcmciamtd_attach(struct pcmcia_device *link)
747 link->conf.IntType = INT_MEMORY; 748 link->conf.IntType = INT_MEMORY;
748 749
749 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 750 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
750 pcmciamtd_config(link); 751 return pcmciamtd_config(link);
751
752 return 0;
753} 752}
754 753
755static struct pcmcia_device_id pcmciamtd_ids[] = { 754static struct pcmcia_device_id pcmciamtd_ids[] = {
@@ -783,7 +782,7 @@ static struct pcmcia_driver pcmciamtd_driver = {
783 .drv = { 782 .drv = {
784 .name = "pcmciamtd" 783 .name = "pcmciamtd"
785 }, 784 },
786 .probe = pcmciamtd_attach, 785 .probe = pcmciamtd_probe,
787 .remove = pcmciamtd_detach, 786 .remove = pcmciamtd_detach,
788 .owner = THIS_MODULE, 787 .owner = THIS_MODULE,
789 .id_table = pcmciamtd_ids, 788 .id_table = pcmciamtd_ids,