aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c574_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/3c574_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/3c574_cs.c')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 71fd41122c91..80414a77fe75 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -547,6 +547,38 @@ static void tc574_release(dev_link_t *link)
547 link->state &= ~DEV_CONFIG; 547 link->state &= ~DEV_CONFIG;
548} 548}
549 549
550static int tc574_suspend(struct pcmcia_device *p_dev)
551{
552 dev_link_t *link = dev_to_instance(p_dev);
553 struct net_device *dev = link->priv;
554
555 link->state |= DEV_SUSPEND;
556 if (link->state & DEV_CONFIG) {
557 if (link->open)
558 netif_device_detach(dev);
559 pcmcia_release_configuration(link->handle);
560 }
561
562 return 0;
563}
564
565static int tc574_resume(struct pcmcia_device *p_dev)
566{
567 dev_link_t *link = dev_to_instance(p_dev);
568 struct net_device *dev = link->priv;
569
570 link->state &= ~DEV_SUSPEND;
571 if (link->state & DEV_CONFIG) {
572 pcmcia_request_configuration(link->handle, &link->conf);
573 if (link->open) {
574 tc574_reset(dev);
575 netif_device_attach(dev);
576 }
577 }
578
579 return 0;
580}
581
550/* 582/*
551 The card status event handler. Mostly, this schedules other 583 The card status event handler. Mostly, this schedules other
552 stuff to run after an event is received. A CARD_REMOVAL event 584 stuff to run after an event is received. A CARD_REMOVAL event
@@ -572,28 +604,6 @@ static int tc574_event(event_t event, int priority,
572 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 604 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
573 tc574_config(link); 605 tc574_config(link);
574 break; 606 break;
575 case CS_EVENT_PM_SUSPEND:
576 link->state |= DEV_SUSPEND;
577 /* Fall through... */
578 case CS_EVENT_RESET_PHYSICAL:
579 if (link->state & DEV_CONFIG) {
580 if (link->open)
581 netif_device_detach(dev);
582 pcmcia_release_configuration(link->handle);
583 }
584 break;
585 case CS_EVENT_PM_RESUME:
586 link->state &= ~DEV_SUSPEND;
587 /* Fall through... */
588 case CS_EVENT_CARD_RESET:
589 if (link->state & DEV_CONFIG) {
590 pcmcia_request_configuration(link->handle, &link->conf);
591 if (link->open) {
592 tc574_reset(dev);
593 netif_device_attach(dev);
594 }
595 }
596 break;
597 } 607 }
598 return 0; 608 return 0;
599} /* tc574_event */ 609} /* tc574_event */
@@ -1296,6 +1306,8 @@ static struct pcmcia_driver tc574_driver = {
1296 .event = tc574_event, 1306 .event = tc574_event,
1297 .detach = tc574_detach, 1307 .detach = tc574_detach,
1298 .id_table = tc574_ids, 1308 .id_table = tc574_ids,
1309 .suspend = tc574_suspend,
1310 .resume = tc574_resume,
1299}; 1311};
1300 1312
1301static int __init init_tc574(void) 1313static int __init init_tc574(void)