aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda
diff options
context:
space:
mode:
authorTadashi Abe <tabe@mvista.com>2009-05-25 16:53:27 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-30 01:12:33 -0400
commite13f93188b8a3b418da2a02dfa1a46718cf4607b (patch)
tree30e1f936cc9a731f16c92bfaa087d824825b2de0 /drivers/net/irda
parentcd39c7a5717191c677a140565bda2f1ca485ecd8 (diff)
irda-usb: suspend/resume support
This patch adds power management suspend/resume hooks for irda-usb. Signed-off-by: Tadashi Abe <tabe@mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda')
-rw-r--r--drivers/net/irda/irda-usb.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 006ba23110db..394b2b17075e 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1859,6 +1859,42 @@ static void irda_usb_disconnect(struct usb_interface *intf)
1859 IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__); 1859 IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__);
1860} 1860}
1861 1861
1862#ifdef CONFIG_PM
1863/* USB suspend, so power off the transmitter/receiver */
1864static int irda_usb_suspend(struct usb_interface *intf, pm_message_t message)
1865{
1866 struct irda_usb_cb *self = usb_get_intfdata(intf);
1867 int i;
1868
1869 netif_device_detach(self->netdev);
1870
1871 if (self->tx_urb != NULL)
1872 usb_kill_urb(self->tx_urb);
1873 if (self->speed_urb != NULL)
1874 usb_kill_urb(self->speed_urb);
1875 for (i = 0; i < self->max_rx_urb; i++) {
1876 if (self->rx_urb[i] != NULL)
1877 usb_kill_urb(self->rx_urb[i]);
1878 }
1879 return 0;
1880}
1881
1882/* Coming out of suspend, so reset hardware */
1883static int irda_usb_resume(struct usb_interface *intf)
1884{
1885 struct irda_usb_cb *self = usb_get_intfdata(intf);
1886 int i;
1887
1888 for (i = 0; i < self->max_rx_urb; i++) {
1889 if (self->rx_urb[i] != NULL)
1890 usb_submit_urb(self->rx_urb[i], GFP_KERNEL);
1891 }
1892
1893 netif_device_attach(self->netdev);
1894 return 0;
1895}
1896#endif
1897
1862/*------------------------------------------------------------------*/ 1898/*------------------------------------------------------------------*/
1863/* 1899/*
1864 * USB device callbacks 1900 * USB device callbacks
@@ -1868,6 +1904,10 @@ static struct usb_driver irda_driver = {
1868 .probe = irda_usb_probe, 1904 .probe = irda_usb_probe,
1869 .disconnect = irda_usb_disconnect, 1905 .disconnect = irda_usb_disconnect,
1870 .id_table = dongles, 1906 .id_table = dongles,
1907#ifdef CONFIG_PM
1908 .suspend = irda_usb_suspend,
1909 .resume = irda_usb_resume,
1910#endif
1871}; 1911};
1872 1912
1873/************************* MODULE CALLBACKS *************************/ 1913/************************* MODULE CALLBACKS *************************/