aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/pcnet_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/pcnet_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/pcnet_cs.c')
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c58
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
783static 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
798static 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
783static int pcnet_event(event_t event, int priority, 816static 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
1854static int __init init_pcnet_cs(void) 1866static int __init init_pcnet_cs(void)