Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 272100 | Differences between
and this patch

Collapse All | Expand All

(-)bulk.c.orig (-15 / +19 lines)
Lines 23-31 Link Here
23
#include <linux/kernel.h>
23
#include <linux/kernel.h>
24
#include <linux/errno.h>
24
#include <linux/errno.h>
25
#include <linux/init.h>
25
#include <linux/init.h>
26
#include <linux/version.h>
27
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) )
26
#include <linux/slab.h>
28
#include <linux/slab.h>
29
#endif
27
#include <linux/module.h>
30
#include <linux/module.h>
28
#include <linux/kref.h>
31
#include <linux/kref.h>
32
#include <linux/slab.h>
29
#include <asm/uaccess.h>
33
#include <asm/uaccess.h>
30
#include <asm/atomic.h>
34
#include <asm/atomic.h>
31
#ifdef CONFIG_COMPAT
35
#ifdef CONFIG_COMPAT
Lines 312-318 Link Here
312
	/*indicate that a bulk output request is in progress.*/
316
	/*indicate that a bulk output request is in progress.*/
313
	atomic_inc(&ubulk->bulk_out_command_in_progress);
317
	atomic_inc(&ubulk->bulk_out_command_in_progress);
314
318
315
	/* Since we allocated our buffer with usb_buffer_alloc, do a copy- surely less of a penalty than using
319
	/* Since we allocated our buffer with usb_alloc_coherent, do a copy- surely less of a penalty than using
316
 	 *  a kmalloc buffer which DMA setup for it, especially with our small buffer sizes */
320
 	 *  a kmalloc buffer which DMA setup for it, especially with our small buffer sizes */
317
	memcpy(ubulk->bulk_out_buffer,buffer,buffer_size);
321
	memcpy(ubulk->bulk_out_buffer,buffer,buffer_size);
318
322
Lines 461-468 Link Here
461
				(void *)chip);
465
				(void *)chip);
462
466
463
	chip->ctrl_urb->setup_dma = chip->ctl_req_dma;
467
	chip->ctrl_urb->setup_dma = chip->ctl_req_dma;
