aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c574_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/3c574_cs.c')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c55
1 files changed, 9 insertions, 46 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,