aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wavelan_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wavelan_cs.c')
-rw-r--r--drivers/net/wireless/wavelan_cs.c92
1 files changed, 52 insertions, 40 deletions
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index c822cad3333f..3e3532830c26 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -4775,6 +4775,56 @@ wavelan_detach(dev_link_t * link)
4775#endif 4775#endif
4776} 4776}
4777 4777
4778static int wavelan_suspend(struct pcmcia_device *p_dev)
4779{
4780 dev_link_t *link = dev_to_instance(p_dev);
4781 struct net_device * dev = (struct net_device *) link->priv;
4782
4783 /* NB: wavelan_close will be called, but too late, so we are
4784 * obliged to close nicely the wavelan here. David, could you
4785 * close the device before suspending them ? And, by the way,
4786 * could you, on resume, add a "route add -net ..." after the
4787 * ifconfig up ? Thanks... */
4788
4789 /* Stop receiving new messages and wait end of transmission */
4790 wv_ru_stop(dev);
4791
4792 /* Power down the module */
4793 hacr_write(dev->base_addr, HACR_DEFAULT & (~HACR_PWR_STAT));
4794
4795 /* The card is now suspended */
4796 link->state |= DEV_SUSPEND;
4797
4798 if(link->state & DEV_CONFIG)
4799 {
4800 if(link->open)
4801 netif_device_detach(dev);
4802 pcmcia_release_configuration(link->handle);
4803 }
4804
4805 return 0;
4806}
4807
4808static int wavelan_resume(struct pcmcia_device *p_dev)
4809{
4810 dev_link_t *link = dev_to_instance(p_dev);
4811 struct net_device * dev = (struct net_device *) link->priv;
4812
4813 link->state &= ~DEV_SUSPEND;
4814 if(link->state & DEV_CONFIG)
4815 {
4816 pcmcia_request_configuration(link->handle, &link->conf);
4817 if(link->open) /* If RESET -> True, If RESUME -> False ? */
4818 {
4819 wv_hw_reset(dev);
4820 netif_device_attach(dev);
4821 }
4822 }
4823
4824 return 0;
4825}
4826
4827
4778/*------------------------------------------------------------------*/ 4828/*------------------------------------------------------------------*/
4779/* 4829/*
4780 * The card status event handler. Mostly, this schedules other stuff 4830 * The card status event handler. Mostly, this schedules other stuff
@@ -4832,46 +4882,6 @@ wavelan_event(event_t event, /* The event received */
4832 else 4882 else
4833 dev->irq = 0; 4883 dev->irq = 0;
4834 break; 4884 break;
4835
4836 case CS_EVENT_PM_SUSPEND:
4837 /* NB: wavelan_close will be called, but too late, so we are
4838 * obliged to close nicely the wavelan here. David, could you
4839 * close the device before suspending them ? And, by the way,
4840 * could you, on resume, add a "route add -net ..." after the
4841 * ifconfig up ? Thanks... */
4842
4843 /* Stop receiving new messages and wait end of transmission */
4844 wv_ru_stop(dev);
4845
4846 /* Power down the module */
4847 hacr_write(dev->base_addr, HACR_DEFAULT & (~HACR_PWR_STAT));
4848
4849 /* The card is now suspended */
4850 link->state |= DEV_SUSPEND;
4851 /* Fall through... */
4852 case CS_EVENT_RESET_PHYSICAL:
4853 if(link->state & DEV_CONFIG)
4854 {
4855 if(link->open)
4856 netif_device_detach(dev);
4857 pcmcia_release_configuration(link->handle);
4858 }
4859 break;
4860
4861 case CS_EVENT_PM_RESUME:
4862 link->state &= ~DEV_SUSPEND;
4863 /* Fall through... */
4864 case CS_EVENT_CARD_RESET:
4865 if(link->state & DEV_CONFIG)
4866 {
4867 pcmcia_request_configuration(link->handle, &link->conf);
4868 if(link->open) /* If RESET -> True, If RESUME -> False ? */
4869 {
4870 wv_hw_reset(dev);
4871 netif_device_attach(dev);
4872 }
4873 }
4874 break;
4875 } 4885 }
4876 4886
4877#ifdef DEBUG_CALLBACK_TRACE 4887#ifdef DEBUG_CALLBACK_TRACE
@@ -4898,6 +4908,8 @@ static struct pcmcia_driver wavelan_driver = {
4898 .event = wavelan_event, 4908 .event = wavelan_event,
4899 .detach = wavelan_detach, 4909 .detach = wavelan_detach,
4900 .id_table = wavelan_ids, 4910 .id_table = wavelan_ids,
4911 .suspend = wavelan_suspend,
4912 .resume = wavelan_resume,
4901}; 4913};
4902 4914
4903static int __init 4915static int __init