]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/dvb/dvb-usb/usb-urb.c
Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa...
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / dvb-usb / usb-urb.c
index 8728cf347a717959adb4611892174d2d99adab02..da93b9e982c04e3c67dbc0db671d43ca313a41ee 100644 (file)
@@ -11,7 +11,7 @@
 #include "dvb-usb-common.h"
 
 /* URB stuff for streaming */
-static void usb_urb_complete(struct urb *urb, struct pt_regs *ptregs)
+static void usb_urb_complete(struct urb *urb)
 {
        struct usb_data_stream *stream = urb->context;
        int ptype = usb_pipetype(urb->pipe);
@@ -116,14 +116,15 @@ static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num,
        for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) {
                deb_mem("allocating buffer %d\n",stream->buf_num);
                if (( stream->buf_list[stream->buf_num] =
-                                       usb_buffer_alloc(stream->udev, size, SLAB_ATOMIC,
+                                       usb_buffer_alloc(stream->udev, size, GFP_ATOMIC,
                                        &stream->dma_addr[stream->buf_num]) ) == NULL) {
                        deb_mem("not enough memory for urb-buffer allocation.\n");
                        usb_free_stream_buffers(stream);
                        return -ENOMEM;
                }
-               deb_mem("buffer %d: %p (dma: %u)\n",
-                       stream->buf_num, stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]);
+               deb_mem("buffer %d: %p (dma: %Lu)\n",
+                       stream->buf_num,
+stream->buf_list[stream->buf_num], (long long)stream->dma_addr[stream->buf_num]);
                memset(stream->buf_list[stream->buf_num],0,size);
                stream->state |= USB_STATE_URB_BUF;
        }
@@ -134,7 +135,7 @@ static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num,
 
 static int usb_bulk_urb_init(struct usb_data_stream *stream)
 {
-       int i;
+       int i, j;
 
        if ((i = usb_allocate_stream_buffers(stream,stream->props.count,
                                        stream->props.u.bulk.buffersize)) < 0)
@@ -142,9 +143,13 @@ static int usb_bulk_urb_init(struct usb_data_stream *stream)
 
        /* allocate the URBs */
        for (i = 0; i < stream->props.count; i++) {
-               if ((stream->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL)
+               stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC);
+               if (!stream->urb_list[i]) {
+                       deb_mem("not enough memory for urb_alloc_urb!.\n");
+                       for (j = 0; j < i; j++)
+                               usb_free_urb(stream->urb_list[i]);
                        return -ENOMEM;
-
+               }
                usb_fill_bulk_urb( stream->urb_list[i], stream->udev,
                                usb_rcvbulkpipe(stream->udev,stream->props.endpoint),
                                stream->buf_list[i],
@@ -169,9 +174,14 @@ static int usb_isoc_urb_init(struct usb_data_stream *stream)
        for (i = 0; i < stream->props.count; i++) {
                struct urb *urb;
                int frame_offset = 0;
-               if ((stream->urb_list[i] =
-                                       usb_alloc_urb(stream->props.u.isoc.framesperurb,GFP_ATOMIC)) == NULL)
+
+               stream->urb_list[i] = usb_alloc_urb(stream->props.u.isoc.framesperurb, GFP_ATOMIC);
+               if (!stream->urb_list[i]) {
+                       deb_mem("not enough memory for urb_alloc_urb!\n");
+                       for (j = 0; j < i; j++)
+                               usb_free_urb(stream->urb_list[i]);
                        return -ENOMEM;
+               }
 
                urb = stream->urb_list[i];