464
	/* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
468
	/* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
465
	chip->ctrl_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
469
	chip->ctrl_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
466
470
467
	ret = hdjbulk_submit_urb(chip, chip->ctrl_urb, GFP_KERNEL);
471
	ret = hdjbulk_submit_urb(chip, chip->ctrl_urb, GFP_KERNEL);
468
	if (ret!=0) {
472
	if (ret!=0) {
Lines 553-559 Link Here
553
				output_control_callback,
557
				output_control_callback,
554
				&ubulk->output_control_completion);
558
				&ubulk->output_control_completion);
555
	ubulk->output_control_urb->setup_dma = ubulk->output_control_dma;
559
	ubulk->output_control_urb->setup_dma = ubulk->output_control_dma;
556
	ubulk->output_control_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
560
	ubulk->output_control_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
557
	if ((rc =  hdjbulk_submit_urb(ubulk->chip,ubulk->output_control_urb, GFP_KERNEL))!=0) {
561
	if ((rc =  hdjbulk_submit_urb(ubulk->chip,ubulk->output_control_urb, GFP_KERNEL))!=0) {
558
		printk(KERN_WARNING"%s hdjbulk_submit_urb() failed, rc:%d\n",__FUNCTION__,rc);
562
		printk(KERN_WARNING"%s hdjbulk_submit_urb() failed, rc:%d\n",__FUNCTION__,rc);
559
	} else {
563
	} else {
Lines 2675-2681 Link Here
2675
{
2679
{
2676
	if (ubulk->chip->product_code!=DJCONTROLSTEEL_PRODUCT_CODE) {
2680
	if (ubulk->chip->product_code!=DJCONTROLSTEEL_PRODUCT_CODE) {
2677
		if (ubulk->output_control_ctl_req!=NULL && ubulk->control_interface!=NULL) {
2681
		if (ubulk->output_control_ctl_req!=NULL && ubulk->control_interface!=NULL) {
2678
			usb_buffer_free(interface_to_usbdev(ubulk->control_interface),
2682
			usb_free_coherent(interface_to_usbdev(ubulk->control_interface),
2679
					sizeof(*(ubulk->output_control_ctl_req)),
2683
					sizeof(*(ubulk->output_control_ctl_req)),
2680
					ubulk->output_control_ctl_req,
2684
					ubulk->output_control_ctl_req,
2681
					ubulk->output_control_dma);
2685
					ubulk->output_control_dma);
Lines 2684-2690 Link Here
2684
2688
2685
		if (ubulk->output_control_buffer!=NULL && ubulk->control_interface!=NULL &&
2689
		if (ubulk->output_control_buffer!=NULL && ubulk->control_interface!=NULL &&
2686
		    ubulk->output_control_urb!=NULL) {
2690
		    ubulk->output_control_urb!=NULL) {
2687
			usb_buffer_free(interface_to_usbdev(ubulk->control_interface),
2691
			usb_free_coherent(interface_to_usbdev(ubulk->control_interface),
2688
					ubulk->output_control_urb->transfer_buffer_length,
2692
					ubulk->output_control_urb->transfer_buffer_length,
2689
					ubulk->output_control_buffer,
2693
					ubulk->output_control_buffer,
2690
					ubulk->output_control_urb->transfer_dma);
2694
					ubulk->output_control_urb->transfer_dma);
Lines 2712-2718 Link Here
2712
		usb_kill_urb(ubulk->bulk_out_urb);
2716
		usb_kill_urb(ubulk->bulk_out_urb);
2713
		if (free_urbs!=0) {
2717
		if (free_urbs!=0) {
2714
			if (ubulk->bulk_out_buffer!=NULL) {
2718
			if (ubulk->bulk_out_buffer!=NULL) {
2715
				usb_buffer_free(ubulk->chip->dev, ubulk->bulk_out_size,
2719
				usb_free_coherent(ubulk->chip->dev, ubulk->bulk_out_size,
2716
						ubulk->bulk_out_urb->transfer_buffer,
2720
						ubulk->bulk_out_urb->transfer_buffer,
2717
						ubulk->bulk_out_urb->transfer_dma);
2721
						ubulk->bulk_out_urb->transfer_dma);
2718
				ubulk->bulk_out_buffer = NULL;
2722
				ubulk->bulk_out_buffer = NULL;
Lines 3065-3075 Link Here
3065
	init_MUTEX(&ubulk->bulk_out_buffer_mutex);
3069
	init_MUTEX(&ubulk->bulk_out_buffer_mutex);
3066
	
3070
	
3067
	ubulk->bulk_out_buffer =
3071
	ubulk->bulk_out_buffer =
3068
		usb_buffer_alloc(ubulk->chip->dev, ubulk->bulk_out_size,
3072
		usb_alloc_coherent(ubulk->chip->dev, ubulk->bulk_out_size,
3069
			GFP_KERNEL, &ubulk->bulk_out_urb->transfer_dma);
3073
			GFP_KERNEL, &ubulk->bulk_out_urb->transfer_dma);
3070
3074
3071
	if (ubulk->bulk_out_buffer==NULL) {
3075
	if (ubulk->bulk_out_buffer==NULL) {
3072
		printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__);
3076
		printk(KERN_WARNING"%s() usb_alloc_coherent() failed\n",__FUNCTION__);
3073
3077
3074
		retval = -ENOMEM;
3078
		retval = -ENOMEM;
3075
		goto hdj_create_bulk_interface_error;
3079
		goto hdj_create_bulk_interface_error;
Lines 3609-3620 Link Here
3609
	 *  control state */
3613
	 *  control state */
3610
	if (ubulk->chip->product_code != DJCONTROLSTEEL_PRODUCT_CODE) {	
3614
	if (ubulk->chip->product_code != DJCONTROLSTEEL_PRODUCT_CODE) {	
3611
		/* allocate memory for setup packet for our control requests */
3615
		/* allocate memory for setup packet for our control requests */
3612
		ubulk->output_control_ctl_req = usb_buffer_alloc(interface_to_usbdev(ubulk->control_interface), 
3616
		ubulk->output_control_ctl_req = usb_alloc_coherent(interface_to_usbdev(ubulk->control_interface), 
3613
						 		sizeof(*(ubulk->output_control_ctl_req)),
3617
						 		sizeof(*(ubulk->output_control_ctl_req)),
3614
						 		GFP_KERNEL, 
3618
						 		GFP_KERNEL, 
3615
								 &ubulk->output_control_dma);
3619
								 &ubulk->output_control_dma);
3616
		if (ubulk->output_control_ctl_req==NULL) {
3620
		if (ubulk->output_control_ctl_req==NULL) {
3617
			printk(KERN_WARNING"%s() usb_buffer_alloc failed (ctl req)\n",__FUNCTION__);
3621
			printk(KERN_WARNING"%s() usb_alloc_coherent failed (ctl req)\n",__FUNCTION__);
3618
			ret = -ENOMEM;
3622
			ret = -ENOMEM;
3619
			goto hdjbulk_init_output_control_state_error;
3623
			goto hdjbulk_init_output_control_state_error;
3620
		} else {
3624
		} else {
Lines 3628-3634 Link Here
3628
			goto hdjbulk_init_output_control_state_error;
3632
			goto hdjbulk_init_output_control_state_error;
3629
		}
3633
		}
3630
3634
3631
		ubulk->output_control_buffer = usb_buffer_alloc(interface_to_usbdev(ubulk->control_interface),
3635
		ubulk->output_control_buffer = usb_alloc_coherent(interface_to_usbdev(ubulk->control_interface),
3632
								ubulk->output_control_buffer_size, 
3636
								ubulk->output_control_buffer_size, 
3633
								GFP_KERNEL,
3637
								GFP_KERNEL,
3634
								&ubulk->output_control_urb->transfer_dma);
3638
								&ubulk->output_control_urb->transfer_dma);
Lines 3773-3782 Link Here
3773
		}
3777
		}
