ChangeSet 1.1608.84.5, 2004/03/08 15:07:07-08:00, stern@rowland.harvard.edu [PATCH] USB: Update USB class drivers This patch makes the necessary updates to the bluetty, cdc-acm, and usblp class drivers for the new interface/altsetting paradigm. The changes are quite small. Unfortunately, the audio and usb-midi drivers are in much worse shape. They will require more in-depth hacking, to come later... drivers/usb/class/bluetty.c | 2 +- drivers/usb/class/cdc-acm.c | 6 +++--- drivers/usb/class/usblp.c | 9 ++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff -Nru a/drivers/usb/class/bluetty.c b/drivers/usb/class/bluetty.c --- a/drivers/usb/class/bluetty.c Tue Mar 16 15:03:43 2004 +++ b/drivers/usb/class/bluetty.c Tue Mar 16 15:03:43 2004 @@ -1025,7 +1025,7 @@ int num_bulk_in = 0; int num_bulk_out = 0; - interface = &intf->altsetting[0]; + interface = intf->cur_altsetting; control_out_endpoint = interface->desc.bInterfaceNumber; /* find the endpoints that we need */ diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c --- a/drivers/usb/class/cdc-acm.c Tue Mar 16 15:03:43 2004 +++ b/drivers/usb/class/cdc-acm.c Tue Mar 16 15:03:43 2004 @@ -595,12 +595,12 @@ * is there it's not for call management ... so use * the cdc union descriptor whenever there is one. */ - ifcom = intf->altsetting + 0; + ifcom = intf->cur_altsetting; if (intf == cfacm->interface[j]) { - ifdata = cfacm->interface[j + 1]->altsetting + 0; + ifdata = cfacm->interface[j + 1]->cur_altsetting; data = cfacm->interface[j + 1]; } else if (intf == cfacm->interface[j + 1]) { - ifdata = cfacm->interface[j]->altsetting + 0; + ifdata = cfacm->interface[j]->cur_altsetting; data = cfacm->interface[j]; } else continue; diff -Nru a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c --- a/drivers/usb/class/usblp.c Tue Mar 16 15:03:43 2004 +++ b/drivers/usb/class/usblp.c Tue Mar 16 15:03:43 2004 @@ -133,6 +133,7 @@ wait_queue_head_t wait; /* Zzzzz ... */ int readcount; /* Counter for reads */ int ifnum; /* Interface number */ + struct usb_interface *intf; /* The interface */ /* Alternate-setting numbers and endpoints for each protocol * (7/1/{index=1,2,3}) that the device supports: */ struct { @@ -837,7 +838,8 @@ usblp->dev = dev; init_MUTEX (&usblp->sem); init_waitqueue_head(&usblp->wait); - usblp->ifnum = intf->altsetting->desc.bInterfaceNumber; + usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; + usblp->intf = intf; usblp->writeurb = usb_alloc_urb(0, GFP_KERNEL); if (!usblp->writeurb) { @@ -973,7 +975,7 @@ struct usb_endpoint_descriptor *epd, *epwrite, *epread; int p, i, e; - if_alt = usblp->dev->actconfig->interface[usblp->ifnum]; + if_alt = usblp->intf; for (p = 0; p < USBLP_MAX_PROTOCOLS; p++) usblp->protocol[p].alt_setting = -1; @@ -1022,7 +1024,8 @@ epread = NULL; } - usblp->protocol[ifd->desc.bInterfaceProtocol].alt_setting = i; + usblp->protocol[ifd->desc.bInterfaceProtocol].alt_setting = + ifd->desc.bAlternateSetting; usblp->protocol[ifd->desc.bInterfaceProtocol].epwrite = epwrite; usblp->protocol[ifd->desc.bInterfaceProtocol].epread = epread; }