aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid/usbkbd.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/usbkbd.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/usbkbd.c')
-rw-r--r--drivers/hid/usbhid/usbkbd.c8
1 files changed, 3 insertions, 5 deletions
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)