The USB core is changing the way interfaces and altsettings are stored. They are no longer required to be in numerical order, and as a result, simply indexing the interface and altsetting arrays won't work as expected.
This patch for the st5481 takes these changes into account. A simpler approach would be to store a pointer to the struct usb_host_interface rather than look it up repeatedly, but I'm not very familiar with this driver and didn't want to attempt such an alteration. Alan Stern ===== drivers/isdn/hisax/st5481_b.c 1.19 vs edited ===== --- 1.19/drivers/isdn/hisax/st5481_b.c Thu Apr 15 12:22:23 2004 +++ edited/drivers/isdn/hisax/st5481_b.c Mon Apr 26 14:43:53 2004 @@ -257,13 +257,18 @@ 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]; ===== drivers/isdn/hisax/st5481_d.c 1.18 vs edited ===== --- 1.18/drivers/isdn/hisax/st5481_d.c Thu Apr 15 12:22:24 2004 +++ edited/drivers/isdn/hisax/st5481_d.c Mon Apr 26 14:43:53 2004 @@ -652,13 +652,18 @@ static int st5481_setup_d_out(struct st5481_adapter *adapter) { struct usb_device *dev = 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_d_out *d_out = &adapter->d_out; DBG(2,""); - 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 D channel out endpoint = &altsetting->endpoint[EP_D_OUT-1]; ===== drivers/isdn/hisax/st5481_usb.c 1.32 vs edited ===== --- 1.32/drivers/isdn/hisax/st5481_usb.c Thu Apr 15 12:22:24 2004 +++ edited/drivers/isdn/hisax/st5481_usb.c Mon Apr 26 14:43:53 2004 @@ -244,7 +244,8 @@ struct usb_device *dev = adapter->usb_dev; struct st5481_ctrl *ctrl = &adapter->ctrl; struct st5481_intr *intr = &adapter->intr; - struct usb_host_interface *altsetting; + struct usb_interface *intf; + struct usb_host_interface *altsetting = NULL; struct usb_host_endpoint *endpoint; int status; struct urb *urb; @@ -257,8 +258,11 @@ return status; } - - 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; // Check if the config is sane if ( altsetting->desc.bNumEndpoints != 7 ) { ------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel