diff options
Diffstat (limited to 'drivers/net/irda/irda-usb.c')
-rw-r--r-- | drivers/net/irda/irda-usb.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 006ba23110db..0c0831c03f64 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -389,7 +389,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
389 | s32 speed; | 389 | s32 speed; |
390 | s16 xbofs; | 390 | s16 xbofs; |
391 | int res, mtt; | 391 | int res, mtt; |
392 | int err = 1; /* Failed */ | ||
393 | 392 | ||
394 | IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name); | 393 | IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name); |
395 | 394 | ||
@@ -430,7 +429,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
430 | irda_usb_change_speed_xbofs(self); | 429 | irda_usb_change_speed_xbofs(self); |
431 | netdev->trans_start = jiffies; | 430 | netdev->trans_start = jiffies; |
432 | /* Will netif_wake_queue() in callback */ | 431 | /* Will netif_wake_queue() in callback */ |
433 | err = 0; /* No error */ | ||
434 | goto drop; | 432 | goto drop; |
435 | } | 433 | } |
436 | } | 434 | } |
@@ -542,7 +540,7 @@ drop: | |||
542 | /* Drop silently the skb and exit */ | 540 | /* Drop silently the skb and exit */ |
543 | dev_kfree_skb(skb); | 541 | dev_kfree_skb(skb); |
544 | spin_unlock_irqrestore(&self->lock, flags); | 542 | spin_unlock_irqrestore(&self->lock, flags); |
545 | return err; /* Usually 1 */ | 543 | return NETDEV_TX_OK; |
546 | } | 544 | } |
547 | 545 | ||
548 | /*------------------------------------------------------------------*/ | 546 | /*------------------------------------------------------------------*/ |
@@ -1859,6 +1857,42 @@ static void irda_usb_disconnect(struct usb_interface *intf) | |||
1859 | IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__); | 1857 | IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__); |
1860 | } | 1858 | } |
1861 | 1859 | ||
1860 | #ifdef CONFIG_PM | ||
1861 | /* USB suspend, so power off the transmitter/receiver */ | ||
1862 | static int irda_usb_suspend(struct usb_interface *intf, pm_message_t message) | ||
1863 | { | ||
1864 | struct irda_usb_cb *self = usb_get_intfdata(intf); | ||
1865 | int i; | ||
1866 | |||
1867 | netif_device_detach(self->netdev); | ||
1868 | |||
1869 | if (self->tx_urb != NULL) | ||
1870 | usb_kill_urb(self->tx_urb); | ||
1871 | if (self->speed_urb != NULL) | ||
1872 | usb_kill_urb(self->speed_urb); | ||
1873 | for (i = 0; i < self->max_rx_urb; i++) { | ||
1874 | if (self->rx_urb[i] != NULL) | ||
1875 | usb_kill_urb(self->rx_urb[i]); | ||
1876 | } | ||
1877 | return 0; | ||
1878 | } | ||
1879 | |||
1880 | /* Coming out of suspend, so reset hardware */ | ||
1881 | static int irda_usb_resume(struct usb_interface *intf) | ||
1882 | { | ||
1883 | struct irda_usb_cb *self = usb_get_intfdata(intf); | ||
1884 | int i; | ||
1885 | |||
1886 | for (i = 0; i < self->max_rx_urb; i++) { | ||
1887 | if (self->rx_urb[i] != NULL) | ||
1888 | usb_submit_urb(self->rx_urb[i], GFP_KERNEL); | ||
1889 | } | ||
1890 | |||
1891 | netif_device_attach(self->netdev); | ||
1892 | return 0; | ||
1893 | } | ||
1894 | #endif | ||
1895 | |||
1862 | /*------------------------------------------------------------------*/ | 1896 | /*------------------------------------------------------------------*/ |
1863 | /* | 1897 | /* |
1864 | * USB device callbacks | 1898 | * USB device callbacks |
@@ -1868,6 +1902,10 @@ static struct usb_driver irda_driver = { | |||
1868 | .probe = irda_usb_probe, | 1902 | .probe = irda_usb_probe, |
1869 | .disconnect = irda_usb_disconnect, | 1903 | .disconnect = irda_usb_disconnect, |
1870 | .id_table = dongles, | 1904 | .id_table = dongles, |
1905 | #ifdef CONFIG_PM | ||
1906 | .suspend = irda_usb_suspend, | ||
1907 | .resume = irda_usb_resume, | ||
1908 | #endif | ||
1871 | }; | 1909 | }; |
1872 | 1910 | ||
1873 | /************************* MODULE CALLBACKS *************************/ | 1911 | /************************* MODULE CALLBACKS *************************/ |