[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/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index f4e293b..4611469 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -225,7 +225,7 @@
/* Index of functions. */
-static void tc574_config(struct pcmcia_device *link);
+static int tc574_config(struct pcmcia_device *link);
static void tc574_release(struct pcmcia_device *link);
static void mdio_sync(kio_addr_t ioaddr, int bits);
@@ -256,7 +256,7 @@
with Card Services.
*/
-static int tc574_attach(struct pcmcia_device *link)
+static int tc574_probe(struct pcmcia_device *link)
{
struct el3_private *lp;
struct net_device *dev;
@@ -297,9 +297,7 @@
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- tc574_config(link);
-
- return 0;
+ return tc574_config(link);
} /* tc574_attach */
/*
@@ -337,7 +335,7 @@
static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
-static void tc574_config(struct pcmcia_device *link)
+static int tc574_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev);
@@ -486,13 +484,13 @@
8 << config.u.ram_size, ram_split[config.u.ram_split],
config.u.autoselect ? "autoselect " : "");
- return;
+ return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
tc574_release(link);
- return;
+ return -ENODEV;
} /* tc574_config */
@@ -1223,7 +1221,7 @@
.drv = {
.name = "3c574_cs",
},
- .probe = tc574_attach,
+ .probe = tc574_probe,
.remove = tc574_detach,
.id_table = tc574_ids,
.suspend = tc574_suspend,
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 565063d..160d48a 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -142,7 +142,7 @@
/*====================================================================*/
-static void tc589_config(struct pcmcia_device *link);
+static int tc589_config(struct pcmcia_device *link);
static void tc589_release(struct pcmcia_device *link);
static u16 read_eeprom(kio_addr_t ioaddr, int index);
@@ -170,7 +170,7 @@
======================================================================*/
-static int tc589_attach(struct pcmcia_device *link)
+static int tc589_probe(struct pcmcia_device *link)
{
struct el3_private *lp;
struct net_device *dev;
@@ -212,9 +212,7 @@
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- tc589_config(link);
-
- return 0;
+ return tc589_config(link);
} /* tc589_attach */
/*======================================================================
@@ -252,7 +250,7 @@
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-static void tc589_config(struct pcmcia_device *link)
+static int tc589_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev);
@@ -359,14 +357,13 @@
printk(KERN_INFO " %dK FIFO split %s Rx:Tx, %s xcvr\n",
(fifo & 7) ? 32 : 8, ram_split[(fifo >> 16) & 3],
if_names[dev->if_port]);
- return;
+ return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
tc589_release(link);
- return;
-
+ return -ENODEV;
} /* tc589_config */
/*======================================================================
@@ -997,7 +994,7 @@
.drv = {
.name = "3c589_cs",
},
- .probe = tc589_attach,
+ .probe = tc589_probe,
.remove = tc589_detach,
.id_table = tc589_ids,
.suspend = tc589_suspend,
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 88f180e..f6ca85d 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -86,7 +86,7 @@
/*====================================================================*/
-static void axnet_config(struct pcmcia_device *link);
+static int axnet_config(struct pcmcia_device *link);
static void axnet_release(struct pcmcia_device *link);
static int axnet_open(struct net_device *dev);
static int axnet_close(struct net_device *dev);
@@ -142,7 +142,7 @@
======================================================================*/
-static int axnet_attach(struct pcmcia_device *link)
+static int axnet_probe(struct pcmcia_device *link)
{
axnet_dev_t *info;
struct net_device *dev;
@@ -169,9 +169,7 @@
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- axnet_config(link);
-
- return 0;
+ return axnet_config(link);
} /* axnet_attach */
/*======================================================================
@@ -288,7 +286,7 @@
}
}
-static void axnet_config(struct pcmcia_device *link)
+static int axnet_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
axnet_dev_t *info = PRIV(dev);
@@ -425,14 +423,14 @@
} else {
printk(KERN_NOTICE " No MII transceivers found!\n");
}
- return;
+ return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
axnet_release(link);
link->state &= ~DEV_CONFIG_PENDING;
- return;
+ return -ENODEV;
} /* axnet_config */
/*======================================================================
@@ -806,7 +804,7 @@
.drv = {
.name = "axnet_cs",
},
- .probe = axnet_attach,
+ .probe = axnet_probe,
.remove = axnet_detach,
.id_table = axnet_ids,
.suspend = axnet_suspend,
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index a9bcfb4..a7d675b 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -118,7 +118,7 @@
/*====================================================================*/
-static void com20020_config(struct pcmcia_device *link);
+static int com20020_config(struct pcmcia_device *link);
static void com20020_release(struct pcmcia_device *link);
static void com20020_detach(struct pcmcia_device *p_dev);
@@ -138,7 +138,7 @@
======================================================================*/
-static int com20020_attach(struct pcmcia_device *p_dev)
+static int com20020_probe(struct pcmcia_device *p_dev)
{
com20020_dev_t *info;
struct net_device *dev;
@@ -179,9 +179,7 @@
p_dev->priv = info;
p_dev->state |= DEV_PRESENT;
- com20020_config(p_dev);
-
- return 0;
+ return com20020_config(p_dev);
fail_alloc_dev:
kfree(info);
@@ -250,7 +248,7 @@
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-static void com20020_config(struct pcmcia_device *link)
+static int com20020_config(struct pcmcia_device *link)
{
struct arcnet_local *lp;
tuple_t tuple;
@@ -345,13 +343,14 @@
DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n",
dev->name, dev->base_addr, dev->irq);
- return;
+ return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
DEBUG(1,"com20020_config failed...\n");
com20020_release(link);
+ return -ENODEV;
} /* com20020_config */
/*======================================================================
@@ -404,7 +403,7 @@
.drv = {
.name = "com20020_cs",
},
- .probe = com20020_attach,
+ .probe = com20020_probe,
.remove = com20020_detach,
.id_table = com20020_ids,
.suspend = com20020_suspend,
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index ad3e490..d9c83b2 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -84,7 +84,7 @@
/*
PCMCIA event handlers
*/
-static void fmvj18x_config(struct pcmcia_device *link);
+static int fmvj18x_config(struct pcmcia_device *link);
static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id);
static int fmvj18x_setup_mfc(struct pcmcia_device *link);
static void fmvj18x_release(struct pcmcia_device *link);
@@ -228,7 +228,7 @@
#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */
-static int fmvj18x_attach(struct pcmcia_device *link)
+static int fmvj18x_probe(struct pcmcia_device *link)
{
local_info_t *lp;
struct net_device *dev;
@@ -273,9 +273,7 @@
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- fmvj18x_config(link);
-
- return 0;
+ return fmvj18x_config(link);
} /* fmvj18x_attach */
/*====================================================================*/
@@ -339,7 +337,7 @@
return ret; /* RequestIO failed */
}
-static void fmvj18x_config(struct pcmcia_device *link)
+static int fmvj18x_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
local_info_t *lp = netdev_priv(dev);
@@ -552,7 +550,7 @@
for (i = 0; i < 6; i++)
printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
- return;
+ return 0;
cs_failed:
/* All Card Services errors end up here */
@@ -560,7 +558,7 @@
failed:
fmvj18x_release(link);
link->state &= ~DEV_CONFIG_PENDING;
-
+ return -ENODEV;
} /* fmvj18x_config */
/*====================================================================*/
@@ -720,7 +718,7 @@
.drv = {
.name = "fmvj18x_cs",
},
- .probe = fmvj18x_attach,
+ .probe = fmvj18x_probe,
.remove = fmvj18x_detach,
.id_table = fmvj18x_ids,
.suspend = fmvj18x_suspend,
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 1b8b44d..e038d92 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -105,7 +105,7 @@
/*====================================================================*/
-static void ibmtr_config(struct pcmcia_device *link);
+static int ibmtr_config(struct pcmcia_device *link);
static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase);
static void ibmtr_release(struct pcmcia_device *link);
static void ibmtr_detach(struct pcmcia_device *p_dev);
@@ -174,9 +174,7 @@
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT;
- ibmtr_config(link);
-
- return 0;
+ return ibmtr_config(link);
} /* ibmtr_attach */
/*======================================================================
@@ -220,7 +218,7 @@
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-static void ibmtr_config(struct pcmcia_device *link)
+static int ibmtr_config(struct pcmcia_device *link)
{
ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
@@ -323,12 +321,13 @@
for (i = 0; i < TR_ALEN; i++)
printk("%02X", dev->dev_addr[i]);
printk("\n");
- return;
+ return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
ibmtr_release(link);
+ return -ENODEV;
} /* ibmtr_config */
/*======================================================================
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 8b8e716..ea8a62e 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -417,7 +417,7 @@
Function Prototypes
---------------------------------------------------------------------------- */
-static void nmclan_config(struct pcmcia_device *link);
+static int nmclan_config(struct pcmcia_device *link);
static void nmclan_release(struct pcmcia_device *link);
static void nmclan_reset(struct net_device *dev);
@@ -443,7 +443,7 @@
Services.
---------------------------------------------------------------------------- */
-static int nmclan_attach(struct pcmcia_device *link)
+static int nmclan_probe(struct pcmcia_device *link)
{
mace_private *lp;
struct net_device *dev;
@@ -488,9 +488,7 @@
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- nmclan_config(link);
-
- return 0;
+ return nmclan_config(link);
} /* nmclan_attach */
/* ----------------------------------------------------------------------------
@@ -655,7 +653,7 @@
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-static void nmclan_config(struct pcmcia_device *link)
+static int nmclan_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
mace_private *lp = netdev_priv(dev);
@@ -710,7 +708,7 @@
printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should"
" be 0x40 0x?9\n", sig[0], sig[1]);
link->state &= ~DEV_CONFIG_PENDING;
- return;
+ return -ENODEV;
}
}
@@ -740,14 +738,13 @@
dev->name, dev->base_addr, dev->irq, if_names[dev->if_port]);
for (i = 0; i < 6; i++)
printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
- return;
+ return 0;
cs_failed:
- cs_error(link, last_fn, last_ret);
+ cs_error(link, last_fn, last_ret);
failed:
- nmclan_release(link);
- return;
-
+ nmclan_release(link);
+ return -ENODEV;
} /* nmclan_config */
/* ----------------------------------------------------------------------------
@@ -1611,7 +1608,7 @@
.drv = {
.name = "nmclan_cs",
},
- .probe = nmclan_attach,
+ .probe = nmclan_probe,
.remove = nmclan_detach,
.id_table = nmclan_ids,
.suspend = nmclan_suspend,
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 9f41355..d840c0f 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -103,7 +103,7 @@
/*====================================================================*/
static void mii_phy_probe(struct net_device *dev);
-static void pcnet_config(struct pcmcia_device *link);
+static int pcnet_config(struct pcmcia_device *link);
static void pcnet_release(struct pcmcia_device *link);
static int pcnet_open(struct net_device *dev);
static int pcnet_close(struct net_device *dev);
@@ -265,9 +265,7 @@
dev->set_config = &set_config;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- pcnet_config(link);
-
- return 0;
+ return pcnet_config(link);
} /* pcnet_attach */
/*======================================================================
@@ -516,7 +514,7 @@
}
}
-static void pcnet_config(struct pcmcia_device *link)
+static int pcnet_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
pcnet_dev_t *info = PRIV(dev);
@@ -701,14 +699,14 @@
printk(" hw_addr ");
for (i = 0; i < 6; i++)
printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
- return;
+ return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
pcnet_release(link);
link->state &= ~DEV_CONFIG_PENDING;
- return;
+ return -ENODEV;
} /* pcnet_config */
/*======================================================================
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index a4ee305..3252c1d 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -279,7 +279,7 @@
/*====================================================================*/
static void smc91c92_detach(struct pcmcia_device *p_dev);
-static void smc91c92_config(struct pcmcia_device *link);
+static int smc91c92_config(struct pcmcia_device *link);
static void smc91c92_release(struct pcmcia_device *link);
static int smc_open(struct net_device *dev);
@@ -309,7 +309,7 @@
======================================================================*/
-static int smc91c92_attach(struct pcmcia_device *link)
+static int smc91c92_probe(struct pcmcia_device *link)
{
struct smc_private *smc;
struct net_device *dev;
@@ -357,9 +357,7 @@
smc->mii_if.reg_num_mask = 0x1f;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- smc91c92_config(link);
-
- return 0;
+ return smc91c92_config(link);
} /* smc91c92_attach */
/*======================================================================
@@ -972,7 +970,7 @@
#define CS_EXIT_TEST(ret, svc, label) \
if (ret != CS_SUCCESS) { cs_error(link, svc, ret); goto label; }
-static void smc91c92_config(struct pcmcia_device *link)
+static int smc91c92_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
struct smc_private *smc = netdev_priv(dev);
@@ -1145,7 +1143,7 @@
}
}
kfree(cfg_mem);
- return;
+ return 0;
config_undo:
unregister_netdev(dev);
@@ -1153,7 +1151,7 @@
smc91c92_release(link);
link->state &= ~DEV_CONFIG_PENDING;
kfree(cfg_mem);
-
+ return -ENODEV;
} /* smc91c92_config */
/*======================================================================
@@ -2289,7 +2287,7 @@
.drv = {
.name = "smc91c92_cs",
},
- .probe = smc91c92_attach,
+ .probe = smc91c92_probe,
.remove = smc91c92_detach,
.id_table = smc91c92_ids,
.suspend = smc91c92_suspend,
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 84328da..77bf4e3 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -290,7 +290,7 @@
*/
static int has_ce2_string(struct pcmcia_device * link);
-static void xirc2ps_config(struct pcmcia_device * link);
+static int xirc2ps_config(struct pcmcia_device * link);
static void xirc2ps_release(struct pcmcia_device * link);
/****************
@@ -553,7 +553,7 @@
*/
static int
-xirc2ps_attach(struct pcmcia_device *link)
+xirc2ps_probe(struct pcmcia_device *link)
{
struct net_device *dev;
local_info_t *local;
@@ -592,9 +592,7 @@
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- xirc2ps_config(link);
-
- return 0;
+ return xirc2ps_config(link);
} /* xirc2ps_attach */
/****************
@@ -731,7 +729,7 @@
* is received, to configure the PCMCIA socket, and to make the
* ethernet device available to the system.
*/
-static void
+static int
xirc2ps_config(struct pcmcia_device * link)
{
struct net_device *dev = link->priv;
@@ -1061,17 +1059,18 @@
printk("%c%02X", i?':':' ', dev->dev_addr[i]);
printk("\n");
- return;
+ return 0;
config_error:
link->state &= ~DEV_CONFIG_PENDING;
xirc2ps_release(link);
- return;
+ return -ENODEV;
cis_error:
printk(KNOT_XIRC "unable to parse CIS\n");
failure:
link->state &= ~DEV_CONFIG_PENDING;
+ return -ENODEV;
} /* xirc2ps_config */
/****************
@@ -1911,7 +1910,7 @@
.drv = {
.name = "xirc2ps_cs",
},
- .probe = xirc2ps_attach,
+ .probe = xirc2ps_probe,
.remove = xirc2ps_detach,
.id_table = xirc2ps_ids,
.suspend = xirc2ps_suspend,