3774
3778
3775
		ep[i]->max_transfer = ubulk->continuous_reader_packet_size;
3779
		ep[i]->max_transfer = ubulk->continuous_reader_packet_size;
3776
		buffer = usb_buffer_alloc(ubulk->chip->dev, ep[i]->max_transfer,
3780
		buffer = usb_alloc_coherent(ubulk->chip->dev, ep[i]->max_transfer,
3777
					GFP_KERNEL, &ep[i]->urb->transfer_dma);
3781
					GFP_KERNEL, &ep[i]->urb->transfer_dma);
3778
		if (!buffer) {
3782
		if (!buffer) {
3779
			printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__);
3783
			printk(KERN_WARNING"%s() usb_alloc_coherent() failed\n",__FUNCTION__);
3780
			
3784
			
3781
			ret = -ENOMEM;
3785
			ret = -ENOMEM;
3782
			goto init_continuous_reader_error;
3786
			goto init_continuous_reader_error;
Lines 4250-4256 Link Here
4250
{
4254
{
4251
	if (ep->urb) {
4255
	if (ep->urb) {
4252
		if (ep->urb->transfer_buffer) {
4256
		if (ep->urb->transfer_buffer) {
4253
			usb_buffer_free(ep->ubulk->chip->dev, ep->max_transfer,
4257
			usb_free_coherent(ep->ubulk->chip->dev, ep->max_transfer,
4254
					ep->urb->transfer_buffer,
4258
					ep->urb->transfer_buffer,
4255
					ep->urb->transfer_dma);
4259
					ep->urb->transfer_dma);
4256
		}
4260
		}
(-)configuration_manager.c.orig (+3 lines)
Lines 26-31 Link Here
26
#include <linux/usb.h>
26
#include <linux/usb.h>
27
#include <linux/version.h>	/* For LINUX_VERSION_CODE */
27
#include <linux/version.h>	/* For LINUX_VERSION_CODE */
28
#include <asm/atomic.h>
28
#include <asm/atomic.h>
29
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) )
30
#include <linux/slab.h>
31
#endif
29
#if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) )
32
#if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) )
30
#include <sound/driver.h>
33
#include <sound/driver.h>
31
#endif
34
#endif
(-)device.c.orig (-6 / +15 lines)
Lines 1559-1565 Link Here
1559
1559
1560
	if(chip->ctrl_req_buffer != NULL)
1560
	if(chip->ctrl_req_buffer != NULL)
1561
	{
1561
	{
1562
		usb_buffer_free(chip->dev,
1562
		usb_free_coherent(chip->dev,
1563
				chip->ctrl_urb->transfer_buffer_length,
1563
				chip->ctrl_urb->transfer_buffer_length,
1564
				chip->ctrl_req_buffer,
1564
				chip->ctrl_req_buffer,
1565
				chip->ctrl_urb->transfer_dma);
1565
				chip->ctrl_urb->transfer_dma);
Lines 1575-1581 Link Here
1575
	
1575
	
1576
	if(chip->ctl_req != NULL)
1576
	if(chip->ctl_req != NULL)
1577
	{
1577
	{
1578
		usb_buffer_free(chip->dev,
1578
		usb_free_coherent(chip->dev,
1579
			sizeof(*(chip->ctl_req)),
1579
			sizeof(*(chip->ctl_req)),
1580
			chip->ctl_req,
1580
			chip->ctl_req,
1581
			chip->ctl_req_dma);
1581
			chip->ctl_req_dma);
Lines 1660-1670 Link Here
1660
		/* let the kernel option override custom id */
1660
		/* let the kernel option override custom id */
1661
		strncpy(card_id,id[idx],sizeof(card_id)-1);
1661
		strncpy(card_id,id[idx],sizeof(card_id)-1);
1662
	}
1662
	}
1663
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) )
1664
	err = snd_card_create(index[idx], card_id/*id[idx]*/, THIS_MODULE, 0, &card );
1665
	if (err) {
1666
		snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx);
1667
		return err;
1668
	}
1669
#else
1670
1663
	card = snd_card_new(index[idx], card_id/*id[idx]*/, THIS_MODULE, 0);
1671
	card = snd_card_new(index[idx], card_id/*id[idx]*/, THIS_MODULE, 0);
1664
	if (card == NULL) {
1672
	if (card == NULL) {
1665
		snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx);
1673
		snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx);
1666
		return -ENOMEM;
1674
		return -ENOMEM;
1667
	}
1675
	}
