diff options
Diffstat (limited to 'drivers/net/pcmcia/pcnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 818c185d6438..7db4d6f3db45 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -780,6 +780,39 @@ static void pcnet_release(dev_link_t *link) | |||
780 | 780 | ||
781 | ======================================================================*/ | 781 | ======================================================================*/ |
782 | 782 | ||
783 | static int pcnet_suspend(struct pcmcia_device *p_dev) | ||
784 | { | ||
785 | dev_link_t *link = dev_to_instance(p_dev); | ||
786 | struct net_device *dev = link->priv; | ||
787 | |||
788 | link->state |= DEV_SUSPEND; | ||
789 | if (link->state & DEV_CONFIG) { | ||
790 | if (link->open) | ||
791 | netif_device_detach(dev); | ||
792 | pcmcia_release_configuration(link->handle); | ||
793 | } | ||
794 | |||
795 | return 0; | ||
796 | } | ||
797 | |||
798 | static int pcnet_resume(struct pcmcia_device *p_dev) | ||
799 | { | ||
800 | dev_link_t *link = dev_to_instance(p_dev); | ||
801 | struct net_device *dev = link->priv; | ||
802 | |||
803 | link->state &= ~DEV_SUSPEND; | ||
804 | if (link->state & DEV_CONFIG) { | ||
805 | pcmcia_request_configuration(link->handle, &link->conf); | ||
806 | if (link->open) { | ||
807 | pcnet_reset_8390(dev); | ||
808 | NS8390_init(dev, 1); | ||
809 | netif_device_attach(dev); | ||
810 | } | ||
811 | } | ||
812 | |||
813 | return 0; | ||
814 | } | ||
815 | |||
783 | static int pcnet_event(event_t event, int priority, | 816 | static int pcnet_event(event_t event, int priority, |
784 | event_callback_args_t *args) | 817 | event_callback_args_t *args) |
785 | { | 818 | { |
@@ -798,29 +831,6 @@ static int pcnet_event(event_t event, int priority, | |||
798 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 831 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
799 | pcnet_config(link); | 832 | pcnet_config(link); |
800 | break; | 833 | break; |
801 | case CS_EVENT_PM_SUSPEND: | ||
802 | link->state |= DEV_SUSPEND; | ||
803 | /* Fall through... */ | ||
804 | case CS_EVENT_RESET_PHYSICAL: | ||
805 | if (link->state & DEV_CONFIG) { | ||
806 | if (link->open) | ||
807 | netif_device_detach(dev); | ||
808 | pcmcia_release_configuration(link->handle); | ||
809 | } | ||
810 | break; | ||
811 | case CS_EVENT_PM_RESUME: | ||
812 | link->state &= ~DEV_SUSPEND; | ||
813 | /* Fall through... */ | ||
814 | case CS_EVENT_CARD_RESET: | ||
815 | if (link->state & DEV_CONFIG) { | ||
816 | pcmcia_request_configuration(link->handle, &link->conf); | ||
817 | if (link->open) { | ||
818 | pcnet_reset_8390(dev); | ||
819 | NS8390_init(dev, 1); | ||
820 | netif_device_attach(dev); | ||
821 | } | ||
822 | } | ||
823 | break; | ||
824 | } | 834 | } |
825 | return 0; | 835 | return 0; |
826 | } /* pcnet_event */ | 836 | } /* pcnet_event */ |
@@ -1849,6 +1859,8 @@ static struct pcmcia_driver pcnet_driver = { | |||
1849 | .detach = pcnet_detach, | 1859 | .detach = pcnet_detach, |
1850 | .owner = THIS_MODULE, | 1860 | .owner = THIS_MODULE, |
1851 | .id_table = pcnet_ids, | 1861 | .id_table = pcnet_ids, |
1862 | .suspend = pcnet_suspend, | ||
1863 | .resume = pcnet_resume, | ||
1852 | }; | 1864 | }; |
1853 | 1865 | ||
1854 | static int __init init_pcnet_cs(void) | 1866 | static int __init init_pcnet_cs(void) |