summaryrefslogtreecommitdiff
path: root/drivers/mtd/maps/pcmciamtd.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 17:26:06 +0200
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 17:26:06 +0200
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,
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-static void pcmciamtd_config(struct pcmcia_device *link)
+static int pcmciamtd_config(struct pcmcia_device *link)
{
struct pcmciamtd_dev *dev = link->priv;
struct mtd_info *mtd = NULL;
@@ -561,7 +561,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
if(!dev->win_size) {
err("Cant allocate memory window");
pcmciamtd_release(link);
- return;
+ return -ENODEV;
}
DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
@@ -573,7 +573,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
if(!dev->win_base) {
err("ioremap(%lu, %u) failed", req.Base, req.Size);
pcmciamtd_release(link);
- return;
+ return -ENODEV;
}
DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x",
dev, req.Base, dev->win_base, req.Size);
@@ -605,6 +605,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
ret = pcmcia_request_configuration(link, &link->conf);
if(ret != CS_SUCCESS) {
cs_error(link, RequestConfiguration, ret);
+ return -ENODEV;
}
if(mem_type == 1) {
@@ -625,7 +626,7 @@ static void pcmciamtd_config(struct pcmcia_device *link)
if(!mtd) {
DEBUG(1, "Cant find an MTD");
pcmciamtd_release(link);
- return;
+ return -ENODEV;
}
dev->mtd_info = mtd;
@@ -668,19 +669,19 @@ static void pcmciamtd_config(struct pcmcia_device *link)
dev->mtd_info = NULL;
err("Couldnt register MTD device");
pcmciamtd_release(link);
- return;
+ return -ENODEV;
}
snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
info("mtd%d: %s", mtd->index, mtd->name);
link->state &= ~DEV_CONFIG_PENDING;
link->dev_node = &dev->node;
- return;
+ return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
err("CS Error, exiting");
pcmciamtd_release(link);
- return;
+ return -ENODEV;
}
@@ -730,7 +731,7 @@ static void pcmciamtd_detach(struct pcmcia_device *link)
* with Card Services.
*/
-static int pcmciamtd_attach(struct pcmcia_device *link)
+static int pcmciamtd_probe(struct pcmcia_device *link)
{
struct pcmciamtd_dev *dev;
@@ -747,9 +748,7 @@ static int pcmciamtd_attach(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- pcmciamtd_config(link);
-
- return 0;
+ return pcmciamtd_config(link);
}
static struct pcmcia_device_id pcmciamtd_ids[] = {
@@ -783,7 +782,7 @@ static struct pcmcia_driver pcmciamtd_driver = {
.drv = {
.name = "pcmciamtd"
},
- .probe = pcmciamtd_attach,
+ .probe = pcmciamtd_probe,
.remove = pcmciamtd_detach,
.owner = THIS_MODULE,
.id_table = pcmciamtd_ids,