aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
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/pcmcia
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/pcmcia')
-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
10 files changed, 100 insertions, 485 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,