aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:25:35 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:20 -0500
commitb463581154f3f3eecda27cae60df813fefcd84d3 (patch)
tree5e5b0f7a32b0727b64e52b9b2649897e6c841074 /drivers/net/pcmcia
parentf3990715589d378a2d3aa9b8accd78bb4a2378b7 (diff)
[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>
Diffstat (limited to 'drivers/net/pcmcia')
-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
10 files changed, 17 insertions, 155 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);