1676
#endif
1668
	
1677
	
1669
	/* save the index, so people who have the card can reference the chip */
1678
	/* save the index, so people who have the card can reference the chip */
1670
	card->private_data = (void*)(unsigned long)idx;
1679
	card->private_data = (void*)(unsigned long)idx;
Lines 1728-1739 Link Here
1728
	}
1737
	}
1729
1738
1730
	/* allocate memory for setup packet for our control requests */
1739
	/* allocate memory for setup packet for our control requests */
1731
	chip->ctl_req = usb_buffer_alloc(chip->dev, 
1740
	chip->ctl_req = usb_alloc_coherent(chip->dev, 
1732
					 sizeof(*(chip->ctl_req)),
1741
					 sizeof(*(chip->ctl_req)),
1733
					 GFP_KERNEL, 
1742
					 GFP_KERNEL, 
1734
					 &chip->ctl_req_dma);
1743
					 &chip->ctl_req_dma);
1735
	if(chip->ctl_req == NULL) {
1744
	if(chip->ctl_req == NULL) {
1736
		printk(KERN_WARNING"snd_hdj_chip_create(): usb_buffer_alloc() failed for setup DMA\n");
1745
		printk(KERN_WARNING"snd_hdj_chip_create(): usb_alloc_coherent() failed for setup DMA\n");
1737
		return err;
1746
		return err;
1738
	}
1747
	}
1739
	
1748
	
Lines 1743-1754 Link Here
1743
1752
1744
	chip->ctrl_req_buffer_len =  sizeof(u16);
1753
	chip->ctrl_req_buffer_len =  sizeof(u16);
1745
	chip->ctrl_urb->transfer_buffer_length = chip->ctrl_req_buffer_len;
1754
	chip->ctrl_urb->transfer_buffer_length = chip->ctrl_req_buffer_len;
1746
	chip->ctrl_req_buffer = usb_buffer_alloc(chip->dev, 
1755
	chip->ctrl_req_buffer = usb_alloc_coherent(chip->dev, 
1747
						 chip->ctrl_urb->transfer_buffer_length,
1756
						 chip->ctrl_urb->transfer_buffer_length,
1748
						 GFP_KERNEL, 
1757
						 GFP_KERNEL, 
1749
						 &chip->ctrl_urb->transfer_dma);
1758
						 &chip->ctrl_urb->transfer_dma);
1750
	if (chip->ctrl_req_buffer == NULL) {
1759
	if (chip->ctrl_req_buffer == NULL) {
1751
		printk(KERN_WARNING"snd_hdj_chip_create(): usb_buffer_alloc() failed\n");
1760
		printk(KERN_WARNING"snd_hdj_chip_create(): usb_alloc_coherent() failed\n");
1752
		return err;
1761
		return err;
1753
	}
1762
	}
