diff options
| author | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
| commit | bb799d3b980eb803ca2da4a4eefbd9308f8d988a (patch) | |
| tree | 69fbe0cd6d47b23a50f5e1d87bf7489532fae149 /drivers/input/touchscreen/usbtouchscreen.c | |
| parent | 919fc6e34831d1c2b58bfb5ae261dc3facc9b269 (diff) | |
| parent | 319e2e3f63c348a9b66db4667efa73178e18b17d (diff) | |
Merge tag 'v3.13-rc4' into core/locking
Merge Linux 3.13-rc4, to refresh this rather old tree with the latest fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
| -rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index ae4b6b903629..5f87bed05467 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
| @@ -106,6 +106,7 @@ struct usbtouch_device_info { | |||
| 106 | struct usbtouch_usb { | 106 | struct usbtouch_usb { |
| 107 | unsigned char *data; | 107 | unsigned char *data; |
| 108 | dma_addr_t data_dma; | 108 | dma_addr_t data_dma; |
| 109 | int data_size; | ||
| 109 | unsigned char *buffer; | 110 | unsigned char *buffer; |
| 110 | int buf_len; | 111 | int buf_len; |
| 111 | struct urb *irq; | 112 | struct urb *irq; |
| @@ -1521,7 +1522,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf) | |||
| 1521 | static void usbtouch_free_buffers(struct usb_device *udev, | 1522 | static void usbtouch_free_buffers(struct usb_device *udev, |
| 1522 | struct usbtouch_usb *usbtouch) | 1523 | struct usbtouch_usb *usbtouch) |
| 1523 | { | 1524 | { |
| 1524 | usb_free_coherent(udev, usbtouch->type->rept_size, | 1525 | usb_free_coherent(udev, usbtouch->data_size, |
| 1525 | usbtouch->data, usbtouch->data_dma); | 1526 | usbtouch->data, usbtouch->data_dma); |
| 1526 | kfree(usbtouch->buffer); | 1527 | kfree(usbtouch->buffer); |
| 1527 | } | 1528 | } |
| @@ -1566,7 +1567,20 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
| 1566 | if (!type->process_pkt) | 1567 | if (!type->process_pkt) |
| 1567 | type->process_pkt = usbtouch_process_pkt; | 1568 | type->process_pkt = usbtouch_process_pkt; |
| 1568 | 1569 | ||
| 1569 | usbtouch->data = usb_alloc_coherent(udev, type->rept_size, | 1570 | usbtouch->data_size = type->rept_size; |
| 1571 | if (type->get_pkt_len) { | ||
| 1572 | /* | ||
| 1573 | * When dealing with variable-length packets we should | ||
| 1574 | * not request more than wMaxPacketSize bytes at once | ||
| 1575 | * as we do not know if there is more data coming or | ||
| 1576 | * we filled exactly wMaxPacketSize bytes and there is | ||
| 1577 | * nothing else. | ||
| 1578 | */ | ||
| 1579 | usbtouch->data_size = min(usbtouch->data_size, | ||
| 1580 | usb_endpoint_maxp(endpoint)); | ||
| 1581 | } | ||
| 1582 | |||
| 1583 | usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, | ||
| 1570 | GFP_KERNEL, &usbtouch->data_dma); | 1584 | GFP_KERNEL, &usbtouch->data_dma); |
| 1571 | if (!usbtouch->data) | 1585 | if (!usbtouch->data) |
| 1572 | goto out_free; | 1586 | goto out_free; |
| @@ -1626,12 +1640,12 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
| 1626 | if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) | 1640 | if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) |
| 1627 | usb_fill_int_urb(usbtouch->irq, udev, | 1641 | usb_fill_int_urb(usbtouch->irq, udev, |
| 1628 | usb_rcvintpipe(udev, endpoint->bEndpointAddress), | 1642 | usb_rcvintpipe(udev, endpoint->bEndpointAddress), |
| 1629 | usbtouch->data, type->rept_size, | 1643 | usbtouch->data, usbtouch->data_size, |
| 1630 | usbtouch_irq, usbtouch, endpoint->bInterval); | 1644 | usbtouch_irq, usbtouch, endpoint->bInterval); |
| 1631 | else | 1645 | else |
| 1632 | usb_fill_bulk_urb(usbtouch->irq, udev, | 1646 | usb_fill_bulk_urb(usbtouch->irq, udev, |
| 1633 | usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), | 1647 | usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), |
| 1634 | usbtouch->data, type->rept_size, | 1648 | usbtouch->data, usbtouch->data_size, |
| 1635 | usbtouch_irq, usbtouch); | 1649 | usbtouch_irq, usbtouch); |
| 1636 | 1650 | ||
| 1637 | usbtouch->irq->dev = udev; | 1651 | usbtouch->irq->dev = udev; |
