Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / isdn / hisax / st5481_b.c
index 010d559..22fd5db 100644 (file)
@@ -172,14 +172,18 @@ static void usb_b_out_complete(struct urb *urb, struct pt_regs *regs)
        test_and_clear_bit(buf_nr, &b_out->busy);
 
        if (unlikely(urb->status < 0)) {
-               if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) {
-                       WARN("urb status %d",urb->status);
-                       if (b_out->busy == 0) {
-                               st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2 | USB_DIR_OUT, NULL, NULL);
-                       }
-               } else {
-                       DBG(1,"urb killed"); 
-                       return; // Give up
+               switch (urb->status) {
+                       case -ENOENT:
+                       case -ESHUTDOWN:
+                       case -ECONNRESET:
+                               DBG(4,"urb killed status %d", urb->status);
+                               return; // Give up
+                       default: 
+                               WARN("urb status %d",urb->status);
+                               if (b_out->busy == 0) {
+                                       st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2 | USB_DIR_OUT, NULL, NULL);
+                               }
+                               break;
                }
        }
 
@@ -257,19 +261,24 @@ static void st5481B_mode(struct st5481_bcs *bcs, int mode)
 static int st5481_setup_b_out(struct st5481_bcs *bcs)
 {
        struct usb_device *dev = bcs->adapter->usb_dev;
-       struct usb_host_interface *altsetting;
+       struct usb_interface *intf;
+       struct usb_host_interface *altsetting = NULL;
        struct usb_host_endpoint *endpoint;
        struct st5481_b_out *b_out = &bcs->b_out;
 
        DBG(4,"");
 
-       altsetting = &(dev->config->interface[0]->altsetting[3]);
+       intf = usb_ifnum_to_if(dev, 0);
+       if (intf)
+               altsetting = usb_altnum_to_altsetting(intf, 3);
+       if (!altsetting)
+               return -ENXIO;
 
        // Allocate URBs and buffers for the B channel out
        endpoint = &altsetting->endpoint[EP_B1_OUT - 1 + bcs->channel * 2];
 
        DBG(4,"endpoint address=%02x,packet size=%d",
-           endpoint->desc.bEndpointAddress, endpoint->desc.wMaxPacketSize);
+           endpoint->desc.bEndpointAddress, le16_to_cpu(endpoint->desc.wMaxPacketSize));
 
        // Allocate memory for 8000bytes/sec + extra bytes if underrun
        return st5481_setup_isocpipes(b_out->urb, dev, 
@@ -347,9 +356,7 @@ void st5481_b_l2l1(struct hisax_if *ifc, int pr, void *arg)
 
        switch (pr) {
        case PH_DATA | REQUEST:
-               if (bcs->b_out.tx_skb)
-                       BUG();
-               
+               BUG_ON(bcs->b_out.tx_skb);
                bcs->b_out.tx_skb = skb;
                break;
        case PH_ACTIVATE | REQUEST: