[PATCH] pcmcia: remove dev_list from drivers

The linked list of devices managed by each PCMCIA driver is, in very most
cases, unused. Therefore, remove it from many drivers.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski
2005-11-14 21:25:35 +01:00
parent f399071558
commit b463581154
38 changed files with 74 additions and 647 deletions

View File

@@ -119,15 +119,7 @@ static dev_info_t dev_info = "airo_cs";
device numbers are used to derive the corresponding array index.
*/
static dev_link_t *dev_list = NULL;
/*
A dev_link_t structure has fields for most things that are needed
to keep track of a socket, but there will usually be some device
specific information that also needs to be kept track of. The
'priv' pointer in a dev_link_t structure can be used to point to
a device-specific private data structure, like this.
A driver needs to provide a dev_node_t structure for each device
on a card. In some cases, there is only one device per card (for
example, ethernet cards, modems). In other cases, there may be
@@ -202,8 +194,7 @@ static dev_link_t *airo_attach(void)
link->priv = local;
/* Register with Card Services */
link->next = dev_list;
dev_list = link;
link->next = NULL;
client_reg.dev_info = &dev_info;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
@@ -229,29 +220,19 @@ static dev_link_t *airo_attach(void)
static void airo_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
DEBUG(0, "airo_detach(0x%p)\n", link);
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG)
airo_release(link);
if ( ((local_info_t*)link->priv)->eth_dev ) {
stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
}
((local_info_t*)link->priv)->eth_dev = NULL;
/* Unlink device structure, free pieces */
*linkp = link->next;
kfree(link->priv);
kfree(link);
} /* airo_detach */
/*======================================================================
@@ -574,7 +555,6 @@ static int airo_cs_init(void)
static void airo_cs_cleanup(void)
{
pcmcia_unregister_driver(&airo_driver);
BUG_ON(dev_list != NULL);
}
/*

View File

@@ -130,15 +130,7 @@ static dev_info_t dev_info = "atmel_cs";
device numbers are used to derive the corresponding array index.
*/
static dev_link_t *dev_list = NULL;
/*
A dev_link_t structure has fields for most things that are needed
to keep track of a socket, but there will usually be some device
specific information that also needs to be kept track of. The
'priv' pointer in a dev_link_t structure can be used to point to
a device-specific private data structure, like this.
A driver needs to provide a dev_node_t structure for each device
on a card. In some cases, there is only one device per card (for
example, ethernet cards, modems). In other cases, there may be
@@ -213,8 +205,7 @@ static dev_link_t *atmel_attach(void)
link->priv = local;
/* Register with Card Services */
link->next = dev_list;
dev_list = link;
link->next = NULL;
client_reg.dev_info = &dev_info;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
@@ -240,21 +231,12 @@ static dev_link_t *atmel_attach(void)
static void atmel_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
DEBUG(0, "atmel_detach(0x%p)\n", link);
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG)
atmel_release(link);
/* Unlink device structure, free pieces */
*linkp = link->next;
kfree(link->priv);
kfree(link);
}
@@ -596,7 +578,6 @@ static int atmel_cs_init(void)
static void atmel_cs_cleanup(void)
{
pcmcia_unregister_driver(&atmel_driver);
BUG_ON(dev_list != NULL);
}
/*

View File

@@ -25,7 +25,6 @@
static char *version = PRISM2_VERSION " (Jouni Malinen <jkmaline@cc.hut.fi>)";
static dev_info_t dev_info = "hostap_cs";
static dev_link_t *dev_list = NULL;
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
@@ -520,8 +519,7 @@ static dev_link_t *prism2_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* register with CardServices */
link->next = dev_list;
dev_list = link;
link->next = NULL;
client_reg.dev_info = &dev_info;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
@@ -538,24 +536,13 @@ static dev_link_t *prism2_attach(void)
static void prism2_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
PDEBUG(DEBUG_FLOW, "prism2_detach\n");
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link)
break;
if (*linkp == NULL) {
printk(KERN_WARNING "%s: Attempt to detach non-existing "
"PCMCIA client\n", dev_info);
return;
}
if (link->state & DEV_CONFIG) {
prism2_release((u_long)link);
}
*linkp = link->next;
/* release net devices */
if (link->priv) {
struct hostap_cs_priv *hw_priv;

View File

@@ -227,17 +227,6 @@ static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
/*
A linked list of "instances" of the skeleton device. Each actual
PCMCIA card corresponds to one device instance, and is described
by one dev_link_t structure (defined in ds.h).
You may not want to use a linked list for this -- for example, the
memory card driver uses an array of dev_link_t pointers, where minor
device numbers are used to derive the corresponding array index.
*/
static dev_link_t *dev_list;
/*
A dev_link_t structure has fields for most things that are needed
to keep track of a socket, but there will usually be some device
@@ -451,8 +440,7 @@ static dev_link_t *netwave_attach(void)
link->irq.Instance = dev;
/* Register with Card Services */
link->next = dev_list;
dev_list = link;
link->next = NULL;
client_reg.dev_info = &dev_info;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
@@ -476,37 +464,18 @@ static dev_link_t *netwave_attach(void)
*/
static void netwave_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
DEBUG(0, "netwave_detach(0x%p)\n", link);
/*
If the device is currently configured and active, we won't
actually delete it yet. Instead, it is marked so that when
the release() function is called, that will trigger a proper
detach().
*/
if (link->state & DEV_CONFIG)
netwave_release(link);
DEBUG(0, "netwave_detach(0x%p)\n", link);
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
if (*linkp == NULL)
{
DEBUG(1, "netwave_cs: detach fail, '%s' not in list\n",
link->dev->dev_name);
return;
}
if (link->state & DEV_CONFIG)
netwave_release(link);
/* Unlink device structure, free pieces */
*linkp = link->next;
if (link->dev)
unregister_netdev(dev);
free_netdev(dev);
if (link->dev)
unregister_netdev(dev);
free_netdev(dev);
} /* netwave_detach */
/*
@@ -1503,7 +1472,6 @@ static int __init init_netwave_cs(void)
static void __exit exit_netwave_cs(void)
{
pcmcia_unregister_driver(&netwave_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_netwave_cs);

View File

@@ -69,12 +69,6 @@ struct orinoco_pccard {
unsigned long hard_reset_in_progress;
};
/*
* A linked list of "instances" of the device. Each actual PCMCIA
* card corresponds to one device instance, and is described by one
* dev_link_t structure (defined in ds.h).
*/
static dev_link_t *dev_list; /* = NULL */
/********************************************************************/
/* Function prototypes */
@@ -154,9 +148,7 @@ orinoco_cs_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* Register with Card Services */
/* FIXME: need a lock? */
link->next = dev_list;
dev_list = link;
link->next = NULL;
client_reg.dev_info = &dev_info;
client_reg.Version = 0x0210; /* FIXME: what does this mean? */
@@ -181,21 +173,11 @@ orinoco_cs_attach(void)
static void orinoco_cs_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
struct net_device *dev = link->priv;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link)
break;
BUG_ON(*linkp == NULL);
if (link->state & DEV_CONFIG)
orinoco_cs_release(link);
/* Unlink device structure, and free it */
*linkp = link->next;
DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev);
if (link->dev) {
DEBUG(0, PFX "About to unregister net device %p\n",
@@ -678,7 +660,6 @@ static void __exit
exit_orinoco_cs(void)
{
pcmcia_unregister_driver(&orinoco_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_orinoco_cs);

View File

@@ -78,13 +78,6 @@ struct orinoco_pccard {
dev_node_t node;
};
/*
* A linked list of "instances" of the device. Each actual PCMCIA
* card corresponds to one device instance, and is described by one
* dev_link_t structure (defined in ds.h).
*/
static dev_link_t *dev_list; /* = NULL */
/********************************************************************/
/* Function prototypes */
/********************************************************************/
@@ -637,8 +630,7 @@ spectrum_cs_attach(void)
/* Register with Card Services */
/* FIXME: need a lock? */
link->next = dev_list;
dev_list = link;
link->next = NULL; /* not needed */
client_reg.dev_info = &dev_info;
client_reg.Version = 0x0210; /* FIXME: what does this mean? */
@@ -1049,7 +1041,6 @@ static void __exit
exit_spectrum_cs(void)
{
pcmcia_unregister_driver(&orinoco_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_spectrum_cs);

View File

@@ -4627,8 +4627,7 @@ wavelan_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* Chain drivers */
link->next = dev_list;
dev_list = link;
link->next = NULL;
/* Allocate the generic data structure */
dev = alloc_etherdev(sizeof(net_local));
@@ -4731,27 +4730,6 @@ wavelan_detach(struct pcmcia_device *p_dev)
wv_pcmcia_release(link);
}
/* Remove the interface data from the linked list */
if(dev_list == link)
dev_list = link->next;
else
{
dev_link_t * prev = dev_list;
while((prev != (dev_link_t *) NULL) && (prev->next != link))
prev = prev->next;
if(prev == (dev_link_t *) NULL)
{
#ifdef DEBUG_CONFIG_ERRORS
printk(KERN_WARNING "wavelan_detach : Attempting to remove a nonexistent device.\n");
#endif
return;
}
prev->next = link->next;
}
/* Free pieces */
if(link->priv)
{

View File

@@ -766,7 +766,6 @@ static int
/**************************** VARIABLES ****************************/
static dev_info_t dev_info = "wavelan_cs";
static dev_link_t *dev_list = NULL; /* Linked list of devices */
/*
* Parameters that can be set with 'insmod'