Commit b4635811 authored by Dominik Brodowski's avatar Dominik Brodowski
Browse files

[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: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent f3990715
......@@ -94,8 +94,6 @@ static dev_info_t dev_info = "bluecard_cs";
static dev_link_t *bluecard_attach(void);
static void bluecard_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
/* Default baud rate: 57600, 115200, 230400 or 460800 */
#define DEFAULT_BAUD_RATE 230400
......@@ -890,8 +888,7 @@ static dev_link_t *bluecard_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -911,22 +908,10 @@ static void bluecard_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
bluecard_info_t *info = link->priv;
dev_link_t **linkp;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link)
break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG)
bluecard_release(link);
/* Unlink device structure, free bits */
*linkp = link->next;
kfree(info);
}
......@@ -1105,7 +1090,6 @@ static int __init init_bluecard_cs(void)
static void __exit exit_bluecard_cs(void)
{
pcmcia_unregister_driver(&bluecard_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_bluecard_cs);
......
......@@ -97,8 +97,6 @@ static dev_info_t dev_info = "bt3c_cs";
static dev_link_t *bt3c_attach(void);
static void bt3c_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
/* Transmit states */
#define XMIT_SENDING 1
......@@ -691,8 +689,7 @@ static dev_link_t *bt3c_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -712,22 +709,10 @@ static void bt3c_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
bt3c_info_t *info = link->priv;
dev_link_t **linkp;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link)
break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG)
bt3c_release(link);
/* Unlink device structure, free bits */
*linkp = link->next;
kfree(info);
}
......@@ -949,7 +934,6 @@ static int __init init_bt3c_cs(void)
static void __exit exit_bt3c_cs(void)
{
pcmcia_unregister_driver(&bt3c_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_bt3c_cs);
......
......@@ -93,8 +93,6 @@ static dev_info_t dev_info = "btuart_cs";
static dev_link_t *btuart_attach(void);
static void btuart_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
/* Maximum baud rate */
#define SPEED_MAX 115200
......@@ -610,8 +608,7 @@ static dev_link_t *btuart_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -631,22 +628,10 @@ static void btuart_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
btuart_info_t *info = link->priv;
dev_link_t **linkp;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link)
break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG)
btuart_release(link);
/* Unlink device structure, free bits */
*linkp = link->next;
kfree(info);
}
......@@ -870,7 +855,6 @@ static int __init init_btuart_cs(void)
static void __exit exit_btuart_cs(void)
{
pcmcia_unregister_driver(&btuart_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_btuart_cs);
......
......@@ -96,8 +96,6 @@ static dev_info_t dev_info = "dtl1_cs";
static dev_link_t *dtl1_attach(void);
static void dtl1_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
/* Transmit states */
#define XMIT_SENDING 1
......@@ -589,8 +587,7 @@ static dev_link_t *dtl1_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -610,22 +607,10 @@ static void dtl1_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dtl1_info_t *info = link->priv;
dev_link_t **linkp;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link)
break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG)
dtl1_release(link);
/* Unlink device structure, free bits */
*linkp = link->next;
kfree(info);
}
......@@ -822,7 +807,6 @@ static int __init init_dtl1_cs(void)
static void __exit exit_dtl1_cs(void)
{
pcmcia_unregister_driver(&dtl1_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_dtl1_cs);
......
......@@ -492,7 +492,6 @@ static dev_link_t *mgslpc_attach(void);
static void mgslpc_detach(struct pcmcia_device *p_dev);
static dev_info_t dev_info = "synclink_cs";
static dev_link_t *dev_list = NULL;
/*
* 1st function defined in .text section. Calling this function in
......@@ -588,8 +587,7 @@ static dev_link_t *mgslpc_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* Register with Card Services */
link->next = dev_list;
dev_list = link;
link->next = NULL;
client_reg.dev_info = &dev_info;
client_reg.Version = 0x0210;
......@@ -741,24 +739,15 @@ static void mgslpc_release(u_long arg)
static void mgslpc_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_detach(0x%p)\n", link);
/* find device */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG) {
((MGSLPC_INFO *)link->priv)->stop = 1;
mgslpc_release((u_long)link);
}
/* Unlink device structure, and free it */
*linkp = link->next;
mgslpc_remove_device((MGSLPC_INFO *)link->priv);
}
......@@ -3131,7 +3120,6 @@ static void synclink_cs_cleanup(void)
}
pcmcia_unregister_driver(&mgslpc_driver);
BUG_ON(dev_list != NULL);
}
static int __init synclink_cs_init(void)
......
......@@ -96,7 +96,8 @@ static dev_info_t dev_info = "ide-cs";
static dev_link_t *ide_attach(void);
static void ide_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
/*======================================================================
......@@ -130,8 +131,7 @@ static dev_link_t *ide_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -157,23 +157,13 @@ static dev_link_t *ide_attach(void)
static void ide_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
DEBUG(0, "ide_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)
ide_release(link);
/* Unlink, free device structure */
*linkp = link->next;
kfree(link->priv);
} /* ide_detach */
static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle)
......@@ -507,7 +497,6 @@ static int __init init_ide_cs(void)
static void __exit exit_ide_cs(void)
{
pcmcia_unregister_driver(&ide_cs_driver);
BUG_ON(dev_list != NULL);
}
late_initcall(init_ide_cs);
......
......@@ -83,15 +83,7 @@ static dev_info_t dev_info = "avm_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
......@@ -157,8 +149,7 @@ static dev_link_t *avmcs_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;
......@@ -188,19 +179,10 @@ static dev_link_t *avmcs_attach(void)
static void avmcs_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
if (*linkp == NULL)
return;
if (link->state & DEV_CONFIG)
avmcs_release(link);
/* Unlink device structure, free pieces */
*linkp = link->next;
kfree(link->priv);
kfree(link);
} /* avmcs_detach */
......@@ -494,7 +476,6 @@ static int __init avmcs_init(void)
static void __exit avmcs_exit(void)
{
pcmcia_unregister_driver(&avmcs_driver);
BUG_ON(dev_list != NULL);
}
module_init(avmcs_init);
......
......@@ -99,15 +99,7 @@ static dev_info_t dev_info = "avma1_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
......@@ -179,8 +171,7 @@ static dev_link_t *avma1cs_attach(void)
link->conf.Present = PRESENT_OPTION;
/* 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;
......@@ -206,21 +197,12 @@ static dev_link_t *avma1cs_attach(void)
static void avma1cs_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
DEBUG(0, "avma1cs_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)
avma1cs_release(link);
/* Unlink device structure, free pieces */
*linkp = link->next;
kfree(link->priv);
kfree(link);
} /* avma1cs_detach */
......@@ -508,7 +490,6 @@ static int __init init_avma1_cs(void)
static void __exit exit_avma1_cs(void)
{
pcmcia_unregister_driver(&avma1cs_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_avma1_cs);
......
......@@ -126,18 +126,7 @@ static dev_info_t dev_info = "elsa_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.
To simplify the data structure handling, we actually include the
dev_link_t structure in the device's private data structure.
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
......@@ -208,8 +197,7 @@ static dev_link_t *elsa_cs_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -235,24 +223,15 @@ static dev_link_t *elsa_cs_attach(void)
static void elsa_cs_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
local_info_t *info = link->priv;
DEBUG(0, "elsa_cs_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) {
((local_info_t*)link->priv)->busy = 1;
elsa_cs_release(link);
info->busy = 1;
elsa_cs_release(link);
}
/* Unlink device structure and free it */
*linkp = link->next;
kfree(info);
} /* elsa_cs_detach */
......@@ -526,7 +505,6 @@ static int __init init_elsa_cs(void)
static void __exit exit_elsa_cs(void)
{
pcmcia_unregister_driver(&elsa_cs_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_elsa_cs);
......
......@@ -134,18 +134,7 @@ static dev_info_t dev_info = "sedlbauer_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.
To simplify the data structure handling, we actually include the
dev_link_t structure in the device's private data structure.
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
......@@ -222,8 +211,7 @@ static dev_link_t *sedlbauer_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -249,23 +237,14 @@ static dev_link_t *sedlbauer_attach(void)
static void sedlbauer_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
DEBUG(0, "sedlbauer_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) {
((local_info_t *)link->priv)->stop = 1;
sedlbauer_release(link);
((local_info_t *)link->priv)->stop = 1;
sedlbauer_release(link);
}
/* Unlink device structure, and free it */
*linkp = link->next;
/* This points to the parent local_info_t struct */
kfree(link->priv);
} /* sedlbauer_detach */
......@@ -623,7 +602,6 @@ static int __init init_sedlbauer_cs(void)
static void __exit exit_sedlbauer_cs(void)
{
pcmcia_unregister_driver(&sedlbauer_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_sedlbauer_cs);
......
......@@ -107,18 +107,7 @@ static dev_info_t dev_info = "teles_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.
To simplify the data structure handling, we actually include the
dev_link_t structure in the device's private data structure.
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
......@@ -189,8 +178,7 @@ static dev_link_t *teles_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
/* 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;
......@@ -216,24 +204,15 @@ static dev_link_t *teles_attach(void)
static void teles_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
local_info_t *info = link->priv;
DEBUG(0, "teles_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) {
info->busy = 1;
teles_cs_release(link);
info->busy = 1;
teles_cs_release(link);
}
/* Unlink device structure and free it */
*linkp = link->next;
kfree(info);
} /* teles_detach */
......@@ -506,7 +485,6 @@ static int __init init_teles_cs(void)
static void __exit exit_teles_cs(void)
{
pcmcia_unregister_driver(&teles_cs_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_teles_cs);
......
......@@ -67,7 +67,6 @@ struct pcmciamtd_dev {
static dev_info_t dev_info = "pcmciamtd";
static dev_link_t *dev_list;
/* Module parameters */
......@@ -782,8 +781,7 @@ static dev_link_t *pcmciamtd_attach(void)
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY;
link->next = dev_list;
dev_list = link;
link->next = NULL;
/* Register with Card Services */
client_reg.dev_info = &dev_info;
......@@ -865,7 +863,6 @@ static void __exit exit_pcmciamtd(void)
{
DEBUG(1, DRIVER_DESC " unloading");
pcmcia_unregister_driver(&pcmciamtd_driver);
BUG_ON(dev_list != NULL);
}
module_init(init_pcmciamtd);
......
......@@ -255,8 +255,6 @@ static dev_info_t dev_info = "3c574_cs";
static dev_link_t *tc574_attach(void);
static void tc574_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list;