aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:25:51 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:24 -0500
commitf8cfa618dccbdc6dab5297f75779566a388a98fd (patch)
treeb91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/net
parentb463581154f3f3eecda27cae60df813fefcd84d3 (diff)
[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback
Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified probe() callback. As all in-kernel drivers are changed to this new callback, there will be no temporary backwards-compatibility. Inside a probe() function, each driver _must_ set struct pcmcia_device *p_dev->instance and instance->handle correctly. With these patches, the basic driver interface for 16-bit PCMCIA drivers now has the classic four callbacks known also from other buses: int (*probe) (struct pcmcia_device *dev); void (*remove) (struct pcmcia_device *dev); int (*suspend) (struct pcmcia_device *dev); int (*resume) (struct pcmcia_device *dev); Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c55
-rw-r--r--drivers/net/pcmcia/3c589_cs.c63
-rw-r--r--drivers/net/pcmcia/axnet_cs.c59
-rw-r--r--drivers/net/pcmcia/com20020_cs.c59
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c54
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c69
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c57
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c45
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c57
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c67
-rw-r--r--drivers/net/wireless/airo_cs.c74
-rw-r--r--drivers/net/wireless/atmel_cs.c80
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c55
-rw-r--r--drivers/net/wireless/netwave_cs.c68
-rw-r--r--drivers/net/wireless/orinoco_cs.c58
-rw-r--r--drivers/net/wireless/ray_cs.c68
-rw-r--r--drivers/net/wireless/spectrum_cs.c63
-rw-r--r--drivers/net/wireless/wavelan_cs.c84
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h8
-rw-r--r--drivers/net/wireless/wl3501_cs.c60
20 files changed, 208 insertions, 995 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 8fcb63698ef1..48774efeec71 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -227,8 +227,6 @@ static char mii_preamble_required = 0;
227 227
228static void tc574_config(dev_link_t *link); 228static void tc574_config(dev_link_t *link);
229static void tc574_release(dev_link_t *link); 229static void tc574_release(dev_link_t *link);
230static int tc574_event(event_t event, int priority,
231 event_callback_args_t *args);
232 230
233static void mdio_sync(kio_addr_t ioaddr, int bits); 231static void mdio_sync(kio_addr_t ioaddr, int bits);
234static int mdio_read(kio_addr_t ioaddr, int phy_id, int location); 232static int mdio_read(kio_addr_t ioaddr, int phy_id, int location);
@@ -250,9 +248,6 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
250static struct ethtool_ops netdev_ethtool_ops; 248static struct ethtool_ops netdev_ethtool_ops;
251static void set_rx_mode(struct net_device *dev); 249static void set_rx_mode(struct net_device *dev);
252 250
253static dev_info_t dev_info = "3c574_cs";
254
255static dev_link_t *tc574_attach(void);
256static void tc574_detach(struct pcmcia_device *p_dev); 251static void tc574_detach(struct pcmcia_device *p_dev);
257 252
258/* 253/*
@@ -261,20 +256,18 @@ static void tc574_detach(struct pcmcia_device *p_dev);
261 with Card Services. 256 with Card Services.
262*/ 257*/
263 258
264static dev_link_t *tc574_attach(void) 259static int tc574_attach(struct pcmcia_device *p_dev)
265{ 260{
266 struct el3_private *lp; 261 struct el3_private *lp;
267 client_reg_t client_reg;
268 dev_link_t *link; 262 dev_link_t *link;
269 struct net_device *dev; 263 struct net_device *dev;
270 int ret;
271 264
272 DEBUG(0, "3c574_attach()\n"); 265 DEBUG(0, "3c574_attach()\n");
273 266
274 /* Create the PC card device object. */ 267 /* Create the PC card device object. */
275 dev = alloc_etherdev(sizeof(struct el3_private)); 268 dev = alloc_etherdev(sizeof(struct el3_private));
276 if (!dev) 269 if (!dev)
277 return NULL; 270 return -ENOMEM;
278 lp = netdev_priv(dev); 271 lp = netdev_priv(dev);
279 link = &lp->link; 272 link = &lp->link;
280 link->priv = dev; 273 link->priv = dev;
@@ -305,19 +298,13 @@ static dev_link_t *tc574_attach(void)
305 dev->watchdog_timeo = TX_TIMEOUT; 298 dev->watchdog_timeo = TX_TIMEOUT;
306#endif 299#endif
307 300
308 /* Register with Card Services */ 301 link->handle = p_dev;
309 link->next = NULL; 302 p_dev->instance = link;
310 client_reg.dev_info = &dev_info;
311 client_reg.Version = 0x0210;
312 client_reg.event_callback_args.client_data = link;
313 ret = pcmcia_register_client(&link->handle, &client_reg);
314 if (ret != 0) {
315 cs_error(link->handle, RegisterClient, ret);
316 tc574_detach(link->handle);
317 return NULL;
318 }
319 303
320 return link; 304 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
305 tc574_config(link);
306
307 return 0;
321} /* tc574_attach */ 308} /* tc574_attach */
322 309
323/* 310/*
@@ -565,29 +552,6 @@ static int tc574_resume(struct pcmcia_device *p_dev)
565 return 0; 552 return 0;
566} 553}
567 554
568/*
569 The card status event handler. Mostly, this schedules other
570 stuff to run after an event is received. A CARD_REMOVAL event
571 also sets some flags to discourage the net drivers from trying
572 to talk to the card any more.
573*/
574
575static int tc574_event(event_t event, int priority,
576 event_callback_args_t *args)
577{
578 dev_link_t *link = args->client_data;
579
580 DEBUG(1, "3c574_event(0x%06x)\n", event);
581
582 switch (event) {
583 case CS_EVENT_CARD_INSERTION:
584 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
585 tc574_config(link);
586 break;
587 }
588 return 0;
589} /* tc574_event */
590
591static void dump_status(struct net_device *dev) 555static void dump_status(struct net_device *dev)
592{ 556{
593 kio_addr_t ioaddr = dev->base_addr; 557 kio_addr_t ioaddr = dev->base_addr;
@@ -1282,8 +1246,7 @@ static struct pcmcia_driver tc574_driver = {
1282 .drv = { 1246 .drv = {
1283 .name = "3c574_cs", 1247 .name = "3c574_cs",
1284 }, 1248 },
1285 .attach = tc574_attach, 1249 .probe = tc574_attach,
1286 .event = tc574_event,
1287 .remove = tc574_detach, 1250 .remove = tc574_detach,
1288 .id_table = tc574_ids, 1251 .id_table = tc574_ids,
1289 .suspend = tc574_suspend, 1252 .suspend = tc574_suspend,
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 3516c02b9c89..1c3c9c666f74 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -143,8 +143,6 @@ DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
143 143
144static void tc589_config(dev_link_t *link); 144static void tc589_config(dev_link_t *link);
145static void tc589_release(dev_link_t *link); 145static void tc589_release(dev_link_t *link);
146static int tc589_event(event_t event, int priority,
147 event_callback_args_t *args);
148 146
149static u16 read_eeprom(kio_addr_t ioaddr, int index); 147static u16 read_eeprom(kio_addr_t ioaddr, int index);
150static void tc589_reset(struct net_device *dev); 148static void tc589_reset(struct net_device *dev);
@@ -161,9 +159,6 @@ static void el3_tx_timeout(struct net_device *dev);
161static void set_multicast_list(struct net_device *dev); 159static void set_multicast_list(struct net_device *dev);
162static struct ethtool_ops netdev_ethtool_ops; 160static struct ethtool_ops netdev_ethtool_ops;
163 161
164static dev_info_t dev_info = "3c589_cs";
165
166static dev_link_t *tc589_attach(void);
167static void tc589_detach(struct pcmcia_device *p_dev); 162static void tc589_detach(struct pcmcia_device *p_dev);
168 163
169/*====================================================================== 164/*======================================================================
@@ -174,20 +169,18 @@ static void tc589_detach(struct pcmcia_device *p_dev);
174 169
175======================================================================*/ 170======================================================================*/
176 171
177static dev_link_t *tc589_attach(void) 172static int tc589_attach(struct pcmcia_device *p_dev)
178{ 173{
179 struct el3_private *lp; 174 struct el3_private *lp;
180 client_reg_t client_reg;
181 dev_link_t *link; 175 dev_link_t *link;
182 struct net_device *dev; 176 struct net_device *dev;
183 int ret;
184 177
185 DEBUG(0, "3c589_attach()\n"); 178 DEBUG(0, "3c589_attach()\n");
186 179
187 /* Create new ethernet device */ 180 /* Create new ethernet device */
188 dev = alloc_etherdev(sizeof(struct el3_private)); 181 dev = alloc_etherdev(sizeof(struct el3_private));
189 if (!dev) 182 if (!dev)
190 return NULL; 183 return -ENOMEM;
191 lp = netdev_priv(dev); 184 lp = netdev_priv(dev);
192 link = &lp->link; 185 link = &lp->link;
193 link->priv = dev; 186 link->priv = dev;
@@ -204,7 +197,7 @@ static dev_link_t *tc589_attach(void)
204 link->conf.IntType = INT_MEMORY_AND_IO; 197 link->conf.IntType = INT_MEMORY_AND_IO;
205 link->conf.ConfigIndex = 1; 198 link->conf.ConfigIndex = 1;
206 link->conf.Present = PRESENT_OPTION; 199 link->conf.Present = PRESENT_OPTION;
207 200
208 /* The EL3-specific entries in the device structure. */ 201 /* The EL3-specific entries in the device structure. */
209 SET_MODULE_OWNER(dev); 202 SET_MODULE_OWNER(dev);
210 dev->hard_start_xmit = &el3_start_xmit; 203 dev->hard_start_xmit = &el3_start_xmit;
@@ -219,19 +212,13 @@ static dev_link_t *tc589_attach(void)
219#endif 212#endif
220 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 213 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
221 214
222 /* Register with Card Services */ 215 link->handle = p_dev;
223 link->next = NULL; 216 p_dev->instance = link;
224 client_reg.dev_info = &dev_info; 217
225 client_reg.Version = 0x0210; 218 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
226 client_reg.event_callback_args.client_data = link; 219 tc589_config(link);
227 ret = pcmcia_register_client(&link->handle, &client_reg); 220
228 if (ret != 0) { 221 return 0;
229 cs_error(link->handle, RegisterClient, ret);
230 tc589_detach(link->handle);
231 return NULL;
232 }
233
234 return link;
235} /* tc589_attach */ 222} /* tc589_attach */
236 223
237/*====================================================================== 224/*======================================================================
@@ -439,31 +426,6 @@ static int tc589_resume(struct pcmcia_device *p_dev)
439 return 0; 426 return 0;
440} 427}
441 428
442/*======================================================================
443
444 The card status event handler. Mostly, this schedules other
445 stuff to run after an event is received. A CARD_REMOVAL event
446 also sets some flags to discourage the net drivers from trying
447 to talk to the card any more.
448
449======================================================================*/
450
451static int tc589_event(event_t event, int priority,
452 event_callback_args_t *args)
453{
454 dev_link_t *link = args->client_data;
455
456 DEBUG(1, "3c589_event(0x%06x)\n", event);
457
458 switch (event) {
459 case CS_EVENT_CARD_INSERTION:
460 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
461 tc589_config(link);
462 break;
463 }
464 return 0;
465} /* tc589_event */
466
467/*====================================================================*/ 429/*====================================================================*/
468 430
469/* 431/*
@@ -1057,8 +1019,7 @@ static struct pcmcia_driver tc589_driver = {
1057 .drv = { 1019 .drv = {
1058 .name = "3c589_cs", 1020 .name = "3c589_cs",
1059 }, 1021 },
1060 .attach = tc589_attach, 1022 .probe = tc589_attach,
1061 .event = tc589_event,
1062 .remove = tc589_detach, 1023 .remove = tc589_detach,
1063 .id_table = tc589_ids, 1024 .id_table = tc589_ids,
1064 .suspend = tc589_suspend, 1025 .suspend = tc589_suspend,
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 3d36207d3332..01ddfc8cce3f 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -87,8 +87,6 @@ static char *version =
87 87
88static void axnet_config(dev_link_t *link); 88static void axnet_config(dev_link_t *link);
89static void axnet_release(dev_link_t *link); 89static void axnet_release(dev_link_t *link);
90static int axnet_event(event_t event, int priority,
91 event_callback_args_t *args);
92static int axnet_open(struct net_device *dev); 90static int axnet_open(struct net_device *dev);
93static int axnet_close(struct net_device *dev); 91static int axnet_close(struct net_device *dev);
94static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 92static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -107,11 +105,8 @@ static void block_input(struct net_device *dev, int count,
107static void block_output(struct net_device *dev, int count, 105static void block_output(struct net_device *dev, int count,
108 const u_char *buf, const int start_page); 106 const u_char *buf, const int start_page);
109 107
110static dev_link_t *axnet_attach(void);
111static void axnet_detach(struct pcmcia_device *p_dev); 108static void axnet_detach(struct pcmcia_device *p_dev);
112 109
113static dev_info_t dev_info = "axnet_cs";
114
115static void axdev_setup(struct net_device *dev); 110static void axdev_setup(struct net_device *dev);
116static void AX88190_init(struct net_device *dev, int startp); 111static void AX88190_init(struct net_device *dev, int startp);
117static int ax_open(struct net_device *dev); 112static int ax_open(struct net_device *dev);
@@ -146,13 +141,11 @@ static inline axnet_dev_t *PRIV(struct net_device *dev)
146 141
147======================================================================*/ 142======================================================================*/
148 143
149static dev_link_t *axnet_attach(void) 144static int axnet_attach(struct pcmcia_device *p_dev)
150{ 145{
151 axnet_dev_t *info; 146 axnet_dev_t *info;
152 dev_link_t *link; 147 dev_link_t *link;
153 struct net_device *dev; 148 struct net_device *dev;
154 client_reg_t client_reg;
155 int ret;
156 149
157 DEBUG(0, "axnet_attach()\n"); 150 DEBUG(0, "axnet_attach()\n");
158 151
@@ -160,7 +153,7 @@ static dev_link_t *axnet_attach(void)
160 "eth%d", axdev_setup); 153 "eth%d", axdev_setup);
161 154
162 if (!dev) 155 if (!dev)
163 return NULL; 156 return -ENOMEM;
164 157
165 info = PRIV(dev); 158 info = PRIV(dev);
166 link = &info->link; 159 link = &info->link;
@@ -175,19 +168,13 @@ static dev_link_t *axnet_attach(void)
175 dev->do_ioctl = &axnet_ioctl; 168 dev->do_ioctl = &axnet_ioctl;
176 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 169 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
177 170
178 /* Register with Card Services */ 171 link->handle = p_dev;
179 link->next = NULL; 172 p_dev->instance = link;
180 client_reg.dev_info = &dev_info;
181 client_reg.Version = 0x0210;
182 client_reg.event_callback_args.client_data = link;
183 ret = pcmcia_register_client(&link->handle, &client_reg);
184 if (ret != CS_SUCCESS) {
185 cs_error(link->handle, RegisterClient, ret);
186 axnet_detach(link->handle);
187 return NULL;
188 }
189 173
190 return link; 174 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
175 axnet_config(link);
176
177 return 0;
191} /* axnet_attach */ 178} /* axnet_attach */
192 179
193/*====================================================================== 180/*======================================================================
@@ -513,31 +500,6 @@ static int axnet_resume(struct pcmcia_device *p_dev)
513 500
514/*====================================================================== 501/*======================================================================
515 502
516 The card status event handler. Mostly, this schedules other
517 stuff to run after an event is received. A CARD_REMOVAL event
518 also sets some flags to discourage the net drivers from trying
519 to talk to the card any more.
520
521======================================================================*/
522
523static int axnet_event(event_t event, int priority,
524 event_callback_args_t *args)
525{
526 dev_link_t *link = args->client_data;
527
528 DEBUG(2, "axnet_event(0x%06x)\n", event);
529
530 switch (event) {
531 case CS_EVENT_CARD_INSERTION:
532 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
533 axnet_config(link);
534 break;
535 }
536 return 0;
537} /* axnet_event */
538
539/*======================================================================
540
541 MII interface support 503 MII interface support
542 504
543======================================================================*/ 505======================================================================*/
@@ -608,7 +570,7 @@ static int axnet_open(struct net_device *dev)
608 570
609 link->open++; 571 link->open++;
610 572
611 request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev); 573 request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, "axnet_cs", dev);
612 574
613 info->link_status = 0x00; 575 info->link_status = 0x00;
614 init_timer(&info->watchdog); 576 init_timer(&info->watchdog);
@@ -869,8 +831,7 @@ static struct pcmcia_driver axnet_cs_driver = {
869 .drv = { 831 .drv = {
870 .name = "axnet_cs", 832 .name = "axnet_cs",
871 }, 833 },
872 .attach = axnet_attach, 834 .probe = axnet_attach,
873 .event = axnet_event,
874 .remove = axnet_detach, 835 .remove = axnet_detach,
875 .id_table = axnet_ids, 836 .id_table = axnet_ids,
876 .suspend = axnet_suspend, 837 .suspend = axnet_suspend,
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index d48dbd3e153a..2827a48ea37c 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -120,12 +120,7 @@ MODULE_LICENSE("GPL");
120 120
121static void com20020_config(dev_link_t *link); 121static void com20020_config(dev_link_t *link);
122static void com20020_release(dev_link_t *link); 122static void com20020_release(dev_link_t *link);
123static int com20020_event(event_t event, int priority,
124 event_callback_args_t *args);
125 123
126static dev_info_t dev_info = "com20020_cs";
127
128static dev_link_t *com20020_attach(void);
129static void com20020_detach(struct pcmcia_device *p_dev); 124static void com20020_detach(struct pcmcia_device *p_dev);
130 125
131/*====================================================================*/ 126/*====================================================================*/
@@ -143,21 +138,19 @@ typedef struct com20020_dev_t {
143 138
144======================================================================*/ 139======================================================================*/
145 140
146static dev_link_t *com20020_attach(void) 141static int com20020_attach(struct pcmcia_device *p_dev)
147{ 142{
148 client_reg_t client_reg;
149 dev_link_t *link; 143 dev_link_t *link;
150 com20020_dev_t *info; 144 com20020_dev_t *info;
151 struct net_device *dev; 145 struct net_device *dev;
152 int ret;
153 struct arcnet_local *lp; 146 struct arcnet_local *lp;
154 147
155 DEBUG(0, "com20020_attach()\n"); 148 DEBUG(0, "com20020_attach()\n");
156 149
157 /* Create new network device */ 150 /* Create new network device */
158 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 151 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
159 if (!link) 152 if (!link)
160 return NULL; 153 return -ENOMEM;
161 154
162 info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); 155 info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
163 if (!info) 156 if (!info)
@@ -189,29 +182,19 @@ static dev_link_t *com20020_attach(void)
189 link->conf.IntType = INT_MEMORY_AND_IO; 182 link->conf.IntType = INT_MEMORY_AND_IO;
190 link->conf.Present = PRESENT_OPTION; 183 link->conf.Present = PRESENT_OPTION;
191 184
192
193 link->irq.Instance = info->dev = dev; 185 link->irq.Instance = info->dev = dev;
194 link->priv = info; 186 link->priv = info;
195 187
196 /* Register with Card Services */ 188 link->state |= DEV_PRESENT;
197 link->next = NULL; 189 com20020_config(link);
198 client_reg.dev_info = &dev_info;
199 client_reg.Version = 0x0210;
200 client_reg.event_callback_args.client_data = link;
201 ret = pcmcia_register_client(&link->handle, &client_reg);
202 if (ret != 0) {
203 cs_error(link->handle, RegisterClient, ret);
204 com20020_detach(link->handle);
205 return NULL;
206 }
207 190
208 return link; 191 return 0;
209 192
210fail_alloc_dev: 193fail_alloc_dev:
211 kfree(info); 194 kfree(info);
212fail_alloc_info: 195fail_alloc_info:
213 kfree(link); 196 kfree(link);
214 return NULL; 197 return -ENOMEM;
215} /* com20020_attach */ 198} /* com20020_attach */
216 199
217/*====================================================================== 200/*======================================================================
@@ -442,31 +425,6 @@ static int com20020_resume(struct pcmcia_device *p_dev)
442 return 0; 425 return 0;
443} 426}
444 427
445/*======================================================================
446
447 The card status event handler. Mostly, this schedules other
448 stuff to run after an event is received. A CARD_REMOVAL event
449 also sets some flags to discourage the net drivers from trying
450 to talk to the card any more.
451
452======================================================================*/
453
454static int com20020_event(event_t event, int priority,
455 event_callback_args_t *args)
456{
457 dev_link_t *link = args->client_data;
458
459 DEBUG(1, "com20020_event(0x%06x)\n", event);
460
461 switch (event) {
462 case CS_EVENT_CARD_INSERTION:
463 link->state |= DEV_PRESENT;
464 com20020_config(link);
465 break;
466 }
467 return 0;
468} /* com20020_event */
469
470static struct pcmcia_device_id com20020_ids[] = { 428static struct pcmcia_device_id com20020_ids[] = {
471 PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), 429 PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf),
472 PCMCIA_DEVICE_NULL 430 PCMCIA_DEVICE_NULL
@@ -478,8 +436,7 @@ static struct pcmcia_driver com20020_cs_driver = {
478 .drv = { 436 .drv = {
479 .name = "com20020_cs", 437 .name = "com20020_cs",
480 }, 438 },
481 .attach = com20020_attach, 439 .probe = com20020_attach,
482 .event = com20020_event,
483 .remove = com20020_detach, 440 .remove = com20020_detach,
484 .id_table = com20020_ids, 441 .id_table = com20020_ids,
485 .suspend = com20020_suspend, 442 .suspend = com20020_suspend,
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index dad6393052ff..28fe2fb4d6c0 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -88,9 +88,6 @@ static void fmvj18x_config(dev_link_t *link);
88static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id); 88static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id);
89static int fmvj18x_setup_mfc(dev_link_t *link); 89static int fmvj18x_setup_mfc(dev_link_t *link);
90static void fmvj18x_release(dev_link_t *link); 90static void fmvj18x_release(dev_link_t *link);
91static int fmvj18x_event(event_t event, int priority,
92 event_callback_args_t *args);
93static dev_link_t *fmvj18x_attach(void);
94static void fmvj18x_detach(struct pcmcia_device *p_dev); 91static void fmvj18x_detach(struct pcmcia_device *p_dev);
95 92
96/* 93/*
@@ -108,8 +105,6 @@ static void set_rx_mode(struct net_device *dev);
108static void fjn_tx_timeout(struct net_device *dev); 105static void fjn_tx_timeout(struct net_device *dev);
109static struct ethtool_ops netdev_ethtool_ops; 106static struct ethtool_ops netdev_ethtool_ops;
110 107
111static dev_info_t dev_info = "fmvj18x_cs";
112
113/* 108/*
114 card type 109 card type
115 */ 110 */
@@ -233,20 +228,18 @@ typedef struct local_info_t {
233#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */ 228#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
234#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */ 229#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */
235 230
236static dev_link_t *fmvj18x_attach(void) 231static int fmvj18x_attach(struct pcmcia_device *p_dev)
237{ 232{
238 local_info_t *lp; 233 local_info_t *lp;
239 dev_link_t *link; 234 dev_link_t *link;
240 struct net_device *dev; 235 struct net_device *dev;
241 client_reg_t client_reg; 236
242 int ret;
243
244 DEBUG(0, "fmvj18x_attach()\n"); 237 DEBUG(0, "fmvj18x_attach()\n");
245 238
246 /* Make up a FMVJ18x specific data structure */ 239 /* Make up a FMVJ18x specific data structure */
247 dev = alloc_etherdev(sizeof(local_info_t)); 240 dev = alloc_etherdev(sizeof(local_info_t));
248 if (!dev) 241 if (!dev)
249 return NULL; 242 return -ENOMEM;
250 lp = netdev_priv(dev); 243 lp = netdev_priv(dev);
251 link = &lp->link; 244 link = &lp->link;
252 link->priv = dev; 245 link->priv = dev;
@@ -261,7 +254,7 @@ static dev_link_t *fmvj18x_attach(void)
261 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 254 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
262 link->irq.Handler = &fjn_interrupt; 255 link->irq.Handler = &fjn_interrupt;
263 link->irq.Instance = dev; 256 link->irq.Instance = dev;
264 257
265 /* General socket configuration */ 258 /* General socket configuration */
266 link->conf.Attributes = CONF_ENABLE_IRQ; 259 link->conf.Attributes = CONF_ENABLE_IRQ;
267 link->conf.Vcc = 50; 260 link->conf.Vcc = 50;
@@ -280,20 +273,14 @@ static dev_link_t *fmvj18x_attach(void)
280 dev->watchdog_timeo = TX_TIMEOUT; 273 dev->watchdog_timeo = TX_TIMEOUT;
281#endif 274#endif
282 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 275 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
283
284 /* Register with Card Services */
285 link->next = NULL;
286 client_reg.dev_info = &dev_info;
287 client_reg.Version = 0x0210;
288 client_reg.event_callback_args.client_data = link;
289 ret = pcmcia_register_client(&link->handle, &client_reg);
290 if (ret != 0) {
291 cs_error(link->handle, RegisterClient, ret);
292 fmvj18x_detach(link->handle);
293 return NULL;
294 }
295 276
296 return link; 277 link->handle = p_dev;
278 p_dev->instance = link;
279
280 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
281 fmvj18x_config(link);
282
283 return 0;
297} /* fmvj18x_attach */ 284} /* fmvj18x_attach */
298 285
299/*====================================================================*/ 286/*====================================================================*/
@@ -734,22 +721,6 @@ static int fmvj18x_resume(struct pcmcia_device *p_dev)
734 721
735/*====================================================================*/ 722/*====================================================================*/
736 723
737static int fmvj18x_event(event_t event, int priority,
738 event_callback_args_t *args)
739{
740 dev_link_t *link = args->client_data;
741
742 DEBUG(1, "fmvj18x_event(0x%06x)\n", event);
743
744 switch (event) {
745 case CS_EVENT_CARD_INSERTION:
746 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
747 fmvj18x_config(link);
748 break;
749 }
750 return 0;
751} /* fmvj18x_event */
752
753static struct pcmcia_device_id fmvj18x_ids[] = { 724static struct pcmcia_device_id fmvj18x_ids[] = {
754 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004), 725 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004),
755 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59), 726 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59),
@@ -780,8 +751,7 @@ static struct pcmcia_driver fmvj18x_cs_driver = {
780 .drv = { 751 .drv = {
781 .name = "fmvj18x_cs", 752 .name = "fmvj18x_cs",
782 }, 753 },
783 .attach = fmvj18x_attach, 754 .probe = fmvj18x_attach,
784 .event = fmvj18x_event,
785 .remove = fmvj18x_detach, 755 .remove = fmvj18x_detach,
786 .id_table = fmvj18x_ids, 756 .id_table = fmvj18x_ids,
787 .suspend = fmvj18x_suspend, 757 .suspend = fmvj18x_suspend,
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 90da35d1f4a5..b9c7e39576f5 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -108,12 +108,6 @@ MODULE_LICENSE("GPL");
108static void ibmtr_config(dev_link_t *link); 108static void ibmtr_config(dev_link_t *link);
109static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase); 109static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase);
110static void ibmtr_release(dev_link_t *link); 110static void ibmtr_release(dev_link_t *link);
111static int ibmtr_event(event_t event, int priority,
112 event_callback_args_t *args);
113
114static dev_info_t dev_info = "ibmtr_cs";
115
116static dev_link_t *ibmtr_attach(void);
117static void ibmtr_detach(struct pcmcia_device *p_dev); 111static void ibmtr_detach(struct pcmcia_device *p_dev);
118 112
119/*====================================================================*/ 113/*====================================================================*/
@@ -144,25 +138,23 @@ static struct ethtool_ops netdev_ethtool_ops = {
144 138
145======================================================================*/ 139======================================================================*/
146 140
147static dev_link_t *ibmtr_attach(void) 141static int ibmtr_attach(struct pcmcia_device *p_dev)
148{ 142{
149 ibmtr_dev_t *info; 143 ibmtr_dev_t *info;
150 dev_link_t *link; 144 dev_link_t *link;
151 struct net_device *dev; 145 struct net_device *dev;
152 client_reg_t client_reg;
153 int ret;
154 146
155 DEBUG(0, "ibmtr_attach()\n"); 147 DEBUG(0, "ibmtr_attach()\n");
156 148
157 /* Create new token-ring device */ 149 /* Create new token-ring device */
158 info = kmalloc(sizeof(*info), GFP_KERNEL); 150 info = kmalloc(sizeof(*info), GFP_KERNEL);
159 if (!info) return NULL; 151 if (!info) return -ENOMEM;
160 memset(info,0,sizeof(*info)); 152 memset(info,0,sizeof(*info));
161 dev = alloc_trdev(sizeof(struct tok_info)); 153 dev = alloc_trdev(sizeof(struct tok_info));
162 if (!dev) { 154 if (!dev) {
163 kfree(info); 155 kfree(info);
164 return NULL; 156 return -ENOMEM;
165 } 157 }
166 158
167 link = &info->link; 159 link = &info->link;
168 link->priv = info; 160 link->priv = info;
@@ -183,24 +175,13 @@ static dev_link_t *ibmtr_attach(void)
183 175
184 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 176 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
185 177
186 /* Register with Card Services */ 178 link->handle = p_dev;
187 link->next = NULL; 179 p_dev->instance = link;
188 client_reg.dev_info = &dev_info;
189 client_reg.Version = 0x0210;
190 client_reg.event_callback_args.client_data = link;
191 ret = pcmcia_register_client(&link->handle, &client_reg);
192 if (ret != 0) {
193 cs_error(link->handle, RegisterClient, ret);
194 goto out_detach;
195 }
196 180
197out: 181 link->state |= DEV_PRESENT;
198 return link; 182 ibmtr_config(link);
199 183
200out_detach: 184 return 0;
201 ibmtr_detach(link->handle);
202 link = NULL;
203 goto out;
204} /* ibmtr_attach */ 185} /* ibmtr_attach */
205 186
206/*====================================================================== 187/*======================================================================
@@ -420,31 +401,6 @@ static int ibmtr_resume(struct pcmcia_device *p_dev)
420} 401}
421 402
422 403
423/*======================================================================
424
425 The card status event handler. Mostly, this schedules other
426 stuff to run after an event is received. A CARD_REMOVAL event
427 also sets some flags to discourage the net drivers from trying
428 to talk to the card any more.
429
430======================================================================*/
431
432static int ibmtr_event(event_t event, int priority,
433 event_callback_args_t *args)
434{
435 dev_link_t *link = args->client_data;
436
437 DEBUG(1, "ibmtr_event(0x%06x)\n", event);
438
439 switch (event) {
440 case CS_EVENT_CARD_INSERTION:
441 link->state |= DEV_PRESENT;
442 ibmtr_config(link);
443 break;
444 }
445 return 0;
446} /* ibmtr_event */
447
448/*====================================================================*/ 404/*====================================================================*/
449 405
450static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase) 406static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase)
@@ -500,8 +456,7 @@ static struct pcmcia_driver ibmtr_cs_driver = {
500 .drv = { 456 .drv = {
501 .name = "ibmtr_cs", 457 .name = "ibmtr_cs",
502 }, 458 },
503 .attach = ibmtr_attach, 459 .probe = ibmtr_attach,
504 .event = ibmtr_event,
505 .remove = ibmtr_detach, 460 .remove = ibmtr_detach,
506 .id_table = ibmtr_ids, 461 .id_table = ibmtr_ids,
507 .suspend = ibmtr_suspend, 462 .suspend = ibmtr_suspend,
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 0c9cb9f49a81..4a232254a497 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -388,8 +388,6 @@ static char *version =
388DRV_NAME " " DRV_VERSION " (Roger C. Pao)"; 388DRV_NAME " " DRV_VERSION " (Roger C. Pao)";
389#endif 389#endif
390 390
391static dev_info_t dev_info="nmclan_cs";
392
393static char *if_names[]={ 391static char *if_names[]={
394 "Auto", "10baseT", "BNC", 392 "Auto", "10baseT", "BNC",
395}; 393};
@@ -421,8 +419,6 @@ Function Prototypes
421 419
422static void nmclan_config(dev_link_t *link); 420static void nmclan_config(dev_link_t *link);
423static void nmclan_release(dev_link_t *link); 421static void nmclan_release(dev_link_t *link);
424static int nmclan_event(event_t event, int priority,
425 event_callback_args_t *args);
426 422
427static void nmclan_reset(struct net_device *dev); 423static void nmclan_reset(struct net_device *dev);
428static int mace_config(struct net_device *dev, struct ifmap *map); 424static int mace_config(struct net_device *dev, struct ifmap *map);
@@ -438,7 +434,6 @@ static void set_multicast_list(struct net_device *dev);
438static struct ethtool_ops netdev_ethtool_ops; 434static struct ethtool_ops netdev_ethtool_ops;
439 435
440 436
441static dev_link_t *nmclan_attach(void);
442static void nmclan_detach(struct pcmcia_device *p_dev); 437static void nmclan_detach(struct pcmcia_device *p_dev);
443 438
444/* ---------------------------------------------------------------------------- 439/* ----------------------------------------------------------------------------
@@ -448,13 +443,11 @@ nmclan_attach
448 Services. 443 Services.
449---------------------------------------------------------------------------- */ 444---------------------------------------------------------------------------- */
450 445
451static dev_link_t *nmclan_attach(void) 446static int nmclan_attach(struct pcmcia_device *p_dev)
452{ 447{
453 mace_private *lp; 448 mace_private *lp;
454 dev_link_t *link; 449 dev_link_t *link;
455 struct net_device *dev; 450 struct net_device *dev;
456 client_reg_t client_reg;
457 int ret;
458 451
459 DEBUG(0, "nmclan_attach()\n"); 452 DEBUG(0, "nmclan_attach()\n");
460 DEBUG(1, "%s\n", rcsid); 453 DEBUG(1, "%s\n", rcsid);
@@ -462,7 +455,7 @@ static dev_link_t *nmclan_attach(void)
462 /* Create new ethernet device */ 455 /* Create new ethernet device */
463 dev = alloc_etherdev(sizeof(mace_private)); 456 dev = alloc_etherdev(sizeof(mace_private));
464 if (!dev) 457 if (!dev)
465 return NULL; 458 return -ENOMEM;
466 lp = netdev_priv(dev); 459 lp = netdev_priv(dev);
467 link = &lp->link; 460 link = &lp->link;
468 link->priv = dev; 461 link->priv = dev;
@@ -496,19 +489,13 @@ static dev_link_t *nmclan_attach(void)
496 dev->watchdog_timeo = TX_TIMEOUT; 489 dev->watchdog_timeo = TX_TIMEOUT;
497#endif 490#endif
498 491
499 /* Register with Card Services */ 492 link->handle = p_dev;
500 link->next = NULL; 493 p_dev->instance = link;
501 client_reg.dev_info = &dev_info; 494
502 client_reg.Version = 0x0210; 495 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
503 client_reg.event_callback_args.client_data = link; 496 nmclan_config(link);
504 ret = pcmcia_register_client(&link->handle, &client_reg);
505 if (ret != 0) {
506 cs_error(link->handle, RegisterClient, ret);
507 nmclan_detach(link->handle);
508 return NULL;
509 }
510 497
511 return link; 498 return 0;
512} /* nmclan_attach */ 499} /* nmclan_attach */
513 500
514/* ---------------------------------------------------------------------------- 501/* ----------------------------------------------------------------------------
@@ -821,31 +808,6 @@ static int nmclan_resume(struct pcmcia_device *p_dev)
821 return 0; 808 return 0;
822} 809}
823 810
824/* ----------------------------------------------------------------------------
825nmclan_event
826 The card status event handler. Mostly, this schedules other
827 stuff to run after an event is received. A CARD_REMOVAL event
828 also sets some flags to discourage the net drivers from trying
829 to talk to the card any more.
830---------------------------------------------------------------------------- */
831static int nmclan_event(event_t event, int priority,
832 event_callback_args_t *args)
833{
834 dev_link_t *link = args->client_data;
835
836 DEBUG(1, "nmclan_event(0x%06x)\n", event);
837
838 switch (event) {
839 case CS_EVENT_CARD_INSERTION:
840 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
841 nmclan_config(link);
842 break;
843 case CS_EVENT_RESET_REQUEST:
844 return 1;
845 break;
846 }
847 return 0;
848} /* nmclan_event */
849 811
850/* ---------------------------------------------------------------------------- 812/* ----------------------------------------------------------------------------
851nmclan_reset 813nmclan_reset
@@ -1673,8 +1635,7 @@ static struct pcmcia_driver nmclan_cs_driver = {
1673 .drv = { 1635 .drv = {
1674 .name = "nmclan_cs", 1636 .name = "nmclan_cs",
1675 }, 1637 },
1676 .attach = nmclan_attach, 1638 .probe = nmclan_attach,
1677 .event = nmclan_event,
1678 .remove = nmclan_detach, 1639 .remove = nmclan_detach,
1679 .id_table = nmclan_ids, 1640 .id_table = nmclan_ids,
1680 .suspend = nmclan_suspend, 1641 .suspend = nmclan_suspend,
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index b35c951fc6fa..d85b758f3efa 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -105,8 +105,6 @@ module_param_array(hw_addr, int, NULL, 0);
105static void mii_phy_probe(struct net_device *dev); 105static void mii_phy_probe(struct net_device *dev);
106static void pcnet_config(dev_link_t *link); 106static void pcnet_config(dev_link_t *link);
107static void pcnet_release(dev_link_t *link); 107static void pcnet_release(dev_link_t *link);
108static int pcnet_event(event_t event, int priority,
109 event_callback_args_t *args);
110static int pcnet_open(struct net_device *dev); 108static int pcnet_open(struct net_device *dev);
111static int pcnet_close(struct net_device *dev); 109static int pcnet_close(struct net_device *dev);
112static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 110static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -120,7 +118,6 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
120static int setup_dma_config(dev_link_t *link, int start_pg, 118static int setup_dma_config(dev_link_t *link, int start_pg,
121 int stop_pg); 119 int stop_pg);
122 120
123static dev_link_t *pcnet_attach(void);
124static void pcnet_detach(struct pcmcia_device *p_dev); 121static void pcnet_detach(struct pcmcia_device *p_dev);
125 122
126static dev_info_t dev_info = "pcnet_cs"; 123static dev_info_t dev_info = "pcnet_cs";
@@ -243,19 +240,17 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev)
243 240
244======================================================================*/ 241======================================================================*/
245 242
246static dev_link_t *pcnet_attach(void) 243static int pcnet_probe(struct pcmcia_device *p_dev)
247{ 244{
248 pcnet_dev_t *info; 245 pcnet_dev_t *info;
249 dev_link_t *link; 246 dev_link_t *link;
250 struct net_device *dev; 247 struct net_device *dev;
251 client_reg_t client_reg;
252 int ret;
253 248
254 DEBUG(0, "pcnet_attach()\n"); 249 DEBUG(0, "pcnet_attach()\n");
255 250
256 /* Create new ethernet device */ 251 /* Create new ethernet device */
257 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); 252 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t));
258 if (!dev) return NULL; 253 if (!dev) return -ENOMEM;
259 info = PRIV(dev); 254 info = PRIV(dev);
260 link = &info->link; 255 link = &info->link;
261 link->priv = dev; 256 link->priv = dev;
@@ -270,19 +265,13 @@ static dev_link_t *pcnet_attach(void)
270 dev->stop = &pcnet_close; 265 dev->stop = &pcnet_close;
271 dev->set_config = &set_config; 266 dev->set_config = &set_config;
272 267
273 /* Register with Card Services */ 268 link->handle = p_dev;
274 link->next = NULL; 269 p_dev->instance = link;
275 client_reg.dev_info = &dev_info; 270
276 client_reg.Version = 0x0210; 271 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
277 client_reg.event_callback_args.client_data = link; 272 pcnet_config(link);
278 ret = pcmcia_register_client(&link->handle, &client_reg);
279 if (ret != CS_SUCCESS) {
280 cs_error(link->handle, RegisterClient, ret);
281 pcnet_detach(link->handle);
282 return NULL;
283 }
284 273
285 return link; 274 return 0;
286} /* pcnet_attach */ 275} /* pcnet_attach */
287 276
288/*====================================================================== 277/*======================================================================
@@ -800,21 +789,6 @@ static int pcnet_resume(struct pcmcia_device *p_dev)
800 return 0; 789 return 0;
801} 790}
802 791
803static int pcnet_event(event_t event, int priority,
804 event_callback_args_t *args)
805{
806 dev_link_t *link = args->client_data;
807
808 DEBUG(2, "pcnet_event(0x%06x)\n", event);
809
810 switch (event) {
811 case CS_EVENT_CARD_INSERTION:
812 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
813 pcnet_config(link);
814 break;
815 }
816 return 0;
817} /* pcnet_event */
818 792
819/*====================================================================== 793/*======================================================================
820 794
@@ -1835,8 +1809,7 @@ static struct pcmcia_driver pcnet_driver = {
1835 .drv = { 1809 .drv = {
1836 .name = "pcnet_cs", 1810 .name = "pcnet_cs",
1837 }, 1811 },
1838 .attach = pcnet_attach, 1812 .probe = pcnet_probe,
1839 .event = pcnet_event,
1840 .remove = pcnet_detach, 1813 .remove = pcnet_detach,
1841 .owner = THIS_MODULE, 1814 .owner = THIS_MODULE,
1842 .id_table = pcnet_ids, 1815 .id_table = pcnet_ids,
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 9eb5cecfb2f5..0122415dfeef 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -102,8 +102,6 @@ static const char *version =
102 currently have room for another Tx packet. */ 102 currently have room for another Tx packet. */
103#define MEMORY_WAIT_TIME 8 103#define MEMORY_WAIT_TIME 8
104 104
105static dev_info_t dev_info = "smc91c92_cs";
106
107struct smc_private { 105struct smc_private {
108 dev_link_t link; 106 dev_link_t link;
109 spinlock_t lock; 107 spinlock_t lock;
@@ -279,12 +277,9 @@ enum RxCfg { RxAllMulti = 0x0004, RxPromisc = 0x0002,
279 277
280/*====================================================================*/ 278/*====================================================================*/
281 279
282static dev_link_t *smc91c92_attach(void);
283static void smc91c92_detach(struct pcmcia_device *p_dev); 280static void smc91c92_detach(struct pcmcia_device *p_dev);
284static void smc91c92_config(dev_link_t *link); 281static void smc91c92_config(dev_link_t *link);
285static void smc91c92_release(dev_link_t *link); 282static void smc91c92_release(dev_link_t *link);
286static int smc91c92_event(event_t event, int priority,
287 event_callback_args_t *args);
288 283
289static int smc_open(struct net_device *dev); 284static int smc_open(struct net_device *dev);
290static int smc_close(struct net_device *dev); 285static int smc_close(struct net_device *dev);
@@ -313,20 +308,18 @@ static struct ethtool_ops ethtool_ops;
313 308
314======================================================================*/ 309======================================================================*/
315 310
316static dev_link_t *smc91c92_attach(void) 311static int smc91c92_attach(struct pcmcia_device *p_dev)
317{ 312{
318 client_reg_t client_reg;
319 struct smc_private *smc; 313 struct smc_private *smc;
320 dev_link_t *link; 314 dev_link_t *link;
321 struct net_device *dev; 315 struct net_device *dev;
322 int ret;
323 316
324 DEBUG(0, "smc91c92_attach()\n"); 317 DEBUG(0, "smc91c92_attach()\n");
325 318
326 /* Create new ethernet device */ 319 /* Create new ethernet device */
327 dev = alloc_etherdev(sizeof(struct smc_private)); 320 dev = alloc_etherdev(sizeof(struct smc_private));
328 if (!dev) 321 if (!dev)
329 return NULL; 322 return -ENOMEM;
330 smc = netdev_priv(dev); 323 smc = netdev_priv(dev);
331 link = &smc->link; 324 link = &smc->link;
332 link->priv = dev; 325 link->priv = dev;
@@ -364,19 +357,13 @@ static dev_link_t *smc91c92_attach(void)
364 smc->mii_if.phy_id_mask = 0x1f; 357 smc->mii_if.phy_id_mask = 0x1f;
365 smc->mii_if.reg_num_mask = 0x1f; 358 smc->mii_if.reg_num_mask = 0x1f;
366 359
367 /* Register with Card Services */ 360 link->handle = p_dev;
368 link->next = NULL; 361 p_dev->instance = link;
369 client_reg.dev_info = &dev_info;
370 client_reg.Version = 0x0210;
371 client_reg.event_callback_args.client_data = link;
372 ret = pcmcia_register_client(&link->handle, &client_reg);
373 if (ret != 0) {
374 cs_error(link->handle, RegisterClient, ret);
375 smc91c92_detach(link->handle);
376 return NULL;
377 }
378 362
379 return link; 363 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
364 smc91c92_config(link);
365
366 return 0;
380} /* smc91c92_attach */ 367} /* smc91c92_attach */
381 368
382/*====================================================================== 369/*======================================================================
@@ -1212,31 +1199,6 @@ static void smc91c92_release(dev_link_t *link)
1212 1199
1213/*====================================================================== 1200/*======================================================================
1214 1201
1215 The card status event handler. Mostly, this schedules other
1216 stuff to run after an event is received. A CARD_REMOVAL event
1217 also sets some flags to discourage the net drivers from trying
1218 to talk to the card any more.
1219
1220======================================================================*/
1221
1222static int smc91c92_event(event_t event, int priority,
1223 event_callback_args_t *args)
1224{
1225 dev_link_t *link = args->client_data;
1226
1227 DEBUG(1, "smc91c92_event(0x%06x)\n", event);
1228
1229 switch (event) {
1230 case CS_EVENT_CARD_INSERTION:
1231 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1232 smc91c92_config(link);
1233 break;
1234 }
1235 return 0;
1236} /* smc91c92_event */
1237
1238/*======================================================================
1239
1240 MII interface support for SMC91cXX based cards 1202 MII interface support for SMC91cXX based cards
1241======================================================================*/ 1203======================================================================*/
1242 1204
@@ -2349,8 +2311,7 @@ static struct pcmcia_driver smc91c92_cs_driver = {
2349 .drv = { 2311 .drv = {
2350 .name = "smc91c92_cs", 2312 .name = "smc91c92_cs",
2351 }, 2313 },
2352 .attach = smc91c92_attach, 2314 .probe = smc91c92_attach,
2353 .event = smc91c92_event,
2354 .remove = smc91c92_detach, 2315 .remove = smc91c92_detach,
2355 .id_table = smc91c92_ids, 2316 .id_table = smc91c92_ids,
2356 .suspend = smc91c92_suspend, 2317 .suspend = smc91c92_suspend,
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 8c8cc40bbb7d..049c34b37067 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -292,8 +292,6 @@ static void mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg,
292static int has_ce2_string(dev_link_t * link); 292static int has_ce2_string(dev_link_t * link);
293static void xirc2ps_config(dev_link_t * link); 293static void xirc2ps_config(dev_link_t * link);
294static void xirc2ps_release(dev_link_t * link); 294static void xirc2ps_release(dev_link_t * link);
295static int xirc2ps_event(event_t event, int priority,
296 event_callback_args_t * args);
297 295
298/**************** 296/****************
299 * The attach() and detach() entry points are used to create and destroy 297 * The attach() and detach() entry points are used to create and destroy
@@ -301,7 +299,6 @@ static int xirc2ps_event(event_t event, int priority,
301 * needed to manage one actual PCMCIA card. 299 * needed to manage one actual PCMCIA card.
302 */ 300 */
303 301
304static dev_link_t *xirc2ps_attach(void);
305static void xirc2ps_detach(struct pcmcia_device *p_dev); 302static void xirc2ps_detach(struct pcmcia_device *p_dev);
306 303
307/**************** 304/****************
@@ -313,14 +310,6 @@ static void xirc2ps_detach(struct pcmcia_device *p_dev);
313 310
314static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs); 311static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs);
315 312
316/*
317 * The dev_info variable is the "key" that is used to match up this
318 * device driver with appropriate cards, through the card configuration
319 * database.
320 */
321
322static dev_info_t dev_info = "xirc2ps_cs";
323
324/**************** 313/****************
325 * A linked list of "instances" of the device. Each actual 314 * A linked list of "instances" of the device. Each actual
326 * PCMCIA card corresponds to one device instance, and is described 315 * PCMCIA card corresponds to one device instance, and is described
@@ -563,21 +552,19 @@ mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg, unsigned data, int len)
563 * card insertion event. 552 * card insertion event.
564 */ 553 */
565 554
566static dev_link_t * 555static int
567xirc2ps_attach(void) 556xirc2ps_attach(struct pcmcia_device *p_dev)
568{ 557{
569 client_reg_t client_reg;
570 dev_link_t *link; 558 dev_link_t *link;
571 struct net_device *dev; 559 struct net_device *dev;
572 local_info_t *local; 560 local_info_t *local;
573 int err;
574 561
575 DEBUG(0, "attach()\n"); 562 DEBUG(0, "attach()\n");
576 563
577 /* Allocate the device structure */ 564 /* Allocate the device structure */
578 dev = alloc_etherdev(sizeof(local_info_t)); 565 dev = alloc_etherdev(sizeof(local_info_t));
579 if (!dev) 566 if (!dev)
580 return NULL; 567 return -ENOMEM;
581 local = netdev_priv(dev); 568 local = netdev_priv(dev);
582 link = &local->link; 569 link = &local->link;
583 link->priv = dev; 570 link->priv = dev;
@@ -606,18 +593,13 @@ xirc2ps_attach(void)
606 dev->watchdog_timeo = TX_TIMEOUT; 593 dev->watchdog_timeo = TX_TIMEOUT;
607#endif 594#endif
608 595
609 /* Register with Card Services */ 596 link->handle = p_dev;
610 link->next = NULL; 597 p_dev->instance = link;
611 client_reg.dev_info = &dev_info; 598
612 client_reg.Version = 0x0210; 599 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
613 client_reg.event_callback_args.client_data = link; 600 xirc2ps_config(link);
614 if ((err = pcmcia_register_client(&link->handle, &client_reg))) {
615 cs_error(link->handle, RegisterClient, err);
616 xirc2ps_detach(link->handle);
617 return NULL;
618 }
619 601
620 return link; 602 return 0;
621} /* xirc2ps_attach */ 603} /* xirc2ps_attach */
622 604
623/**************** 605/****************
@@ -1162,34 +1144,6 @@ static int xirc2ps_resume(struct pcmcia_device *p_dev)
1162 return 0; 1144 return 0;
1163} 1145}
1164 1146
1165/****************
1166 * The card status event handler. Mostly, this schedules other
1167 * stuff to run after an event is received. A CARD_REMOVAL event
1168 * also sets some flags to discourage the net drivers from trying
1169 * to talk to the card any more.
1170 *
1171 * When a CARD_REMOVAL event is received, we immediately set a flag
1172 * to block future accesses to this device. All the functions that
1173 * actually access the device should check this flag to make sure
1174 * the card is still present.
1175 */
1176
1177static int
1178xirc2ps_event(event_t event, int priority,
1179 event_callback_args_t * args)
1180{
1181 dev_link_t *link = args->client_data;
1182
1183 DEBUG(0, "event(%d)\n", (int)event);
1184
1185 switch (event) {
1186 case CS_EVENT_CARD_INSERTION:
1187 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1188 xirc2ps_config(link);
1189 break;
1190 }
1191 return 0;
1192} /* xirc2ps_event */
1193 1147
1194/*====================================================================*/ 1148/*====================================================================*/
1195 1149
@@ -1981,8 +1935,7 @@ static struct pcmcia_driver xirc2ps_cs_driver = {
1981 .drv = { 1935 .drv = {
1982 .name = "xirc2ps_cs", 1936 .name = "xirc2ps_cs",
1983 }, 1937 },
1984 .attach = xirc2ps_attach, 1938 .probe = xirc2ps_attach,
1985 .event = xirc2ps_event,
1986 .remove = xirc2ps_detach, 1939 .remove = xirc2ps_detach,
1987 .id_table = xirc2ps_ids, 1940 .id_table = xirc2ps_ids,
1988 .suspend = xirc2ps_suspend, 1941 .suspend = xirc2ps_suspend,
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
83static void airo_config(dev_link_t *link); 83static void airo_config(dev_link_t *link);
84static void airo_release(dev_link_t *link); 84static void airo_release(dev_link_t *link);
85static 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
94static dev_link_t *airo_attach(void);
95static void airo_detach(struct pcmcia_device *p_dev); 92static 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
110static 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
155static dev_link_t *airo_attach(void) 144static 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
512static 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
528static struct pcmcia_device_id airo_ids[] = { 481static 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
94static void atmel_config(dev_link_t *link); 94static void atmel_config(dev_link_t *link);
95static void atmel_release(dev_link_t *link); 95static void atmel_release(dev_link_t *link);
96static 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
105static dev_link_t *atmel_attach(void);
106static void atmel_detach(struct pcmcia_device *p_dev); 103static 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
121static 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
166static dev_link_t *atmel_attach(void) 155static 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
500static 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
205static void prism2_detach(struct pcmcia_device *p_dev); 205static void prism2_detach(struct pcmcia_device *p_dev);
206static void prism2_release(u_long arg); 206static void prism2_release(u_long arg);
207static int prism2_event(event_t event, int priority, 207static int prism2_config(dev_link_t *link);
208 event_callback_args_t *args);
209 208
210 209
211static int prism2_pccard_card_present(local_info_t *local) 210static 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 */
505static dev_link_t *prism2_attach(void) 504static 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
881static 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
904static struct pcmcia_device_id hostap_cs_ids[] = { 874static 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
169static 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 */
197static void netwave_release(dev_link_t *link); /* Card removal */ 195static void netwave_release(dev_link_t *link); /* Card removal */
198static int netwave_event(event_t event, int priority,
199 event_callback_args_t *args);
200static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card 196static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card
201 insertion */ 197 insertion */
202static dev_link_t *netwave_attach(void); /* Create instance */
203static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ 198static 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 */
386static dev_link_t *netwave_attach(void) 381static 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 */
951static 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);
43MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); 43MODULE_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 */
54static 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
66static void orinoco_cs_config(dev_link_t *link);
77static void orinoco_cs_release(dev_link_t *link); 67static void orinoco_cs_release(dev_link_t *link);
78static void orinoco_cs_detach(struct pcmcia_device *p_dev); 68static 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. */
116static dev_link_t * 106static int
117orinoco_cs_attach(void) 107orinoco_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 */
528static int
529orinoco_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 *******************************/
93static void ray_config(dev_link_t *link); 93static void ray_config(dev_link_t *link);
94static void ray_release(dev_link_t *link); 94static void ray_release(dev_link_t *link);
95static int ray_event(event_t event, int priority, event_callback_args_t *args);
96static dev_link_t *ray_attach(void);
97static void ray_detach(struct pcmcia_device *p_dev); 95static 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;
192static char *phy_addr = NULL; 190static 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*/
199static 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=============================================================================*/
317static dev_link_t *ray_attach(void) 309static 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
411fail_alloc_dev: 390fail_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=============================================================================*/
938static 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/*===========================================================================*/
954int ray_dev_init(struct net_device *dev) 907int 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);
57MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); 57MODULE_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 */
68static 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
74static void spectrum_cs_config(dev_link_t *link);
85static void spectrum_cs_release(dev_link_t *link); 75static void spectrum_cs_release(dev_link_t *link);
86static 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. */
597static dev_link_t * 586static int
598spectrum_cs_attach(void) 587spectrum_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 */
984static int
985spectrum_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 */
4597static dev_link_t * 4597static int
4598wavelan_attach(void) 4598wavelan_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 */
4811static int
4812wavelan_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
4850static struct pcmcia_device_id wavelan_ids[] = { 4795static 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
754static int 754static 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 */
757static dev_link_t *
758 wavelan_attach(void); /* Create a new device */
759static void 757static 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 */
761static int
762 wavelan_event(event_t, /* Manage pcmcia events */
763 int,
764 event_callback_args_t *);
765 759
766/**************************** VARIABLES ****************************/ 760/**************************** VARIABLES ****************************/
767 761
768static 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 */
106static void wl3501_config(dev_link_t *link); 106static void wl3501_config(dev_link_t *link);
107static void wl3501_release(dev_link_t *link); 107static void wl3501_release(dev_link_t *link);
108static 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 */
1957static dev_link_t *wl3501_attach(void) 1956static 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 }
2016out:
2017 return link;
2018out_link: 2008out_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 */
2223static 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
2236static struct pcmcia_device_id wl3501_ids[] = { 2199static 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,