1754
1763
(-)midi.c.orig (-35 / +38 lines)
Lines 34-39 Link Here
34
#include <linux/module.h>
34
#include <linux/module.h>
35
#include <linux/usb.h>
35
#include <linux/usb.h>
36
#include <linux/kthread.h>
36
#include <linux/kthread.h>
37
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) )
38
#include <linux/slab.h>
39
#endif
37
#include <asm/byteorder.h>
40
#include <asm/byteorder.h>
38
#include <asm/atomic.h>
41
#include <asm/atomic.h>
39
#if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) )
42
#if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) )
Lines 367-373 Link Here
367
{
370
{
368
	if (ep->urb) {
371
	if (ep->urb) {
369
		if (ep->urb->transfer_buffer) {
372
		if (ep->urb->transfer_buffer) {
370
			usb_buffer_free(ep->umidi->chip->dev,
373
			usb_free_coherent(ep->umidi->chip->dev,
371
					ep->urb->transfer_buffer_length,
374
					ep->urb->transfer_buffer_length,
372
					ep->urb->transfer_buffer,
375
					ep->urb->transfer_buffer,
373
					ep->urb->transfer_dma);
376
					ep->urb->transfer_dma);
Lines 503-512 Link Here
503
		pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep);
506
		pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep);
504
	}
507
	}
505
	length = usb_maxpacket(umidi->chip->dev, pipe, 0);
508
	length = usb_maxpacket(umidi->chip->dev, pipe, 0);
506
	buffer = usb_buffer_alloc(umidi->chip->dev, length, GFP_KERNEL,
509
	buffer = usb_alloc_coherent(umidi->chip->dev, length, GFP_KERNEL,
507
				  &ep->urb->transfer_dma);
510
				  &ep->urb->transfer_dma);
508
	if (!buffer) {
511
	if (!buffer) {
509
		snd_printk(KERN_WARNING"%s() usb_buffer_alloc failed\n",__FUNCTION__);
512
		snd_printk(KERN_WARNING"%s() usb_alloc_coherent failed\n",__FUNCTION__);
510
		snd_hdjmidi_in_endpoint_delete(ep);
513
		snd_hdjmidi_in_endpoint_delete(ep);
511
		return -ENOMEM;
514
		return -ENOMEM;
512
	}
515
	}
Lines 536-542 Link Here
536
#endif
539
#endif
537
	if (ep->urb) {
540
	if (ep->urb) {
538
		if (ep->urb->transfer_buffer) {
541
		if (ep->urb->transfer_buffer) {
539
			usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
542
			usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
540
					ep->urb->transfer_buffer,
543
					ep->urb->transfer_buffer,
541
					ep->urb->transfer_dma);
544
					ep->urb->transfer_dma);
542
		}
545
		}
Lines 544-570 Link Here
544
	}
547
	}
545
	if (ep->urb_led) {
548
	if (ep->urb_led) {
546
		if (ep->urb_led->transfer_buffer) {
549
		if (ep->urb_led->transfer_buffer) {
547
			usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
550
			usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
548
					ep->urb_led->transfer_buffer,
551
					ep->urb_led->transfer_buffer,
549
					ep->urb_led->transfer_dma);
552
					ep->urb_led->transfer_dma);
550
		}
553
		}
551
		usb_free_urb(ep->urb_led);	
554
		usb_free_urb(ep->urb_led);	
552
	}
555
	}
553
	if (ep->ctrl_req_led) {
556
	if (ep->ctrl_req_led) {
554
		usb_buffer_free(ep->umidi->chip->dev, sizeof(*(ep->ctrl_req_led)),
557
		usb_free_coherent(ep->umidi->chip->dev, sizeof(*(ep->ctrl_req_led)),
555
						ep->ctrl_req_led, ep->ctrl_req_led_dma);
558
						ep->ctrl_req_led, ep->ctrl_req_led_dma);
556
	}
559
	}
557
	if (ep->controller_state) {
560
	if (ep->controller_state) {
558
		if (ep->controller_state->output_control_ctl_urb &&
561
		if (ep->controller_state->output_control_ctl_urb &&
559
			 ep->controller_state->output_control_ctl_urb->transfer_buffer &&
562
			 ep->controller_state->output_control_ctl_urb->transfer_buffer &&
560
			 ep->controller_state->output_control_ctl_urb->transfer_dma) {
563
			 ep->controller_state->output_control_ctl_urb->transfer_dma) {
561
			usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
564
			usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
562
					ep->controller_state->output_control_ctl_urb->transfer_buffer,
565
					ep->controller_state->output_control_ctl_urb->transfer_buffer,
563
					ep->controller_state->output_control_ctl_urb->transfer_dma);
566
					ep->controller_state->output_control_ctl_urb->transfer_dma);
564
		}
567
		}
565
		if (ep->controller_state->output_control_ctl_req &&
568
		if (ep->controller_state->output_control_ctl_req &&
566
			 ep->controller_state->output_control_ctl_dma) {
569
			 ep->controller_state->output_control_ctl_dma) {
567
			usb_buffer_free(ep->umidi->chip->dev, 
570
			usb_free_coherent(ep->umidi->chip->dev, 
568
					sizeof(*(ep->controller_state->output_control_ctl_req)),
571
					sizeof(*(ep->controller_state->output_control_ctl_req)),
569
					ep->controller_state->output_control_ctl_req,
572
					ep->controller_state->output_control_ctl_req,
570
					ep->controller_state->output_control_ctl_dma);
573
					ep->controller_state->output_control_ctl_dma);
Lines 573-579 Link Here
573
			usb_free_urb(ep->controller_state->output_control_ctl_urb);
576
			usb_free_urb(ep->controller_state->output_control_ctl_urb);
574
		}
577
		}
