aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/usbhid/hid-core.c20
-rw-r--r--drivers/hid/usbhid/usbhid.h1
-rw-r--r--drivers/hid/usbhid/usbkbd.c16
-rw-r--r--drivers/hid/usbhid/usbmouse.c6
4 files changed, 19 insertions, 24 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index a9364c36c42d..1ebd3244eb85 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -784,13 +784,12 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
784{ 784{
785 struct usbhid_device *usbhid = hid->driver_data; 785 struct usbhid_device *usbhid = hid->driver_data;
786 786
787 usbhid->inbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL, 787 usbhid->inbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
788 &usbhid->inbuf_dma); 788 &usbhid->inbuf_dma);
789 usbhid->outbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL, 789 usbhid->outbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
790 &usbhid->outbuf_dma); 790 &usbhid->outbuf_dma);
791 usbhid->cr = usb_buffer_alloc(dev, sizeof(*usbhid->cr), GFP_KERNEL, 791 usbhid->cr = kmalloc(sizeof(*usbhid->cr), GFP_KERNEL);
792 &usbhid->cr_dma); 792 usbhid->ctrlbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
793 usbhid->ctrlbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
794 &usbhid->ctrlbuf_dma); 793 &usbhid->ctrlbuf_dma);
795 if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr || 794 if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr ||
796 !usbhid->ctrlbuf) 795 !usbhid->ctrlbuf)
@@ -865,10 +864,10 @@ static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
865{ 864{
866 struct usbhid_device *usbhid = hid->driver_data; 865 struct usbhid_device *usbhid = hid->driver_data;
867 866
868 usb_buffer_free(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma); 867 usb_free_coherent(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma);
869 usb_buffer_free(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma); 868 usb_free_coherent(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma);
870 usb_buffer_free(dev, sizeof(*(usbhid->cr)), usbhid->cr, usbhid->cr_dma); 869 kfree(usbhid->cr);
871 usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma); 870 usb_free_coherent(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma);
872} 871}
873 872
874static int usbhid_parse(struct hid_device *hid) 873static int usbhid_parse(struct hid_device *hid)
@@ -1028,9 +1027,8 @@ static int usbhid_start(struct hid_device *hid)
1028 1027
1029 usb_fill_control_urb(usbhid->urbctrl, dev, 0, (void *) usbhid->cr, 1028 usb_fill_control_urb(usbhid->urbctrl, dev, 0, (void *) usbhid->cr,
1030 usbhid->ctrlbuf, 1, hid_ctrl, hid); 1029 usbhid->ctrlbuf, 1, hid_ctrl, hid);
1031 usbhid->urbctrl->setup_dma = usbhid->cr_dma;
1032 usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma; 1030 usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma;
1033 usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); 1031 usbhid->urbctrl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1034 1032
1035 if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS)) 1033 if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS))
1036 usbhid_init_reports(hid); 1034 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 b2fd0b00de92..a948605564fb 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};
@@ -197,11 +196,11 @@ static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd)
197 return -1; 196 return -1;
198 if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL))) 197 if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL)))
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_alloc_coherent(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_alloc_coherent(dev, 1, GFP_ATOMIC, &kbd->leds_dma)))
205 return -1; 204 return -1;
206 205
207 return 0; 206 return 0;
@@ -211,9 +210,9 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd)
211{ 210{
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_free_coherent(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_free_coherent(dev, 1, kbd->leds, kbd->leds_dma);
217} 216}
218 217
219static int usb_kbd_probe(struct usb_interface *iface, 218static int usb_kbd_probe(struct usb_interface *iface,
@@ -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)
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c
index 72ab4b268096..79b2bf81a059 100644
--- a/drivers/hid/usbhid/usbmouse.c
+++ b/drivers/hid/usbhid/usbmouse.c
@@ -142,7 +142,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i
142 if (!mouse || !input_dev) 142 if (!mouse || !input_dev)
143 goto fail1; 143 goto fail1;
144 144
145 mouse->data = usb_buffer_alloc(dev, 8, GFP_ATOMIC, &mouse->data_dma); 145 mouse->data = usb_alloc_coherent(dev, 8, GFP_ATOMIC, &mouse->data_dma);
146 if (!mouse->data) 146 if (!mouse->data)
147 goto fail1; 147 goto fail1;
148 148
@@ -205,7 +205,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i
205fail3: 205fail3:
206 usb_free_urb(mouse->irq); 206 usb_free_urb(mouse->irq);
207fail2: 207fail2:
208 usb_buffer_free(dev, 8, mouse->data, mouse->data_dma); 208 usb_free_coherent(dev, 8, mouse->data, mouse->data_dma);
209fail1: 209fail1:
210 input_free_device(input_dev); 210 input_free_device(input_dev);
211 kfree(mouse); 211 kfree(mouse);
@@ -221,7 +221,7 @@ static void usb_mouse_disconnect(struct usb_interface *intf)
221 usb_kill_urb(mouse->irq); 221 usb_kill_urb(mouse->irq);
222 input_unregister_device(mouse->dev); 222 input_unregister_device(mouse->dev);
223 usb_free_urb(mouse->irq); 223 usb_free_urb(mouse->irq);
224 usb_buffer_free(interface_to_usbdev(intf), 8, mouse->data, mouse->data_dma); 224 usb_free_coherent(interface_to_usbdev(intf), 8, mouse->data, mouse->data_dma);
225 kfree(mouse); 225 kfree(mouse);
226 } 226 }
227} 227}