diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 17:26:06 +0200 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 17:26:06 +0200 |
commit | 15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch) | |
tree | cfb8897487beba502aac2b28bc35066a87e34299 /drivers/char/pcmcia | |
parent | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (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.c | 15 | ||||
-rw-r--r-- | drivers/char/pcmcia/cm4040_cs.c | 15 | ||||
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 16 |
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) /*==== Interface to PCMCIA Layer =======================================*/ -static void cm4000_config(struct pcmcia_device * link, int devno) +static int cm4000_config(struct pcmcia_device * link, int devno) { struct cm4000_dev *dev; tuple_t tuple; @@ -1846,7 +1846,7 @@ static void cm4000_config(struct pcmcia_device * link, int devno) link->dev_node = &dev->node; link->state &= ~DEV_CONFIG_PENDING; - return; + return 0; cs_failed: cs_error(link, fail_fn, fail_rc); @@ -1854,6 +1854,7 @@ cs_release: cm4000_release(link); link->state &= ~DEV_CONFIG_PENDING; + return -ENODEV; } static int cm4000_suspend(struct pcmcia_device *link) @@ -1883,10 +1884,10 @@ static void cm4000_release(struct pcmcia_device *link) pcmcia_disable_device(link); } -static int cm4000_attach(struct pcmcia_device *link) +static int cm4000_probe(struct pcmcia_device *link) { struct cm4000_dev *dev; - int i; + int i, ret; for (i = 0; i < CM4000_MAX_DEV; i++) if (dev_table[i] == NULL) @@ -1913,7 +1914,9 @@ static int cm4000_attach(struct pcmcia_device *link) init_waitqueue_head(&dev->readq); link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - cm4000_config(link, i); + ret = cm4000_config(link, i); + if (ret) + return ret; class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i); @@ -1968,7 +1971,7 @@ static struct pcmcia_driver cm4000_driver = { .drv = { .name = "cm4000_cs", }, - .probe = cm4000_attach, + .probe = cm4000_probe, .remove = cm4000_detach, .suspend = cm4000_suspend, .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) return; } -static void reader_config(struct pcmcia_device *link, int devno) +static int reader_config(struct pcmcia_device *link, int devno) { struct reader_dev *dev; tuple_t tuple; @@ -610,13 +610,14 @@ static void reader_config(struct pcmcia_device *link, int devno) link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1); DEBUGP(2, dev, "<- reader_config (succ)\n"); - return; + return 0; cs_failed: cs_error(link, fail_fn, fail_rc); cs_release: reader_release(link); link->state &= ~DEV_CONFIG_PENDING; + return -ENODEV; } static void reader_release(struct pcmcia_device *link) @@ -625,10 +626,10 @@ static void reader_release(struct pcmcia_device *link) pcmcia_disable_device(link); } -static int reader_attach(struct pcmcia_device *link) +static int reader_probe(struct pcmcia_device *link) { struct reader_dev *dev; - int i; + int i, ret; for (i = 0; i < CM_MAX_DEV; i++) { if (dev_table[i] == NULL) @@ -659,7 +660,9 @@ static int reader_attach(struct pcmcia_device *link) dev->poll_timer.function = &cm4040_do_poll; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - reader_config(link, i); + ret = reader_config(link, i); + if (ret) + return ret; class_device_create(cmx_class, NULL, MKDEV(major, i), NULL, "cmx%d", i); @@ -715,7 +718,7 @@ static struct pcmcia_driver reader_driver = { .drv = { .name = "cm4040_cs", }, - .probe = reader_attach, + .probe = reader_probe, .remove = reader_detach, .id_table = cm4040_ids, }; 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); /* PCMCIA prototypes */ -static void mgslpc_config(struct pcmcia_device *link); +static int mgslpc_config(struct pcmcia_device *link); static void mgslpc_release(u_long arg); static void mgslpc_detach(struct pcmcia_device *p_dev); @@ -533,9 +533,10 @@ static void ldisc_receive_buf(struct tty_struct *tty, } } -static int mgslpc_attach(struct pcmcia_device *link) +static int mgslpc_probe(struct pcmcia_device *link) { MGSLPC_INFO *info; + int ret; if (debug_level >= DEBUG_LEVEL_INFO) printk("mgslpc_attach\n"); @@ -578,7 +579,9 @@ static int mgslpc_attach(struct pcmcia_device *link) link->conf.IntType = INT_MEMORY_AND_IO; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - mgslpc_config(link); + ret = mgslpc_config(link); + if (ret) + return ret; mgslpc_add_device(info); @@ -591,7 +594,7 @@ static int mgslpc_attach(struct pcmcia_device *link) #define CS_CHECK(fn, ret) \ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) -static void mgslpc_config(struct pcmcia_device *link) +static int mgslpc_config(struct pcmcia_device *link) { MGSLPC_INFO *info = link->priv; tuple_t tuple; @@ -680,11 +683,12 @@ static void mgslpc_config(struct pcmcia_device *link) printk("\n"); link->state &= ~DEV_CONFIG_PENDING; - return; + return 0; cs_failed: cs_error(link, last_fn, last_ret); mgslpc_release((u_long)link); + return -ENODEV; } /* Card has been removed. @@ -3003,7 +3007,7 @@ static struct pcmcia_driver mgslpc_driver = { .drv = { .name = "synclink_cs", }, - .probe = mgslpc_attach, + .probe = mgslpc_probe, .remove = mgslpc_detach, .id_table = mgslpc_ids, .suspend = mgslpc_suspend, |