[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>
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 9bfd90e..ef7a813 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -484,7 +484,7 @@
/* 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 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 @@
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 @@
#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 @@
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 @@
.drv = {
.name = "synclink_cs",
},
- .probe = mgslpc_attach,
+ .probe = mgslpc_probe,
.remove = mgslpc_detach,
.id_table = mgslpc_ids,
.suspend = mgslpc_suspend,