aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:21:18 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 17:59:02 -0500
commit98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch)
treeb3d46f0643352e541d6a39e6da09059687cf713d /drivers/net/wireless/atmel_cs.c
parent63e7ebd06402951bc8863ba5b7bc9b9f42044849 (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/wireless/atmel_cs.c')
-rw-r--r--drivers/net/wireless/atmel_cs.c50
1 files changed, 31 insertions, 19 deletions
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 17d1fd90f832..598a9cd0f83e 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -477,6 +477,35 @@ static void atmel_release(dev_link_t *link)
477 link->state &= ~DEV_CONFIG; 477 link->state &= ~DEV_CONFIG;
478} 478}
479 479
480static int atmel_suspend(struct pcmcia_device *dev)
481{
482 dev_link_t *link = dev_to_instance(dev);
483 local_info_t *local = link->priv;
484
485 link->state |= DEV_SUSPEND;
486 if (link->state & DEV_CONFIG) {
487 netif_device_detach(local->eth_dev);
488 pcmcia_release_configuration(link->handle);
489 }
490
491 return 0;
492}
493
494static int atmel_resume(struct pcmcia_device *dev)
495{
496 dev_link_t *link = dev_to_instance(dev);
497 local_info_t *local = link->priv;
498
499 link->state &= ~DEV_SUSPEND;
500 if (link->state & DEV_CONFIG) {
501 pcmcia_request_configuration(link->handle, &link->conf);
502 atmel_open(local->eth_dev);
503 netif_device_attach(local->eth_dev);
504 }
505
506 return 0;
507}
508
480/*====================================================================== 509/*======================================================================
481 510
482 The card status event handler. Mostly, this schedules other 511 The card status event handler. Mostly, this schedules other
@@ -509,25 +538,6 @@ static int atmel_event(event_t event, int priority,
509 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 538 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
510 atmel_config(link); 539 atmel_config(link);
511 break; 540 break;
512 case CS_EVENT_PM_SUSPEND:
513 link->state |= DEV_SUSPEND;
514 /* Fall through... */
515 case CS_EVENT_RESET_PHYSICAL:
516 if (link->state & DEV_CONFIG) {
517 netif_device_detach(local->eth_dev);
518 pcmcia_release_configuration(link->handle);
519 }
520 break;
521 case CS_EVENT_PM_RESUME:
522 link->state &= ~DEV_SUSPEND;
523 /* Fall through... */
524 case CS_EVENT_CARD_RESET:
525 if (link->state & DEV_CONFIG) {
526 pcmcia_request_configuration(link->handle, &link->conf);
527 atmel_open(local->eth_dev);
528 netif_device_attach(local->eth_dev);
529 }
530 break;
531 } 541 }
532 return 0; 542 return 0;
533} /* atmel_event */ 543} /* atmel_event */
@@ -585,6 +595,8 @@ static struct pcmcia_driver atmel_driver = {
585 .event = atmel_event, 595 .event = atmel_event,
586 .detach = atmel_detach, 596 .detach = atmel_detach,
587 .id_table = atmel_ids, 597 .id_table = atmel_ids,
598 .suspend = atmel_suspend,
599 .resume = atmel_resume,
588}; 600};
589 601
590static int atmel_cs_init(void) 602static int atmel_cs_init(void)