aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/axnet_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/pcmcia/axnet_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/pcmcia/axnet_cs.c')
-rw-r--r--drivers/net/pcmcia/axnet_cs.c59
1 files changed, 36 insertions, 23 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 8bb4e85689ea..6c6b25265659 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -490,6 +490,40 @@ static void axnet_release(dev_link_t *link)
490 link->state &= ~DEV_CONFIG; 490 link->state &= ~DEV_CONFIG;
491} 491}
492 492
493static int axnet_suspend(struct pcmcia_device *p_dev)
494{
495 dev_link_t *link = dev_to_instance(p_dev);
496 struct net_device *dev = link->priv;
497
498 link->state |= DEV_SUSPEND;
499 if (link->state & DEV_CONFIG) {
500 if (link->open)
501 netif_device_detach(dev);
502 pcmcia_release_configuration(link->handle);
503 }
504
505 return 0;
506}
507
508static int axnet_resume(struct pcmcia_device *p_dev)
509{
510 dev_link_t *link = dev_to_instance(p_dev);
511 struct net_device *dev = link->priv;
512
513 link->state &= ~DEV_SUSPEND;
514 if (link->state & DEV_CONFIG) {
515 pcmcia_request_configuration(link->handle, &link->conf);
516 if (link->open) {
517 axnet_reset_8390(dev);
518 AX88190_init(dev, 1);
519 netif_device_attach(dev);
520 }
521 }
522
523 return 0;
524}
525
526
493/*====================================================================== 527/*======================================================================
494 528
495 The card status event handler. Mostly, this schedules other 529 The card status event handler. Mostly, this schedules other
@@ -517,29 +551,6 @@ static int axnet_event(event_t event, int priority,
517 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 551 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
518 axnet_config(link); 552 axnet_config(link);
519 break; 553 break;
520 case CS_EVENT_PM_SUSPEND:
521 link->state |= DEV_SUSPEND;
522 /* Fall through... */
523 case CS_EVENT_RESET_PHYSICAL:
524 if (link->state & DEV_CONFIG) {
525 if (link->open)
526 netif_device_detach(dev);
527 pcmcia_release_configuration(link->handle);
528 }
529 break;
530 case CS_EVENT_PM_RESUME:
531 link->state &= ~DEV_SUSPEND;
532 /* Fall through... */
533 case CS_EVENT_CARD_RESET:
534 if (link->state & DEV_CONFIG) {
535 pcmcia_request_configuration(link->handle, &link->conf);
536 if (link->open) {
537 axnet_reset_8390(dev);
538 AX88190_init(dev, 1);
539 netif_device_attach(dev);
540 }
541 }
542 break;
543 } 554 }
544 return 0; 555 return 0;
545} /* axnet_event */ 556} /* axnet_event */
@@ -881,6 +892,8 @@ static struct pcmcia_driver axnet_cs_driver = {
881 .event = axnet_event, 892 .event = axnet_event,
882 .detach = axnet_detach, 893 .detach = axnet_detach,
883 .id_table = axnet_ids, 894 .id_table = axnet_ids,
895 .suspend = axnet_suspend,
896 .resume = axnet_resume,
884}; 897};
885 898
886static int __init init_axnet_cs(void) 899static int __init init_axnet_cs(void)