diff options
Diffstat (limited to 'drivers/net/pcmcia/nmclan_cs.c')
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 57 |
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 | ||
804 | static 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 | |||
820 | static 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 | /* ---------------------------------------------------------------------------- |
805 | nmclan_event | 838 | nmclan_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 | ||
1690 | static int __init init_nmclan_cs(void) | 1703 | static int __init init_nmclan_cs(void) |