aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/com20020_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/com20020_cs.c')
-rw-r--r--drivers/net/pcmcia/com20020_cs.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 6970888cba10..d48dbd3e153a 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -128,8 +128,6 @@ static dev_info_t dev_info = "com20020_cs";
128static dev_link_t *com20020_attach(void); 128static dev_link_t *com20020_attach(void);
129static void com20020_detach(struct pcmcia_device *p_dev); 129static void com20020_detach(struct pcmcia_device *p_dev);
130 130
131static dev_link_t *dev_list;
132
133/*====================================================================*/ 131/*====================================================================*/
134 132
135typedef struct com20020_dev_t { 133typedef struct com20020_dev_t {
@@ -196,8 +194,7 @@ static dev_link_t *com20020_attach(void)
196 link->priv = info; 194 link->priv = info;
197 195
198 /* Register with Card Services */ 196 /* Register with Card Services */
199 link->next = dev_list; 197 link->next = NULL;
200 dev_list = link;
201 client_reg.dev_info = &dev_info; 198 client_reg.dev_info = &dev_info;
202 client_reg.Version = 0x0210; 199 client_reg.Version = 0x0210;
203 client_reg.event_callback_args.client_data = link; 200 client_reg.event_callback_args.client_data = link;
@@ -230,26 +227,17 @@ static void com20020_detach(struct pcmcia_device *p_dev)
230{ 227{
231 dev_link_t *link = dev_to_instance(p_dev); 228 dev_link_t *link = dev_to_instance(p_dev);
232 struct com20020_dev_t *info = link->priv; 229 struct com20020_dev_t *info = link->priv;
233 dev_link_t **linkp; 230 struct net_device *dev = info->dev;
234 struct net_device *dev; 231
235
236 DEBUG(1,"detach...\n"); 232 DEBUG(1,"detach...\n");
237 233
238 DEBUG(0, "com20020_detach(0x%p)\n", link); 234 DEBUG(0, "com20020_detach(0x%p)\n", link);
239 235
240 /* Locate device structure */
241 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
242 if (*linkp == link) break;
243 if (*linkp == NULL)
244 return;
245
246 dev = info->dev;
247
248 if (link->dev) { 236 if (link->dev) {
249 DEBUG(1,"unregister...\n"); 237 DEBUG(1,"unregister...\n");
250 238
251 unregister_netdev(dev); 239 unregister_netdev(dev);
252 240
253 /* 241 /*
254 * this is necessary because we register our IRQ separately 242 * this is necessary because we register our IRQ separately
255 * from card services. 243 * from card services.
@@ -263,7 +251,6 @@ static void com20020_detach(struct pcmcia_device *p_dev)
263 251
264 /* Unlink device structure, free bits */ 252 /* Unlink device structure, free bits */
265 DEBUG(1,"unlinking...\n"); 253 DEBUG(1,"unlinking...\n");
266 *linkp = link->next;
267 if (link->priv) 254 if (link->priv)
268 { 255 {
269 dev = info->dev; 256 dev = info->dev;
@@ -507,7 +494,6 @@ static int __init init_com20020_cs(void)
507static void __exit exit_com20020_cs(void) 494static void __exit exit_com20020_cs(void)
508{ 495{
509 pcmcia_unregister_driver(&com20020_cs_driver); 496 pcmcia_unregister_driver(&com20020_cs_driver);
510 BUG_ON(dev_list != NULL);
511} 497}
512 498
513module_init(init_com20020_cs); 499module_init(init_com20020_cs);