575
		if (ep->controller_state->ctl_req) {
578
		if (ep->controller_state->ctl_req) {
576
			usb_buffer_free(ep->umidi->chip->dev, 
579
			usb_free_coherent(ep->umidi->chip->dev, 
577
					sizeof(*(ep->controller_state->ctl_req)),
580
					sizeof(*(ep->controller_state->ctl_req)),
578
					ep->controller_state->ctl_req,
581
					ep->controller_state->ctl_req,
579
					ep->controller_state->ctl_req_dma);
582
					ep->controller_state->ctl_req_dma);
Lines 584-597 Link Here
584
		}
587
		}
585
		if (ep->controller_state->urb_kt) {
588
		if (ep->controller_state->urb_kt) {
586
			if (ep->controller_state->urb_kt->transfer_buffer) {
589
			if (ep->controller_state->urb_kt->transfer_buffer) {
587
				usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
590
				usb_free_coherent(ep->umidi->chip->dev, ep->max_transfer,
588
						ep->controller_state->urb_kt->transfer_buffer,
591
						ep->controller_state->urb_kt->transfer_buffer,
589
						ep->controller_state->urb_kt->transfer_dma);
592
						ep->controller_state->urb_kt->transfer_dma);
590
			}
593
			}
591
			usb_free_urb(ep->controller_state->urb_kt);
594
			usb_free_urb(ep->controller_state->urb_kt);
592
		}
595
		}
593
		if (ep->controller_state->ctl_req_kt) {
596
		if (ep->controller_state->ctl_req_kt) {
594
			usb_buffer_free(ep->umidi->chip->dev, 
597
			usb_free_coherent(ep->umidi->chip->dev, 
595
					sizeof(*(ep->controller_state->ctl_req_kt)),
598
					sizeof(*(ep->controller_state->ctl_req_kt)),
596
					ep->controller_state->ctl_req_kt,
599
					ep->controller_state->ctl_req_kt,
597
					ep->controller_state->ctl_req_dma_kt);
600
					ep->controller_state->ctl_req_dma_kt);
Lines 666-677 Link Here
666
		controller_state->is_weltrend = is_mp3_weltrend(ep->umidi->chip->usb_id);
669
		controller_state->is_weltrend = is_mp3_weltrend(ep->umidi->chip->usb_id);
667
	}
670
	}
668
	
671
	
669
	controller_state->ctl_req = usb_buffer_alloc(ep->umidi->chip->dev, 
672
	controller_state->ctl_req = usb_alloc_coherent(ep->umidi->chip->dev, 
670
							sizeof(*(controller_state->ctl_req)),
673
							sizeof(*(controller_state->ctl_req)),
671
							GFP_KERNEL, 
674
							GFP_KERNEL, 
672
							&controller_state->ctl_req_dma);
675
							&controller_state->ctl_req_dma);
673
	if (controller_state->ctl_req==NULL) {
676
	if (controller_state->ctl_req==NULL) {
674
		snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for setup DMA\n",__FUNCTION__);
677
		snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for setup DMA\n",__FUNCTION__);
675
		return -ENOMEM;
678
		return -ENOMEM;
676
	}
679
	}
677
	
680
	
Lines 679-690 Link Here
679
	 *  mouse setting or setting LEDs */
682
	 *  mouse setting or setting LEDs */
680
	init_MUTEX(&controller_state->output_control_ctl_mutex);
683
	init_MUTEX(&controller_state->output_control_ctl_mutex);
681
	init_completion(&controller_state->output_control_ctl_completion);
684
	init_completion(&controller_state->output_control_ctl_completion);
682
	controller_state->output_control_ctl_req = usb_buffer_alloc(ep->umidi->chip->dev, 
685
	controller_state->output_control_ctl_req = usb_alloc_coherent(ep->umidi->chip->dev, 
683
							sizeof(*(controller_state->output_control_ctl_req)),
686
							sizeof(*(controller_state->output_control_ctl_req)),
684
							GFP_KERNEL, 
687
							GFP_KERNEL, 
685
							&controller_state->output_control_ctl_dma);
688
							&controller_state->output_control_ctl_dma);
686
	if (controller_state->output_control_ctl_req==NULL) {
689
	if (controller_state->output_control_ctl_req==NULL) {
687
		snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for general setup DMA\n",
690
		snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for general setup DMA\n",
688
				__FUNCTION__);
691
				__FUNCTION__);
689
		return -ENOMEM;
692
		return -ENOMEM;
690
	}
693
	}
