Skip to content

Commit

Permalink
[PATCH] pcmcia: remove dev_list from drivers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dominik Brodowski committed Jan 5, 2006
1 parent f399071 commit b463581
Show file tree
Hide file tree
Showing 38 changed files with 78 additions and 651 deletions.
18 changes: 1 addition & 17 deletions drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
18 changes: 1 addition & 17 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
18 changes: 1 addition & 17 deletions drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
18 changes: 1 addition & 17 deletions drivers/bluetooth/dtl1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
14 changes: 1 addition & 13 deletions drivers/char/pcmcia/synclink_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)
Expand Down
19 changes: 4 additions & 15 deletions drivers/ide/legacy/ide-cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;



/*======================================================================
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
21 changes: 1 addition & 20 deletions drivers/isdn/hardware/avm/avm_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit b463581

Please sign in to comment.