aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia
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/char/pcmcia
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/char/pcmcia')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c15
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c15
-rw-r--r--drivers/char/pcmcia/synclink_cs.c16
3 files changed, 28 insertions, 18 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 79b8ad0e32df..22dce9d47b2b 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1759,7 +1759,7 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
1759 1759
1760/*==== Interface to PCMCIA Layer =======================================*/ 1760/*==== Interface to PCMCIA Layer =======================================*/
1761 1761
1762static void cm4000_config(struct pcmcia_device * link, int devno) 1762static int cm4000_config(struct pcmcia_device * link, int devno)
1763{ 1763{
1764 struct cm4000_dev *dev; 1764 struct cm4000_dev *dev;
1765 tuple_t tuple; 1765 tuple_t tuple;
@@ -1846,7 +1846,7 @@ static void cm4000_config(struct pcmcia_device * link, int devno)
1846 link->dev_node = &dev->node; 1846 link->dev_node = &dev->node;
1847 link->state &= ~DEV_CONFIG_PENDING; 1847 link->state &= ~DEV_CONFIG_PENDING;
1848 1848
1849 return; 1849 return 0;
1850 1850
1851cs_failed: 1851cs_failed:
1852 cs_error(link, fail_fn, fail_rc); 1852 cs_error(link, fail_fn, fail_rc);
@@ -1854,6 +1854,7 @@ cs_release:
1854 cm4000_release(link); 1854 cm4000_release(link);
1855 1855
1856 link->state &= ~DEV_CONFIG_PENDING; 1856 link->state &= ~DEV_CONFIG_PENDING;
1857 return -ENODEV;
1857} 1858}
1858 1859
1859static int cm4000_suspend(struct pcmcia_device *link) 1860static int cm4000_suspend(struct pcmcia_device *link)
@@ -1883,10 +1884,10 @@ static void cm4000_release(struct pcmcia_device *link)
1883 pcmcia_disable_device(link); 1884 pcmcia_disable_device(link);
1884} 1885}
1885 1886
1886static int cm4000_attach(struct pcmcia_device *link) 1887static int cm4000_probe(struct pcmcia_device *link)
1887{ 1888{
1888 struct cm4000_dev *dev; 1889 struct cm4000_dev *dev;
1889 int i; 1890 int i, ret;
1890 1891
1891 for (i = 0; i < CM4000_MAX_DEV; i++) 1892 for (i = 0; i < CM4000_MAX_DEV; i++)
1892 if (dev_table[i] == NULL) 1893 if (dev_table[i] == NULL)
@@ -1913,7 +1914,9 @@ static int cm4000_attach(struct pcmcia_device *link)
1913 init_waitqueue_head(&dev->readq); 1914 init_waitqueue_head(&dev->readq);
1914 1915
1915 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1916 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1916 cm4000_config(link, i); 1917 ret = cm4000_config(link, i);
1918 if (ret)
1919 return ret;
1917 1920
1918 class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, 1921 class_device_create(cmm_class, NULL, MKDEV(major, i), NULL,
1919 "cmm%d", i); 1922 "cmm%d", i);
@@ -1968,7 +1971,7 @@ static struct pcmcia_driver cm4000_driver = {
1968 .drv = { 1971 .drv = {
1969 .name = "cm4000_cs", 1972 .name = "cm4000_cs",
1970 }, 1973 },
1971 .probe = cm4000_attach, 1974 .probe = cm4000_probe,
1972 .remove = cm4000_detach, 1975 .remove = cm4000_detach,
1973 .suspend = cm4000_suspend, 1976 .suspend = cm4000_suspend,
1974 .resume = cm4000_resume, 1977 .resume = cm4000_resume,
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 8334226e103c..6ccca8cbabc1 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -514,7 +514,7 @@ static void cm4040_reader_release(struct pcmcia_device *link)
514 return; 514 return;
515} 515}
516 516
517static void reader_config(struct pcmcia_device *link, int devno) 517static int reader_config(struct pcmcia_device *link, int devno)
518{ 518{
519 struct reader_dev *dev; 519 struct reader_dev *dev;
520 tuple_t tuple; 520 tuple_t tuple;
@@ -610,13 +610,14 @@ static void reader_config(struct pcmcia_device *link, int devno)
610 link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1); 610 link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1);
611 DEBUGP(2, dev, "<- reader_config (succ)\n"); 611 DEBUGP(2, dev, "<- reader_config (succ)\n");
612 612
613 return; 613 return 0;
614 614
615cs_failed: 615cs_failed:
616 cs_error(link, fail_fn, fail_rc); 616 cs_error(link, fail_fn, fail_rc);
617cs_release: 617cs_release:
618 reader_release(link); 618 reader_release(link);
619 link->state &= ~DEV_CONFIG_PENDING; 619 link->state &= ~DEV_CONFIG_PENDING;
620 return -ENODEV;
620} 621}
621 622
622static void reader_release(struct pcmcia_device *link) 623static void reader_release(struct pcmcia_device *link)
@@ -625,10 +626,10 @@ static void reader_release(struct pcmcia_device *link)
625 pcmcia_disable_device(link); 626 pcmcia_disable_device(link);
626} 627}
627 628
628static int reader_attach(struct pcmcia_device *link) 629static int reader_probe(struct pcmcia_device *link)
629{ 630{
630 struct reader_dev *dev; 631 struct reader_dev *dev;
631 int i; 632 int i, ret;
632 633
633 for (i = 0; i < CM_MAX_DEV; i++) { 634 for (i = 0; i < CM_MAX_DEV; i++) {
634 if (dev_table[i] == NULL) 635 if (dev_table[i] == NULL)
@@ -659,7 +660,9 @@ static int reader_attach(struct pcmcia_device *link)
659 dev->poll_timer.function = &cm4040_do_poll; 660 dev->poll_timer.function = &cm4040_do_poll;
660 661
661 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 662 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
662 reader_config(link, i); 663 ret = reader_config(link, i);
664 if (ret)
665 return ret;
663 666
664 class_device_create(cmx_class, NULL, MKDEV(major, i), NULL, 667 class_device_create(cmx_class, NULL, MKDEV(major, i), NULL,
665 "cmx%d", i); 668 "cmx%d", i);
@@ -715,7 +718,7 @@ static struct pcmcia_driver reader_driver = {
715 .drv = { 718 .drv = {
716 .name = "cm4040_cs", 719 .name = "cm4040_cs",
717 }, 720 },
718 .probe = reader_attach, 721 .probe = reader_probe,
719 .remove = reader_detach, 722 .remove = reader_detach,
720 .id_table = cm4040_ids, 723 .id_table = cm4040_ids,
721}; 724};
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 9bfd90e5d6b7..ef7a81314f0c 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -484,7 +484,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
484 484
485/* PCMCIA prototypes */ 485/* PCMCIA prototypes */
486 486
487static void mgslpc_config(struct pcmcia_device *link); 487static int mgslpc_config(struct pcmcia_device *link);
488static void mgslpc_release(u_long arg); 488static void mgslpc_release(u_long arg);
489static void mgslpc_detach(struct pcmcia_device *p_dev); 489static void mgslpc_detach(struct pcmcia_device *p_dev);
490 490
@@ -533,9 +533,10 @@ static void ldisc_receive_buf(struct tty_struct *tty,
533 } 533 }
534} 534}
535 535
536static int mgslpc_attach(struct pcmcia_device *link) 536static int mgslpc_probe(struct pcmcia_device *link)
537{ 537{
538 MGSLPC_INFO *info; 538 MGSLPC_INFO *info;
539 int ret;
539 540
540 if (debug_level >= DEBUG_LEVEL_INFO) 541 if (debug_level >= DEBUG_LEVEL_INFO)
541 printk("mgslpc_attach\n"); 542 printk("mgslpc_attach\n");
@@ -578,7 +579,9 @@ static int mgslpc_attach(struct pcmcia_device *link)
578 link->conf.IntType = INT_MEMORY_AND_IO; 579 link->conf.IntType = INT_MEMORY_AND_IO;
579 580
580 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 581 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
581 mgslpc_config(link); 582 ret = mgslpc_config(link);
583 if (ret)
584 return ret;
582 585
583 mgslpc_add_device(info); 586 mgslpc_add_device(info);
584 587
@@ -591,7 +594,7 @@ static int mgslpc_attach(struct pcmcia_device *link)
591#define CS_CHECK(fn, ret) \ 594#define CS_CHECK(fn, ret) \
592do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 595do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
593 596
594static void mgslpc_config(struct pcmcia_device *link) 597static int mgslpc_config(struct pcmcia_device *link)
595{ 598{
596 MGSLPC_INFO *info = link->priv; 599 MGSLPC_INFO *info = link->priv;
597 tuple_t tuple; 600 tuple_t tuple;
@@ -680,11 +683,12 @@ static void mgslpc_config(struct pcmcia_device *link)
680 printk("\n"); 683 printk("\n");
681 684
682 link->state &= ~DEV_CONFIG_PENDING; 685 link->state &= ~DEV_CONFIG_PENDING;
683 return; 686 return 0;
684 687
685cs_failed: 688cs_failed:
686 cs_error(link, last_fn, last_ret); 689 cs_error(link, last_fn, last_ret);
687 mgslpc_release((u_long)link); 690 mgslpc_release((u_long)link);
691 return -ENODEV;
688} 692}
689 693
690/* Card has been removed. 694/* Card has been removed.
@@ -3003,7 +3007,7 @@ static struct pcmcia_driver mgslpc_driver = {
3003 .drv = { 3007 .drv = {
3004 .name = "synclink_cs", 3008 .name = "synclink_cs",
3005 }, 3009 },
3006 .probe = mgslpc_attach, 3010 .probe = mgslpc_probe,
3007 .remove = mgslpc_detach, 3011 .remove = mgslpc_detach,
3008 .id_table = mgslpc_ids, 3012 .id_table = mgslpc_ids,
3009 .suspend = mgslpc_suspend, 3013 .suspend = mgslpc_suspend,