diff options
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 74 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 80 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/netwave_cs.c | 68 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 58 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 68 | ||||
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 63 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.c | 84 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.p.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 60 |
10 files changed, 108 insertions, 510 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 88805a4c29f1..a496460ce224 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -82,8 +82,6 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); | |||
82 | 82 | ||
83 | static void airo_config(dev_link_t *link); | 83 | static void airo_config(dev_link_t *link); |
84 | static void airo_release(dev_link_t *link); | 84 | static void airo_release(dev_link_t *link); |
85 | static int airo_event(event_t event, int priority, | ||
86 | event_callback_args_t *args); | ||
87 | 85 | ||
88 | /* | 86 | /* |
89 | The attach() and detach() entry points are used to create and destroy | 87 | The attach() and detach() entry points are used to create and destroy |
@@ -91,7 +89,6 @@ static int airo_event(event_t event, int priority, | |||
91 | needed to manage one actual PCMCIA card. | 89 | needed to manage one actual PCMCIA card. |
92 | */ | 90 | */ |
93 | 91 | ||
94 | static dev_link_t *airo_attach(void); | ||
95 | static void airo_detach(struct pcmcia_device *p_dev); | 92 | static void airo_detach(struct pcmcia_device *p_dev); |
96 | 93 | ||
97 | /* | 94 | /* |
@@ -102,14 +99,6 @@ static void airo_detach(struct pcmcia_device *p_dev); | |||
102 | */ | 99 | */ |
103 | 100 | ||
104 | /* | 101 | /* |
105 | The dev_info variable is the "key" that is used to match up this | ||
106 | device driver with appropriate cards, through the card configuration | ||
107 | database. | ||
108 | */ | ||
109 | |||
110 | static dev_info_t dev_info = "airo_cs"; | ||
111 | |||
112 | /* | ||
113 | A linked list of "instances" of the aironet device. Each actual | 102 | A linked list of "instances" of the aironet device. Each actual |
114 | PCMCIA card corresponds to one device instance, and is described | 103 | PCMCIA card corresponds to one device instance, and is described |
115 | by one dev_link_t structure (defined in ds.h). | 104 | by one dev_link_t structure (defined in ds.h). |
@@ -152,20 +141,18 @@ typedef struct local_info_t { | |||
152 | 141 | ||
153 | ======================================================================*/ | 142 | ======================================================================*/ |
154 | 143 | ||
155 | static dev_link_t *airo_attach(void) | 144 | static int airo_attach(struct pcmcia_device *p_dev) |
156 | { | 145 | { |
157 | client_reg_t client_reg; | ||
158 | dev_link_t *link; | 146 | dev_link_t *link; |
159 | local_info_t *local; | 147 | local_info_t *local; |
160 | int ret; | 148 | |
161 | |||
162 | DEBUG(0, "airo_attach()\n"); | 149 | DEBUG(0, "airo_attach()\n"); |
163 | 150 | ||
164 | /* Initialize the dev_link_t structure */ | 151 | /* Initialize the dev_link_t structure */ |
165 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 152 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
166 | if (!link) { | 153 | if (!link) { |
167 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 154 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
168 | return NULL; | 155 | return -ENOMEM; |
169 | } | 156 | } |
170 | 157 | ||
171 | /* Interrupt setup */ | 158 | /* Interrupt setup */ |
@@ -189,23 +176,17 @@ static dev_link_t *airo_attach(void) | |||
189 | if (!local) { | 176 | if (!local) { |
190 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 177 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
191 | kfree (link); | 178 | kfree (link); |
192 | return NULL; | 179 | return -ENOMEM; |
193 | } | 180 | } |
194 | link->priv = local; | 181 | link->priv = local; |
195 | 182 | ||
196 | /* Register with Card Services */ | 183 | link->handle = p_dev; |
197 | link->next = NULL; | 184 | p_dev->instance = link; |
198 | client_reg.dev_info = &dev_info; | 185 | |
199 | client_reg.Version = 0x0210; | 186 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
200 | client_reg.event_callback_args.client_data = link; | 187 | airo_config(link); |
201 | ret = pcmcia_register_client(&link->handle, &client_reg); | 188 | |
202 | if (ret != 0) { | 189 | return 0; |
203 | cs_error(link->handle, RegisterClient, ret); | ||
204 | airo_detach(link->handle); | ||
205 | return NULL; | ||
206 | } | ||
207 | |||
208 | return link; | ||
209 | } /* airo_attach */ | 190 | } /* airo_attach */ |
210 | 191 | ||
211 | /*====================================================================== | 192 | /*====================================================================== |
@@ -497,34 +478,6 @@ static int airo_resume(struct pcmcia_device *p_dev) | |||
497 | return 0; | 478 | return 0; |
498 | } | 479 | } |
499 | 480 | ||
500 | /*====================================================================== | ||
501 | |||
502 | The card status event handler. Mostly, this schedules other | ||
503 | stuff to run after an event is received. | ||
504 | |||
505 | When a CARD_REMOVAL event is received, we immediately set a | ||
506 | private flag to block future accesses to this device. All the | ||
507 | functions that actually access the device should check this flag | ||
508 | to make sure the card is still present. | ||
509 | |||
510 | ======================================================================*/ | ||
511 | |||
512 | static int airo_event(event_t event, int priority, | ||
513 | event_callback_args_t *args) | ||
514 | { | ||
515 | dev_link_t *link = args->client_data; | ||
516 | |||
517 | DEBUG(1, "airo_event(0x%06x)\n", event); | ||
518 | |||
519 | switch (event) { | ||
520 | case CS_EVENT_CARD_INSERTION: | ||
521 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
522 | airo_config(link); | ||
523 | break; | ||
524 | } | ||
525 | return 0; | ||
526 | } /* airo_event */ | ||
527 | |||
528 | static struct pcmcia_device_id airo_ids[] = { | 481 | static struct pcmcia_device_id airo_ids[] = { |
529 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a), | 482 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a), |
530 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005), | 483 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005), |
@@ -539,8 +492,7 @@ static struct pcmcia_driver airo_driver = { | |||
539 | .drv = { | 492 | .drv = { |
540 | .name = "airo_cs", | 493 | .name = "airo_cs", |
541 | }, | 494 | }, |
542 | .attach = airo_attach, | 495 | .probe = airo_attach, |
543 | .event = airo_event, | ||
544 | .remove = airo_detach, | 496 | .remove = airo_detach, |
545 | .id_table = airo_ids, | 497 | .id_table = airo_ids, |
546 | .suspend = airo_suspend, | 498 | .suspend = airo_suspend, |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 32f009709355..d6f4a5a3e55a 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -93,8 +93,6 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards"); | |||
93 | 93 | ||
94 | static void atmel_config(dev_link_t *link); | 94 | static void atmel_config(dev_link_t *link); |
95 | static void atmel_release(dev_link_t *link); | 95 | static void atmel_release(dev_link_t *link); |
96 | static int atmel_event(event_t event, int priority, | ||
97 | event_callback_args_t *args); | ||
98 | 96 | ||
99 | /* | 97 | /* |
100 | The attach() and detach() entry points are used to create and destroy | 98 | The attach() and detach() entry points are used to create and destroy |
@@ -102,7 +100,6 @@ static int atmel_event(event_t event, int priority, | |||
102 | needed to manage one actual PCMCIA card. | 100 | needed to manage one actual PCMCIA card. |
103 | */ | 101 | */ |
104 | 102 | ||
105 | static dev_link_t *atmel_attach(void); | ||
106 | static void atmel_detach(struct pcmcia_device *p_dev); | 103 | static void atmel_detach(struct pcmcia_device *p_dev); |
107 | 104 | ||
108 | /* | 105 | /* |
@@ -113,14 +110,6 @@ static void atmel_detach(struct pcmcia_device *p_dev); | |||
113 | */ | 110 | */ |
114 | 111 | ||
115 | /* | 112 | /* |
116 | The dev_info variable is the "key" that is used to match up this | ||
117 | device driver with appropriate cards, through the card configuration | ||
118 | database. | ||
119 | */ | ||
120 | |||
121 | static dev_info_t dev_info = "atmel_cs"; | ||
122 | |||
123 | /* | ||
124 | A linked list of "instances" of the atmelnet device. Each actual | 113 | A linked list of "instances" of the atmelnet device. Each actual |
125 | PCMCIA card corresponds to one device instance, and is described | 114 | PCMCIA card corresponds to one device instance, and is described |
126 | by one dev_link_t structure (defined in ds.h). | 115 | by one dev_link_t structure (defined in ds.h). |
@@ -163,27 +152,25 @@ typedef struct local_info_t { | |||
163 | 152 | ||
164 | ======================================================================*/ | 153 | ======================================================================*/ |
165 | 154 | ||
166 | static dev_link_t *atmel_attach(void) | 155 | static int atmel_attach(struct pcmcia_device *p_dev) |
167 | { | 156 | { |
168 | client_reg_t client_reg; | ||
169 | dev_link_t *link; | 157 | dev_link_t *link; |
170 | local_info_t *local; | 158 | local_info_t *local; |
171 | int ret; | 159 | |
172 | |||
173 | DEBUG(0, "atmel_attach()\n"); | 160 | DEBUG(0, "atmel_attach()\n"); |
174 | 161 | ||
175 | /* Initialize the dev_link_t structure */ | 162 | /* Initialize the dev_link_t structure */ |
176 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 163 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
177 | if (!link) { | 164 | if (!link) { |
178 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 165 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
179 | return NULL; | 166 | return -ENOMEM; |
180 | } | 167 | } |
181 | 168 | ||
182 | /* Interrupt setup */ | 169 | /* Interrupt setup */ |
183 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 170 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
184 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 171 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
185 | link->irq.Handler = NULL; | 172 | link->irq.Handler = NULL; |
186 | 173 | ||
187 | /* | 174 | /* |
188 | General socket configuration defaults can go here. In this | 175 | General socket configuration defaults can go here. In this |
189 | client, we assume very little, and rely on the CIS for almost | 176 | client, we assume very little, and rely on the CIS for almost |
@@ -194,29 +181,23 @@ static dev_link_t *atmel_attach(void) | |||
194 | link->conf.Attributes = 0; | 181 | link->conf.Attributes = 0; |
195 | link->conf.Vcc = 50; | 182 | link->conf.Vcc = 50; |
196 | link->conf.IntType = INT_MEMORY_AND_IO; | 183 | link->conf.IntType = INT_MEMORY_AND_IO; |
197 | 184 | ||
198 | /* Allocate space for private device-specific data */ | 185 | /* Allocate space for private device-specific data */ |
199 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 186 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
200 | if (!local) { | 187 | if (!local) { |
201 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 188 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
202 | kfree (link); | 189 | kfree (link); |
203 | return NULL; | 190 | return -ENOMEM; |
204 | } | 191 | } |
205 | link->priv = local; | 192 | link->priv = local; |
206 | 193 | ||
207 | /* Register with Card Services */ | 194 | link->handle = p_dev; |
208 | link->next = NULL; | 195 | p_dev->instance = link; |
209 | client_reg.dev_info = &dev_info; | 196 | |
210 | client_reg.Version = 0x0210; | 197 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
211 | client_reg.event_callback_args.client_data = link; | 198 | atmel_config(link); |
212 | ret = pcmcia_register_client(&link->handle, &client_reg); | 199 | |
213 | if (ret != 0) { | 200 | return 0; |
214 | cs_error(link->handle, RegisterClient, ret); | ||
215 | atmel_detach(link->handle); | ||
216 | return NULL; | ||
217 | } | ||
218 | |||
219 | return link; | ||
220 | } /* atmel_attach */ | 201 | } /* atmel_attach */ |
221 | 202 | ||
222 | /*====================================================================== | 203 | /*====================================================================== |
@@ -485,34 +466,6 @@ static int atmel_resume(struct pcmcia_device *dev) | |||
485 | return 0; | 466 | return 0; |
486 | } | 467 | } |
487 | 468 | ||
488 | /*====================================================================== | ||
489 | |||
490 | The card status event handler. Mostly, this schedules other | ||
491 | stuff to run after an event is received. | ||
492 | |||
493 | When a CARD_REMOVAL event is received, we immediately set a | ||
494 | private flag to block future accesses to this device. All the | ||
495 | functions that actually access the device should check this flag | ||
496 | to make sure the card is still present. | ||
497 | |||
498 | ======================================================================*/ | ||
499 | |||
500 | static int atmel_event(event_t event, int priority, | ||
501 | event_callback_args_t *args) | ||
502 | { | ||
503 | dev_link_t *link = args->client_data; | ||
504 | |||
505 | DEBUG(1, "atmel_event(0x%06x)\n", event); | ||
506 | |||
507 | switch (event) { | ||
508 | case CS_EVENT_CARD_INSERTION: | ||
509 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
510 | atmel_config(link); | ||
511 | break; | ||
512 | } | ||
513 | return 0; | ||
514 | } /* atmel_event */ | ||
515 | |||
516 | /*====================================================================*/ | 469 | /*====================================================================*/ |
517 | /* We use the driver_info field to store the correct firmware type for a card. */ | 470 | /* We use the driver_info field to store the correct firmware type for a card. */ |
518 | 471 | ||
@@ -562,8 +515,7 @@ static struct pcmcia_driver atmel_driver = { | |||
562 | .drv = { | 515 | .drv = { |
563 | .name = "atmel_cs", | 516 | .name = "atmel_cs", |
564 | }, | 517 | }, |
565 | .attach = atmel_attach, | 518 | .probe = atmel_attach, |
566 | .event = atmel_event, | ||
567 | .remove = atmel_detach, | 519 | .remove = atmel_detach, |
568 | .id_table = atmel_ids, | 520 | .id_table = atmel_ids, |
569 | .suspend = atmel_suspend, | 521 | .suspend = atmel_suspend, |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 195a5bf3d725..8bc0b528548f 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -204,8 +204,7 @@ static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) | |||
204 | 204 | ||
205 | static void prism2_detach(struct pcmcia_device *p_dev); | 205 | static void prism2_detach(struct pcmcia_device *p_dev); |
206 | static void prism2_release(u_long arg); | 206 | static void prism2_release(u_long arg); |
207 | static int prism2_event(event_t event, int priority, | 207 | static int prism2_config(dev_link_t *link); |
208 | event_callback_args_t *args); | ||
209 | 208 | ||
210 | 209 | ||
211 | static int prism2_pccard_card_present(local_info_t *local) | 210 | static int prism2_pccard_card_present(local_info_t *local) |
@@ -502,15 +501,13 @@ static struct prism2_helper_functions prism2_pccard_funcs = | |||
502 | 501 | ||
503 | /* allocate local data and register with CardServices | 502 | /* allocate local data and register with CardServices |
504 | * initialize dev_link structure, but do not configure the card yet */ | 503 | * initialize dev_link structure, but do not configure the card yet */ |
505 | static dev_link_t *prism2_attach(void) | 504 | static int prism2_attach(struct pcmcia_device *p_dev) |
506 | { | 505 | { |
507 | dev_link_t *link; | 506 | dev_link_t *link; |
508 | client_reg_t client_reg; | ||
509 | int ret; | ||
510 | 507 | ||
511 | link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); | 508 | link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); |
512 | if (link == NULL) | 509 | if (link == NULL) |
513 | return NULL; | 510 | return -ENOMEM; |
514 | 511 | ||
515 | memset(link, 0, sizeof(dev_link_t)); | 512 | memset(link, 0, sizeof(dev_link_t)); |
516 | 513 | ||
@@ -518,18 +515,14 @@ static dev_link_t *prism2_attach(void) | |||
518 | link->conf.Vcc = 33; | 515 | link->conf.Vcc = 33; |
519 | link->conf.IntType = INT_MEMORY_AND_IO; | 516 | link->conf.IntType = INT_MEMORY_AND_IO; |
520 | 517 | ||
521 | /* register with CardServices */ | 518 | link->handle = p_dev; |
522 | link->next = NULL; | 519 | p_dev->instance = link; |
523 | client_reg.dev_info = &dev_info; | 520 | |
524 | client_reg.Version = 0x0210; | 521 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
525 | client_reg.event_callback_args.client_data = link; | 522 | if (prism2_config(link)) |
526 | ret = pcmcia_register_client(&link->handle, &client_reg); | 523 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); |
527 | if (ret != CS_SUCCESS) { | 524 | |
528 | cs_error(link->handle, RegisterClient, ret); | 525 | return 0; |
529 | prism2_detach(link->handle); | ||
530 | return NULL; | ||
531 | } | ||
532 | return link; | ||
533 | } | 526 | } |
534 | 527 | ||
535 | 528 | ||
@@ -878,29 +871,6 @@ static int hostap_cs_resume(struct pcmcia_device *p_dev) | |||
878 | return 0; | 871 | return 0; |
879 | } | 872 | } |
880 | 873 | ||
881 | static int prism2_event(event_t event, int priority, | ||
882 | event_callback_args_t *args) | ||
883 | { | ||
884 | dev_link_t *link = args->client_data; | ||
885 | |||
886 | switch (event) { | ||
887 | case CS_EVENT_CARD_INSERTION: | ||
888 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_CARD_INSERTION\n", dev_info); | ||
889 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
890 | if (prism2_config(link)) { | ||
891 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); | ||
892 | } | ||
893 | break; | ||
894 | |||
895 | default: | ||
896 | PDEBUG(DEBUG_EXTRA, "%s: prism2_event() - unknown event %d\n", | ||
897 | dev_info, event); | ||
898 | break; | ||
899 | } | ||
900 | return 0; | ||
901 | } | ||
902 | |||
903 | |||
904 | static struct pcmcia_device_id hostap_cs_ids[] = { | 874 | static struct pcmcia_device_id hostap_cs_ids[] = { |
905 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), | 875 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), |
906 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), | 876 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), |
@@ -959,10 +929,9 @@ static struct pcmcia_driver hostap_driver = { | |||
959 | .drv = { | 929 | .drv = { |
960 | .name = "hostap_cs", | 930 | .name = "hostap_cs", |
961 | }, | 931 | }, |
962 | .attach = prism2_attach, | 932 | .probe = prism2_attach, |
963 | .remove = prism2_detach, | 933 | .remove = prism2_detach, |
964 | .owner = THIS_MODULE, | 934 | .owner = THIS_MODULE, |
965 | .event = prism2_event, | ||
966 | .id_table = hostap_cs_ids, | 935 | .id_table = hostap_cs_ids, |
967 | .suspend = hostap_cs_suspend, | 936 | .suspend = hostap_cs_suspend, |
968 | .resume = hostap_cs_resume, | 937 | .resume = hostap_cs_resume, |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index af9a32d8d22d..bf6271ee387a 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -166,8 +166,6 @@ static char *version = | |||
166 | #define DEBUG(n, args...) | 166 | #define DEBUG(n, args...) |
167 | #endif | 167 | #endif |
168 | 168 | ||
169 | static dev_info_t dev_info = "netwave_cs"; | ||
170 | |||
171 | /*====================================================================*/ | 169 | /*====================================================================*/ |
172 | 170 | ||
173 | /* Parameters that can be set with 'insmod' */ | 171 | /* Parameters that can be set with 'insmod' */ |
@@ -195,11 +193,8 @@ module_param(mem_speed, int, 0); | |||
195 | 193 | ||
196 | /* PCMCIA (Card Services) related functions */ | 194 | /* PCMCIA (Card Services) related functions */ |
197 | static void netwave_release(dev_link_t *link); /* Card removal */ | 195 | static void netwave_release(dev_link_t *link); /* Card removal */ |
198 | static int netwave_event(event_t event, int priority, | ||
199 | event_callback_args_t *args); | ||
200 | static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card | 196 | static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card |
201 | insertion */ | 197 | insertion */ |
202 | static dev_link_t *netwave_attach(void); /* Create instance */ | ||
203 | static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ | 198 | static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ |
204 | 199 | ||
205 | /* Hardware configuration */ | 200 | /* Hardware configuration */ |
@@ -383,20 +378,18 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev) | |||
383 | * configure the card at this point -- we wait until we receive a | 378 | * configure the card at this point -- we wait until we receive a |
384 | * card insertion event. | 379 | * card insertion event. |
385 | */ | 380 | */ |
386 | static dev_link_t *netwave_attach(void) | 381 | static int netwave_attach(struct pcmcia_device *p_dev) |
387 | { | 382 | { |
388 | client_reg_t client_reg; | ||
389 | dev_link_t *link; | 383 | dev_link_t *link; |
390 | struct net_device *dev; | 384 | struct net_device *dev; |
391 | netwave_private *priv; | 385 | netwave_private *priv; |
392 | int ret; | 386 | |
393 | |||
394 | DEBUG(0, "netwave_attach()\n"); | 387 | DEBUG(0, "netwave_attach()\n"); |
395 | 388 | ||
396 | /* Initialize the dev_link_t structure */ | 389 | /* Initialize the dev_link_t structure */ |
397 | dev = alloc_etherdev(sizeof(netwave_private)); | 390 | dev = alloc_etherdev(sizeof(netwave_private)); |
398 | if (!dev) | 391 | if (!dev) |
399 | return NULL; | 392 | return -ENOMEM; |
400 | priv = netdev_priv(dev); | 393 | priv = netdev_priv(dev); |
401 | link = &priv->link; | 394 | link = &priv->link; |
402 | link->priv = dev; | 395 | link->priv = dev; |
@@ -438,20 +431,14 @@ static dev_link_t *netwave_attach(void) | |||
438 | dev->open = &netwave_open; | 431 | dev->open = &netwave_open; |
439 | dev->stop = &netwave_close; | 432 | dev->stop = &netwave_close; |
440 | link->irq.Instance = dev; | 433 | link->irq.Instance = dev; |
441 | |||
442 | /* Register with Card Services */ | ||
443 | link->next = NULL; | ||
444 | client_reg.dev_info = &dev_info; | ||
445 | client_reg.Version = 0x0210; | ||
446 | client_reg.event_callback_args.client_data = link; | ||
447 | ret = pcmcia_register_client(&link->handle, &client_reg); | ||
448 | if (ret != 0) { | ||
449 | cs_error(link->handle, RegisterClient, ret); | ||
450 | netwave_detach(link->handle); | ||
451 | return NULL; | ||
452 | } | ||
453 | 434 | ||
454 | return link; | 435 | link->handle = p_dev; |
436 | p_dev->instance = link; | ||
437 | |||
438 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
439 | netwave_pcmcia_config( link); | ||
440 | |||
441 | return 0; | ||
455 | } /* netwave_attach */ | 442 | } /* netwave_attach */ |
456 | 443 | ||
457 | /* | 444 | /* |
@@ -935,36 +922,6 @@ static int netwave_resume(struct pcmcia_device *p_dev) | |||
935 | 922 | ||
936 | 923 | ||
937 | /* | 924 | /* |
938 | * Function netwave_event (event, priority, args) | ||
939 | * | ||
940 | * The card status event handler. Mostly, this schedules other | ||
941 | * stuff to run after an event is received. A CARD_REMOVAL event | ||
942 | * also sets some flags to discourage the net drivers from trying | ||
943 | * to talk to the card any more. | ||
944 | * | ||
945 | * When a CARD_REMOVAL event is received, we immediately set a flag | ||
946 | * to block future accesses to this device. All the functions that | ||
947 | * actually access the device should check this flag to make sure | ||
948 | * the card is still present. | ||
949 | * | ||
950 | */ | ||
951 | static int netwave_event(event_t event, int priority, | ||
952 | event_callback_args_t *args) | ||
953 | { | ||
954 | dev_link_t *link = args->client_data; | ||
955 | |||
956 | DEBUG(1, "netwave_event(0x%06x)\n", event); | ||
957 | |||
958 | switch (event) { | ||
959 | case CS_EVENT_CARD_INSERTION: | ||
960 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
961 | netwave_pcmcia_config( link); | ||
962 | break; | ||
963 | } | ||
964 | return 0; | ||
965 | } /* netwave_event */ | ||
966 | |||
967 | /* | ||
968 | * Function netwave_doreset (ioBase, ramBase) | 925 | * Function netwave_doreset (ioBase, ramBase) |
969 | * | 926 | * |
970 | * Proper hardware reset of the card. | 927 | * Proper hardware reset of the card. |
@@ -1456,8 +1413,7 @@ static struct pcmcia_driver netwave_driver = { | |||
1456 | .drv = { | 1413 | .drv = { |
1457 | .name = "netwave_cs", | 1414 | .name = "netwave_cs", |
1458 | }, | 1415 | }, |
1459 | .attach = netwave_attach, | 1416 | .probe = netwave_attach, |
1460 | .event = netwave_event, | ||
1461 | .remove = netwave_detach, | 1417 | .remove = netwave_detach, |
1462 | .id_table = netwave_ids, | 1418 | .id_table = netwave_ids, |
1463 | .suspend = netwave_suspend, | 1419 | .suspend = netwave_suspend, |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index bfeeef49f0b3..b664708481cc 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -43,17 +43,6 @@ module_param(ignore_cis_vcc, int, 0); | |||
43 | MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); | 43 | MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); |
44 | 44 | ||
45 | /********************************************************************/ | 45 | /********************************************************************/ |
46 | /* Magic constants */ | ||
47 | /********************************************************************/ | ||
48 | |||
49 | /* | ||
50 | * The dev_info variable is the "key" that is used to match up this | ||
51 | * device driver with appropriate cards, through the card | ||
52 | * configuration database. | ||
53 | */ | ||
54 | static dev_info_t dev_info = DRIVER_NAME; | ||
55 | |||
56 | /********************************************************************/ | ||
57 | /* Data structures */ | 46 | /* Data structures */ |
58 | /********************************************************************/ | 47 | /********************************************************************/ |
59 | 48 | ||
@@ -74,6 +63,7 @@ struct orinoco_pccard { | |||
74 | /* Function prototypes */ | 63 | /* Function prototypes */ |
75 | /********************************************************************/ | 64 | /********************************************************************/ |
76 | 65 | ||
66 | static void orinoco_cs_config(dev_link_t *link); | ||
77 | static void orinoco_cs_release(dev_link_t *link); | 67 | static void orinoco_cs_release(dev_link_t *link); |
78 | static void orinoco_cs_detach(struct pcmcia_device *p_dev); | 68 | static void orinoco_cs_detach(struct pcmcia_device *p_dev); |
79 | 69 | ||
@@ -113,19 +103,17 @@ orinoco_cs_hard_reset(struct orinoco_private *priv) | |||
113 | * The dev_link structure is initialized, but we don't actually | 103 | * The dev_link structure is initialized, but we don't actually |
114 | * configure the card at this point -- we wait until we receive a card | 104 | * configure the card at this point -- we wait until we receive a card |
115 | * insertion event. */ | 105 | * insertion event. */ |
116 | static dev_link_t * | 106 | static int |
117 | orinoco_cs_attach(void) | 107 | orinoco_cs_attach(struct pcmcia_device *p_dev) |
118 | { | 108 | { |
119 | struct net_device *dev; | 109 | struct net_device *dev; |
120 | struct orinoco_private *priv; | 110 | struct orinoco_private *priv; |
121 | struct orinoco_pccard *card; | 111 | struct orinoco_pccard *card; |
122 | dev_link_t *link; | 112 | dev_link_t *link; |
123 | client_reg_t client_reg; | ||
124 | int ret; | ||
125 | 113 | ||
126 | dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); | 114 | dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); |
127 | if (! dev) | 115 | if (! dev) |
128 | return NULL; | 116 | return -ENOMEM; |
129 | priv = netdev_priv(dev); | 117 | priv = netdev_priv(dev); |
130 | card = priv->card; | 118 | card = priv->card; |
131 | 119 | ||
@@ -150,18 +138,13 @@ orinoco_cs_attach(void) | |||
150 | /* Register with Card Services */ | 138 | /* Register with Card Services */ |
151 | link->next = NULL; | 139 | link->next = NULL; |
152 | 140 | ||
153 | client_reg.dev_info = &dev_info; | 141 | link->handle = p_dev; |
154 | client_reg.Version = 0x0210; /* FIXME: what does this mean? */ | 142 | p_dev->instance = link; |
155 | client_reg.event_callback_args.client_data = link; | ||
156 | 143 | ||
157 | ret = pcmcia_register_client(&link->handle, &client_reg); | 144 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
158 | if (ret != CS_SUCCESS) { | 145 | orinoco_cs_config(link); |
159 | cs_error(link->handle, RegisterClient, ret); | ||
160 | orinoco_cs_detach(link->handle); | ||
161 | return NULL; | ||
162 | } | ||
163 | 146 | ||
164 | return link; | 147 | return 0; |
165 | } /* orinoco_cs_attach */ | 148 | } /* orinoco_cs_attach */ |
166 | 149 | ||
167 | /* | 150 | /* |
@@ -521,26 +504,6 @@ static int orinoco_cs_resume(struct pcmcia_device *p_dev) | |||
521 | } | 504 | } |
522 | 505 | ||
523 | 506 | ||
524 | /* | ||
525 | * The card status event handler. Mostly, this schedules other stuff | ||
526 | * to run after an event is received. | ||
527 | */ | ||
528 | static int | ||
529 | orinoco_cs_event(event_t event, int priority, | ||
530 | event_callback_args_t * args) | ||
531 | { | ||
532 | dev_link_t *link = args->client_data; | ||
533 | |||
534 | switch (event) { | ||
535 | case CS_EVENT_CARD_INSERTION: | ||
536 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
537 | orinoco_cs_config(link); | ||
538 | break; | ||
539 | } | ||
540 | |||
541 | return 0; | ||
542 | } /* orinoco_cs_event */ | ||
543 | |||
544 | /********************************************************************/ | 507 | /********************************************************************/ |
545 | /* Module initialization */ | 508 | /* Module initialization */ |
546 | /********************************************************************/ | 509 | /********************************************************************/ |
@@ -640,9 +603,8 @@ static struct pcmcia_driver orinoco_driver = { | |||
640 | .drv = { | 603 | .drv = { |
641 | .name = DRIVER_NAME, | 604 | .name = DRIVER_NAME, |
642 | }, | 605 | }, |
643 | .attach = orinoco_cs_attach, | 606 | .probe = orinoco_cs_attach, |
644 | .remove = orinoco_cs_detach, | 607 | .remove = orinoco_cs_detach, |
645 | .event = orinoco_cs_event, | ||
646 | .id_table = orinoco_cs_ids, | 608 | .id_table = orinoco_cs_ids, |
647 | .suspend = orinoco_cs_suspend, | 609 | .suspend = orinoco_cs_suspend, |
648 | .resume = orinoco_cs_resume, | 610 | .resume = orinoco_cs_resume, |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 33a89e292126..319180ca7e71 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -92,8 +92,6 @@ module_param(pc_debug, int, 0); | |||
92 | /** Prototypes based on PCMCIA skeleton driver *******************************/ | 92 | /** Prototypes based on PCMCIA skeleton driver *******************************/ |
93 | static void ray_config(dev_link_t *link); | 93 | static void ray_config(dev_link_t *link); |
94 | static void ray_release(dev_link_t *link); | 94 | static void ray_release(dev_link_t *link); |
95 | static int ray_event(event_t event, int priority, event_callback_args_t *args); | ||
96 | static dev_link_t *ray_attach(void); | ||
97 | static void ray_detach(struct pcmcia_device *p_dev); | 95 | static void ray_detach(struct pcmcia_device *p_dev); |
98 | 96 | ||
99 | /***** Prototypes indicated by device structure ******************************/ | 97 | /***** Prototypes indicated by device structure ******************************/ |
@@ -192,12 +190,6 @@ static int bc; | |||
192 | static char *phy_addr = NULL; | 190 | static char *phy_addr = NULL; |
193 | 191 | ||
194 | 192 | ||
195 | /* The dev_info variable is the "key" that is used to match up this | ||
196 | device driver with appropriate cards, through the card configuration | ||
197 | database. | ||
198 | */ | ||
199 | static dev_info_t dev_info = "ray_cs"; | ||
200 | |||
201 | /* A linked list of "instances" of the ray device. Each actual | 193 | /* A linked list of "instances" of the ray device. Each actual |
202 | PCMCIA card corresponds to one device instance, and is described | 194 | PCMCIA card corresponds to one device instance, and is described |
203 | by one dev_link_t structure (defined in ds.h). | 195 | by one dev_link_t structure (defined in ds.h). |
@@ -314,12 +306,10 @@ static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey@world. | |||
314 | configure the card at this point -- we wait until we receive a | 306 | configure the card at this point -- we wait until we receive a |
315 | card insertion event. | 307 | card insertion event. |
316 | =============================================================================*/ | 308 | =============================================================================*/ |
317 | static dev_link_t *ray_attach(void) | 309 | static int ray_attach(struct pcmcia_device *p_dev) |
318 | { | 310 | { |
319 | client_reg_t client_reg; | ||
320 | dev_link_t *link; | 311 | dev_link_t *link; |
321 | ray_dev_t *local; | 312 | ray_dev_t *local; |
322 | int ret; | ||
323 | struct net_device *dev; | 313 | struct net_device *dev; |
324 | 314 | ||
325 | DEBUG(1, "ray_attach()\n"); | 315 | DEBUG(1, "ray_attach()\n"); |
@@ -328,7 +318,7 @@ static dev_link_t *ray_attach(void) | |||
328 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 318 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
329 | 319 | ||
330 | if (!link) | 320 | if (!link) |
331 | return NULL; | 321 | return -ENOMEM; |
332 | 322 | ||
333 | /* Allocate space for private device-specific data */ | 323 | /* Allocate space for private device-specific data */ |
334 | dev = alloc_etherdev(sizeof(ray_dev_t)); | 324 | dev = alloc_etherdev(sizeof(ray_dev_t)); |
@@ -387,30 +377,19 @@ static dev_link_t *ray_attach(void) | |||
387 | dev->stop = &ray_dev_close; | 377 | dev->stop = &ray_dev_close; |
388 | netif_stop_queue(dev); | 378 | netif_stop_queue(dev); |
389 | 379 | ||
390 | /* Register with Card Services */ | 380 | init_timer(&local->timer); |
391 | link->next = dev_list; | ||
392 | dev_list = link; | ||
393 | client_reg.dev_info = &dev_info; | ||
394 | client_reg.Version = 0x0210; | ||
395 | client_reg.event_callback_args.client_data = link; | ||
396 | 381 | ||
397 | DEBUG(2,"ray_cs ray_attach calling pcmcia_register_client(...)\n"); | 382 | link->handle = p_dev; |
383 | p_dev->instance = link; | ||
398 | 384 | ||
399 | init_timer(&local->timer); | 385 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
386 | ray_config(link); | ||
400 | 387 | ||
401 | ret = pcmcia_register_client(&link->handle, &client_reg); | 388 | return 0; |
402 | if (ret != 0) { | ||
403 | printk("ray_cs ray_attach RegisterClient unhappy - detaching\n"); | ||
404 | cs_error(link->handle, RegisterClient, ret); | ||
405 | ray_detach(link->handle); | ||
406 | return NULL; | ||
407 | } | ||
408 | DEBUG(2,"ray_cs ray_attach ending\n"); | ||
409 | return link; | ||
410 | 389 | ||
411 | fail_alloc_dev: | 390 | fail_alloc_dev: |
412 | kfree(link); | 391 | kfree(link); |
413 | return NULL; | 392 | return -ENOMEM; |
414 | } /* ray_attach */ | 393 | } /* ray_attach */ |
415 | /*============================================================================= | 394 | /*============================================================================= |
416 | This deletes a driver "instance". The device is de-registered | 395 | This deletes a driver "instance". The device is de-registered |
@@ -924,32 +903,6 @@ static int ray_resume(struct pcmcia_device *p_dev) | |||
924 | return 0; | 903 | return 0; |
925 | } | 904 | } |
926 | 905 | ||
927 | /*============================================================================= | ||
928 | The card status event handler. Mostly, this schedules other | ||
929 | stuff to run after an event is received. A CARD_REMOVAL event | ||
930 | also sets some flags to discourage the net drivers from trying | ||
931 | to talk to the card any more. | ||
932 | |||
933 | When a CARD_REMOVAL event is received, we immediately set a flag | ||
934 | to block future accesses to this device. All the functions that | ||
935 | actually access the device should check this flag to make sure | ||
936 | the card is still present. | ||
937 | =============================================================================*/ | ||
938 | static int ray_event(event_t event, int priority, | ||
939 | event_callback_args_t *args) | ||
940 | { | ||
941 | dev_link_t *link = args->client_data; | ||
942 | DEBUG(1, "ray_event(0x%06x)\n", event); | ||
943 | |||
944 | switch (event) { | ||
945 | case CS_EVENT_CARD_INSERTION: | ||
946 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
947 | ray_config(link); | ||
948 | break; | ||
949 | } | ||
950 | return 0; | ||
951 | DEBUG(2,"ray_event ending\n"); | ||
952 | } /* ray_event */ | ||
953 | /*===========================================================================*/ | 906 | /*===========================================================================*/ |
954 | int ray_dev_init(struct net_device *dev) | 907 | int ray_dev_init(struct net_device *dev) |
955 | { | 908 | { |
@@ -2945,8 +2898,7 @@ static struct pcmcia_driver ray_driver = { | |||
2945 | .drv = { | 2898 | .drv = { |
2946 | .name = "ray_cs", | 2899 | .name = "ray_cs", |
2947 | }, | 2900 | }, |
2948 | .attach = ray_attach, | 2901 | .probe = ray_attach, |
2949 | .event = ray_event, | ||
2950 | .remove = ray_detach, | 2902 | .remove = ray_detach, |
2951 | .id_table = ray_ids, | 2903 | .id_table = ray_ids, |
2952 | .suspend = ray_suspend, | 2904 | .suspend = ray_suspend, |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 1933250dad1a..fee4be1ce810 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -57,17 +57,6 @@ module_param(ignore_cis_vcc, int, 0); | |||
57 | MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); | 57 | MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); |
58 | 58 | ||
59 | /********************************************************************/ | 59 | /********************************************************************/ |
60 | /* Magic constants */ | ||
61 | /********************************************************************/ | ||
62 | |||
63 | /* | ||
64 | * The dev_info variable is the "key" that is used to match up this | ||
65 | * device driver with appropriate cards, through the card | ||
66 | * configuration database. | ||
67 | */ | ||
68 | static dev_info_t dev_info = DRIVER_NAME; | ||
69 | |||
70 | /********************************************************************/ | ||
71 | /* Data structures */ | 60 | /* Data structures */ |
72 | /********************************************************************/ | 61 | /********************************************************************/ |
73 | 62 | ||
@@ -82,8 +71,8 @@ struct orinoco_pccard { | |||
82 | /* Function prototypes */ | 71 | /* Function prototypes */ |
83 | /********************************************************************/ | 72 | /********************************************************************/ |
84 | 73 | ||
74 | static void spectrum_cs_config(dev_link_t *link); | ||
85 | static void spectrum_cs_release(dev_link_t *link); | 75 | static void spectrum_cs_release(dev_link_t *link); |
86 | static void spectrum_cs_detach(struct pcmcia_device *p_dev); | ||
87 | 76 | ||
88 | /********************************************************************/ | 77 | /********************************************************************/ |
89 | /* Firmware downloader */ | 78 | /* Firmware downloader */ |
@@ -594,19 +583,17 @@ spectrum_cs_hard_reset(struct orinoco_private *priv) | |||
594 | * The dev_link structure is initialized, but we don't actually | 583 | * The dev_link structure is initialized, but we don't actually |
595 | * configure the card at this point -- we wait until we receive a card | 584 | * configure the card at this point -- we wait until we receive a card |
596 | * insertion event. */ | 585 | * insertion event. */ |
597 | static dev_link_t * | 586 | static int |
598 | spectrum_cs_attach(void) | 587 | spectrum_cs_attach(struct pcmcia_device *p_dev) |
599 | { | 588 | { |
600 | struct net_device *dev; | 589 | struct net_device *dev; |
601 | struct orinoco_private *priv; | 590 | struct orinoco_private *priv; |
602 | struct orinoco_pccard *card; | 591 | struct orinoco_pccard *card; |
603 | dev_link_t *link; | 592 | dev_link_t *link; |
604 | client_reg_t client_reg; | ||
605 | int ret; | ||
606 | 593 | ||
607 | dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); | 594 | dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); |
608 | if (! dev) | 595 | if (! dev) |
609 | return NULL; | 596 | return -ENOMEM; |
610 | priv = netdev_priv(dev); | 597 | priv = netdev_priv(dev); |
611 | card = priv->card; | 598 | card = priv->card; |
612 | 599 | ||
@@ -628,22 +615,13 @@ spectrum_cs_attach(void) | |||
628 | link->conf.Attributes = 0; | 615 | link->conf.Attributes = 0; |
629 | link->conf.IntType = INT_MEMORY_AND_IO; | 616 | link->conf.IntType = INT_MEMORY_AND_IO; |
630 | 617 | ||
631 | /* Register with Card Services */ | 618 | link->handle = p_dev; |
632 | /* FIXME: need a lock? */ | 619 | p_dev->instance = link; |
633 | link->next = NULL; /* not needed */ | ||
634 | 620 | ||
635 | client_reg.dev_info = &dev_info; | 621 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
636 | client_reg.Version = 0x0210; /* FIXME: what does this mean? */ | 622 | spectrum_cs_config(link); |
637 | client_reg.event_callback_args.client_data = link; | ||
638 | 623 | ||
639 | ret = pcmcia_register_client(&link->handle, &client_reg); | 624 | return 0; |
640 | if (ret != CS_SUCCESS) { | ||
641 | cs_error(link->handle, RegisterClient, ret); | ||
642 | spectrum_cs_detach(link->handle); | ||
643 | return NULL; | ||
644 | } | ||
645 | |||
646 | return link; | ||
647 | } /* spectrum_cs_attach */ | 625 | } /* spectrum_cs_attach */ |
648 | 626 | ||
649 | /* | 627 | /* |
@@ -977,26 +955,6 @@ spectrum_cs_resume(struct pcmcia_device *p_dev) | |||
977 | return 0; | 955 | return 0; |
978 | } | 956 | } |
979 | 957 | ||
980 | /* | ||
981 | * The card status event handler. Mostly, this schedules other stuff | ||
982 | * to run after an event is received. | ||
983 | */ | ||
984 | static int | ||
985 | spectrum_cs_event(event_t event, int priority, | ||
986 | event_callback_args_t * args) | ||
987 | { | ||
988 | dev_link_t *link = args->client_data; | ||
989 | |||
990 | switch (event) { | ||
991 | case CS_EVENT_CARD_INSERTION: | ||
992 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
993 | spectrum_cs_config(link); | ||
994 | break; | ||
995 | |||
996 | } | ||
997 | |||
998 | return 0; | ||
999 | } /* spectrum_cs_event */ | ||
1000 | 958 | ||
1001 | /********************************************************************/ | 959 | /********************************************************************/ |
1002 | /* Module initialization */ | 960 | /* Module initialization */ |
@@ -1021,11 +979,10 @@ static struct pcmcia_driver orinoco_driver = { | |||
1021 | .drv = { | 979 | .drv = { |
1022 | .name = DRIVER_NAME, | 980 | .name = DRIVER_NAME, |
1023 | }, | 981 | }, |
1024 | .attach = spectrum_cs_attach, | 982 | .probe = spectrum_cs_attach, |
1025 | .remove = spectrum_cs_detach, | 983 | .remove = spectrum_cs_detach, |
1026 | .suspend = spectrum_cs_suspend, | 984 | .suspend = spectrum_cs_suspend, |
1027 | .resume = spectrum_cs_resume, | 985 | .resume = spectrum_cs_resume, |
1028 | .event = spectrum_cs_event, | ||
1029 | .id_table = spectrum_cs_ids, | 986 | .id_table = spectrum_cs_ids, |
1030 | }; | 987 | }; |
1031 | 988 | ||
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 196e827fc846..7e2039f52c49 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -4594,14 +4594,12 @@ wavelan_close(struct net_device * dev) | |||
4594 | * configure the card at this point -- we wait until we receive a | 4594 | * configure the card at this point -- we wait until we receive a |
4595 | * card insertion event. | 4595 | * card insertion event. |
4596 | */ | 4596 | */ |
4597 | static dev_link_t * | 4597 | static int |
4598 | wavelan_attach(void) | 4598 | wavelan_attach(struct pcmcia_device *p_dev) |
4599 | { | 4599 | { |
4600 | client_reg_t client_reg; /* Register with cardmgr */ | ||
4601 | dev_link_t * link; /* Info for cardmgr */ | 4600 | dev_link_t * link; /* Info for cardmgr */ |
4602 | struct net_device * dev; /* Interface generic data */ | 4601 | struct net_device * dev; /* Interface generic data */ |
4603 | net_local * lp; /* Interface specific data */ | 4602 | net_local * lp; /* Interface specific data */ |
4604 | int ret; | ||
4605 | 4603 | ||
4606 | #ifdef DEBUG_CALLBACK_TRACE | 4604 | #ifdef DEBUG_CALLBACK_TRACE |
4607 | printk(KERN_DEBUG "-> wavelan_attach()\n"); | 4605 | printk(KERN_DEBUG "-> wavelan_attach()\n"); |
@@ -4609,7 +4607,7 @@ wavelan_attach(void) | |||
4609 | 4607 | ||
4610 | /* Initialize the dev_link_t structure */ | 4608 | /* Initialize the dev_link_t structure */ |
4611 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 4609 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
4612 | if (!link) return NULL; | 4610 | if (!link) return -ENOMEM; |
4613 | 4611 | ||
4614 | /* The io structure describes IO port mapping */ | 4612 | /* The io structure describes IO port mapping */ |
4615 | link->io.NumPorts1 = 8; | 4613 | link->io.NumPorts1 = 8; |
@@ -4633,7 +4631,7 @@ wavelan_attach(void) | |||
4633 | dev = alloc_etherdev(sizeof(net_local)); | 4631 | dev = alloc_etherdev(sizeof(net_local)); |
4634 | if (!dev) { | 4632 | if (!dev) { |
4635 | kfree(link); | 4633 | kfree(link); |
4636 | return NULL; | 4634 | return -ENOMEM; |
4637 | } | 4635 | } |
4638 | link->priv = link->irq.Instance = dev; | 4636 | link->priv = link->irq.Instance = dev; |
4639 | 4637 | ||
@@ -4678,28 +4676,21 @@ wavelan_attach(void) | |||
4678 | /* Other specific data */ | 4676 | /* Other specific data */ |
4679 | dev->mtu = WAVELAN_MTU; | 4677 | dev->mtu = WAVELAN_MTU; |
4680 | 4678 | ||
4681 | /* Register with Card Services */ | 4679 | link->handle = p_dev; |
4682 | client_reg.dev_info = &dev_info; | 4680 | p_dev->instance = link; |
4683 | client_reg.Version = 0x0210; | ||
4684 | client_reg.event_callback_args.client_data = link; | ||
4685 | |||
4686 | #ifdef DEBUG_CONFIG_INFO | ||
4687 | printk(KERN_DEBUG "wavelan_attach(): almost done, calling pcmcia_register_client\n"); | ||
4688 | #endif | ||
4689 | 4681 | ||
4690 | ret = pcmcia_register_client(&link->handle, &client_reg); | 4682 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
4691 | if(ret != 0) | 4683 | if(wv_pcmcia_config(link) && |
4692 | { | 4684 | wv_hw_config(dev)) |
4693 | cs_error(link->handle, RegisterClient, ret); | 4685 | wv_init_info(dev); |
4694 | wavelan_detach(link->handle); | 4686 | else |
4695 | return NULL; | 4687 | dev->irq = 0; |
4696 | } | ||
4697 | 4688 | ||
4698 | #ifdef DEBUG_CALLBACK_TRACE | 4689 | #ifdef DEBUG_CALLBACK_TRACE |
4699 | printk(KERN_DEBUG "<- wavelan_attach()\n"); | 4690 | printk(KERN_DEBUG "<- wavelan_attach()\n"); |
4700 | #endif | 4691 | #endif |
4701 | 4692 | ||
4702 | return link; | 4693 | return 0; |
4703 | } | 4694 | } |
4704 | 4695 | ||
4705 | /*------------------------------------------------------------------*/ | 4696 | /*------------------------------------------------------------------*/ |
@@ -4801,52 +4792,6 @@ static int wavelan_resume(struct pcmcia_device *p_dev) | |||
4801 | } | 4792 | } |
4802 | 4793 | ||
4803 | 4794 | ||
4804 | /*------------------------------------------------------------------*/ | ||
4805 | /* | ||
4806 | * The card status event handler. Mostly, this schedules other stuff | ||
4807 | * to run after an event is received. A CARD_REMOVAL event also sets | ||
4808 | * some flags to discourage the net drivers from trying to talk to the | ||
4809 | * card any more. | ||
4810 | */ | ||
4811 | static int | ||
4812 | wavelan_event(event_t event, /* The event received */ | ||
4813 | int priority, | ||
4814 | event_callback_args_t * args) | ||
4815 | { | ||
4816 | dev_link_t * link = (dev_link_t *) args->client_data; | ||
4817 | struct net_device * dev = (struct net_device *) link->priv; | ||
4818 | |||
4819 | #ifdef DEBUG_CALLBACK_TRACE | ||
4820 | printk(KERN_DEBUG "->wavelan_event(): %s\n", | ||
4821 | ((event == CS_EVENT_REGISTRATION_COMPLETE)?"registration complete" : | ||
4822 | ((event == CS_EVENT_CARD_REMOVAL) ? "card removal" : | ||
4823 | ((event == CS_EVENT_CARD_INSERTION) ? "card insertion" : | ||
4824 | ((event == CS_EVENT_PM_SUSPEND) ? "pm suspend" : | ||
4825 | ((event == CS_EVENT_RESET_PHYSICAL) ? "physical reset" : | ||
4826 | ((event == CS_EVENT_PM_RESUME) ? "pm resume" : | ||
4827 | ((event == CS_EVENT_CARD_RESET) ? "card reset" : | ||
4828 | "unknown")))))))); | ||
4829 | #endif | ||
4830 | |||
4831 | switch(event) | ||
4832 | { | ||
4833 | case CS_EVENT_CARD_INSERTION: | ||
4834 | /* Reset and configure the card */ | ||
4835 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
4836 | if(wv_pcmcia_config(link) && | ||
4837 | wv_hw_config(dev)) | ||
4838 | wv_init_info(dev); | ||
4839 | else | ||
4840 | dev->irq = 0; | ||
4841 | break; | ||
4842 | } | ||
4843 | |||
4844 | #ifdef DEBUG_CALLBACK_TRACE | ||
4845 | printk(KERN_DEBUG "<-wavelan_event()\n"); | ||
4846 | #endif | ||
4847 | return 0; | ||
4848 | } | ||
4849 | |||
4850 | static struct pcmcia_device_id wavelan_ids[] = { | 4795 | static struct pcmcia_device_id wavelan_ids[] = { |
4851 | PCMCIA_DEVICE_PROD_ID12("AT&T","WaveLAN/PCMCIA", 0xe7c5affd, 0x1bc50975), | 4796 | PCMCIA_DEVICE_PROD_ID12("AT&T","WaveLAN/PCMCIA", 0xe7c5affd, 0x1bc50975), |
4852 | PCMCIA_DEVICE_PROD_ID12("Digital", "RoamAbout/DS", 0x9999ab35, 0x00d05e06), | 4797 | PCMCIA_DEVICE_PROD_ID12("Digital", "RoamAbout/DS", 0x9999ab35, 0x00d05e06), |
@@ -4861,8 +4806,7 @@ static struct pcmcia_driver wavelan_driver = { | |||
4861 | .drv = { | 4806 | .drv = { |
4862 | .name = "wavelan_cs", | 4807 | .name = "wavelan_cs", |
4863 | }, | 4808 | }, |
4864 | .attach = wavelan_attach, | 4809 | .probe = wavelan_attach, |
4865 | .event = wavelan_event, | ||
4866 | .remove = wavelan_detach, | 4810 | .remove = wavelan_detach, |
4867 | .id_table = wavelan_ids, | 4811 | .id_table = wavelan_ids, |
4868 | .suspend = wavelan_suspend, | 4812 | .suspend = wavelan_suspend, |
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h index a1a19177c5cd..f2d597568151 100644 --- a/drivers/net/wireless/wavelan_cs.p.h +++ b/drivers/net/wireless/wavelan_cs.p.h | |||
@@ -754,19 +754,11 @@ static void | |||
754 | static int | 754 | static int |
755 | wavelan_open(struct net_device *), /* Open the device */ | 755 | wavelan_open(struct net_device *), /* Open the device */ |
756 | wavelan_close(struct net_device *); /* Close the device */ | 756 | wavelan_close(struct net_device *); /* Close the device */ |
757 | static dev_link_t * | ||
758 | wavelan_attach(void); /* Create a new device */ | ||
759 | static void | 757 | static void |
760 | wavelan_detach(struct pcmcia_device *p_dev); /* Destroy a removed device */ | 758 | wavelan_detach(struct pcmcia_device *p_dev); /* Destroy a removed device */ |
761 | static int | ||
762 | wavelan_event(event_t, /* Manage pcmcia events */ | ||
763 | int, | ||
764 | event_callback_args_t *); | ||
765 | 759 | ||
766 | /**************************** VARIABLES ****************************/ | 760 | /**************************** VARIABLES ****************************/ |
767 | 761 | ||
768 | static dev_info_t dev_info = "wavelan_cs"; | ||
769 | |||
770 | /* | 762 | /* |
771 | * Parameters that can be set with 'insmod' | 763 | * Parameters that can be set with 'insmod' |
772 | * The exact syntax is 'insmod wavelan_cs.o <var>=<value>' | 764 | * The exact syntax is 'insmod wavelan_cs.o <var>=<value>' |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 21e498fe7b14..48e10b0c7e74 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -105,7 +105,6 @@ module_param(pc_debug, int, 0); | |||
105 | */ | 105 | */ |
106 | static void wl3501_config(dev_link_t *link); | 106 | static void wl3501_config(dev_link_t *link); |
107 | static void wl3501_release(dev_link_t *link); | 107 | static void wl3501_release(dev_link_t *link); |
108 | static int wl3501_event(event_t event, int pri, event_callback_args_t *args); | ||
109 | 108 | ||
110 | /* | 109 | /* |
111 | * The dev_info variable is the "key" that is used to match up this | 110 | * The dev_info variable is the "key" that is used to match up this |
@@ -1954,18 +1953,16 @@ static const struct iw_handler_def wl3501_handler_def = { | |||
1954 | * The dev_link structure is initialized, but we don't actually configure the | 1953 | * The dev_link structure is initialized, but we don't actually configure the |
1955 | * card at this point -- we wait until we receive a card insertion event. | 1954 | * card at this point -- we wait until we receive a card insertion event. |
1956 | */ | 1955 | */ |
1957 | static dev_link_t *wl3501_attach(void) | 1956 | static int wl3501_attach(struct pcmcia_device *p_dev) |
1958 | { | 1957 | { |
1959 | client_reg_t client_reg; | ||
1960 | dev_link_t *link; | 1958 | dev_link_t *link; |
1961 | struct net_device *dev; | 1959 | struct net_device *dev; |
1962 | struct wl3501_card *this; | 1960 | struct wl3501_card *this; |
1963 | int ret; | ||
1964 | 1961 | ||
1965 | /* Initialize the dev_link_t structure */ | 1962 | /* Initialize the dev_link_t structure */ |
1966 | link = kzalloc(sizeof(*link), GFP_KERNEL); | 1963 | link = kzalloc(sizeof(*link), GFP_KERNEL); |
1967 | if (!link) | 1964 | if (!link) |
1968 | goto out; | 1965 | return -ENOMEM; |
1969 | 1966 | ||
1970 | /* The io structure describes IO port mapping */ | 1967 | /* The io structure describes IO port mapping */ |
1971 | link->io.NumPorts1 = 16; | 1968 | link->io.NumPorts1 = 16; |
@@ -2001,24 +1998,17 @@ static dev_link_t *wl3501_attach(void) | |||
2001 | netif_stop_queue(dev); | 1998 | netif_stop_queue(dev); |
2002 | link->priv = link->irq.Instance = dev; | 1999 | link->priv = link->irq.Instance = dev; |
2003 | 2000 | ||
2004 | /* Register with Card Services */ | 2001 | link->handle = p_dev; |
2005 | link->next = wl3501_dev_list; | 2002 | p_dev->instance = link; |
2006 | wl3501_dev_list = link; | 2003 | |
2007 | client_reg.dev_info = &wl3501_dev_info; | 2004 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
2008 | client_reg.Version = 0x0210; | 2005 | wl3501_config(link); |
2009 | client_reg.event_callback_args.client_data = link; | 2006 | |
2010 | ret = pcmcia_register_client(&link->handle, &client_reg); | 2007 | return 0; |
2011 | if (ret) { | ||
2012 | cs_error(link->handle, RegisterClient, ret); | ||
2013 | wl3501_detach(link->handle); | ||
2014 | link = NULL; | ||
2015 | } | ||
2016 | out: | ||
2017 | return link; | ||
2018 | out_link: | 2008 | out_link: |
2019 | kfree(link); | 2009 | kfree(link); |
2020 | link = NULL; | 2010 | link = NULL; |
2021 | goto out; | 2011 | return -ENOMEM; |
2022 | } | 2012 | } |
2023 | 2013 | ||
2024 | #define CS_CHECK(fn, ret) \ | 2014 | #define CS_CHECK(fn, ret) \ |
@@ -2206,33 +2196,6 @@ static int wl3501_resume(struct pcmcia_device *p_dev) | |||
2206 | } | 2196 | } |
2207 | 2197 | ||
2208 | 2198 | ||
2209 | /** | ||
2210 | * wl3501_event - The card status event handler | ||
2211 | * @event - event | ||
2212 | * @pri - priority | ||
2213 | * @args - arguments for this event | ||
2214 | * | ||
2215 | * The card status event handler. Mostly, this schedules other stuff to run | ||
2216 | * after an event is received. A CARD_REMOVAL event also sets some flags to | ||
2217 | * discourage the net drivers from trying to talk to the card any more. | ||
2218 | * | ||
2219 | * When a CARD_REMOVAL event is received, we immediately set a flag to block | ||
2220 | * future accesses to this device. All the functions that actually access the | ||
2221 | * device should check this flag to make sure the card is still present. | ||
2222 | */ | ||
2223 | static int wl3501_event(event_t event, int pri, event_callback_args_t *args) | ||
2224 | { | ||
2225 | dev_link_t *link = args->client_data; | ||
2226 | |||
2227 | switch (event) { | ||
2228 | case CS_EVENT_CARD_INSERTION: | ||
2229 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
2230 | wl3501_config(link); | ||
2231 | break; | ||
2232 | } | ||
2233 | return 0; | ||
2234 | } | ||
2235 | |||
2236 | static struct pcmcia_device_id wl3501_ids[] = { | 2199 | static struct pcmcia_device_id wl3501_ids[] = { |
2237 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0001), | 2200 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0001), |
2238 | PCMCIA_DEVICE_NULL | 2201 | PCMCIA_DEVICE_NULL |
@@ -2244,8 +2207,7 @@ static struct pcmcia_driver wl3501_driver = { | |||
2244 | .drv = { | 2207 | .drv = { |
2245 | .name = "wl3501_cs", | 2208 | .name = "wl3501_cs", |
2246 | }, | 2209 | }, |
2247 | .attach = wl3501_attach, | 2210 | .probe = wl3501_attach, |
2248 | .event = wl3501_event, | ||
2249 | .remove = wl3501_detach, | 2211 | .remove = wl3501_detach, |
2250 | .id_table = wl3501_ids, | 2212 | .id_table = wl3501_ids, |
2251 | .suspend = wl3501_suspend, | 2213 | .suspend = wl3501_suspend, |