Lines 700-709 Link Here
700
	max_transfer = usb_maxpacket(ep->umidi->chip->dev, 
703
	max_transfer = usb_maxpacket(ep->umidi->chip->dev, 
701
					controller_state->output_control_ctl_pipe, 1);
704
					controller_state->output_control_ctl_pipe, 1);
702
	
705
	
703
	buffer = usb_buffer_alloc(ep->umidi->chip->dev, max_transfer,
706
	buffer = usb_alloc_coherent(ep->umidi->chip->dev, max_transfer,
704
				  GFP_KERNEL, &controller_state->output_control_ctl_urb->transfer_dma);
707
				  GFP_KERNEL, &controller_state->output_control_ctl_urb->transfer_dma);
705
	if (buffer==NULL) {
708
	if (buffer==NULL) {
706
		snd_printk(KERN_WARNING"%s() usb_buffer_alloc failed (general URB buffer)\n",
709
		snd_printk(KERN_WARNING"%s() usb_alloc_coherent failed (general URB buffer)\n",
707
					__FUNCTION__);
710
					__FUNCTION__);
708
		return -ENOMEM;	
711
		return -ENOMEM;	
709
	}
712
	}
Lines 726-733 Link Here
726
	controller_state->output_control_ctl_req->wIndex = cpu_to_le16(ep->umidi->iface->cur_altsetting->desc.bInterfaceNumber);
729
	controller_state->output_control_ctl_req->wIndex = cpu_to_le16(ep->umidi->iface->cur_altsetting->desc.bInterfaceNumber);
727
	controller_state->output_control_ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
730
	controller_state->output_control_ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
728
	controller_state->output_control_ctl_urb->setup_dma = controller_state->output_control_ctl_dma;
731
	controller_state->output_control_ctl_urb->setup_dma = controller_state->output_control_ctl_dma;
