aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid/hid-core.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-03-05 15:10:17 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:31 -0400
commit0ede76fcec5415ef82a423a95120286895822e2d (patch)
tree61aa2a0b499a0101033c59b8884328bdb31e5956 /drivers/hid/usbhid/hid-core.c
parent749da5f82fe33ff68dd4aa1a5e35cd9aa6246dab (diff)
USB: remove uses of URB_NO_SETUP_DMA_MAP
This patch (as1350) removes all usages of coherent buffers for USB control-request setup-packet buffers. There's no good reason to reserve coherent memory for these things; control requests are hardly ever used in large quantity (the major exception is firmware transfers, and they aren't time-critical). Furthermore, only seven drivers used it. We might as well always use streaming DMA mappings for setup-packet buffers, and remove some extra complexity from usbcore. The DMA-mapping portion of hcd.c is currently in flux. A separate patch will be submitted to remove support for URB_NO_SETUP_DMA_MAP after everything else settles down. The removal should go smoothly, as by then nobody will be using it. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hid/usbhid/hid-core.c')
-rw-r--r--drivers/hid/usbhid/hid-core.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 7b85b696fdab..6a510c9675fc 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -787,8 +787,7 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
787 &usbhid->inbuf_dma); 787 &usbhid->inbuf_dma);
788 usbhid->outbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL, 788 usbhid->outbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
789 &usbhid->outbuf_dma); 789 &usbhid->outbuf_dma);
790 usbhid->cr = usb_buffer_alloc(dev, sizeof(*usbhid->cr), GFP_KERNEL, 790 usbhid->cr = kmalloc(sizeof(*usbhid->cr), GFP_KERNEL);
791 &usbhid->cr_dma);
792 usbhid->ctrlbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL, 791 usbhid->ctrlbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
793 &usbhid->ctrlbuf_dma); 792 &usbhid->ctrlbuf_dma);
794 if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr || 793 if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr ||
@@ -846,7 +845,7 @@ static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
846 845
847 usb_buffer_free(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma); 846 usb_buffer_free(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma);
848 usb_buffer_free(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma); 847 usb_buffer_free(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma);
849 usb_buffer_free(dev, sizeof(*(usbhid->cr)), usbhid->cr, usbhid->cr_dma); 848 kfree(usbhid->cr);
850 usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma); 849 usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma);
851} 850}
852 851
@@ -1007,9 +1006,8 @@ static int usbhid_start(struct hid_device *hid)
1007 1006
1008 usb_fill_control_urb(usbhid->urbctrl, dev, 0, (void *) usbhid->cr, 1007 usb_fill_control_urb(usbhid->urbctrl, dev, 0, (void *) usbhid->cr,
1009 usbhid->ctrlbuf, 1, hid_ctrl, hid); 1008 usbhid->ctrlbuf, 1, hid_ctrl, hid);
1010 usbhid->urbctrl->setup_dma = usbhid->cr_dma;
1011 usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma; 1009 usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma;
1012 usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); 1010 usbhid->urbctrl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1013 1011
1014 if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS)) 1012 if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS))
1015 usbhid_init_reports(hid); 1013 usbhid_init_reports(hid);