diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:21:18 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 17:59:02 -0500 |
commit | 98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch) | |
tree | b3d46f0643352e541d6a39e6da09059687cf713d /drivers/net/pcmcia/com20020_cs.c | |
parent | 63e7ebd06402951bc8863ba5b7bc9b9f42044849 (diff) |
[PATCH] pcmcia: new suspend core
Move the suspend and resume methods out of the event handler, and into
special functions. Also use these functions for pre- and post-reset, as
almost all drivers already do, and the remaining ones can easily be
converted.
Bugfix to include/pcmcia/ds.c
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia/com20020_cs.c')
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index b9355d9498a3..68612222de6e 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -421,6 +421,42 @@ static void com20020_release(dev_link_t *link) | |||
421 | link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING); | 421 | link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING); |
422 | } | 422 | } |
423 | 423 | ||
424 | static int com20020_suspend(struct pcmcia_device *p_dev) | ||
425 | { | ||
426 | dev_link_t *link = dev_to_instance(p_dev); | ||
427 | com20020_dev_t *info = link->priv; | ||
428 | struct net_device *dev = info->dev; | ||
429 | |||
430 | link->state |= DEV_SUSPEND; | ||
431 | if (link->state & DEV_CONFIG) { | ||
432 | if (link->open) { | ||
433 | netif_device_detach(dev); | ||
434 | } | ||
435 | pcmcia_release_configuration(link->handle); | ||
436 | } | ||
437 | |||
438 | return 0; | ||
439 | } | ||
440 | |||
441 | static int com20020_resume(struct pcmcia_device *p_dev) | ||
442 | { | ||
443 | dev_link_t *link = dev_to_instance(p_dev); | ||
444 | com20020_dev_t *info = link->priv; | ||
445 | struct net_device *dev = info->dev; | ||
446 | |||
447 | link->state &= ~DEV_SUSPEND; | ||
448 | if (link->state & DEV_CONFIG) { | ||
449 | pcmcia_request_configuration(link->handle, &link->conf); | ||
450 | if (link->open) { | ||
451 | int ioaddr = dev->base_addr; | ||
452 | struct arcnet_local *lp = dev->priv; | ||
453 | ARCRESET; | ||
454 | } | ||
455 | } | ||
456 | |||
457 | return 0; | ||
458 | } | ||
459 | |||
424 | /*====================================================================== | 460 | /*====================================================================== |
425 | 461 | ||
426 | The card status event handler. Mostly, this schedules other | 462 | The card status event handler. Mostly, this schedules other |
@@ -449,30 +485,6 @@ static int com20020_event(event_t event, int priority, | |||
449 | link->state |= DEV_PRESENT; | 485 | link->state |= DEV_PRESENT; |
450 | com20020_config(link); | 486 | com20020_config(link); |
451 | break; | 487 | break; |
452 | case CS_EVENT_PM_SUSPEND: | ||
453 | link->state |= DEV_SUSPEND; | ||
454 | /* Fall through... */ | ||
455 | case CS_EVENT_RESET_PHYSICAL: | ||
456 | if (link->state & DEV_CONFIG) { | ||
457 | if (link->open) { | ||
458 | netif_device_detach(dev); | ||
459 | } | ||
460 | pcmcia_release_configuration(link->handle); | ||
461 | } | ||
462 | break; | ||
463 | case CS_EVENT_PM_RESUME: | ||
464 | link->state &= ~DEV_SUSPEND; | ||
465 | /* Fall through... */ | ||
466 | case CS_EVENT_CARD_RESET: | ||
467 | if (link->state & DEV_CONFIG) { | ||
468 | pcmcia_request_configuration(link->handle, &link->conf); | ||
469 | if (link->open) { | ||
470 | int ioaddr = dev->base_addr; | ||
471 | struct arcnet_local *lp = dev->priv; | ||
472 | ARCRESET; | ||
473 | } | ||
474 | } | ||
475 | break; | ||
476 | } | 488 | } |
477 | return 0; | 489 | return 0; |
478 | } /* com20020_event */ | 490 | } /* com20020_event */ |
@@ -492,6 +504,8 @@ static struct pcmcia_driver com20020_cs_driver = { | |||
492 | .event = com20020_event, | 504 | .event = com20020_event, |
493 | .detach = com20020_detach, | 505 | .detach = com20020_detach, |
494 | .id_table = com20020_ids, | 506 | .id_table = com20020_ids, |
507 | .suspend = com20020_suspend, | ||
508 | .resume = com20020_resume, | ||
495 | }; | 509 | }; |
496 | 510 | ||
497 | static int __init init_com20020_cs(void) | 511 | static int __init init_com20020_cs(void) |