aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorMarkus Rechberger <mrechberger@gmail.com>2005-11-09 00:37:46 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:21 -0500
commit02f7427333c5784a937314a305132ed31cc6b9d1 (patch)
tree3420ad4eb8ac1875552e959d8b35d7ee04ad4716 /drivers/media/video/em28xx
parentf2421ca3383ed35bc634aa29416a3229dc603fa4 (diff)
[PATCH] v4l: 802: replaced kmalloc kfree with usb buffer alloc usb buffer free to get
- Replaced kmalloc/kfree with usb_buffer_alloc/usb_buffer_free to get Signed-off-by: Markus Rechberger <mrechberger@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 227a47d6e4bd..ba2d986c6dfc 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -714,11 +714,12 @@ void em2820_uninit_isoc(struct em2820 *dev)
714 for (i = 0; i < EM2820_NUM_BUFS; i++) { 714 for (i = 0; i < EM2820_NUM_BUFS; i++) {
715 if (dev->urb[i]) { 715 if (dev->urb[i]) {
716 usb_kill_urb(dev->urb[i]); 716 usb_kill_urb(dev->urb[i]);
717 if (dev->transfer_buffer[i]){
718 usb_buffer_free(dev->udev,(EM2820_NUM_PACKETS*dev->max_pkt_size),dev->transfer_buffer[i],dev->urb[i]->transfer_dma);
719 }
717 usb_free_urb(dev->urb[i]); 720 usb_free_urb(dev->urb[i]);
718 } 721 }
719 dev->urb[i] = NULL; 722 dev->urb[i] = NULL;
720 if (dev->transfer_buffer[i])
721 kfree(dev->transfer_buffer[i]);
722 dev->transfer_buffer[i] = NULL; 723 dev->transfer_buffer[i] = NULL;
723 } 724 }
724 em2820_capture_start(dev, 0); 725 em2820_capture_start(dev, 0);
@@ -743,7 +744,13 @@ int em2820_init_isoc(struct em2820 *dev)
743 struct urb *urb; 744 struct urb *urb;
744 int j, k; 745 int j, k;
745 /* allocate transfer buffer */ 746 /* allocate transfer buffer */
746 dev->transfer_buffer[i] = kmalloc(sb_size, GFP_KERNEL); 747 urb = usb_alloc_urb(EM2820_NUM_PACKETS, GFP_KERNEL);
748 if (!urb){
749 em2820_errdev("cannot alloc urb %i\n", i);
750 em2820_uninit_isoc(dev);
751 return -ENOMEM;
752 }
753 dev->transfer_buffer[i] = usb_buffer_alloc(dev->udev, sb_size, GFP_KERNEL,&urb->transfer_dma);
747 if (!dev->transfer_buffer[i]) { 754 if (!dev->transfer_buffer[i]) {
748 em2820_errdev 755 em2820_errdev
749 ("unable to allocate %i bytes for transfer buffer %i\n", 756 ("unable to allocate %i bytes for transfer buffer %i\n",
@@ -752,29 +759,22 @@ int em2820_init_isoc(struct em2820 *dev)
752 return -ENOMEM; 759 return -ENOMEM;
753 } 760 }
754 memset(dev->transfer_buffer[i], 0, sb_size); 761 memset(dev->transfer_buffer[i], 0, sb_size);
755 urb = usb_alloc_urb(EM2820_NUM_PACKETS, GFP_KERNEL); 762 urb->dev = dev->udev;
756 if (urb) { 763 urb->context = dev;
757 urb->dev = dev->udev; 764 urb->pipe = usb_rcvisocpipe(dev->udev, 0x82);
758 urb->context = dev; 765 urb->transfer_flags = URB_ISO_ASAP;
759 urb->pipe = usb_rcvisocpipe(dev->udev, 0x82); 766 urb->interval = 1;
760 urb->transfer_flags = URB_ISO_ASAP; 767 urb->transfer_buffer = dev->transfer_buffer[i];
761 urb->interval = 1; 768 urb->complete = em2820_isocIrq;
762 urb->transfer_buffer = dev->transfer_buffer[i]; 769 urb->number_of_packets = EM2820_NUM_PACKETS;
763 urb->complete = em2820_isocIrq; 770 urb->transfer_buffer_length = sb_size;
764 urb->number_of_packets = EM2820_NUM_PACKETS; 771 for (j = k = 0; j < EM2820_NUM_PACKETS;
765 urb->transfer_buffer_length = sb_size; 772 j++, k += dev->max_pkt_size) {
766 for (j = k = 0; j < EM2820_NUM_PACKETS; 773 urb->iso_frame_desc[j].offset = k;
767 j++, k += dev->max_pkt_size) { 774 urb->iso_frame_desc[j].length =
768 urb->iso_frame_desc[j].offset = k; 775 dev->max_pkt_size;
769 urb->iso_frame_desc[j].length =
770 dev->max_pkt_size;
771 }
772 dev->urb[i] = urb;
773 } else {
774 em2820_errdev("cannot alloc urb %i\n", i);
775 em2820_uninit_isoc(dev);
776 return -ENOMEM;
777 } 776 }
777 dev->urb[i] = urb;
778 } 778 }
779 779
780 /* submit urbs */ 780 /* submit urbs */