diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:25:51 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:24 -0500 |
commit | f8cfa618dccbdc6dab5297f75779566a388a98fd (patch) | |
tree | b91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/net/pcmcia/smc91c92_cs.c | |
parent | b463581154f3f3eecda27cae60df813fefcd84d3 (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/smc91c92_cs.c')
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 57 |
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 | ||
105 | static dev_info_t dev_info = "smc91c92_cs"; | ||
106 | |||
107 | struct smc_private { | 105 | struct 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 | ||
282 | static dev_link_t *smc91c92_attach(void); | ||
283 | static void smc91c92_detach(struct pcmcia_device *p_dev); | 280 | static void smc91c92_detach(struct pcmcia_device *p_dev); |
284 | static void smc91c92_config(dev_link_t *link); | 281 | static void smc91c92_config(dev_link_t *link); |
285 | static void smc91c92_release(dev_link_t *link); | 282 | static void smc91c92_release(dev_link_t *link); |
286 | static int smc91c92_event(event_t event, int priority, | ||
287 | event_callback_args_t *args); | ||
288 | 283 | ||
289 | static int smc_open(struct net_device *dev); | 284 | static int smc_open(struct net_device *dev); |
290 | static int smc_close(struct net_device *dev); | 285 | static int smc_close(struct net_device *dev); |
@@ -313,20 +308,18 @@ static struct ethtool_ops ethtool_ops; | |||
313 | 308 | ||
314 | ======================================================================*/ | 309 | ======================================================================*/ |
315 | 310 | ||
316 | static dev_link_t *smc91c92_attach(void) | 311 | static 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 | |||
1222 | static 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, |