diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-03-05 15:10:17 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:31 -0400 |
commit | 0ede76fcec5415ef82a423a95120286895822e2d (patch) | |
tree | 61aa2a0b499a0101033c59b8884328bdb31e5956 /drivers/hid/usbhid | |
parent | 749da5f82fe33ff68dd4aa1a5e35cd9aa6246dab (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')
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 8 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbhid.h | 1 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbkbd.c | 8 |
3 files changed, 6 insertions, 11 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); |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index ec20400c7f29..693fd3e720df 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -75,7 +75,6 @@ struct usbhid_device { | |||
75 | 75 | ||
76 | struct urb *urbctrl; /* Control URB */ | 76 | struct urb *urbctrl; /* Control URB */ |
77 | struct usb_ctrlrequest *cr; /* Control request struct */ | 77 | struct usb_ctrlrequest *cr; /* Control request struct */ |
78 | dma_addr_t cr_dma; /* Control request struct dma */ | ||
79 | struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE]; /* Control fifo */ | 78 | struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE]; /* Control fifo */ |
80 | unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */ | 79 | unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */ |
81 | char *ctrlbuf; /* Control buffer */ | 80 | char *ctrlbuf; /* Control buffer */ |
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index f843443ba5c3..bdc7b09e8670 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c | |||
@@ -74,7 +74,6 @@ struct usb_kbd { | |||
74 | unsigned char *new; | 74 | unsigned char *new; |
75 | struct usb_ctrlrequest *cr; | 75 | struct usb_ctrlrequest *cr; |
76 | unsigned char *leds; | 76 | unsigned char *leds; |
77 | dma_addr_t cr_dma; | ||
78 | dma_addr_t new_dma; | 77 | dma_addr_t new_dma; |
79 | dma_addr_t leds_dma; | 78 | dma_addr_t leds_dma; |
80 | }; | 79 | }; |
@@ -199,7 +198,7 @@ static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd) | |||
199 | return -1; | 198 | return -1; |
200 | if (!(kbd->new = usb_buffer_alloc(dev, 8, GFP_ATOMIC, &kbd->new_dma))) | 199 | if (!(kbd->new = usb_buffer_alloc(dev, 8, GFP_ATOMIC, &kbd->new_dma))) |
201 | return -1; | 200 | return -1; |
202 | if (!(kbd->cr = usb_buffer_alloc(dev, sizeof(struct usb_ctrlrequest), GFP_ATOMIC, &kbd->cr_dma))) | 201 | if (!(kbd->cr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL))) |
203 | return -1; | 202 | return -1; |
204 | if (!(kbd->leds = usb_buffer_alloc(dev, 1, GFP_ATOMIC, &kbd->leds_dma))) | 203 | if (!(kbd->leds = usb_buffer_alloc(dev, 1, GFP_ATOMIC, &kbd->leds_dma))) |
205 | return -1; | 204 | return -1; |
@@ -212,7 +211,7 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd) | |||
212 | usb_free_urb(kbd->irq); | 211 | usb_free_urb(kbd->irq); |
213 | usb_free_urb(kbd->led); | 212 | usb_free_urb(kbd->led); |
214 | usb_buffer_free(dev, 8, kbd->new, kbd->new_dma); | 213 | usb_buffer_free(dev, 8, kbd->new, kbd->new_dma); |
215 | usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd->cr, kbd->cr_dma); | 214 | kfree(kbd->cr); |
216 | usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma); | 215 | usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma); |
217 | } | 216 | } |
218 | 217 | ||
@@ -304,9 +303,8 @@ static int usb_kbd_probe(struct usb_interface *iface, | |||
304 | usb_fill_control_urb(kbd->led, dev, usb_sndctrlpipe(dev, 0), | 303 | usb_fill_control_urb(kbd->led, dev, usb_sndctrlpipe(dev, 0), |
305 | (void *) kbd->cr, kbd->leds, 1, | 304 | (void *) kbd->cr, kbd->leds, 1, |
306 | usb_kbd_led, kbd); | 305 | usb_kbd_led, kbd); |
307 | kbd->led->setup_dma = kbd->cr_dma; | ||
308 | kbd->led->transfer_dma = kbd->leds_dma; | 306 | kbd->led->transfer_dma = kbd->leds_dma; |
309 | kbd->led->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); | 307 | kbd->led->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
310 | 308 | ||
311 | error = input_register_device(kbd->dev); | 309 | error = input_register_device(kbd->dev); |
312 | if (error) | 310 | if (error) |