While at it also removing some unused fields to increase readability. Turned out that "bufsize" was one of these. Keep that and use it instead of wMaxCommand as it much better describes what the field is used for. Signed-off-by: Bjørn Mork <bjorn@xxxxxxx> --- drivers/usb/class/cdc-wdm.c | 24 +++++++++--------------- 1 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index b4c42c1..c4d6757 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -80,15 +80,11 @@ struct wdm_device { unsigned long flags; u16 bufsize; - u16 wMaxCommand; - u16 wMaxPacketSize; __le16 inum; int reslength; int length; int read; int count; - dma_addr_t shandle; - dma_addr_t ihandle; struct mutex wlock; struct mutex rlock; wait_queue_head_t wait; @@ -275,8 +271,8 @@ static ssize_t wdm_write struct wdm_device *desc = file->private_data; struct usb_ctrlrequest *req; - if (count > desc->wMaxCommand) - count = desc->wMaxCommand; + if (count > desc->bufsize) + count = desc->bufsize; spin_lock_irq(&desc->iuspin); we = desc->werr; @@ -649,7 +645,7 @@ next_desc: mutex_init(&desc->wlock); spin_lock_init(&desc->iuspin); init_waitqueue_head(&desc->wait); - desc->wMaxCommand = maxcom; + desc->bufsize = maxcom; /* this will be expanded and needed in hardware endianness */ desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); desc->intf = intf; @@ -663,8 +659,6 @@ next_desc: if (!ep || !usb_endpoint_is_int_in(ep)) goto err; - desc->wMaxPacketSize = usb_endpoint_maxp(ep); - desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); if (!desc->orq) goto err; @@ -684,15 +678,15 @@ next_desc: if (!desc->command) goto err; - desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); + desc->ubuf = kmalloc(desc->bufsize, GFP_KERNEL); if (!desc->ubuf) goto err; - desc->sbuf = kmalloc(desc->wMaxPacketSize, GFP_KERNEL); + desc->sbuf = kmalloc(usb_endpoint_maxp(ep), GFP_KERNEL); if (!desc->sbuf) goto err; - desc->inbuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); + desc->inbuf = kmalloc(desc->bufsize, GFP_KERNEL); if (!desc->inbuf) goto err; @@ -701,7 +695,7 @@ next_desc: interface_to_usbdev(intf), usb_rcvintpipe(interface_to_usbdev(intf), ep->bEndpointAddress), desc->sbuf, - desc->wMaxPacketSize, + usb_endpoint_maxp(ep), wdm_int_callback, desc, ep->bInterval @@ -711,7 +705,7 @@ next_desc: desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; desc->irq->wValue = 0; desc->irq->wIndex = desc->inum; - desc->irq->wLength = cpu_to_le16(desc->wMaxCommand); + desc->irq->wLength = cpu_to_le16(desc->bufsize); usb_fill_control_urb( desc->response, @@ -720,7 +714,7 @@ next_desc: usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), (unsigned char *)desc->irq, desc->inbuf, - desc->wMaxCommand, + desc->bufsize, wdm_in_callback, desc ); -- 1.7.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html