Commit e7285d82 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: USB altsetting updates for IDSN Hisax driver

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.
parent 5f90abee
......@@ -257,13 +257,18 @@ 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];
......
......@@ -652,13 +652,18 @@ static void ph_disconnect(struct st5481_adapter *adapter)
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];
......
......@@ -244,7 +244,8 @@ int st5481_setup_usb(struct st5481_adapter *adapter)
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 @@ int st5481_setup_usb(struct st5481_adapter *adapter)
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 ) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment