aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/nmclan_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/nmclan_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/nmclan_cs.c')
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 980d7e5d66cb..fa4921f8b9fc 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -801,6 +801,39 @@ static void nmclan_release(dev_link_t *link)
801 link->state &= ~DEV_CONFIG; 801 link->state &= ~DEV_CONFIG;
802} 802}
803 803
804static int nmclan_suspend(struct pcmcia_device *p_dev)
805{
806 dev_link_t *link = dev_to_instance(p_dev);
807 struct net_device *dev = link->priv;
808
809 link->state |= DEV_SUSPEND;
810 if (link->state & DEV_CONFIG) {
811 if (link->open)
812 netif_device_detach(dev);
813 pcmcia_release_configuration(link->handle);
814 }
815
816
817 return 0;
818}
819
820static int nmclan_resume(struct pcmcia_device *p_dev)
821{
822 dev_link_t *link = dev_to_instance(p_dev);
823 struct net_device *dev = link->priv;
824
825 link->state &= ~DEV_SUSPEND;
826 if (link->state & DEV_CONFIG) {
827 pcmcia_request_configuration(link->handle, &link->conf);
828 if (link->open) {
829 nmclan_reset(dev);
830 netif_device_attach(dev);
831 }
832 }
833
834 return 0;
835}
836
804/* ---------------------------------------------------------------------------- 837/* ----------------------------------------------------------------------------
805nmclan_event 838nmclan_event
806 The card status event handler. Mostly, this schedules other 839 The card status event handler. Mostly, this schedules other
@@ -826,28 +859,6 @@ static int nmclan_event(event_t event, int priority,
826 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 859 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
827 nmclan_config(link); 860 nmclan_config(link);
828 break; 861 break;
829 case CS_EVENT_PM_SUSPEND:
830 link->state |= DEV_SUSPEND;
831 /* Fall through... */
832 case CS_EVENT_RESET_PHYSICAL:
833 if (link->state & DEV_CONFIG) {
834 if (link->open)
835 netif_device_detach(dev);
836 pcmcia_release_configuration(link->handle);
837 }
838 break;
839 case CS_EVENT_PM_RESUME:
840 link->state &= ~DEV_SUSPEND;
841 /* Fall through... */
842 case CS_EVENT_CARD_RESET:
843 if (link->state & DEV_CONFIG) {
844 pcmcia_request_configuration(link->handle, &link->conf);
845 if (link->open) {
846 nmclan_reset(dev);
847 netif_device_attach(dev);
848 }
849 }
850 break;
851 case CS_EVENT_RESET_REQUEST: 862 case CS_EVENT_RESET_REQUEST:
852 return 1; 863 return 1;
853 break; 864 break;
@@ -1685,6 +1696,8 @@ static struct pcmcia_driver nmclan_cs_driver = {
1685 .event = nmclan_event, 1696 .event = nmclan_event,
1686 .detach = nmclan_detach, 1697 .detach = nmclan_detach,
1687 .id_table = nmclan_ids, 1698 .id_table = nmclan_ids,
1699 .suspend = nmclan_suspend,
1700 .resume = nmclan_resume,
1688}; 1701};
1689 1702
1690static int __init init_nmclan_cs(void) 1703static int __init init_nmclan_cs(void)