[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 <[email protected]>
This commit is contained in:
Dominik Brodowski 2006-03-31 17:26:06 +02:00
commit 15b99ac172
45 changed files with 379 additions and 404 deletions

View file

@ -225,7 +225,7 @@ static char mii_preamble_required = 0;
/* 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 @@ static void tc574_detach(struct pcmcia_device *p_dev);
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 @@ static int tc574_attach(struct pcmcia_device *link)
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
tc574_config(link);
return 0;
return tc574_config(link);
} /* tc574_attach */
/*
@ -337,7 +335,7 @@ static void tc574_detach(struct pcmcia_device *link)
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 @@ static void tc574_config(struct pcmcia_device *link)
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 @@ static struct pcmcia_driver tc574_driver = {
.drv = {
.name = "3c574_cs",
},
.probe = tc574_attach,
.probe = tc574_probe,
.remove = tc574_detach,
.id_table = tc574_ids,
.suspend = tc574_suspend,

View file

@ -142,7 +142,7 @@ DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
/*====================================================================*/
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 void tc589_detach(struct pcmcia_device *p_dev);
======================================================================*/
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 @@ static int tc589_attach(struct pcmcia_device *link)
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 @@ static void tc589_detach(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 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 @@ static void tc589_config(struct pcmcia_device *link)
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 @@ static struct pcmcia_driver tc589_driver = {
.drv = {
.name = "3c589_cs",
},
.probe = tc589_attach,
.probe = tc589_probe,
.remove = tc589_detach,
.id_table = tc589_ids,
.suspend = tc589_suspend,

View file

@ -86,7 +86,7 @@ static char *version =
/*====================================================================*/
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 inline axnet_dev_t *PRIV(struct net_device *dev)
======================================================================*/
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 @@ static int axnet_attach(struct pcmcia_device *link)
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 int try_io_port(struct pcmcia_device *link)
}
}
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 @@ static void axnet_config(struct pcmcia_device *link)
} 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 @@ static struct pcmcia_driver axnet_cs_driver = {
.drv = {
.name = "axnet_cs",
},
.probe = axnet_attach,
.probe = axnet_probe,
.remove = axnet_detach,
.id_table = axnet_ids,
.suspend = axnet_suspend,

View file

@ -118,7 +118,7 @@ MODULE_LICENSE("GPL");
/*====================================================================*/
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 @@ typedef struct com20020_dev_t {
======================================================================*/
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 @@ static int com20020_attach(struct pcmcia_device *p_dev)
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 @@ static void com20020_detach(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 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 @@ static void com20020_config(struct pcmcia_device *link)
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 @@ static struct pcmcia_driver com20020_cs_driver = {
.drv = {
.name = "com20020_cs",
},
.probe = com20020_attach,
.probe = com20020_probe,
.remove = com20020_detach,
.id_table = com20020_ids,
.suspend = com20020_suspend,

View file

@ -84,7 +84,7 @@ static char *version = DRV_NAME ".c " DRV_VERSION " 2002/03/23";
/*
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 @@ typedef struct local_info_t {
#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 @@ static int fmvj18x_attach(struct pcmcia_device *link)
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 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
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 @@ static void fmvj18x_config(struct pcmcia_device *link)
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 @@ cs_failed:
failed:
fmvj18x_release(link);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
} /* fmvj18x_config */
/*====================================================================*/
@ -720,7 +718,7 @@ static struct pcmcia_driver fmvj18x_cs_driver = {
.drv = {
.name = "fmvj18x_cs",
},
.probe = fmvj18x_attach,
.probe = fmvj18x_probe,
.remove = fmvj18x_detach,
.id_table = fmvj18x_ids,
.suspend = fmvj18x_suspend,

View file

@ -105,7 +105,7 @@ MODULE_LICENSE("GPL");
/*====================================================================*/
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 @@ static int ibmtr_attach(struct pcmcia_device *link)
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 @@ static void ibmtr_detach(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 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 @@ static void ibmtr_config(struct pcmcia_device *link)
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 */
/*======================================================================

View file

@ -417,7 +417,7 @@ INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
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 @@ nmclan_attach
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 @@ static int nmclan_attach(struct pcmcia_device *link)
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
nmclan_config(link);
return 0;
return nmclan_config(link);
} /* nmclan_attach */
/* ----------------------------------------------------------------------------
@ -655,7 +653,7 @@ nmclan_config
#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 @@ static void nmclan_config(struct pcmcia_device *link)
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 @@ static void nmclan_config(struct pcmcia_device *link)
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 @@ static struct pcmcia_driver nmclan_cs_driver = {
.drv = {
.name = "nmclan_cs",
},
.probe = nmclan_attach,
.probe = nmclan_probe,
.remove = nmclan_detach,
.id_table = nmclan_ids,
.suspend = nmclan_suspend,

View file

@ -103,7 +103,7 @@ module_param_array(hw_addr, int, NULL, 0);
/*====================================================================*/
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 @@ static int pcnet_probe(struct pcmcia_device *link)
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 int try_io_port(struct pcmcia_device *link)
}
}
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 @@ static void pcnet_config(struct pcmcia_device *link)
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 */
/*======================================================================

View file

@ -279,7 +279,7 @@ enum RxCfg { RxAllMulti = 0x0004, RxPromisc = 0x0002,
/*====================================================================*/
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 struct ethtool_ops ethtool_ops;
======================================================================*/
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 @@ static int smc91c92_attach(struct pcmcia_device *link)
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 @@ static int check_sig(struct pcmcia_device *link)
#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 @@ static void smc91c92_config(struct pcmcia_device *link)
}
}
kfree(cfg_mem);
return;
return 0;
config_undo:
unregister_netdev(dev);
@ -1153,7 +1151,7 @@ config_failed: /* CS_EXIT_TEST() calls jump to here... */
smc91c92_release(link);
link->state &= ~DEV_CONFIG_PENDING;
kfree(cfg_mem);
return -ENODEV;
} /* smc91c92_config */
/*======================================================================
@ -2289,7 +2287,7 @@ static struct pcmcia_driver smc91c92_cs_driver = {
.drv = {
.name = "smc91c92_cs",
},
.probe = smc91c92_attach,
.probe = smc91c92_probe,
.remove = smc91c92_detach,
.id_table = smc91c92_ids,
.suspend = smc91c92_suspend,

View file

@ -290,7 +290,7 @@ static void mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg,
*/
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 @@ mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg, unsigned data, int len)
*/
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 @@ xirc2ps_attach(struct pcmcia_device *link)
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
xirc2ps_config(link);
return 0;
return xirc2ps_config(link);
} /* xirc2ps_attach */
/****************
@ -731,7 +729,7 @@ has_ce2_string(struct pcmcia_device * link)
* 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 @@ xirc2ps_config(struct pcmcia_device * link)
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 @@ static struct pcmcia_driver xirc2ps_cs_driver = {
.drv = {
.name = "xirc2ps_cs",
},
.probe = xirc2ps_attach,
.probe = xirc2ps_probe,
.remove = xirc2ps_detach,
.id_table = xirc2ps_ids,
.suspend = xirc2ps_suspend,

View file

@ -80,7 +80,7 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
event handler.
*/
static void airo_config(struct pcmcia_device *link);
static int airo_config(struct pcmcia_device *link);
static void airo_release(struct pcmcia_device *link);
/*
@ -141,7 +141,7 @@ typedef struct local_info_t {
======================================================================*/
static int airo_attach(struct pcmcia_device *p_dev)
static int airo_probe(struct pcmcia_device *p_dev)
{
local_info_t *local;
@ -171,9 +171,7 @@ static int airo_attach(struct pcmcia_device *p_dev)
p_dev->priv = local;
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
airo_config(p_dev);
return 0;
return airo_config(p_dev);
} /* airo_attach */
/*======================================================================
@ -211,7 +209,7 @@ static void airo_detach(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 airo_config(struct pcmcia_device *link)
static int airo_config(struct pcmcia_device *link)
{
tuple_t tuple;
cisparse_t parse;
@ -386,12 +384,12 @@ static void airo_config(struct pcmcia_device *link)
printk("\n");
link->state &= ~DEV_CONFIG_PENDING;
return;
return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
airo_release(link);
return -ENODEV;
} /* airo_config */
/*======================================================================
@ -444,7 +442,7 @@ static struct pcmcia_driver airo_driver = {
.drv = {
.name = "airo_cs",
},
.probe = airo_attach,
.probe = airo_probe,
.remove = airo_detach,
.id_table = airo_ids,
.suspend = airo_suspend,

View file

@ -91,7 +91,7 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
event handler.
*/
static void atmel_config(struct pcmcia_device *link);
static int atmel_config(struct pcmcia_device *link);
static void atmel_release(struct pcmcia_device *link);
/*
@ -152,7 +152,7 @@ typedef struct local_info_t {
======================================================================*/
static int atmel_attach(struct pcmcia_device *p_dev)
static int atmel_probe(struct pcmcia_device *p_dev)
{
local_info_t *local;
@ -182,9 +182,7 @@ static int atmel_attach(struct pcmcia_device *p_dev)
p_dev->priv = local;
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
atmel_config(p_dev);
return 0;
return atmel_config(p_dev);
} /* atmel_attach */
/*======================================================================
@ -230,7 +228,7 @@ static int card_present(void *arg)
return 0;
}
static void atmel_config(struct pcmcia_device *link)
static int atmel_config(struct pcmcia_device *link)
{
tuple_t tuple;
cisparse_t parse;
@ -377,11 +375,12 @@ static void atmel_config(struct pcmcia_device *link)
link->dev_node = &dev->node;
link->state &= ~DEV_CONFIG_PENDING;
return;
return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
atmel_release(link);
return -ENODEV;
}
/*======================================================================
@ -476,7 +475,7 @@ static struct pcmcia_driver atmel_driver = {
.drv = {
.name = "atmel_cs",
},
.probe = atmel_attach,
.probe = atmel_probe,
.remove = atmel_detach,
.id_table = atmel_ids,
.suspend = atmel_suspend,

View file

@ -501,16 +501,20 @@ static struct prism2_helper_functions prism2_pccard_funcs =
/* allocate local data and register with CardServices
* initialize dev_link structure, but do not configure the card yet */
static int prism2_attach(struct pcmcia_device *p_dev)
static int hostap_cs_probe(struct pcmcia_device *p_dev)
{
int ret;
PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
p_dev->conf.IntType = INT_MEMORY_AND_IO;
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
if (prism2_config(p_dev))
ret = prism2_config(p_dev);
if (ret) {
PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
}
return 0;
return ret;
}
@ -894,7 +898,7 @@ static struct pcmcia_driver hostap_driver = {
.drv = {
.name = "hostap_cs",
},
.probe = prism2_attach,
.probe = hostap_cs_probe,
.remove = prism2_detach,
.owner = THIS_MODULE,
.id_table = hostap_cs_ids,

View file

@ -191,7 +191,7 @@ module_param(mem_speed, int, 0);
/* PCMCIA (Card Services) related functions */
static void netwave_release(struct pcmcia_device *link); /* Card removal */
static void netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
static int netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
insertion */
static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */
@ -376,7 +376,7 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
* configure the card at this point -- we wait until we receive a
* card insertion event.
*/
static int netwave_attach(struct pcmcia_device *link)
static int netwave_probe(struct pcmcia_device *link)
{
struct net_device *dev;
netwave_private *priv;
@ -429,9 +429,7 @@ static int netwave_attach(struct pcmcia_device *link)
link->irq.Instance = dev;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
netwave_pcmcia_config( link);
return 0;
return netwave_pcmcia_config( link);
} /* netwave_attach */
/*
@ -737,7 +735,7 @@ static const struct iw_handler_def netwave_handler_def =
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void netwave_pcmcia_config(struct pcmcia_device *link) {
static int netwave_pcmcia_config(struct pcmcia_device *link) {
struct net_device *dev = link->priv;
netwave_private *priv = netdev_priv(dev);
tuple_t tuple;
@ -845,12 +843,13 @@ static void netwave_pcmcia_config(struct pcmcia_device *link) {
printk(KERN_DEBUG "Netwave_reset: revision %04x %04x\n",
get_uint16(ramBase + NETWAVE_EREG_ARW),
get_uint16(ramBase + NETWAVE_EREG_ARW+2));
return;
return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
netwave_release(link);
return -ENODEV;
} /* netwave_pcmcia_config */
/*
@ -1387,7 +1386,7 @@ static struct pcmcia_driver netwave_driver = {
.drv = {
.name = "netwave_cs",
},
.probe = netwave_attach,
.probe = netwave_probe,
.remove = netwave_detach,
.id_table = netwave_ids,
.suspend = netwave_suspend,

View file

@ -63,7 +63,7 @@ struct orinoco_pccard {
/* Function prototypes */
/********************************************************************/
static void orinoco_cs_config(struct pcmcia_device *link);
static int orinoco_cs_config(struct pcmcia_device *link);
static void orinoco_cs_release(struct pcmcia_device *link);
static void orinoco_cs_detach(struct pcmcia_device *p_dev);
@ -104,7 +104,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
* configure the card at this point -- we wait until we receive a card
* insertion event. */
static int
orinoco_cs_attach(struct pcmcia_device *link)
orinoco_cs_probe(struct pcmcia_device *link)
{
struct net_device *dev;
struct orinoco_private *priv;
@ -135,9 +135,7 @@ orinoco_cs_attach(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY_AND_IO;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
orinoco_cs_config(link);
return 0;
return orinoco_cs_config(link);
} /* orinoco_cs_attach */
/*
@ -172,7 +170,7 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \
} while (0)
static void
static int
orinoco_cs_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
@ -377,13 +375,14 @@ orinoco_cs_config(struct pcmcia_device *link)
link->io.BasePort2 + link->io.NumPorts2 - 1);
printk("\n");
return;
return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
orinoco_cs_release(link);
return -ENODEV;
} /* orinoco_cs_config */
/*
@ -576,7 +575,7 @@ static struct pcmcia_driver orinoco_driver = {
.drv = {
.name = DRIVER_NAME,
},
.probe = orinoco_cs_attach,
.probe = orinoco_cs_probe,
.remove = orinoco_cs_detach,
.id_table = orinoco_cs_ids,
.suspend = orinoco_cs_suspend,

View file

@ -90,7 +90,7 @@ module_param(pc_debug, int, 0);
#define DEBUG(n, args...)
#endif
/** Prototypes based on PCMCIA skeleton driver *******************************/
static void ray_config(struct pcmcia_device *link);
static int ray_config(struct pcmcia_device *link);
static void ray_release(struct pcmcia_device *link);
static void ray_detach(struct pcmcia_device *p_dev);
@ -303,7 +303,7 @@ static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey@world.
configure the card at this point -- we wait until we receive a
card insertion event.
=============================================================================*/
static int ray_attach(struct pcmcia_device *p_dev)
static int ray_probe(struct pcmcia_device *p_dev)
{
ray_dev_t *local;
struct net_device *dev;
@ -368,9 +368,7 @@ static int ray_attach(struct pcmcia_device *p_dev)
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
this_device = p_dev;
ray_config(p_dev);
return 0;
return ray_config(p_dev);
fail_alloc_dev:
return -ENOMEM;
@ -412,7 +410,7 @@ static void ray_detach(struct pcmcia_device *link)
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
#define MAX_TUPLE_SIZE 128
static void ray_config(struct pcmcia_device *link)
static int ray_config(struct pcmcia_device *link)
{
tuple_t tuple;
cisparse_t parse;
@ -499,7 +497,7 @@ static void ray_config(struct pcmcia_device *link)
DEBUG(3,"ray_config amem=%p\n",local->amem);
if (ray_init(dev) < 0) {
ray_release(link);
return;
return -ENODEV;
}
SET_NETDEV_DEV(dev, &handle_to_dev(link));
@ -507,7 +505,7 @@ static void ray_config(struct pcmcia_device *link)
if (i != 0) {
printk("ray_config register_netdev() failed\n");
ray_release(link);
return;
return i;
}
strcpy(local->node.dev_name, dev->name);
@ -519,12 +517,13 @@ static void ray_config(struct pcmcia_device *link)
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);
ray_release(link);
return -ENODEV;
} /* ray_config */
static inline struct ccs __iomem *ccs_base(ray_dev_t *dev)
@ -2846,7 +2845,7 @@ static struct pcmcia_driver ray_driver = {
.drv = {
.name = "ray_cs",
},
.probe = ray_attach,
.probe = ray_probe,
.remove = ray_detach,
.id_table = ray_ids,
.suspend = ray_suspend,

View file

@ -71,7 +71,7 @@ struct orinoco_pccard {
/* Function prototypes */
/********************************************************************/
static void spectrum_cs_config(struct pcmcia_device *link);
static int spectrum_cs_config(struct pcmcia_device *link);
static void spectrum_cs_release(struct pcmcia_device *link);
/********************************************************************/
@ -583,7 +583,7 @@ spectrum_cs_hard_reset(struct orinoco_private *priv)
* configure the card at this point -- we wait until we receive a card
* insertion event. */
static int
spectrum_cs_attach(struct pcmcia_device *link)
spectrum_cs_probe(struct pcmcia_device *link)
{
struct net_device *dev;
struct orinoco_private *priv;
@ -614,9 +614,7 @@ spectrum_cs_attach(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY_AND_IO;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
spectrum_cs_config(link);
return 0;
return spectrum_cs_config(link);
} /* spectrum_cs_attach */
/*
@ -647,7 +645,7 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
* device available to the system.
*/
static void
static int
spectrum_cs_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
@ -857,13 +855,14 @@ spectrum_cs_config(struct pcmcia_device *link)
link->io.BasePort2 + link->io.NumPorts2 - 1);
printk("\n");
return;
return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
spectrum_cs_release(link);
return -ENODEV;
} /* spectrum_cs_config */
/*
@ -954,7 +953,7 @@ static struct pcmcia_driver orinoco_driver = {
.drv = {
.name = DRIVER_NAME,
},
.probe = spectrum_cs_attach,
.probe = spectrum_cs_probe,
.remove = spectrum_cs_detach,
.suspend = spectrum_cs_suspend,
.resume = spectrum_cs_resume,

View file

@ -4580,10 +4580,11 @@ wavelan_close(struct net_device * dev)
* card insertion event.
*/
static int
wavelan_attach(struct pcmcia_device *p_dev)
wavelan_probe(struct pcmcia_device *p_dev)
{
struct net_device * dev; /* Interface generic data */
net_local * lp; /* Interface specific data */
int ret;
#ifdef DEBUG_CALLBACK_TRACE
printk(KERN_DEBUG "-> wavelan_attach()\n");
@ -4651,11 +4652,18 @@ wavelan_attach(struct pcmcia_device *p_dev)
dev->mtu = WAVELAN_MTU;
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
if(wv_pcmcia_config(p_dev) &&
wv_hw_config(dev))
wv_init_info(dev);
else
ret = wv_pcmcia_config(p_dev);
if (ret)
return ret;
ret = wv_hw_config(dev);
if (ret) {
dev->irq = 0;
pcmcia_disable_device(p_dev);
return ret;
}
wv_init_info(dev);
#ifdef DEBUG_CALLBACK_TRACE
printk(KERN_DEBUG "<- wavelan_attach()\n");
@ -4760,7 +4768,7 @@ static struct pcmcia_driver wavelan_driver = {
.drv = {
.name = "wavelan_cs",
},
.probe = wavelan_attach,
.probe = wavelan_probe,
.remove = wavelan_detach,
.id_table = wavelan_ids,
.suspend = wavelan_suspend,

View file

@ -103,7 +103,7 @@ module_param(pc_debug, int, 0);
* release a socket, in response to card insertion and ejection events. They
* are invoked from the wl24 event handler.
*/
static void wl3501_config(struct pcmcia_device *link);
static int wl3501_config(struct pcmcia_device *link);
static void wl3501_release(struct pcmcia_device *link);
/*
@ -1920,7 +1920,7 @@ static const struct iw_handler_def wl3501_handler_def = {
* The dev_link structure is initialized, but we don't actually configure the
* card at this point -- we wait until we receive a card insertion event.
*/
static int wl3501_attach(struct pcmcia_device *p_dev)
static int wl3501_probe(struct pcmcia_device *p_dev)
{
struct net_device *dev;
struct wl3501_card *this;
@ -1960,9 +1960,7 @@ static int wl3501_attach(struct pcmcia_device *p_dev)
p_dev->priv = p_dev->irq.Instance = dev;
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
wl3501_config(p_dev);
return 0;
return wl3501_config(p_dev);
out_link:
return -ENOMEM;
}
@ -1978,7 +1976,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
* received, to configure the PCMCIA socket, and to make the ethernet device
* available to the system.
*/
static void wl3501_config(struct pcmcia_device *link)
static int wl3501_config(struct pcmcia_device *link)
{
tuple_t tuple;
cisparse_t parse;
@ -2082,13 +2080,13 @@ static void wl3501_config(struct pcmcia_device *link)
spin_lock_init(&this->lock);
init_waitqueue_head(&this->wait);
netif_start_queue(dev);
goto out;
return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
wl3501_release(link);
out:
return;
return -ENODEV;
}
/**
@ -2146,7 +2144,7 @@ static struct pcmcia_driver wl3501_driver = {
.drv = {
.name = "wl3501_cs",
},
.probe = wl3501_attach,
.probe = wl3501_probe,
.remove = wl3501_detach,
.id_table = wl3501_ids,
.suspend = wl3501_suspend,