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