729
	/* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
732
	/* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
730
	controller_state->output_control_ctl_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
733
	controller_state->output_control_ctl_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
731
	
734
	
732
	return 0;
735
	return 0;
733
}
736
}
Lines 772-783 Link Here
772
	}
775
	}
773
	
776
	
774
	if (ep->umidi->chip->caps.leds_hid_controlled) {
777
	if (ep->umidi->chip->caps.leds_hid_controlled) {
775
		ep->ctrl_req_led = usb_buffer_alloc(ep->umidi->chip->dev, 
778
		ep->ctrl_req_led = usb_alloc_coherent(ep->umidi->chip->dev, 
776
								sizeof(*(ep->ctrl_req_led)),
779
								sizeof(*(ep->ctrl_req_led)),
777
								GFP_KERNEL, 
780
								GFP_KERNEL, 
778
								&ep->ctrl_req_led_dma);
781
								&ep->ctrl_req_led_dma);
779
		if (ep->ctrl_req_led==NULL) {
782
		if (ep->ctrl_req_led==NULL) {
780
			snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for setup DMA\n",__FUNCTION__);
783
			snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for setup DMA\n",__FUNCTION__);
781
			return -ENOMEM;
784
			return -ENOMEM;
782
		}
785
		}
783
	}
786
	}
Lines 806-823 Link Here
806
		pipe = usb_sndctrlpipe(umidi->chip->dev, 0);
809
		pipe = usb_sndctrlpipe(umidi->chip->dev, 0);
807
	}
810
	}
808
	ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1);
811
	ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1);
809
	buffer = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer,
812
	buffer = usb_alloc_coherent(umidi->chip->dev, ep->max_transfer,
810
				  GFP_KERNEL, &ep->urb->transfer_dma);
813
				  GFP_KERNEL, &ep->urb->transfer_dma);
811
	if (!buffer) {
814
	if (!buffer) {
812
		snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__);
815
		snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed\n",__FUNCTION__);
813
		snd_hdjmidi_out_endpoint_delete(ep);
816
		snd_hdjmidi_out_endpoint_delete(ep);
814
		return -ENOMEM;
817
		return -ENOMEM;
815
	}
818
	}
816
	
819
	
817
	buffer_led = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer,
820
	buffer_led = usb_alloc_coherent(umidi->chip->dev, ep->max_transfer,
818
				  GFP_KERNEL, &ep->urb_led->transfer_dma);
821
				  GFP_KERNEL, &ep->urb_led->transfer_dma);
819
	if (!buffer_led) {
822
	if (!buffer_led) {
820
		snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for LED buffer\n",
823
		snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for LED buffer\n",
821
					__FUNCTION__);
824
					__FUNCTION__);
822
		snd_hdjmidi_out_endpoint_delete(ep);
825
		snd_hdjmidi_out_endpoint_delete(ep);
823
		return -ENOMEM;
826
		return -ENOMEM;
Lines 853-860 Link Here
853
		ep->controller_state->ctl_req->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
856
		ep->controller_state->ctl_req->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
854
		ep->controller_state->ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
857
		ep->controller_state->ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
855
		ep->urb->setup_dma = ep->controller_state->ctl_req_dma;
858
		ep->urb->setup_dma = ep->controller_state->ctl_req_dma;
856
		/* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
859
		/* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
857
		ep->urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
860
		ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
858
	}
861
	}
859
	
862
	
860
	if (ep->umidi->chip->caps.leds_hid_controlled) {
863
	if (ep->umidi->chip->caps.leds_hid_controlled) {
Lines 874-881 Link Here
874
		ep->ctrl_req_led->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
877
		ep->ctrl_req_led->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
875
		ep->ctrl_req_led->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
878
		ep->ctrl_req_led->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
876
		ep->urb_led->setup_dma = ep->ctrl_req_led_dma;
879
		ep->urb_led->setup_dma = ep->ctrl_req_led_dma;
877
		/* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
880
		/* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
878
		ep->urb_led->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
881
		ep->urb_led->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
879
	}
882
	}
880
	
883
	
881
	if (ep->umidi->chip->caps.leds_bulk_controlled) {
884
	if (ep->umidi->chip->caps.leds_bulk_controlled) {
Lines 913-932 Link Here
913
			return -ENOMEM;
916
			return -ENOMEM;
914
		}
917
		}
915
918
916
		buffer = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer,
919
		buffer = usb_alloc_coherent(umidi->chip->dev, ep->max_transfer,
917
				  GFP_KERNEL, &ep->controller_state->urb_kt->transfer_dma);
920
				  GFP_KERNEL, &ep->controller_state->urb_kt->transfer_dma);
918
		if (!buffer) {
921
		if (!buffer) {
919
			snd_printk(KERN_WARNING"%s() usb_buffer_alloc() for wq failed\n",__FUNCTION__);
922
			snd_printk(KERN_WARNING"%s() usb_alloc_coherent() for wq failed\n",__FUNCTION__);
920
			snd_hdjmidi_out_endpoint_delete(ep);
923
			snd_hdjmidi_out_endpoint_delete(ep);
921
			return -ENOMEM;
924
			return -ENOMEM;
922
		}
925
		}
923
926
924
		ep->controller_state->ctl_req_kt = usb_buffer_alloc(umidi->chip->dev, 
927
		ep->controller_state->ctl_req_kt = usb_alloc_coherent(umidi->chip->dev, 
925
							sizeof(*(ep->controller_state->ctl_req_kt)),
928
							sizeof(*(ep->controller_state->ctl_req_kt)),
926
							GFP_KERNEL, 
929
							GFP_KERNEL, 
927
							&ep->controller_state->ctl_req_dma_kt);
930
							&ep->controller_state->ctl_req_dma_kt);
928
		if (!ep->controller_state->ctl_req_kt) {
931
		if (!ep->controller_state->ctl_req_kt) {
929
			snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for setup DMA for wq\n",__FUNCTION__);
932
			snd_printk(KERN_WARNING"%s() usb_alloc_coherent() failed for setup DMA for wq\n",__FUNCTION__);
930
			snd_hdjmidi_out_endpoint_delete(ep);
933
			snd_hdjmidi_out_endpoint_delete(ep);
931
			return -ENOMEM;
934
			return -ENOMEM;
932
		}
935
		}
Lines 946-953 Link Here
946
		ep->controller_state->ctl_req_kt->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
949
		ep->controller_state->ctl_req_kt->wIndex = cpu_to_le16(umidi->iface->cur_altsetting->desc.bInterfaceNumber);
947
		ep->controller_state->ctl_req_kt->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
950
		ep->controller_state->ctl_req_kt->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN);
948
		ep->controller_state->urb_kt->setup_dma = ep->controller_state->ctl_req_dma_kt;
951
		ep->controller_state->urb_kt->setup_dma = ep->controller_state->ctl_req_dma_kt;
949
		/* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */
952
		/* NOTE: transfer_dma setup above in call to usb_alloc_coherent() */
950
		ep->controller_state->urb_kt->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP;
953
		ep->controller_state->urb_kt->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
951
	
954
	
952
		init_completion(&ep->controller_state->ctl_req_completion_kt);
955
		init_completion(&ep->controller_state->ctl_req_completion_kt);
953
		init_completion(&ep->controller_state->mp3w_kthread_started);
956
		init_completion(&ep->controller_state->mp3w_kthread_started);

Return to bug 272100