aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
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/wireless
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/wireless')
-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
8 files changed, 23 insertions, 158 deletions
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'