1 --- bulk.c 2009-01-27 15:25:50.000000000 +0100
2 +++ bulkpatched.c 2010-08-19 00:11:40.802050414 +0200
3 @@ -312,7 +312,7 @@ int firmware_send_bulk(struct usb_hdjbul
4 /*indicate that a bulk output request is in progress.*/
5 atomic_inc(&ubulk->bulk_out_command_in_progress);
7 - /* Since we allocated our buffer with usb_buffer_alloc, do a copy- surely less of a penalty than using
8 + /* Since we allocated our buffer with usb_alloc_coherent, do a copy- surely less of a penalty than using
9 * a kmalloc buffer which DMA setup for it, especially with our small buffer sizes */
10 memcpy(ubulk->bulk_out_buffer,buffer,buffer_size);
12 @@ -461,8 +461,8 @@ int send_vendor_request(int chip_index,
15 chip->ctrl_urb->setup_dma = chip->ctl_req_dma;
16 - /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
17 - chip->ctrl_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
18 + /* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
19 + chip->ctrl_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
21 ret = hdjbulk_submit_urb(chip, chip->ctrl_urb, GFP_KERNEL);
23 @@ -553,7 +553,7 @@ int usb_set_report(struct usb_hdjbulk *u
24 output_control_callback,
25 &ubulk->output_control_completion);
26 ubulk->output_control_urb->setup_dma = ubulk->output_control_dma;
27 - ubulk->output_control_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
28 + ubulk->output_control_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
29 if ((rc = hdjbulk_submit_urb(ubulk->chip,ubulk->output_control_urb, GFP_KERNEL))!=0) {
30 printk(KERN_WARNING"%s hdjbulk_submit_urb() failed, rc:%d\n",__FUNCTION__,rc);
32 @@ -2675,7 +2675,7 @@ static void uninit_output_control_state(
34 if (ubulk->chip->product_code!=DJCONTROLSTEEL_PRODUCT_CODE) {
35 if (ubulk->output_control_ctl_req!=NULL && ubulk->control_interface!=NULL) {
36 - usb_buffer_free(interface_to_usbdev(ubulk->control_interface),
37 + usb_free_coherent(interface_to_usbdev(ubulk->control_interface),
38 sizeof(*(ubulk->output_control_ctl_req)),
39 ubulk->output_control_ctl_req,
40 ubulk->output_control_dma);
41 @@ -2684,7 +2684,7 @@ static void uninit_output_control_state(
43 if (ubulk->output_control_buffer!=NULL && ubulk->control_interface!=NULL &&
44 ubulk->output_control_urb!=NULL) {
45 - usb_buffer_free(interface_to_usbdev(ubulk->control_interface),
46 + usb_free_coherent(interface_to_usbdev(ubulk->control_interface),
47 ubulk->output_control_urb->transfer_buffer_length,
48 ubulk->output_control_buffer,
49 ubulk->output_control_urb->transfer_dma);
50 @@ -2712,7 +2712,7 @@ void kill_bulk_urbs(struct usb_hdjbulk *
51 usb_kill_urb(ubulk->bulk_out_urb);
53 if (ubulk->bulk_out_buffer!=NULL) {
54 - usb_buffer_free(ubulk->chip->dev, ubulk->bulk_out_size,
55 + usb_free_coherent(ubulk->chip->dev, ubulk->bulk_out_size,
56 ubulk->bulk_out_urb->transfer_buffer,
57 ubulk->bulk_out_urb->transfer_dma);
58 ubulk->bulk_out_buffer = NULL;
59 @@ -3065,11 +3065,11 @@ int hdj_create_bulk_interface(struct snd
60 init_MUTEX(&ubulk->bulk_out_buffer_mutex);
62 ubulk->bulk_out_buffer =
63 - usb_buffer_alloc(ubulk->chip->dev, ubulk->bulk_out_size,
64 + usb_alloc_coherent(ubulk->chip->dev, ubulk->bulk_out_size,
65 GFP_KERNEL, &ubulk->bulk_out_urb->transfer_dma);
67 if (ubulk->bulk_out_buffer==NULL) {
68 - printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__);
69 + printk(KERN_WARNING"%s() usb_alloc_coherent() failed\n",__FUNCTION__);
72 goto hdj_create_bulk_interface_error;
73 @@ -3609,12 +3609,12 @@ static int init_output_control_state(str
75 if (ubulk->chip->product_code != DJCONTROLSTEEL_PRODUCT_CODE) {
76 /* allocate memory for setup packet for our control requests */
77 - ubulk->output_control_ctl_req = usb_buffer_alloc(interface_to_usbdev(ubulk->control_interface),
78 + ubulk->output_control_ctl_req = usb_alloc_coherent(interface_to_usbdev(ubulk->control_interface),
79 sizeof(*(ubulk->output_control_ctl_req)),
81 &ubulk->output_control_dma);
82 if (ubulk->output_control_ctl_req==NULL) {
83 - printk(KERN_WARNING"%s() usb_buffer_alloc failed (ctl req)\n",__FUNCTION__);
84 + printk(KERN_WARNING"%s() usb_alloc_coherent failed (ctl req)\n",__FUNCTION__);
86 goto hdjbulk_init_output_control_state_error;
88 @@ -3628,7 +3628,7 @@ static int init_output_control_state(str
89 goto hdjbulk_init_output_control_state_error;
92 - ubulk->output_control_buffer = usb_buffer_alloc(interface_to_usbdev(ubulk->control_interface),
93 + ubulk->output_control_buffer = usb_alloc_coherent(interface_to_usbdev(ubulk->control_interface),
94 ubulk->output_control_buffer_size,
96 &ubulk->output_control_urb->transfer_dma);
97 @@ -3773,10 +3773,10 @@ static int init_continuous_reader(struct
100 ep[i]->max_transfer = ubulk->continuous_reader_packet_size;
101 - buffer = usb_buffer_alloc(ubulk->chip->dev, ep[i]->max_transfer,
102 + buffer = usb_alloc_coherent(ubulk->chip->dev, ep[i]->max_transfer,
103 GFP_KERNEL, &ep[i]->urb->transfer_dma);
105 - printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__);
106 + printk(KERN_WARNING"%s() usb_alloc_coherent() failed\n",__FUNCTION__);
109 goto init_continuous_reader_error;
110 @@ -4250,7 +4250,7 @@ void hdjbulk_in_endpoint_delete(struct h
113 if (ep->urb->transfer_buffer) {
114 - usb_buffer_free(ep->ubulk->chip->dev, ep->max_transfer,
115 + usb_free_coherent(ep->ubulk->chip->dev, ep->max_transfer,
116 ep->urb->transfer_buffer,
117 ep->urb->transfer_dma);
119 --- bulk.h 2009-01-27 15:25:50.000000000 +0100
120 +++ bulkpatched.h 2010-08-19 00:12:41.552050469 +0200
125 +#include "/usr/src/linux-2.6.35-ARCH/include/linux/slab.h"
127 #if !defined(_BULK_H_)
130 --- device.c 2010-08-19 00:05:54.875385619 +0200
131 +++ devicepatched.c 2010-08-19 00:11:57.452050579 +0200
132 @@ -1559,7 +1559,7 @@ static int snd_hdj_chip_free(struct snd_
134 if(chip->ctrl_req_buffer != NULL)
136 - usb_buffer_free(chip->dev,
137 + usb_free_coherent(chip->dev,
138 chip->ctrl_urb->transfer_buffer_length,
139 chip->ctrl_req_buffer,
140 chip->ctrl_urb->transfer_dma);
141 @@ -1575,7 +1575,7 @@ static int snd_hdj_chip_free(struct snd_
143 if(chip->ctl_req != NULL)
145 - usb_buffer_free(chip->dev,
146 + usb_free_coherent(chip->dev,
147 sizeof(*(chip->ctl_req)),
150 @@ -1727,12 +1727,12 @@ static int snd_hdj_chip_create(struct us
153 /* allocate memory for setup packet for our control requests */
154 - chip->ctl_req = usb_buffer_alloc(chip->dev,
155 + chip->ctl_req = usb_alloc_coherent(chip->dev,
156 sizeof(*(chip->ctl_req)),
159 if(chip->ctl_req == NULL) {
160 - printk(KERN_WARNING"snd_hdj_chip_create(): usb_buffer_alloc() failed for setup DMA\n");
161 + printk(KERN_WARNING"snd_hdj_chip_create(): usb_alloc_coherent() failed for setup DMA\n");
165 @@ -1742,12 +1742,12 @@ static int snd_hdj_chip_create(struct us
167 chip->ctrl_req_buffer_len = sizeof(u16);
168 chip->ctrl_urb->transfer_buffer_length = chip->ctrl_req_buffer_len;
169 - chip->ctrl_req_buffer = usb_buffer_alloc(chip->dev,
170 + chip->ctrl_req_buffer = usb_alloc_coherent(chip->dev,
171 chip->ctrl_urb->transfer_buffer_length,
173 &chip->ctrl_urb->transfer_dma);
174 if (chip->ctrl_req_buffer == NULL) {
175 - printk(KERN_WARNING"snd_hdj_chip_create(): usb_buffer_alloc() failed\n");
176 + printk(KERN_WARNING"snd_hdj_chip_create(): usb_alloc_coherent() failed\n");
180 --- midi.c 2009-01-27 15:25:50.000000000 +0100
181 +++ midipatched.c 2010-08-19 00:12:10.072050470 +0200
182 @@ -367,7 +367,7 @@ static void snd_hdjmidi_in_endpoint_dele
185 if (ep->urb->transfer_buffer) {
186 - usb_buffer_free(ep->umidi->chip->dev,
187 + usb_free_coherent(ep->umidi->chip->dev,
188 ep->urb->transfer_buffer_length,
189 ep->urb->transfer_buffer,
190 ep->urb->transfer_dma);
191 @@ -503,10 +503,10 @@ static int snd_hdjmidi_in_endpoint_creat
192 pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep);
194 length = usb_maxpacket(umidi->chip->dev, pipe, 0);
195 - buffer = usb_buffer_alloc(umidi->chip->dev, length, GFP_KERNEL,
196 + buffer = usb_alloc_coherent(umidi->chip->dev, length, GFP_KERNEL,
197 &ep->urb->transfer_dma);
199 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc failed\n",__FUNCTION__);
200 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent failed\n",__FUNCTION__);
201 snd_hdjmidi_in_endpoint_delete(ep);
204 @@ -536,7 +536,7 @@ static void snd_hdjmidi_out_endpoint_del
207 if (ep->urb->transfer_buffer) {
208 - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
209 + usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
210 ep->urb->transfer_buffer,
211 ep->urb->transfer_dma);
213 @@ -544,27 +544,27 @@ static void snd_hdjmidi_out_endpoint_del
216 if (ep->urb_led->transfer_buffer) {
217 - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
218 + usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
219 ep->urb_led->transfer_buffer,
220 ep->urb_led->transfer_dma);
222 usb_free_urb(ep->urb_led);
224 if (ep->ctrl_req_led) {
225 - usb_buffer_free(ep->umidi->chip->dev, sizeof(*(ep->ctrl_req_led)),
226 + usb_free_coherent(ep->umidi->chip->dev, sizeof(*(ep->ctrl_req_led)),
227 ep->ctrl_req_led, ep->ctrl_req_led_dma);
229 if (ep->controller_state) {
230 if (ep->controller_state->output_control_ctl_urb &&
231 ep->controller_state->output_control_ctl_urb->transfer_buffer &&
232 ep->controller_state->output_control_ctl_urb->transfer_dma) {
233 - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
234 + usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
235 ep->controller_state->output_control_ctl_urb->transfer_buffer,
236 ep->controller_state->output_control_ctl_urb->transfer_dma);
238 if (ep->controller_state->output_control_ctl_req &&
239 ep->controller_state->output_control_ctl_dma) {
240 - usb_buffer_free(ep->umidi->chip->dev,
241 + usb_free_coherent(ep->umidi->chip->dev,
242 sizeof(*(ep->controller_state->output_control_ctl_req)),
243 ep->controller_state->output_control_ctl_req,
244 ep->controller_state->output_control_ctl_dma);
245 @@ -573,7 +573,7 @@ static void snd_hdjmidi_out_endpoint_del
246 usb_free_urb(ep->controller_state->output_control_ctl_urb);
248 if (ep->controller_state->ctl_req) {
249 - usb_buffer_free(ep->umidi->chip->dev,
250 + usb_free_coherent(ep->umidi->chip->dev,
251 sizeof(*(ep->controller_state->ctl_req)),
252 ep->controller_state->ctl_req,
253 ep->controller_state->ctl_req_dma);
254 @@ -584,14 +584,14 @@ static void snd_hdjmidi_out_endpoint_del
256 if (ep->controller_state->urb_kt) {
257 if (ep->controller_state->urb_kt->transfer_buffer) {
258 - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
259 + usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
260 ep->controller_state->urb_kt->transfer_buffer,
261 ep->controller_state->urb_kt->transfer_dma);
263 usb_free_urb(ep->controller_state->urb_kt);
265 if (ep->controller_state->ctl_req_kt) {
266 - usb_buffer_free(ep->umidi->chip->dev,
267 + usb_free_coherent(ep->umidi->chip->dev,
268 sizeof(*(ep->controller_state->ctl_req_kt)),
269 ep->controller_state->ctl_req_kt,
270 ep->controller_state->ctl_req_dma_kt);
271 @@ -666,12 +666,12 @@ static int controller_output_init(struct
272 controller_state->is_weltrend = is_mp3_weltrend(ep->umidi->chip->usb_id);
275 - controller_state->ctl_req = usb_buffer_alloc(ep->umidi->chip->dev,
276 + controller_state->ctl_req = usb_alloc_coherent(ep->umidi->chip->dev,
277 sizeof(*(controller_state->ctl_req)),
279 &controller_state->ctl_req_dma);
280 if (controller_state->ctl_req==NULL) {
281 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for setup DMA\n",__FUNCTION__);
282 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for setup DMA\n",__FUNCTION__);
286 @@ -679,12 +679,12 @@ static int controller_output_init(struct
287 * mouse setting or setting LEDs */
288 init_MUTEX(&controller_state->output_control_ctl_mutex);
289 init_completion(&controller_state->output_control_ctl_completion);
290 - controller_state->output_control_ctl_req = usb_buffer_alloc(ep->umidi->chip->dev,
291 + controller_state->output_control_ctl_req = usb_alloc_coherent(ep->umidi->chip->dev,
292 sizeof(*(controller_state->output_control_ctl_req)),
294 &controller_state->output_control_ctl_dma);
295 if (controller_state->output_control_ctl_req==NULL) {
296 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for general setup DMA\n",
297 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for general setup DMA\n",
301 @@ -700,10 +700,10 @@ static int controller_output_init(struct
302 max_transfer = usb_maxpacket(ep->umidi->chip->dev,
303 controller_state->output_control_ctl_pipe, 1);
305 - buffer = usb_buffer_alloc(ep->umidi->chip->dev, max_transfer,
306 + buffer = usb_alloc_coherent(ep->umidi->chip->dev, max_transfer,
307 GFP_KERNEL, &controller_state->output_control_ctl_urb->transfer_dma);
309 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc failed (general URB buffer)\n",
310 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent failed (general URB buffer)\n",
314 @@ -726,8 +726,8 @@ static int controller_output_init(struct
315 controller_state->output_control_ctl_req->wIndex = cpu_to_le16(ep->umidi->iface->cur_altsetting->desc.bInterfaceNumber);
316 controller_state->output_control_ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
317 controller_state->output_control_ctl_urb->setup_dma = controller_state->output_control_ctl_dma;
318 - /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
319 - controller_state->output_control_ctl_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
320 + /* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
321 + controller_state->output_control_ctl_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
325 @@ -772,12 +772,12 @@ static int snd_hdjmidi_out_endpoint_crea
328 if (ep->umidi->chip->caps.leds_hid_controlled) {
329 - ep->ctrl_req_led = usb_buffer_alloc(ep->umidi->chip->dev,
330 + ep->ctrl_req_led = usb_alloc_coherent(ep->umidi->chip->dev,
331 sizeof(*(ep->ctrl_req_led)),
333 &ep->ctrl_req_led_dma);
334 if (ep->ctrl_req_led==NULL) {
335 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for setup DMA\n",__FUNCTION__);
336 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for setup DMA\n",__FUNCTION__);
340 @@ -806,18 +806,18 @@ static int snd_hdjmidi_out_endpoint_crea
341 pipe = usb_sndctrlpipe(umidi->chip->dev, 0);
343 ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1);
344 - buffer = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer,
345 + buffer = usb_alloc_coherent(umidi->chip->dev, ep->max_transfer,
346 GFP_KERNEL, &ep->urb->transfer_dma);
348 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__);
349 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed\n",__FUNCTION__);
350 snd_hdjmidi_out_endpoint_delete(ep);
354 - buffer_led = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer,
355 + buffer_led = usb_alloc_coherent(umidi->chip->dev, ep->max_transfer,
356 GFP_KERNEL, &ep->urb_led->transfer_dma);
358 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for LED buffer\n",
359 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for LED buffer\n",
361 snd_hdjmidi_out_endpoint_delete(ep);
363 @@ -853,8 +853,8 @@ static int snd_hdjmidi_out_endpoint_crea
364 ep->controller_state->ctl_req->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
365 ep->controller_state->ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
366 ep->urb->setup_dma = ep->controller_state->ctl_req_dma;
367 - /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
368 - ep->urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
369 + /* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
370 + ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
373 if (ep->umidi->chip->caps.leds_hid_controlled) {
374 @@ -874,8 +874,8 @@ static int snd_hdjmidi_out_endpoint_crea
375 ep->ctrl_req_led->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
376 ep->ctrl_req_led->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
377 ep->urb_led->setup_dma = ep->ctrl_req_led_dma;
378 - /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
379 - ep->urb_led->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
380 + /* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
381 + ep->urb_led->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
384 if (ep->umidi->chip->caps.leds_bulk_controlled) {
385 @@ -913,20 +913,20 @@ static int snd_hdjmidi_out_endpoint_crea
389 - buffer = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer,
390 + buffer = usb_alloc_coherent(umidi->chip->dev, ep->max_transfer,
391 GFP_KERNEL, &ep->controller_state->urb_kt->transfer_dma);
393 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc() for wq failed\n",__FUNCTION__);
394 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent() for wq failed\n",__FUNCTION__);
395 snd_hdjmidi_out_endpoint_delete(ep);
399 - ep->controller_state->ctl_req_kt = usb_buffer_alloc(umidi->chip->dev,
400 + ep->controller_state->ctl_req_kt = usb_alloc_coherent(umidi->chip->dev,
401 sizeof(*(ep->controller_state->ctl_req_kt)),
403 &ep->controller_state->ctl_req_dma_kt);
404 if (!ep->controller_state->ctl_req_kt) {
405 - snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for setup DMA for wq\n",__FUNCTION__);
406 + snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for setup DMA for wq\n",__FUNCTION__);
407 snd_hdjmidi_out_endpoint_delete(ep);
410 @@ -946,8 +946,8 @@ static int snd_hdjmidi_out_endpoint_crea
411 ep->controller_state->ctl_req_kt->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
412 ep->controller_state->ctl_req_kt->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
413 ep->controller_state->urb_kt->setup_dma = ep->controller_state->ctl_req_dma_kt;
414 - /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
415 - ep->controller_state->urb_kt->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
416 + /* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
417 + ep->controller_state->urb_kt->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
419 init_completion(&ep->controller_state->ctl_req_completion_kt);
420 init_completion(&ep->controller_state->mp3w_kthread_started);