aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2009-04-09 03:11:55 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-13 18:44:35 -0400
commit710b523ac59426e8bfdea3533f42118e46b9cbfb (patch)
tree49f41b4ab6fc8404da5638db06eacf765bd302b9 /drivers/net/usb
parent54cb2284dce50672c40248b8e95940318ec2ca41 (diff)
kaweth: Clean up code
The driver kaweth yields a -EBUSY error when starting, and a -ETIME error when shutting down. These errors are avoided, and the RX status is further checked for other potential errors. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/kaweth.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 3d0d0b0b37c5..e01314789718 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -31,7 +31,6 @@
31 ****************************************************************/ 31 ****************************************************************/
32 32
33/* TODO: 33/* TODO:
34 * Fix in_interrupt() problem
35 * Develop test procedures for USB net interfaces 34 * Develop test procedures for USB net interfaces
36 * Run test procedures 35 * Run test procedures
37 * Fix bugs from previous two steps 36 * Fix bugs from previous two steps
@@ -606,14 +605,30 @@ static void kaweth_usb_receive(struct urb *urb)
606 605
607 struct sk_buff *skb; 606 struct sk_buff *skb;
608 607
609 if(unlikely(status == -ECONNRESET || status == -ESHUTDOWN)) 608 if (unlikely(status == -EPIPE)) {
610 /* we are killed - set a flag and wake the disconnect handler */ 609 kaweth->stats.rx_errors++;
611 {
612 kaweth->end = 1; 610 kaweth->end = 1;
613 wake_up(&kaweth->term_wait); 611 wake_up(&kaweth->term_wait);
612 dbg("Status was -EPIPE.");
614 return; 613 return;
615 } 614 }
616 615 if (unlikely(status == -ECONNRESET || status == -ESHUTDOWN)) {
616 /* we are killed - set a flag and wake the disconnect handler */
617 kaweth->end = 1;
618 wake_up(&kaweth->term_wait);
619 dbg("Status was -ECONNRESET or -ESHUTDOWN.");
620 return;
621 }
622 if (unlikely(status == -EPROTO || status == -ETIME ||
623 status == -EILSEQ)) {
624 kaweth->stats.rx_errors++;
625 dbg("Status was -EPROTO, -ETIME, or -EILSEQ.");
626 return;
627 }
628 if (unlikely(status == -EOVERFLOW)) {
629 kaweth->stats.rx_errors++;
630 dbg("Status was -EOVERFLOW.");
631 }
617 spin_lock(&kaweth->device_lock); 632 spin_lock(&kaweth->device_lock);
618 if (IS_BLOCKED(kaweth->status)) { 633 if (IS_BLOCKED(kaweth->status)) {
619 spin_unlock(&kaweth->device_lock); 634 spin_unlock(&kaweth->device_lock);
@@ -883,13 +898,16 @@ static void kaweth_set_rx_mode(struct net_device *net)
883 ****************************************************************/ 898 ****************************************************************/
884static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth) 899static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
885{ 900{
901 int result;
886 __u16 packet_filter_bitmap = kaweth->packet_filter_bitmap; 902 __u16 packet_filter_bitmap = kaweth->packet_filter_bitmap;
903
887 kaweth->packet_filter_bitmap = 0; 904 kaweth->packet_filter_bitmap = 0;
888 if (packet_filter_bitmap == 0) 905 if (packet_filter_bitmap == 0)
889 return; 906 return;
890 907
891 { 908 if (in_interrupt())
892 int result; 909 return;
910
893 result = kaweth_control(kaweth, 911 result = kaweth_control(kaweth,
894 usb_sndctrlpipe(kaweth->dev, 0), 912 usb_sndctrlpipe(kaweth->dev, 0),
895 KAWETH_COMMAND_SET_PACKET_FILTER, 913 KAWETH_COMMAND_SET_PACKET_FILTER,
@@ -906,7 +924,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
906 else { 924 else {
907 dbg("Set Rx mode to %d", packet_filter_bitmap); 925 dbg("Set Rx mode to %d", packet_filter_bitmap);
908 } 926 }
909 }
910} 927}
911 928
912/**************************************************************** 929/****************************************************************