···3939 * own interruptible routines.4040 */4141static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)4242-{ 4242+{4343 struct api_context ctx;4444 unsigned long expire;4545 int retval;···7474}75757676/*-------------------------------------------------------------------*/7777-// returns status (negative) or length (positive)7777+/* returns status (negative) or length (positive) */7878static int usb_internal_control_msg(struct usb_device *usb_dev,7979- unsigned int pipe, 7979+ unsigned int pipe,8080 struct usb_ctrlrequest *cmd,8181 void *data, int len, int timeout)8282{···8787 urb = usb_alloc_urb(0, GFP_NOIO);8888 if (!urb)8989 return -ENOMEM;9090-9090+9191 usb_fill_control_urb(urb, usb_dev, pipe, (unsigned char *)cmd, data,9292 len, usb_api_blocking_completion, NULL);9393···9999}100100101101/**102102- * usb_control_msg - Builds a control urb, sends it off and waits for completion103103- * @dev: pointer to the usb device to send the message to104104- * @pipe: endpoint "pipe" to send the message to105105- * @request: USB message request value106106- * @requesttype: USB message request type value107107- * @value: USB message value108108- * @index: USB message index value109109- * @data: pointer to the data to send110110- * @size: length in bytes of the data to send111111- * @timeout: time in msecs to wait for the message to complete before112112- * timing out (if 0 the wait is forever)113113- * Context: !in_interrupt ()102102+ * usb_control_msg - Builds a control urb, sends it off and waits for completion103103+ * @dev: pointer to the usb device to send the message to104104+ * @pipe: endpoint "pipe" to send the message to105105+ * @request: USB message request value106106+ * @requesttype: USB message request type value107107+ * @value: USB message value108108+ * @index: USB message index value109109+ * @data: pointer to the data to send110110+ * @size: length in bytes of the data to send111111+ * @timeout: time in msecs to wait for the message to complete before timing112112+ * out (if 0 the wait is forever)114113 *115115- * This function sends a simple control message to a specified endpoint116116- * and waits for the message to complete, or timeout.117117- * 118118- * If successful, it returns the number of bytes transferred, otherwise a negative error number.114114+ * Context: !in_interrupt ()119115 *120120- * Don't use this function from within an interrupt context, like a121121- * bottom half handler. If you need an asynchronous message, or need to send122122- * a message from within interrupt context, use usb_submit_urb()123123- * If a thread in your driver uses this call, make sure your disconnect()124124- * method can wait for it to complete. Since you don't have a handle on125125- * the URB used, you can't cancel the request.116116+ * This function sends a simple control message to a specified endpoint and117117+ * waits for the message to complete, or timeout.118118+ *119119+ * If successful, it returns the number of bytes transferred, otherwise a120120+ * negative error number.121121+ *122122+ * Don't use this function from within an interrupt context, like a bottom half123123+ * handler. If you need an asynchronous message, or need to send a message124124+ * from within interrupt context, use usb_submit_urb().125125+ * If a thread in your driver uses this call, make sure your disconnect()126126+ * method can wait for it to complete. Since you don't have a handle on the127127+ * URB used, you can't cancel the request.126128 */127127-int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype,128128- __u16 value, __u16 index, void *data, __u16 size, int timeout)129129+int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,130130+ __u8 requesttype, __u16 value, __u16 index, void *data,131131+ __u16 size, int timeout)129132{130130- struct usb_ctrlrequest *dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);133133+ struct usb_ctrlrequest *dr;131134 int ret;132132-135135+136136+ dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);133137 if (!dr)134138 return -ENOMEM;135139136136- dr->bRequestType= requesttype;140140+ dr->bRequestType = requesttype;137141 dr->bRequest = request;138142 dr->wValue = cpu_to_le16p(&value);139143 dr->wIndex = cpu_to_le16p(&index);140144 dr->wLength = cpu_to_le16p(&size);141145142142- //dbg("usb_control_msg"); 146146+ /* dbg("usb_control_msg"); */143147144148 ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout);145149···159155 * @pipe: endpoint "pipe" to send the message to160156 * @data: pointer to the data to send161157 * @len: length in bytes of the data to send162162- * @actual_length: pointer to a location to put the actual length transferred in bytes158158+ * @actual_length: pointer to a location to put the actual length transferred159159+ * in bytes163160 * @timeout: time in msecs to wait for the message to complete before164161 * timing out (if 0 the wait is forever)162162+ *165163 * Context: !in_interrupt ()166164 *167165 * This function sends a simple interrupt message to a specified endpoint and···187181EXPORT_SYMBOL_GPL(usb_interrupt_msg);188182189183/**190190- * usb_bulk_msg - Builds a bulk urb, sends it off and waits for completion191191- * @usb_dev: pointer to the usb device to send the message to192192- * @pipe: endpoint "pipe" to send the message to193193- * @data: pointer to the data to send194194- * @len: length in bytes of the data to send195195- * @actual_length: pointer to a location to put the actual length transferred in bytes196196- * @timeout: time in msecs to wait for the message to complete before197197- * timing out (if 0 the wait is forever)198198- * Context: !in_interrupt ()184184+ * usb_bulk_msg - Builds a bulk urb, sends it off and waits for completion185185+ * @usb_dev: pointer to the usb device to send the message to186186+ * @pipe: endpoint "pipe" to send the message to187187+ * @data: pointer to the data to send188188+ * @len: length in bytes of the data to send189189+ * @actual_length: pointer to a location to put the actual length transferred190190+ * in bytes191191+ * @timeout: time in msecs to wait for the message to complete before192192+ * timing out (if 0 the wait is forever)199193 *200200- * This function sends a simple bulk message to a specified endpoint201201- * and waits for the message to complete, or timeout.202202- * 203203- * If successful, it returns 0, otherwise a negative error number.204204- * The number of actual bytes transferred will be stored in the 205205- * actual_length paramater.194194+ * Context: !in_interrupt ()206195 *207207- * Don't use this function from within an interrupt context, like a208208- * bottom half handler. If you need an asynchronous message, or need to209209- * send a message from within interrupt context, use usb_submit_urb()210210- * If a thread in your driver uses this call, make sure your disconnect()211211- * method can wait for it to complete. Since you don't have a handle on212212- * the URB used, you can't cancel the request.196196+ * This function sends a simple bulk message to a specified endpoint197197+ * and waits for the message to complete, or timeout.213198 *214214- * Because there is no usb_interrupt_msg() and no USBDEVFS_INTERRUPT215215- * ioctl, users are forced to abuse this routine by using it to submit216216- * URBs for interrupt endpoints. We will take the liberty of creating217217- * an interrupt URB (with the default interval) if the target is an218218- * interrupt endpoint.199199+ * If successful, it returns 0, otherwise a negative error number. The number200200+ * of actual bytes transferred will be stored in the actual_length paramater.201201+ *202202+ * Don't use this function from within an interrupt context, like a bottom half203203+ * handler. If you need an asynchronous message, or need to send a message204204+ * from within interrupt context, use usb_submit_urb() If a thread in your205205+ * driver uses this call, make sure your disconnect() method can wait for it to206206+ * complete. Since you don't have a handle on the URB used, you can't cancel207207+ * the request.208208+ *209209+ * Because there is no usb_interrupt_msg() and no USBDEVFS_INTERRUPT ioctl,210210+ * users are forced to abuse this routine by using it to submit URBs for211211+ * interrupt endpoints. We will take the liberty of creating an interrupt URB212212+ * (with the default interval) if the target is an interrupt endpoint.219213 */220220-int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, 221221- void *data, int len, int *actual_length, int timeout)214214+int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,215215+ void *data, int len, int *actual_length, int timeout)222216{223217 struct urb *urb;224218 struct usb_host_endpoint *ep;···248242249243/*-------------------------------------------------------------------*/250244251251-static void sg_clean (struct usb_sg_request *io)245245+static void sg_clean(struct usb_sg_request *io)252246{253247 if (io->urbs) {254248 while (io->entries--)255255- usb_free_urb (io->urbs [io->entries]);256256- kfree (io->urbs);249249+ usb_free_urb(io->urbs [io->entries]);250250+ kfree(io->urbs);257251 io->urbs = NULL;258252 }259253 if (io->dev->dev.dma_mask != NULL)260260- usb_buffer_unmap_sg (io->dev, usb_pipein(io->pipe),261261- io->sg, io->nents);254254+ usb_buffer_unmap_sg(io->dev, usb_pipein(io->pipe),255255+ io->sg, io->nents);262256 io->dev = NULL;263257}264258265265-static void sg_complete (struct urb *urb)259259+static void sg_complete(struct urb *urb)266260{267267- struct usb_sg_request *io = urb->context;261261+ struct usb_sg_request *io = urb->context;268262 int status = urb->status;269263270270- spin_lock (&io->lock);264264+ spin_lock(&io->lock);271265272266 /* In 2.5 we require hcds' endpoint queues not to progress after fault273267 * reports, until the completion callback (this!) returns. That lets···283277 && (io->status != -ECONNRESET284278 || status != -ECONNRESET)285279 && urb->actual_length) {286286- dev_err (io->dev->bus->controller,280280+ dev_err(io->dev->bus->controller,287281 "dev %s ep%d%s scatterlist error %d/%d\n",288282 io->dev->devpath,289283 usb_endpoint_num(&urb->ep->desc),290284 usb_urb_dir_in(urb) ? "in" : "out",291285 status, io->status);292292- // BUG ();286286+ /* BUG (); */293287 }294288295289 if (io->status == 0 && status && status != -ECONNRESET) {···301295 * unlink pending urbs so they won't rx/tx bad data.302296 * careful: unlink can sometimes be synchronous...303297 */304304- spin_unlock (&io->lock);298298+ spin_unlock(&io->lock);305299 for (i = 0, found = 0; i < io->entries; i++) {306300 if (!io->urbs [i] || !io->urbs [i]->dev)307301 continue;308302 if (found) {309309- retval = usb_unlink_urb (io->urbs [i]);303303+ retval = usb_unlink_urb(io->urbs [i]);310304 if (retval != -EINPROGRESS &&311305 retval != -ENODEV &&312306 retval != -EBUSY)313313- dev_err (&io->dev->dev,307307+ dev_err(&io->dev->dev,314308 "%s, unlink --> %d\n",315309 __FUNCTION__, retval);316310 } else if (urb == io->urbs [i])317311 found = 1;318312 }319319- spin_lock (&io->lock);313313+ spin_lock(&io->lock);320314 }321315 urb->dev = NULL;322316···324318 io->bytes += urb->actual_length;325319 io->count--;326320 if (!io->count)327327- complete (&io->complete);321321+ complete(&io->complete);328322329329- spin_unlock (&io->lock);323323+ spin_unlock(&io->lock);330324}331325332326···355349 * The request may be canceled with usb_sg_cancel(), either before or after356350 * usb_sg_wait() is called.357351 */358358-int usb_sg_init (359359- struct usb_sg_request *io,360360- struct usb_device *dev,361361- unsigned pipe, 362362- unsigned period,363363- struct scatterlist *sg,364364- int nents,365365- size_t length,366366- gfp_t mem_flags367367-)352352+int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,353353+ unsigned pipe, unsigned period, struct scatterlist *sg,354354+ int nents, size_t length, gfp_t mem_flags)368355{369369- int i;370370- int urb_flags;371371- int dma;356356+ int i;357357+ int urb_flags;358358+ int dma;372359373360 if (!io || !dev || !sg374374- || usb_pipecontrol (pipe)375375- || usb_pipeisoc (pipe)361361+ || usb_pipecontrol(pipe)362362+ || usb_pipeisoc(pipe)376363 || nents <= 0)377364 return -EINVAL;378365379379- spin_lock_init (&io->lock);366366+ spin_lock_init(&io->lock);380367 io->dev = dev;381368 io->pipe = pipe;382369 io->sg = sg;···381382 dma = (dev->dev.dma_mask != NULL);382383 if (dma)383384 io->entries = usb_buffer_map_sg(dev, usb_pipein(pipe),384384- sg, nents);385385+ sg, nents);385386 else386387 io->entries = nents;387388···390391 return io->entries;391392392393 io->count = io->entries;393393- io->urbs = kmalloc (io->entries * sizeof *io->urbs, mem_flags);394394+ io->urbs = kmalloc(io->entries * sizeof *io->urbs, mem_flags);394395 if (!io->urbs)395396 goto nomem;396397397398 urb_flags = URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT;398398- if (usb_pipein (pipe))399399+ if (usb_pipein(pipe))399400 urb_flags |= URB_SHORT_NOT_OK;400401401402 for (i = 0; i < io->entries; i++) {402402- unsigned len;403403+ unsigned len;403404404404- io->urbs [i] = usb_alloc_urb (0, mem_flags);405405- if (!io->urbs [i]) {405405+ io->urbs[i] = usb_alloc_urb(0, mem_flags);406406+ if (!io->urbs[i]) {406407 io->entries = i;407408 goto nomem;408409 }409410410410- io->urbs [i]->dev = NULL;411411- io->urbs [i]->pipe = pipe;412412- io->urbs [i]->interval = period;413413- io->urbs [i]->transfer_flags = urb_flags;411411+ io->urbs[i]->dev = NULL;412412+ io->urbs[i]->pipe = pipe;413413+ io->urbs[i]->interval = period;414414+ io->urbs[i]->transfer_flags = urb_flags;414415415415- io->urbs [i]->complete = sg_complete;416416- io->urbs [i]->context = io;416416+ io->urbs[i]->complete = sg_complete;417417+ io->urbs[i]->context = io;417418418419 /*419420 * Some systems need to revert to PIO when DMA is temporarily···432433 * to prevent stale pointers and to help spot bugs.433434 */434435 if (dma) {435435- io->urbs [i]->transfer_dma = sg_dma_address (sg + i);436436- len = sg_dma_len (sg + i);436436+ io->urbs[i]->transfer_dma = sg_dma_address(sg + i);437437+ len = sg_dma_len(sg + i);437438#if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU)438439 io->urbs[i]->transfer_buffer = NULL;439440#else···441442#endif442443 } else {443444 /* hc may use _only_ transfer_buffer */444444- io->urbs [i]->transfer_buffer = sg_virt(&sg[i]);445445- len = sg [i].length;445445+ io->urbs[i]->transfer_buffer = sg_virt(&sg[i]);446446+ len = sg[i].length;446447 }447448448449 if (length) {449449- len = min_t (unsigned, len, length);450450+ len = min_t(unsigned, len, length);450451 length -= len;451452 if (length == 0)452453 io->entries = i + 1;453454 }454454- io->urbs [i]->transfer_buffer_length = len;455455+ io->urbs[i]->transfer_buffer_length = len;455456 }456456- io->urbs [--i]->transfer_flags &= ~URB_NO_INTERRUPT;457457+ io->urbs[--i]->transfer_flags &= ~URB_NO_INTERRUPT;457458458459 /* transaction state */459460 io->status = 0;460461 io->bytes = 0;461461- init_completion (&io->complete);462462+ init_completion(&io->complete);462463 return 0;463464464465nomem:465465- sg_clean (io);466466+ sg_clean(io);466467 return -ENOMEM;467468}468469EXPORT_SYMBOL_GPL(usb_sg_init);···506507 * speed interrupt endpoints, which allow at most one packet per millisecond,507508 * of at most 8 or 64 bytes (respectively).508509 */509509-void usb_sg_wait (struct usb_sg_request *io)510510+void usb_sg_wait(struct usb_sg_request *io)510511{511511- int i, entries = io->entries;512512+ int i;513513+ int entries = io->entries;512514513515 /* queue the urbs. */514514- spin_lock_irq (&io->lock);516516+ spin_lock_irq(&io->lock);515517 i = 0;516518 while (i < entries && !io->status) {517517- int retval;519519+ int retval;518520519519- io->urbs [i]->dev = io->dev;520520- retval = usb_submit_urb (io->urbs [i], GFP_ATOMIC);521521+ io->urbs[i]->dev = io->dev;522522+ retval = usb_submit_urb(io->urbs [i], GFP_ATOMIC);521523522524 /* after we submit, let completions or cancelations fire;523525 * we handshake using io->status.524526 */525525- spin_unlock_irq (&io->lock);527527+ spin_unlock_irq(&io->lock);526528 switch (retval) {527529 /* maybe we retrying will recover */528528- case -ENXIO: // hc didn't queue this one530530+ case -ENXIO: /* hc didn't queue this one */529531 case -EAGAIN:530532 case -ENOMEM:531533 io->urbs[i]->dev = NULL;532534 retval = 0;533533- yield ();535535+ yield();534536 break;535537536538 /* no error? continue immediately.···542542 */543543 case 0:544544 ++i;545545- cpu_relax ();545545+ cpu_relax();546546 break;547547548548 /* fail any uncompleted urbs */549549 default:550550- io->urbs [i]->dev = NULL;551551- io->urbs [i]->status = retval;552552- dev_dbg (&io->dev->dev, "%s, submit --> %d\n",550550+ io->urbs[i]->dev = NULL;551551+ io->urbs[i]->status = retval;552552+ dev_dbg(&io->dev->dev, "%s, submit --> %d\n",553553 __FUNCTION__, retval);554554- usb_sg_cancel (io);554554+ usb_sg_cancel(io);555555 }556556- spin_lock_irq (&io->lock);556556+ spin_lock_irq(&io->lock);557557 if (retval && (io->status == 0 || io->status == -ECONNRESET))558558 io->status = retval;559559 }560560 io->count -= entries - i;561561 if (io->count == 0)562562- complete (&io->complete);563563- spin_unlock_irq (&io->lock);562562+ complete(&io->complete);563563+ spin_unlock_irq(&io->lock);564564565565 /* OK, yes, this could be packaged as non-blocking.566566 * So could the submit loop above ... but it's easier to567567 * solve neither problem than to solve both!568568 */569569- wait_for_completion (&io->complete);569569+ wait_for_completion(&io->complete);570570571571- sg_clean (io);571571+ sg_clean(io);572572}573573EXPORT_SYMBOL_GPL(usb_sg_wait);574574···580580 * It can also prevents one initialized by usb_sg_init() from starting,581581 * so that call just frees resources allocated to the request.582582 */583583-void usb_sg_cancel (struct usb_sg_request *io)583583+void usb_sg_cancel(struct usb_sg_request *io)584584{585585- unsigned long flags;585585+ unsigned long flags;586586587587- spin_lock_irqsave (&io->lock, flags);587587+ spin_lock_irqsave(&io->lock, flags);588588589589 /* shut everything down, if it didn't already */590590 if (!io->status) {591591- int i;591591+ int i;592592593593 io->status = -ECONNRESET;594594- spin_unlock (&io->lock);594594+ spin_unlock(&io->lock);595595 for (i = 0; i < io->entries; i++) {596596- int retval;596596+ int retval;597597598598 if (!io->urbs [i]->dev)599599 continue;600600- retval = usb_unlink_urb (io->urbs [i]);600600+ retval = usb_unlink_urb(io->urbs [i]);601601 if (retval != -EINPROGRESS && retval != -EBUSY)602602- dev_warn (&io->dev->dev, "%s, unlink --> %d\n",602602+ dev_warn(&io->dev->dev, "%s, unlink --> %d\n",603603 __FUNCTION__, retval);604604 }605605- spin_lock (&io->lock);605605+ spin_lock(&io->lock);606606 }607607- spin_unlock_irqrestore (&io->lock, flags);607607+ spin_unlock_irqrestore(&io->lock, flags);608608}609609EXPORT_SYMBOL_GPL(usb_sg_cancel);610610···632632 * Returns the number of bytes received on success, or else the status code633633 * returned by the underlying usb_control_msg() call.634634 */635635-int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size)635635+int usb_get_descriptor(struct usb_device *dev, unsigned char type,636636+ unsigned char index, void *buf, int size)636637{637638 int i;638639 int result;639639-640640- memset(buf,0,size); // Make sure we parse really received data640640+641641+ memset(buf, 0, size); /* Make sure we parse really received data */641642642643 for (i = 0; i < 3; ++i) {643644 /* retry on length 0 or error; some devices are flakey */···713712}714713715714static int usb_string_sub(struct usb_device *dev, unsigned int langid,716716- unsigned int index, unsigned char *buf)715715+ unsigned int index, unsigned char *buf)717716{718717 int rc;719718···756755 * @buf: where to put the string757756 * @size: how big is "buf"?758757 * Context: !in_interrupt ()759759- * 758758+ *760759 * This converts the UTF-16LE encoded strings returned by devices, from761760 * usb_get_string_descriptor(), to null-terminated ISO-8859-1 encoded ones762761 * that are more usable in most kernel contexts. Note that all characters···792791 if (!dev->have_langid) {793792 err = usb_string_sub(dev, 0, 0, tbuf);794793 if (err < 0) {795795- dev_err (&dev->dev,794794+ dev_err(&dev->dev,796795 "string descriptor 0 read error: %d\n",797796 err);798797 goto errout;799798 } else if (err < 4) {800800- dev_err (&dev->dev, "string descriptor 0 too short\n");799799+ dev_err(&dev->dev, "string descriptor 0 too short\n");801800 err = -EINVAL;802801 goto errout;803802 } else {804803 dev->have_langid = 1;805805- dev->string_langid = tbuf[2] | (tbuf[3]<< 8);806806- /* always use the first langid listed */807807- dev_dbg (&dev->dev, "default language 0x%04x\n",804804+ dev->string_langid = tbuf[2] | (tbuf[3] << 8);805805+ /* always use the first langid listed */806806+ dev_dbg(&dev->dev, "default language 0x%04x\n",808807 dev->string_langid);809808 }810809 }811811-810810+812811 err = usb_string_sub(dev, dev->string_langid, index, tbuf);813812 if (err < 0)814813 goto errout;···826825 err = idx;827826828827 if (tbuf[1] != USB_DT_STRING)829829- dev_dbg(&dev->dev, "wrong descriptor type %02x for string %d (\"%s\")\n", tbuf[1], index, buf);828828+ dev_dbg(&dev->dev,829829+ "wrong descriptor type %02x for string %d (\"%s\")\n",830830+ tbuf[1], index, buf);830831831832 errout:832833 kfree(tbuf);···850847 char *smallbuf = NULL;851848 int len;852849853853- if (index > 0 && (buf = kmalloc(256, GFP_KERNEL)) != NULL) {854854- if ((len = usb_string(udev, index, buf, 256)) > 0) {855855- if ((smallbuf = kmalloc(++len, GFP_KERNEL)) == NULL)850850+ if (index <= 0)851851+ return NULL;852852+853853+ buf = kmalloc(256, GFP_KERNEL);854854+ if (buf) {855855+ len = usb_string(udev, index, buf, 256);856856+ if (len > 0) {857857+ smallbuf = kmalloc(++len, GFP_KERNEL);858858+ if (!smallbuf)856859 return buf;857860 memcpy(smallbuf, buf, len);858861 }···897888 return -ENOMEM;898889899890 ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, size);900900- if (ret >= 0) 891891+ if (ret >= 0)901892 memcpy(&dev->descriptor, desc, size);902893 kfree(desc);903894 return ret;···970961{971962 int result;972963 int endp = usb_pipeendpoint(pipe);973973-974974- if (usb_pipein (pipe))964964+965965+ if (usb_pipein(pipe))975966 endp |= USB_DIR_IN;976967977968 /* we don't care if it wasn't halted first. in fact some devices···10541045 }10551046}1056104710571057-/*10481048+/**10581049 * usb_disable_device - Disable all the endpoints for a USB device10591050 * @dev: the device whose endpoints are being disabled10601051 * @skip_ep0: 0 to disable endpoint 0, 1 to skip it.···10691060 int i;1070106110711062 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __FUNCTION__,10721072- skip_ep0 ? "non-ep0" : "all");10631063+ skip_ep0 ? "non-ep0" : "all");10731064 for (i = skip_ep0; i < 16; ++i) {10741065 usb_disable_endpoint(dev, i);10751066 usb_disable_endpoint(dev, i + USB_DIR_IN);···10871078 interface = dev->actconfig->interface[i];10881079 if (!device_is_registered(&interface->dev))10891080 continue;10901090- dev_dbg (&dev->dev, "unregistering interface %s\n",10811081+ dev_dbg(&dev->dev, "unregistering interface %s\n",10911082 interface->dev.bus_id);10921083 usb_remove_sysfs_intf_files(interface);10931093- device_del (&interface->dev);10841084+ device_del(&interface->dev);10941085 }1095108610961087 /* Now that the interfaces are unbound, nobody should10971088 * try to access them.10981089 */10991090 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {11001100- put_device (&dev->actconfig->interface[i]->dev);10911091+ put_device(&dev->actconfig->interface[i]->dev);11011092 dev->actconfig->interface[i] = NULL;11021093 }11031094 dev->actconfig = NULL;···11061097 }11071098}1108109911091109-11101110-/*11001100+/**11111101 * usb_enable_endpoint - Enable an endpoint for USB communications11121102 * @dev: the device whose interface is being enabled11131103 * @ep: the endpoint···11311123 ep->enabled = 1;11321124}1133112511341134-/*11261126+/**11351127 * usb_enable_interface - Enable all the endpoints for an interface11361128 * @dev: the device whose interface is being enabled11371129 * @intf: pointer to the interface descriptor···11871179 struct usb_host_interface *alt;11881180 int ret;11891181 int manual = 0;11821182+ unsigned int epaddr;11831183+ unsigned int pipe;1190118411911185 if (dev->state == USB_STATE_SUSPENDED)11921186 return -EHOSTUNREACH;···12431233 int i;1244123412451235 for (i = 0; i < alt->desc.bNumEndpoints; i++) {12461246- unsigned int epaddr =12471247- alt->endpoint[i].desc.bEndpointAddress;12481248- unsigned int pipe =12491249- __create_pipe(dev, USB_ENDPOINT_NUMBER_MASK & epaddr)12501250- | (usb_endpoint_out(epaddr) ? USB_DIR_OUT : USB_DIR_IN);12361236+ epaddr = alt->endpoint[i].desc.bEndpointAddress;12371237+ pipe = __create_pipe(dev,12381238+ USB_ENDPOINT_NUMBER_MASK & epaddr) |12391239+ (usb_endpoint_out(epaddr) ?12401240+ USB_DIR_OUT : USB_DIR_IN);1251124112521242 usb_clear_halt(dev, pipe);12531243 }···13761366 return -ENOMEM;1377136713781368 if (add_uevent_var(env,13791379- "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",13691369+ "MODALIAS=usb:"13701370+ "v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",13801371 le16_to_cpu(usb_dev->descriptor.idVendor),13811372 le16_to_cpu(usb_dev->descriptor.idProduct),13821373 le16_to_cpu(usb_dev->descriptor.bcdDevice),···14071396};1408139714091398static struct usb_interface_assoc_descriptor *find_iad(struct usb_device *dev,14101410- struct usb_host_config *config,14111411- u8 inum)13991399+ struct usb_host_config *config,14001400+ u8 inum)14121401{14131402 struct usb_interface_assoc_descriptor *retval = NULL;14141403 struct usb_interface_assoc_descriptor *intf_assoc;···1434142314351424 return retval;14361425}14371437-1438142614391427/*14401428 * usb_set_configuration - Makes a particular device setting be current···15521542 * getting rid of old interfaces means unbinding their drivers.15531543 */15541544 if (dev->state != USB_STATE_ADDRESS)15551555- usb_disable_device (dev, 1); // Skip ep015451545+ usb_disable_device(dev, 1); /* Skip ep0 */1556154615571557- if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),15581558- USB_REQ_SET_CONFIGURATION, 0, configuration, 0,15591559- NULL, 0, USB_CTRL_SET_TIMEOUT)) < 0) {15601560-15471547+ ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),15481548+ USB_REQ_SET_CONFIGURATION, 0, configuration, 0,15491549+ NULL, 0, USB_CTRL_SET_TIMEOUT);15501550+ if (ret < 0) {15611551 /* All the old state is gone, so what else can we do?15621552 * The device is probably useless now anyway.15631553 */···16041594 intf->dev.bus = &usb_bus_type;16051595 intf->dev.type = &usb_if_device_type;16061596 intf->dev.dma_mask = dev->dev.dma_mask;16071607- device_initialize (&intf->dev);15971597+ device_initialize(&intf->dev);16081598 mark_quiesced(intf);16091609- sprintf (&intf->dev.bus_id[0], "%d-%s:%d.%d",16101610- dev->bus->busnum, dev->devpath,16111611- configuration, alt->desc.bInterfaceNumber);15991599+ sprintf(&intf->dev.bus_id[0], "%d-%s:%d.%d",16001600+ dev->bus->busnum, dev->devpath,16011601+ configuration, alt->desc.bInterfaceNumber);16121602 }16131603 kfree(new_interfaces);16141604···16241614 for (i = 0; i < nintf; ++i) {16251615 struct usb_interface *intf = cp->interface[i];1626161616271627- dev_dbg (&dev->dev,16171617+ dev_dbg(&dev->dev,16281618 "adding %s (config #%d, interface %d)\n",16291619 intf->dev.bus_id, configuration,16301620 intf->cur_altsetting->desc.bInterfaceNumber);16311631- ret = device_add (&intf->dev);16211621+ ret = device_add(&intf->dev);16321622 if (ret != 0) {16331623 dev_err(&dev->dev, "device_add(%s) --> %d\n",16341624 intf->dev.bus_id, ret);