aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c15
-rw-r--r--drivers/net/pcmcia/3c589_cs.c17
-rw-r--r--drivers/net/pcmcia/axnet_cs.c14
-rw-r--r--drivers/net/pcmcia/com20020_cs.c22
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c16
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c21
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c14
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c14
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c15
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c24
-rw-r--r--drivers/net/wireless/airo_cs.c28
-rw-r--r--drivers/net/wireless/atmel_cs.c25
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c15
-rw-r--r--drivers/net/wireless/netwave_cs.c56
-rw-r--r--drivers/net/wireless/orinoco_cs.c21
-rw-r--r--drivers/net/wireless/spectrum_cs.c11
-rw-r--r--drivers/net/wireless/wavelan_cs.c24
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h1
18 files changed, 40 insertions, 313 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 60a3bc2b8fc4..8fcb63698ef1 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -255,8 +255,6 @@ static dev_info_t dev_info = "3c574_cs";
255static dev_link_t *tc574_attach(void); 255static dev_link_t *tc574_attach(void);
256static void tc574_detach(struct pcmcia_device *p_dev); 256static void tc574_detach(struct pcmcia_device *p_dev);
257 257
258static dev_link_t *dev_list;
259
260/* 258/*
261 tc574_attach() creates an "instance" of the driver, allocating 259 tc574_attach() creates an "instance" of the driver, allocating
262 local data structures for one device. The device is registered 260 local data structures for one device. The device is registered
@@ -308,8 +306,7 @@ static dev_link_t *tc574_attach(void)
308#endif 306#endif
309 307
310 /* Register with Card Services */ 308 /* Register with Card Services */
311 link->next = dev_list; 309 link->next = NULL;
312 dev_list = link;
313 client_reg.dev_info = &dev_info; 310 client_reg.dev_info = &dev_info;
314 client_reg.Version = 0x0210; 311 client_reg.Version = 0x0210;
315 client_reg.event_callback_args.client_data = link; 312 client_reg.event_callback_args.client_data = link;
@@ -336,24 +333,15 @@ static void tc574_detach(struct pcmcia_device *p_dev)
336{ 333{
337 dev_link_t *link = dev_to_instance(p_dev); 334 dev_link_t *link = dev_to_instance(p_dev);
338 struct net_device *dev = link->priv; 335 struct net_device *dev = link->priv;
339 dev_link_t **linkp;
340 336
341 DEBUG(0, "3c574_detach(0x%p)\n", link); 337 DEBUG(0, "3c574_detach(0x%p)\n", link);
342 338
343 /* Locate device structure */
344 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
345 if (*linkp == link) break;
346 if (*linkp == NULL)
347 return;
348
349 if (link->dev) 339 if (link->dev)
350 unregister_netdev(dev); 340 unregister_netdev(dev);
351 341
352 if (link->state & DEV_CONFIG) 342 if (link->state & DEV_CONFIG)
353 tc574_release(link); 343 tc574_release(link);
354 344
355 /* Unlink device structure, free bits */
356 *linkp = link->next;
357 free_netdev(dev); 345 free_netdev(dev);
358} /* tc574_detach */ 346} /* tc574_detach */
359 347
@@ -1310,7 +1298,6 @@ static int __init init_tc574(void)
1310static void __exit exit_tc574(void) 1298static void __exit exit_tc574(void)
1311{ 1299{
1312 pcmcia_unregister_driver(&tc574_driver); 1300 pcmcia_unregister_driver(&tc574_driver);
1313 BUG_ON(dev_list != NULL);
1314} 1301}
1315 1302
1316module_init(init_tc574); 1303module_init(init_tc574);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 09b96c76216e..3516c02b9c89 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -166,8 +166,6 @@ static dev_info_t dev_info = "3c589_cs";
166static dev_link_t *tc589_attach(void); 166static dev_link_t *tc589_attach(void);
167static void tc589_detach(struct pcmcia_device *p_dev); 167static void tc589_detach(struct pcmcia_device *p_dev);
168 168
169static dev_link_t *dev_list;
170
171/*====================================================================== 169/*======================================================================
172 170
173 tc589_attach() creates an "instance" of the driver, allocating 171 tc589_attach() creates an "instance" of the driver, allocating
@@ -222,8 +220,7 @@ static dev_link_t *tc589_attach(void)
222 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 220 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
223 221
224 /* Register with Card Services */ 222 /* Register with Card Services */
225 link->next = dev_list; 223 link->next = NULL;
226 dev_list = link;
227 client_reg.dev_info = &dev_info; 224 client_reg.dev_info = &dev_info;
228 client_reg.Version = 0x0210; 225 client_reg.Version = 0x0210;
229 client_reg.event_callback_args.client_data = link; 226 client_reg.event_callback_args.client_data = link;
@@ -250,15 +247,8 @@ static void tc589_detach(struct pcmcia_device *p_dev)
250{ 247{
251 dev_link_t *link = dev_to_instance(p_dev); 248 dev_link_t *link = dev_to_instance(p_dev);
252 struct net_device *dev = link->priv; 249 struct net_device *dev = link->priv;
253 dev_link_t **linkp; 250
254
255 DEBUG(0, "3c589_detach(0x%p)\n", link); 251 DEBUG(0, "3c589_detach(0x%p)\n", link);
256
257 /* Locate device structure */
258 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
259 if (*linkp == link) break;
260 if (*linkp == NULL)
261 return;
262 252
263 if (link->dev) 253 if (link->dev)
264 unregister_netdev(dev); 254 unregister_netdev(dev);
@@ -266,8 +256,6 @@ static void tc589_detach(struct pcmcia_device *p_dev)
266 if (link->state & DEV_CONFIG) 256 if (link->state & DEV_CONFIG)
267 tc589_release(link); 257 tc589_release(link);
268 258
269 /* Unlink device structure, free bits */
270 *linkp = link->next;
271 free_netdev(dev); 259 free_netdev(dev);
272} /* tc589_detach */ 260} /* tc589_detach */
273 261
@@ -1085,7 +1073,6 @@ static int __init init_tc589(void)
1085static void __exit exit_tc589(void) 1073static void __exit exit_tc589(void)
1086{ 1074{
1087 pcmcia_unregister_driver(&tc589_driver); 1075 pcmcia_unregister_driver(&tc589_driver);
1088 BUG_ON(dev_list != NULL);
1089} 1076}
1090 1077
1091module_init(init_tc589); 1078module_init(init_tc589);
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 11f701a8ff02..3d36207d3332 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -111,7 +111,6 @@ static dev_link_t *axnet_attach(void);
111static void axnet_detach(struct pcmcia_device *p_dev); 111static void axnet_detach(struct pcmcia_device *p_dev);
112 112
113static dev_info_t dev_info = "axnet_cs"; 113static dev_info_t dev_info = "axnet_cs";
114static dev_link_t *dev_list;
115 114
116static void axdev_setup(struct net_device *dev); 115static void axdev_setup(struct net_device *dev);
117static void AX88190_init(struct net_device *dev, int startp); 116static void AX88190_init(struct net_device *dev, int startp);
@@ -177,8 +176,7 @@ static dev_link_t *axnet_attach(void)
177 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 176 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
178 177
179 /* Register with Card Services */ 178 /* Register with Card Services */
180 link->next = dev_list; 179 link->next = NULL;
181 dev_list = link;
182 client_reg.dev_info = &dev_info; 180 client_reg.dev_info = &dev_info;
183 client_reg.Version = 0x0210; 181 client_reg.Version = 0x0210;
184 client_reg.event_callback_args.client_data = link; 182 client_reg.event_callback_args.client_data = link;
@@ -205,24 +203,15 @@ static void axnet_detach(struct pcmcia_device *p_dev)
205{ 203{
206 dev_link_t *link = dev_to_instance(p_dev); 204 dev_link_t *link = dev_to_instance(p_dev);
207 struct net_device *dev = link->priv; 205 struct net_device *dev = link->priv;
208 dev_link_t **linkp;
209 206
210 DEBUG(0, "axnet_detach(0x%p)\n", link); 207 DEBUG(0, "axnet_detach(0x%p)\n", link);
211 208
212 /* Locate device structure */
213 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
214 if (*linkp == link) break;
215 if (*linkp == NULL)
216 return;
217
218 if (link->dev) 209 if (link->dev)
219 unregister_netdev(dev); 210 unregister_netdev(dev);
220 211
221 if (link->state & DEV_CONFIG) 212 if (link->state & DEV_CONFIG)
222 axnet_release(link); 213 axnet_release(link);
223 214
224 /* Unlink device structure, free bits */
225 *linkp = link->next;
226 free_netdev(dev); 215 free_netdev(dev);
227} /* axnet_detach */ 216} /* axnet_detach */
228 217
@@ -896,7 +885,6 @@ static int __init init_axnet_cs(void)
896static void __exit exit_axnet_cs(void) 885static void __exit exit_axnet_cs(void)
897{ 886{
898 pcmcia_unregister_driver(&axnet_cs_driver); 887 pcmcia_unregister_driver(&axnet_cs_driver);
899 BUG_ON(dev_list != NULL);
900} 888}
901 889
902module_init(init_axnet_cs); 890module_init(init_axnet_cs);
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);
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 560d4ee22803..dad6393052ff 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -109,7 +109,6 @@ static void fjn_tx_timeout(struct net_device *dev);
109static struct ethtool_ops netdev_ethtool_ops; 109static struct ethtool_ops netdev_ethtool_ops;
110 110
111static dev_info_t dev_info = "fmvj18x_cs"; 111static dev_info_t dev_info = "fmvj18x_cs";
112static dev_link_t *dev_list;
113 112
114/* 113/*
115 card type 114 card type
@@ -283,8 +282,7 @@ static dev_link_t *fmvj18x_attach(void)
283 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 282 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
284 283
285 /* Register with Card Services */ 284 /* Register with Card Services */
286 link->next = dev_list; 285 link->next = NULL;
287 dev_list = link;
288 client_reg.dev_info = &dev_info; 286 client_reg.dev_info = &dev_info;
289 client_reg.Version = 0x0210; 287 client_reg.Version = 0x0210;
290 client_reg.event_callback_args.client_data = link; 288 client_reg.event_callback_args.client_data = link;
@@ -304,15 +302,8 @@ static void fmvj18x_detach(struct pcmcia_device *p_dev)
304{ 302{
305 dev_link_t *link = dev_to_instance(p_dev); 303 dev_link_t *link = dev_to_instance(p_dev);
306 struct net_device *dev = link->priv; 304 struct net_device *dev = link->priv;
307 dev_link_t **linkp; 305
308
309 DEBUG(0, "fmvj18x_detach(0x%p)\n", link); 306 DEBUG(0, "fmvj18x_detach(0x%p)\n", link);
310
311 /* Locate device structure */
312 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
313 if (*linkp == link) break;
314 if (*linkp == NULL)
315 return;
316 307
317 if (link->dev) 308 if (link->dev)
318 unregister_netdev(dev); 309 unregister_netdev(dev);
@@ -320,8 +311,6 @@ static void fmvj18x_detach(struct pcmcia_device *p_dev)
320 if (link->state & DEV_CONFIG) 311 if (link->state & DEV_CONFIG)
321 fmvj18x_release(link); 312 fmvj18x_release(link);
322 313
323 /* Unlink device structure, free pieces */
324 *linkp = link->next;
325 free_netdev(dev); 314 free_netdev(dev);
326} /* fmvj18x_detach */ 315} /* fmvj18x_detach */
327 316
@@ -807,7 +796,6 @@ static int __init init_fmvj18x_cs(void)
807static void __exit exit_fmvj18x_cs(void) 796static void __exit exit_fmvj18x_cs(void)
808{ 797{
809 pcmcia_unregister_driver(&fmvj18x_cs_driver); 798 pcmcia_unregister_driver(&fmvj18x_cs_driver);
810 BUG_ON(dev_list != NULL);
811} 799}
812 800
813module_init(init_fmvj18x_cs); 801module_init(init_fmvj18x_cs);
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 961294983354..90da35d1f4a5 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -116,8 +116,6 @@ static dev_info_t dev_info = "ibmtr_cs";
116static dev_link_t *ibmtr_attach(void); 116static dev_link_t *ibmtr_attach(void);
117static void ibmtr_detach(struct pcmcia_device *p_dev); 117static void ibmtr_detach(struct pcmcia_device *p_dev);
118 118
119static dev_link_t *dev_list;
120
121/*====================================================================*/ 119/*====================================================================*/
122 120
123typedef struct ibmtr_dev_t { 121typedef struct ibmtr_dev_t {
@@ -186,8 +184,7 @@ static dev_link_t *ibmtr_attach(void)
186 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 184 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
187 185
188 /* Register with Card Services */ 186 /* Register with Card Services */
189 link->next = dev_list; 187 link->next = NULL;
190 dev_list = link;
191 client_reg.dev_info = &dev_info; 188 client_reg.dev_info = &dev_info;
192 client_reg.Version = 0x0210; 189 client_reg.Version = 0x0210;
193 client_reg.event_callback_args.client_data = link; 190 client_reg.event_callback_args.client_data = link;
@@ -219,19 +216,10 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
219{ 216{
220 dev_link_t *link = dev_to_instance(p_dev); 217 dev_link_t *link = dev_to_instance(p_dev);
221 struct ibmtr_dev_t *info = link->priv; 218 struct ibmtr_dev_t *info = link->priv;
222 dev_link_t **linkp; 219 struct net_device *dev = info->dev;
223 struct net_device *dev;
224 220
225 DEBUG(0, "ibmtr_detach(0x%p)\n", link); 221 DEBUG(0, "ibmtr_detach(0x%p)\n", link);
226 222
227 /* Locate device structure */
228 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
229 if (*linkp == link) break;
230 if (*linkp == NULL)
231 return;
232
233 dev = info->dev;
234
235 if (link->dev) 223 if (link->dev)
236 unregister_netdev(dev); 224 unregister_netdev(dev);
237 225
@@ -242,10 +230,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
242 if (link->state & DEV_CONFIG) 230 if (link->state & DEV_CONFIG)
243 ibmtr_release(link); 231 ibmtr_release(link);
244 232
245 /* Unlink device structure, free bits */
246 *linkp = link->next;
247 free_netdev(dev); 233 free_netdev(dev);
248 kfree(info); 234 kfree(info);
249} /* ibmtr_detach */ 235} /* ibmtr_detach */
250 236
251/*====================================================================== 237/*======================================================================
@@ -530,7 +516,6 @@ static int __init init_ibmtr_cs(void)
530static void __exit exit_ibmtr_cs(void) 516static void __exit exit_ibmtr_cs(void)
531{ 517{
532 pcmcia_unregister_driver(&ibmtr_cs_driver); 518 pcmcia_unregister_driver(&ibmtr_cs_driver);
533 BUG_ON(dev_list != NULL);
534} 519}
535 520
536module_init(init_ibmtr_cs); 521module_init(init_ibmtr_cs);
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 011ceb090320..0c9cb9f49a81 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -389,7 +389,6 @@ DRV_NAME " " DRV_VERSION " (Roger C. Pao)";
389#endif 389#endif
390 390
391static dev_info_t dev_info="nmclan_cs"; 391static dev_info_t dev_info="nmclan_cs";
392static dev_link_t *dev_list;
393 392
394static char *if_names[]={ 393static char *if_names[]={
395 "Auto", "10baseT", "BNC", 394 "Auto", "10baseT", "BNC",
@@ -498,8 +497,7 @@ static dev_link_t *nmclan_attach(void)
498#endif 497#endif
499 498
500 /* Register with Card Services */ 499 /* Register with Card Services */
501 link->next = dev_list; 500 link->next = NULL;
502 dev_list = link;
503 client_reg.dev_info = &dev_info; 501 client_reg.dev_info = &dev_info;
504 client_reg.Version = 0x0210; 502 client_reg.Version = 0x0210;
505 client_reg.event_callback_args.client_data = link; 503 client_reg.event_callback_args.client_data = link;
@@ -525,24 +523,15 @@ static void nmclan_detach(struct pcmcia_device *p_dev)
525{ 523{
526 dev_link_t *link = dev_to_instance(p_dev); 524 dev_link_t *link = dev_to_instance(p_dev);
527 struct net_device *dev = link->priv; 525 struct net_device *dev = link->priv;
528 dev_link_t **linkp;
529 526
530 DEBUG(0, "nmclan_detach(0x%p)\n", link); 527 DEBUG(0, "nmclan_detach(0x%p)\n", link);
531 528
532 /* Locate device structure */
533 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
534 if (*linkp == link) break;
535 if (*linkp == NULL)
536 return;
537
538 if (link->dev) 529 if (link->dev)
539 unregister_netdev(dev); 530 unregister_netdev(dev);
540 531
541 if (link->state & DEV_CONFIG) 532 if (link->state & DEV_CONFIG)
542 nmclan_release(link); 533 nmclan_release(link);
543 534
544 /* Unlink device structure, free bits */
545 *linkp = link->next;
546 free_netdev(dev); 535 free_netdev(dev);
547} /* nmclan_detach */ 536} /* nmclan_detach */
548 537
@@ -1700,7 +1689,6 @@ static int __init init_nmclan_cs(void)
1700static void __exit exit_nmclan_cs(void) 1689static void __exit exit_nmclan_cs(void)
1701{ 1690{
1702 pcmcia_unregister_driver(&nmclan_cs_driver); 1691 pcmcia_unregister_driver(&nmclan_cs_driver);
1703 BUG_ON(dev_list != NULL);
1704} 1692}
1705 1693
1706module_init(init_nmclan_cs); 1694module_init(init_nmclan_cs);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index fb3e411d6daf..b35c951fc6fa 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -124,7 +124,6 @@ static dev_link_t *pcnet_attach(void);
124static void pcnet_detach(struct pcmcia_device *p_dev); 124static void pcnet_detach(struct pcmcia_device *p_dev);
125 125
126static dev_info_t dev_info = "pcnet_cs"; 126static dev_info_t dev_info = "pcnet_cs";
127static dev_link_t *dev_list;
128 127
129/*====================================================================*/ 128/*====================================================================*/
130 129
@@ -272,8 +271,7 @@ static dev_link_t *pcnet_attach(void)
272 dev->set_config = &set_config; 271 dev->set_config = &set_config;
273 272
274 /* Register with Card Services */ 273 /* Register with Card Services */
275 link->next = dev_list; 274 link->next = NULL;
276 dev_list = link;
277 client_reg.dev_info = &dev_info; 275 client_reg.dev_info = &dev_info;
278 client_reg.Version = 0x0210; 276 client_reg.Version = 0x0210;
279 client_reg.event_callback_args.client_data = link; 277 client_reg.event_callback_args.client_data = link;
@@ -300,24 +298,15 @@ static void pcnet_detach(struct pcmcia_device *p_dev)
300{ 298{
301 dev_link_t *link = dev_to_instance(p_dev); 299 dev_link_t *link = dev_to_instance(p_dev);
302 struct net_device *dev = link->priv; 300 struct net_device *dev = link->priv;
303 dev_link_t **linkp;
304 301
305 DEBUG(0, "pcnet_detach(0x%p)\n", link); 302 DEBUG(0, "pcnet_detach(0x%p)\n", link);
306 303
307 /* Locate device structure */
308 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
309 if (*linkp == link) break;
310 if (*linkp == NULL)
311 return;
312
313 if (link->dev) 304 if (link->dev)
314 unregister_netdev(dev); 305 unregister_netdev(dev);
315 306
316 if (link->state & DEV_CONFIG) 307 if (link->state & DEV_CONFIG)
317 pcnet_release(link); 308 pcnet_release(link);
318 309
319 /* Unlink device structure, free bits */
320 *linkp = link->next;
321 free_netdev(dev); 310 free_netdev(dev);
322} /* pcnet_detach */ 311} /* pcnet_detach */
323 312
@@ -1864,7 +1853,6 @@ static void __exit exit_pcnet_cs(void)
1864{ 1853{
1865 DEBUG(0, "pcnet_cs: unloading\n"); 1854 DEBUG(0, "pcnet_cs: unloading\n");
1866 pcmcia_unregister_driver(&pcnet_driver); 1855 pcmcia_unregister_driver(&pcnet_driver);
1867 BUG_ON(dev_list != NULL);
1868} 1856}
1869 1857
1870module_init(init_pcnet_cs); 1858module_init(init_pcnet_cs);
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 6cb5198d6094..9eb5cecfb2f5 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -104,8 +104,6 @@ static const char *version =
104 104
105static dev_info_t dev_info = "smc91c92_cs"; 105static dev_info_t dev_info = "smc91c92_cs";
106 106
107static dev_link_t *dev_list;
108
109struct smc_private { 107struct smc_private {
110 dev_link_t link; 108 dev_link_t link;
111 spinlock_t lock; 109 spinlock_t lock;
@@ -367,8 +365,7 @@ static dev_link_t *smc91c92_attach(void)
367 smc->mii_if.reg_num_mask = 0x1f; 365 smc->mii_if.reg_num_mask = 0x1f;
368 366
369 /* Register with Card Services */ 367 /* Register with Card Services */
370 link->next = dev_list; 368 link->next = NULL;
371 dev_list = link;
372 client_reg.dev_info = &dev_info; 369 client_reg.dev_info = &dev_info;
373 client_reg.Version = 0x0210; 370 client_reg.Version = 0x0210;
374 client_reg.event_callback_args.client_data = link; 371 client_reg.event_callback_args.client_data = link;
@@ -395,24 +392,15 @@ static void smc91c92_detach(struct pcmcia_device *p_dev)
395{ 392{
396 dev_link_t *link = dev_to_instance(p_dev); 393 dev_link_t *link = dev_to_instance(p_dev);
397 struct net_device *dev = link->priv; 394 struct net_device *dev = link->priv;
398 dev_link_t **linkp;
399 395
400 DEBUG(0, "smc91c92_detach(0x%p)\n", link); 396 DEBUG(0, "smc91c92_detach(0x%p)\n", link);
401 397
402 /* Locate device structure */
403 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
404 if (*linkp == link) break;
405 if (*linkp == NULL)
406 return;
407
408 if (link->dev) 398 if (link->dev)
409 unregister_netdev(dev); 399 unregister_netdev(dev);
410 400
411 if (link->state & DEV_CONFIG) 401 if (link->state & DEV_CONFIG)
412 smc91c92_release(link); 402 smc91c92_release(link);
413 403
414 /* Unlink device structure, free bits */
415 *linkp = link->next;
416 free_netdev(dev); 404 free_netdev(dev);
417} /* smc91c92_detach */ 405} /* smc91c92_detach */
418 406
@@ -2377,7 +2365,6 @@ static int __init init_smc91c92_cs(void)
2377static void __exit exit_smc91c92_cs(void) 2365static void __exit exit_smc91c92_cs(void)
2378{ 2366{
2379 pcmcia_unregister_driver(&smc91c92_cs_driver); 2367 pcmcia_unregister_driver(&smc91c92_cs_driver);
2380 BUG_ON(dev_list != NULL);
2381} 2368}
2382 2369
2383module_init(init_smc91c92_cs); 2370module_init(init_smc91c92_cs);
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 804e56771baf..8c8cc40bbb7d 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -331,15 +331,7 @@ static dev_info_t dev_info = "xirc2ps_cs";
331 * device numbers are used to derive the corresponding array index. 331 * device numbers are used to derive the corresponding array index.
332 */ 332 */
333 333
334static dev_link_t *dev_list;
335
336/**************** 334/****************
337 * A dev_link_t structure has fields for most things that are needed
338 * to keep track of a socket, but there will usually be some device
339 * specific information that also needs to be kept track of. The
340 * 'priv' pointer in a dev_link_t structure can be used to point to
341 * a device-specific private data structure, like this.
342 *
343 * A driver needs to provide a dev_node_t structure for each device 335 * A driver needs to provide a dev_node_t structure for each device
344 * on a card. In some cases, there is only one device per card (for 336 * on a card. In some cases, there is only one device per card (for
345 * example, ethernet cards, modems). In other cases, there may be 337 * example, ethernet cards, modems). In other cases, there may be
@@ -615,8 +607,7 @@ xirc2ps_attach(void)
615#endif 607#endif
616 608
617 /* Register with Card Services */ 609 /* Register with Card Services */
618 link->next = dev_list; 610 link->next = NULL;
619 dev_list = link;
620 client_reg.dev_info = &dev_info; 611 client_reg.dev_info = &dev_info;
621 client_reg.Version = 0x0210; 612 client_reg.Version = 0x0210;
622 client_reg.event_callback_args.client_data = link; 613 client_reg.event_callback_args.client_data = link;
@@ -641,27 +632,15 @@ xirc2ps_detach(struct pcmcia_device *p_dev)
641{ 632{
642 dev_link_t *link = dev_to_instance(p_dev); 633 dev_link_t *link = dev_to_instance(p_dev);
643 struct net_device *dev = link->priv; 634 struct net_device *dev = link->priv;
644 dev_link_t **linkp;
645 635
646 DEBUG(0, "detach(0x%p)\n", link); 636 DEBUG(0, "detach(0x%p)\n", link);
647 637
648 /* Locate device structure */
649 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
650 if (*linkp == link)
651 break;
652 if (!*linkp) {
653 DEBUG(0, "detach(0x%p): dev_link lost\n", link);
654 return;
655 }
656
657 if (link->dev) 638 if (link->dev)
658 unregister_netdev(dev); 639 unregister_netdev(dev);
659 640
660 if (link->state & DEV_CONFIG) 641 if (link->state & DEV_CONFIG)
661 xirc2ps_release(link); 642 xirc2ps_release(link);
662 643
663 /* Unlink device structure, free it */
664 *linkp = link->next;
665 free_netdev(dev); 644 free_netdev(dev);
666} /* xirc2ps_detach */ 645} /* xirc2ps_detach */
667 646
@@ -2020,7 +1999,6 @@ static void __exit
2020exit_xirc2ps_cs(void) 1999exit_xirc2ps_cs(void)
2021{ 2000{
2022 pcmcia_unregister_driver(&xirc2ps_cs_driver); 2001 pcmcia_unregister_driver(&xirc2ps_cs_driver);
2023 BUG_ON(dev_list != NULL);
2024} 2002}
2025 2003
2026module_init(init_xirc2ps_cs); 2004module_init(init_xirc2ps_cs);
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 7a28139544c0..88805a4c29f1 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -119,15 +119,7 @@ static dev_info_t dev_info = "airo_cs";
119 device numbers are used to derive the corresponding array index. 119 device numbers are used to derive the corresponding array index.
120*/ 120*/
121 121
122static dev_link_t *dev_list = NULL;
123
124/* 122/*
125 A dev_link_t structure has fields for most things that are needed
126 to keep track of a socket, but there will usually be some device
127 specific information that also needs to be kept track of. The
128 'priv' pointer in a dev_link_t structure can be used to point to
129 a device-specific private data structure, like this.
130
131 A driver needs to provide a dev_node_t structure for each device 123 A driver needs to provide a dev_node_t structure for each device
132 on a card. In some cases, there is only one device per card (for 124 on a card. In some cases, there is only one device per card (for
133 example, ethernet cards, modems). In other cases, there may be 125 example, ethernet cards, modems). In other cases, there may be
@@ -202,8 +194,7 @@ static dev_link_t *airo_attach(void)
202 link->priv = local; 194 link->priv = local;
203 195
204 /* Register with Card Services */ 196 /* Register with Card Services */
205 link->next = dev_list; 197 link->next = NULL;
206 dev_list = link;
207 client_reg.dev_info = &dev_info; 198 client_reg.dev_info = &dev_info;
208 client_reg.Version = 0x0210; 199 client_reg.Version = 0x0210;
209 client_reg.event_callback_args.client_data = link; 200 client_reg.event_callback_args.client_data = link;
@@ -229,29 +220,19 @@ static dev_link_t *airo_attach(void)
229static void airo_detach(struct pcmcia_device *p_dev) 220static void airo_detach(struct pcmcia_device *p_dev)
230{ 221{
231 dev_link_t *link = dev_to_instance(p_dev); 222 dev_link_t *link = dev_to_instance(p_dev);
232 dev_link_t **linkp; 223
233
234 DEBUG(0, "airo_detach(0x%p)\n", link); 224 DEBUG(0, "airo_detach(0x%p)\n", link);
235 225
236 /* Locate device structure */
237 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
238 if (*linkp == link) break;
239 if (*linkp == NULL)
240 return;
241
242 if (link->state & DEV_CONFIG) 226 if (link->state & DEV_CONFIG)
243 airo_release(link); 227 airo_release(link);
244 228
245 if ( ((local_info_t*)link->priv)->eth_dev ) { 229 if ( ((local_info_t*)link->priv)->eth_dev ) {
246 stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 ); 230 stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
247 } 231 }
248 ((local_info_t*)link->priv)->eth_dev = NULL; 232 ((local_info_t*)link->priv)->eth_dev = NULL;
249 233
250 /* Unlink device structure, free pieces */
251 *linkp = link->next;
252 kfree(link->priv); 234 kfree(link->priv);
253 kfree(link); 235 kfree(link);
254
255} /* airo_detach */ 236} /* airo_detach */
256 237
257/*====================================================================== 238/*======================================================================
@@ -574,7 +555,6 @@ static int airo_cs_init(void)
574static void airo_cs_cleanup(void) 555static void airo_cs_cleanup(void)
575{ 556{
576 pcmcia_unregister_driver(&airo_driver); 557 pcmcia_unregister_driver(&airo_driver);
577 BUG_ON(dev_list != NULL);
578} 558}
579 559
580/* 560/*
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 3ab33dd49ea2..32f009709355 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -130,15 +130,7 @@ static dev_info_t dev_info = "atmel_cs";
130 device numbers are used to derive the corresponding array index. 130 device numbers are used to derive the corresponding array index.
131*/ 131*/
132 132
133static dev_link_t *dev_list = NULL;
134
135/* 133/*
136 A dev_link_t structure has fields for most things that are needed
137 to keep track of a socket, but there will usually be some device
138 specific information that also needs to be kept track of. The
139 'priv' pointer in a dev_link_t structure can be used to point to
140 a device-specific private data structure, like this.
141
142 A driver needs to provide a dev_node_t structure for each device 134 A driver needs to provide a dev_node_t structure for each device
143 on a card. In some cases, there is only one device per card (for 135 on a card. In some cases, there is only one device per card (for
144 example, ethernet cards, modems). In other cases, there may be 136 example, ethernet cards, modems). In other cases, there may be
@@ -213,8 +205,7 @@ static dev_link_t *atmel_attach(void)
213 link->priv = local; 205 link->priv = local;
214 206
215 /* Register with Card Services */ 207 /* Register with Card Services */
216 link->next = dev_list; 208 link->next = NULL;
217 dev_list = link;
218 client_reg.dev_info = &dev_info; 209 client_reg.dev_info = &dev_info;
219 client_reg.Version = 0x0210; 210 client_reg.Version = 0x0210;
220 client_reg.event_callback_args.client_data = link; 211 client_reg.event_callback_args.client_data = link;
@@ -240,21 +231,12 @@ static dev_link_t *atmel_attach(void)
240static void atmel_detach(struct pcmcia_device *p_dev) 231static void atmel_detach(struct pcmcia_device *p_dev)
241{ 232{
242 dev_link_t *link = dev_to_instance(p_dev); 233 dev_link_t *link = dev_to_instance(p_dev);
243 dev_link_t **linkp; 234
244
245 DEBUG(0, "atmel_detach(0x%p)\n", link); 235 DEBUG(0, "atmel_detach(0x%p)\n", link);
246
247 /* Locate device structure */
248 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
249 if (*linkp == link) break;
250 if (*linkp == NULL)
251 return;
252 236
253 if (link->state & DEV_CONFIG) 237 if (link->state & DEV_CONFIG)
254 atmel_release(link); 238 atmel_release(link);
255 239
256 /* Unlink device structure, free pieces */
257 *linkp = link->next;
258 kfree(link->priv); 240 kfree(link->priv);
259 kfree(link); 241 kfree(link);
260} 242}
@@ -596,7 +578,6 @@ static int atmel_cs_init(void)
596static void atmel_cs_cleanup(void) 578static void atmel_cs_cleanup(void)
597{ 579{
598 pcmcia_unregister_driver(&atmel_driver); 580 pcmcia_unregister_driver(&atmel_driver);
599 BUG_ON(dev_list != NULL);
600} 581}
601 582
602/* 583/*
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 866142af7d92..195a5bf3d725 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -25,7 +25,6 @@
25 25
26static char *version = PRISM2_VERSION " (Jouni Malinen <jkmaline@cc.hut.fi>)"; 26static char *version = PRISM2_VERSION " (Jouni Malinen <jkmaline@cc.hut.fi>)";
27static dev_info_t dev_info = "hostap_cs"; 27static dev_info_t dev_info = "hostap_cs";
28static dev_link_t *dev_list = NULL;
29 28
30MODULE_AUTHOR("Jouni Malinen"); 29MODULE_AUTHOR("Jouni Malinen");
31MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " 30MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
@@ -520,8 +519,7 @@ static dev_link_t *prism2_attach(void)
520 link->conf.IntType = INT_MEMORY_AND_IO; 519 link->conf.IntType = INT_MEMORY_AND_IO;
521 520
522 /* register with CardServices */ 521 /* register with CardServices */
523 link->next = dev_list; 522 link->next = NULL;
524 dev_list = link;
525 client_reg.dev_info = &dev_info; 523 client_reg.dev_info = &dev_info;
526 client_reg.Version = 0x0210; 524 client_reg.Version = 0x0210;
527 client_reg.event_callback_args.client_data = link; 525 client_reg.event_callback_args.client_data = link;
@@ -538,24 +536,13 @@ static dev_link_t *prism2_attach(void)
538static void prism2_detach(struct pcmcia_device *p_dev) 536static void prism2_detach(struct pcmcia_device *p_dev)
539{ 537{
540 dev_link_t *link = dev_to_instance(p_dev); 538 dev_link_t *link = dev_to_instance(p_dev);
541 dev_link_t **linkp;
542 539
543 PDEBUG(DEBUG_FLOW, "prism2_detach\n"); 540 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
544 541
545 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
546 if (*linkp == link)
547 break;
548 if (*linkp == NULL) {
549 printk(KERN_WARNING "%s: Attempt to detach non-existing "
550 "PCMCIA client\n", dev_info);
551 return;
552 }
553
554 if (link->state & DEV_CONFIG) { 542 if (link->state & DEV_CONFIG) {
555 prism2_release((u_long)link); 543 prism2_release((u_long)link);
556 } 544 }
557 545
558 *linkp = link->next;
559 /* release net devices */ 546 /* release net devices */
560 if (link->priv) { 547 if (link->priv) {
561 struct hostap_cs_priv *hw_priv; 548 struct hostap_cs_priv *hw_priv;
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 1770677d9e10..af9a32d8d22d 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -228,17 +228,6 @@ static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev);
228static void set_multicast_list(struct net_device *dev); 228static void set_multicast_list(struct net_device *dev);
229 229
230/* 230/*
231 A linked list of "instances" of the skeleton device. Each actual
232 PCMCIA card corresponds to one device instance, and is described
233 by one dev_link_t structure (defined in ds.h).
234
235 You may not want to use a linked list for this -- for example, the
236 memory card driver uses an array of dev_link_t pointers, where minor
237 device numbers are used to derive the corresponding array index.
238*/
239static dev_link_t *dev_list;
240
241/*
242 A dev_link_t structure has fields for most things that are needed 231 A dev_link_t structure has fields for most things that are needed
243 to keep track of a socket, but there will usually be some device 232 to keep track of a socket, but there will usually be some device
244 specific information that also needs to be kept track of. The 233 specific information that also needs to be kept track of. The
@@ -451,8 +440,7 @@ static dev_link_t *netwave_attach(void)
451 link->irq.Instance = dev; 440 link->irq.Instance = dev;
452 441
453 /* Register with Card Services */ 442 /* Register with Card Services */
454 link->next = dev_list; 443 link->next = NULL;
455 dev_list = link;
456 client_reg.dev_info = &dev_info; 444 client_reg.dev_info = &dev_info;
457 client_reg.Version = 0x0210; 445 client_reg.Version = 0x0210;
458 client_reg.event_callback_args.client_data = link; 446 client_reg.event_callback_args.client_data = link;
@@ -476,37 +464,18 @@ static dev_link_t *netwave_attach(void)
476 */ 464 */
477static void netwave_detach(struct pcmcia_device *p_dev) 465static void netwave_detach(struct pcmcia_device *p_dev)
478{ 466{
479 dev_link_t *link = dev_to_instance(p_dev); 467 dev_link_t *link = dev_to_instance(p_dev);
480 struct net_device *dev = link->priv; 468 struct net_device *dev = link->priv;
481 dev_link_t **linkp;
482 469
483 DEBUG(0, "netwave_detach(0x%p)\n", link); 470 DEBUG(0, "netwave_detach(0x%p)\n", link);
484 471
485 /* 472 if (link->state & DEV_CONFIG)
486 If the device is currently configured and active, we won't 473 netwave_release(link);
487 actually delete it yet. Instead, it is marked so that when 474
488 the release() function is called, that will trigger a proper 475 if (link->dev)
489 detach(). 476 unregister_netdev(dev);
490 */ 477
491 if (link->state & DEV_CONFIG) 478 free_netdev(dev);
492 netwave_release(link);
493
494 /* Locate device structure */
495 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
496 if (*linkp == link) break;
497 if (*linkp == NULL)
498 {
499 DEBUG(1, "netwave_cs: detach fail, '%s' not in list\n",
500 link->dev->dev_name);
501 return;
502 }
503
504 /* Unlink device structure, free pieces */
505 *linkp = link->next;
506 if (link->dev)
507 unregister_netdev(dev);
508 free_netdev(dev);
509
510} /* netwave_detach */ 479} /* netwave_detach */
511 480
512/* 481/*
@@ -1503,7 +1472,6 @@ static int __init init_netwave_cs(void)
1503static void __exit exit_netwave_cs(void) 1472static void __exit exit_netwave_cs(void)
1504{ 1473{
1505 pcmcia_unregister_driver(&netwave_driver); 1474 pcmcia_unregister_driver(&netwave_driver);
1506 BUG_ON(dev_list != NULL);
1507} 1475}
1508 1476
1509module_init(init_netwave_cs); 1477module_init(init_netwave_cs);
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 00679b6c87c1..bfeeef49f0b3 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -69,12 +69,6 @@ struct orinoco_pccard {
69 unsigned long hard_reset_in_progress; 69 unsigned long hard_reset_in_progress;
70}; 70};
71 71
72/*
73 * A linked list of "instances" of the device. Each actual PCMCIA
74 * card corresponds to one device instance, and is described by one
75 * dev_link_t structure (defined in ds.h).
76 */
77static dev_link_t *dev_list; /* = NULL */
78 72
79/********************************************************************/ 73/********************************************************************/
80/* Function prototypes */ 74/* Function prototypes */
@@ -154,9 +148,7 @@ orinoco_cs_attach(void)
154 link->conf.IntType = INT_MEMORY_AND_IO; 148 link->conf.IntType = INT_MEMORY_AND_IO;
155 149
156 /* Register with Card Services */ 150 /* Register with Card Services */
157 /* FIXME: need a lock? */ 151 link->next = NULL;
158 link->next = dev_list;
159 dev_list = link;
160 152
161 client_reg.dev_info = &dev_info; 153 client_reg.dev_info = &dev_info;
162 client_reg.Version = 0x0210; /* FIXME: what does this mean? */ 154 client_reg.Version = 0x0210; /* FIXME: what does this mean? */
@@ -181,21 +173,11 @@ orinoco_cs_attach(void)
181static void orinoco_cs_detach(struct pcmcia_device *p_dev) 173static void orinoco_cs_detach(struct pcmcia_device *p_dev)
182{ 174{
183 dev_link_t *link = dev_to_instance(p_dev); 175 dev_link_t *link = dev_to_instance(p_dev);
184 dev_link_t **linkp;
185 struct net_device *dev = link->priv; 176 struct net_device *dev = link->priv;
186 177
187 /* Locate device structure */
188 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
189 if (*linkp == link)
190 break;
191
192 BUG_ON(*linkp == NULL);
193
194 if (link->state & DEV_CONFIG) 178 if (link->state & DEV_CONFIG)
195 orinoco_cs_release(link); 179 orinoco_cs_release(link);
196 180
197 /* Unlink device structure, and free it */
198 *linkp = link->next;
199 DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); 181 DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev);
200 if (link->dev) { 182 if (link->dev) {
201 DEBUG(0, PFX "About to unregister net device %p\n", 183 DEBUG(0, PFX "About to unregister net device %p\n",
@@ -678,7 +660,6 @@ static void __exit
678exit_orinoco_cs(void) 660exit_orinoco_cs(void)
679{ 661{
680 pcmcia_unregister_driver(&orinoco_driver); 662 pcmcia_unregister_driver(&orinoco_driver);
681 BUG_ON(dev_list != NULL);
682} 663}
683 664
684module_init(init_orinoco_cs); 665module_init(init_orinoco_cs);
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index a2dcab7995c1..1933250dad1a 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -78,13 +78,6 @@ struct orinoco_pccard {
78 dev_node_t node; 78 dev_node_t node;
79}; 79};
80 80
81/*
82 * A linked list of "instances" of the device. Each actual PCMCIA
83 * card corresponds to one device instance, and is described by one
84 * dev_link_t structure (defined in ds.h).
85 */
86static dev_link_t *dev_list; /* = NULL */
87
88/********************************************************************/ 81/********************************************************************/
89/* Function prototypes */ 82/* Function prototypes */
90/********************************************************************/ 83/********************************************************************/
@@ -637,8 +630,7 @@ spectrum_cs_attach(void)
637 630
638 /* Register with Card Services */ 631 /* Register with Card Services */
639 /* FIXME: need a lock? */ 632 /* FIXME: need a lock? */
640 link->next = dev_list; 633 link->next = NULL; /* not needed */
641 dev_list = link;
642 634
643 client_reg.dev_info = &dev_info; 635 client_reg.dev_info = &dev_info;
644 client_reg.Version = 0x0210; /* FIXME: what does this mean? */ 636 client_reg.Version = 0x0210; /* FIXME: what does this mean? */
@@ -1049,7 +1041,6 @@ static void __exit
1049exit_spectrum_cs(void) 1041exit_spectrum_cs(void)
1050{ 1042{
1051 pcmcia_unregister_driver(&orinoco_driver); 1043 pcmcia_unregister_driver(&orinoco_driver);
1052 BUG_ON(dev_list != NULL);
1053} 1044}
1054 1045
1055module_init(init_spectrum_cs); 1046module_init(init_spectrum_cs);
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 255952d8cea0..196e827fc846 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -4627,8 +4627,7 @@ wavelan_attach(void)
4627 link->conf.IntType = INT_MEMORY_AND_IO; 4627 link->conf.IntType = INT_MEMORY_AND_IO;
4628 4628
4629 /* Chain drivers */ 4629 /* Chain drivers */
4630 link->next = dev_list; 4630 link->next = NULL;
4631 dev_list = link;
4632 4631
4633 /* Allocate the generic data structure */ 4632 /* Allocate the generic data structure */
4634 dev = alloc_etherdev(sizeof(net_local)); 4633 dev = alloc_etherdev(sizeof(net_local));
@@ -4731,27 +4730,6 @@ wavelan_detach(struct pcmcia_device *p_dev)
4731 wv_pcmcia_release(link); 4730 wv_pcmcia_release(link);
4732 } 4731 }
4733 4732
4734 /* Remove the interface data from the linked list */
4735 if(dev_list == link)
4736 dev_list = link->next;
4737 else
4738 {
4739 dev_link_t * prev = dev_list;
4740
4741 while((prev != (dev_link_t *) NULL) && (prev->next != link))
4742 prev = prev->next;
4743
4744 if(prev == (dev_link_t *) NULL)
4745 {
4746#ifdef DEBUG_CONFIG_ERRORS
4747 printk(KERN_WARNING "wavelan_detach : Attempting to remove a nonexistent device.\n");
4748#endif
4749 return;
4750 }
4751
4752 prev->next = link->next;
4753 }
4754
4755 /* Free pieces */ 4733 /* Free pieces */
4756 if(link->priv) 4734 if(link->priv)
4757 { 4735 {
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index 3cb34817c039..a1a19177c5cd 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -766,7 +766,6 @@ static int
766/**************************** VARIABLES ****************************/ 766/**************************** VARIABLES ****************************/
767 767
768static dev_info_t dev_info = "wavelan_cs"; 768static dev_info_t dev_info = "wavelan_cs";
769static dev_link_t *dev_list = NULL; /* Linked list of devices */
770 769
771/* 770/*
772 * Parameters that can be set with 'insmod' 771 * Parameters that can be set with 'insmod'