From cad933e2797385d098ca44e262fb517fa9942303 Mon Sep 17 00:00:00 2001 From: Tadashi Abe Date: Mon, 25 May 2009 20:53:27 +0000 Subject: [PATCH] --- yaml --- r: 150575 b: refs/heads/master c: e13f93188b8a3b418da2a02dfa1a46718cf4607b h: refs/heads/master i: 150573: 627cc58066114b4794f368b579612e7d7bd0add3 150571: f3c84f22e26b88df4ccd591039d46c19975acd8c 150567: ae83346642c56788e9121d1c5f998543c9229e05 150559: 66d807fa88f93f45f2774f83beee930806e123b7 v: v3 --- [refs] | 2 +- trunk/drivers/net/irda/irda-usb.c | 40 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index defea98e775a..dde78fb9c7fd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cd39c7a5717191c677a140565bda2f1ca485ecd8 +refs/heads/master: e13f93188b8a3b418da2a02dfa1a46718cf4607b diff --git a/trunk/drivers/net/irda/irda-usb.c b/trunk/drivers/net/irda/irda-usb.c index 006ba23110db..394b2b17075e 100644 --- a/trunk/drivers/net/irda/irda-usb.c +++ b/trunk/drivers/net/irda/irda-usb.c @@ -1859,6 +1859,42 @@ static void irda_usb_disconnect(struct usb_interface *intf) IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__); } +#ifdef CONFIG_PM +/* USB suspend, so power off the transmitter/receiver */ +static int irda_usb_suspend(struct usb_interface *intf, pm_message_t message) +{ + struct irda_usb_cb *self = usb_get_intfdata(intf); + int i; + + netif_device_detach(self->netdev); + + if (self->tx_urb != NULL) + usb_kill_urb(self->tx_urb); + if (self->speed_urb != NULL) + usb_kill_urb(self->speed_urb); + for (i = 0; i < self->max_rx_urb; i++) { + if (self->rx_urb[i] != NULL) + usb_kill_urb(self->rx_urb[i]); + } + return 0; +} + +/* Coming out of suspend, so reset hardware */ +static int irda_usb_resume(struct usb_interface *intf) +{ + struct irda_usb_cb *self = usb_get_intfdata(intf); + int i; + + for (i = 0; i < self->max_rx_urb; i++) { + if (self->rx_urb[i] != NULL) + usb_submit_urb(self->rx_urb[i], GFP_KERNEL); + } + + netif_device_attach(self->netdev); + return 0; +} +#endif + /*------------------------------------------------------------------*/ /* * USB device callbacks @@ -1868,6 +1904,10 @@ static struct usb_driver irda_driver = { .probe = irda_usb_probe, .disconnect = irda_usb_disconnect, .id_table = dongles, +#ifdef CONFIG_PM + .suspend = irda_usb_suspend, + .resume = irda_usb_resume, +#endif }; /************************* MODULE CALLBACKS *************************/