diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-04-12 13:17:25 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 13:21:38 -0700 |
commit | 997ea58eb92f9970b8af7aae48800d0ef43b9423 (patch) | |
tree | 65e021973e5a48ad7290d5be1f441940566468ad /drivers/media | |
parent | 48679c6d772b1459a2945729e3a1256ac78fcabf (diff) |
USB: rename usb_buffer_alloc() and usb_buffer_free() users
For more clearance what the functions actually do,
usb_buffer_alloc() is renamed to usb_alloc_coherent()
usb_buffer_free() is renamed to usb_free_coherent()
They should only be used in code which really needs DMA coherency.
All call sites have been changed accordingly, except for staging
drivers.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Pedro Ribeiro <pedrib@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-usb/usb-urb.c | 7 | ||||
-rw-r--r-- | drivers/media/dvb/ttusb-dec/ttusb_dec.c | 6 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-video.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-core.c | 14 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 4 | ||||
-rw-r--r-- | drivers/media/video/gspca/benq.c | 4 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 30 | ||||
-rw-r--r-- | drivers/media/video/hdpvr/hdpvr-video.c | 8 | ||||
-rw-r--r-- | drivers/media/video/tlg2300/pd-video.c | 14 | ||||
-rw-r--r-- | drivers/media/video/usbvision/usbvision-core.c | 16 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_video.c | 4 |
11 files changed, 56 insertions, 55 deletions
diff --git a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c index f9702e3756b..86d68933b6b 100644 --- a/drivers/media/dvb/dvb-usb/usb-urb.c +++ b/drivers/media/dvb/dvb-usb/usb-urb.c @@ -96,8 +96,9 @@ static int usb_free_stream_buffers(struct usb_data_stream *stream) while (stream->buf_num) { stream->buf_num--; deb_mem("freeing buffer %d\n",stream->buf_num); - usb_buffer_free(stream->udev, stream->buf_size, - stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]); + usb_free_coherent(stream->udev, stream->buf_size, + stream->buf_list[stream->buf_num], + stream->dma_addr[stream->buf_num]); } } @@ -116,7 +117,7 @@ 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, GFP_ATOMIC, + usb_alloc_coherent(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); diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 53baccbab17..fe1b8037b24 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1257,7 +1257,7 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec) if(!dec->irq_urb) { return -ENOMEM; } - dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE, + dec->irq_buffer = usb_alloc_coherent(dec->udev,IRQ_PACKET_SIZE, GFP_ATOMIC, &dec->irq_dma_handle); if(!dec->irq_buffer) { usb_free_urb(dec->irq_urb); @@ -1550,8 +1550,8 @@ static void ttusb_dec_exit_rc(struct ttusb_dec *dec) usb_free_urb(dec->irq_urb); - usb_buffer_free(dec->udev,IRQ_PACKET_SIZE, - dec->irq_buffer, dec->irq_dma_handle); + usb_free_coherent(dec->udev,IRQ_PACKET_SIZE, + dec->irq_buffer, dec->irq_dma_handle); if (dec->rc_input_dev) { input_unregister_device(dec->rc_input_dev); diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 8c140c01c5e..a2a0f79a84f 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c @@ -177,7 +177,7 @@ void au0828_uninit_isoc(struct au0828_dev *dev) usb_unlink_urb(urb); if (dev->isoc_ctl.transfer_buffer[i]) { - usb_buffer_free(dev->usbdev, + usb_free_coherent(dev->usbdev, urb->transfer_buffer_length, dev->isoc_ctl.transfer_buffer[i], urb->transfer_dma); @@ -247,7 +247,7 @@ int au0828_init_isoc(struct au0828_dev *dev, int max_packets, } dev->isoc_ctl.urb[i] = urb; - dev->isoc_ctl.transfer_buffer[i] = usb_buffer_alloc(dev->usbdev, + dev->isoc_ctl.transfer_buffer[i] = usb_alloc_coherent(dev->usbdev, sb_size, GFP_KERNEL, &urb->transfer_dma); if (!dev->isoc_ctl.transfer_buffer[i]) { printk("unable to allocate %i bytes for transfer" diff --git a/drivers/media/video/cx231xx/cx231xx-core.c b/drivers/media/video/cx231xx/cx231xx-core.c index b24eee115e7..6ccd87d5fb9 100644 --- a/drivers/media/video/cx231xx/cx231xx-core.c +++ b/drivers/media/video/cx231xx/cx231xx-core.c @@ -679,11 +679,11 @@ void cx231xx_uninit_isoc(struct cx231xx *dev) usb_unlink_urb(urb); if (dev->video_mode.isoc_ctl.transfer_buffer[i]) { - usb_buffer_free(dev->udev, - urb->transfer_buffer_length, - dev->video_mode.isoc_ctl. - transfer_buffer[i], - urb->transfer_dma); + usb_free_coherent(dev->udev, + urb->transfer_buffer_length, + dev->video_mode.isoc_ctl. + transfer_buffer[i], + urb->transfer_dma); } usb_free_urb(urb); dev->video_mode.isoc_ctl.urb[i] = NULL; @@ -770,8 +770,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, dev->video_mode.isoc_ctl.urb[i] = urb; dev->video_mode.isoc_ctl.transfer_buffer[i] = - usb_buffer_alloc(dev->udev, sb_size, GFP_KERNEL, - &urb->transfer_dma); + usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL, + &urb->transfer_dma); if (!dev->video_mode.isoc_ctl.transfer_buffer[i]) { cx231xx_err("unable to allocate %i bytes for transfer" " buffer %i%s\n", diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index a41cc556677..d4a95546504 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -966,7 +966,7 @@ void em28xx_uninit_isoc(struct em28xx *dev) usb_unlink_urb(urb); if (dev->isoc_ctl.transfer_buffer[i]) { - usb_buffer_free(dev->udev, + usb_free_coherent(dev->udev, urb->transfer_buffer_length, dev->isoc_ctl.transfer_buffer[i], urb->transfer_dma); @@ -1041,7 +1041,7 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets, } dev->isoc_ctl.urb[i] = urb; - dev->isoc_ctl.transfer_buffer[i] = usb_buffer_alloc(dev->udev, + dev->isoc_ctl.transfer_buffer[i] = usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL, &urb->transfer_dma); if (!dev->isoc_ctl.transfer_buffer[i]) { em28xx_err("unable to allocate %i bytes for transfer" diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c index 43ac4af8d3e..fce8d949264 100644 --- a/drivers/media/video/gspca/benq.c +++ b/drivers/media/video/gspca/benq.c @@ -117,13 +117,13 @@ static int sd_start(struct gspca_dev *gspca_dev) return -ENOMEM; } gspca_dev->urb[n] = urb; - urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev, + urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev, SD_PKT_SZ * SD_NPKT, GFP_KERNEL, &urb->transfer_dma); if (urb->transfer_buffer == NULL) { - err("usb_buffer_alloc failed"); + err("usb_alloc_coherent failed"); return -ENOMEM; } urb->dev = gspca_dev->dev; diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 222af479150..00713f81d1e 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -213,7 +213,7 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev, goto error; } - buffer = usb_buffer_alloc(dev, ep->wMaxPacketSize, + buffer = usb_alloc_coherent(dev, ep->wMaxPacketSize, GFP_KERNEL, &urb->transfer_dma); if (!buffer) { ret = -ENOMEM; @@ -232,10 +232,10 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev, return ret; error_submit: - usb_buffer_free(dev, - urb->transfer_buffer_length, - urb->transfer_buffer, - urb->transfer_dma); + usb_free_coherent(dev, + urb->transfer_buffer_length, + urb->transfer_buffer, + urb->transfer_dma); error_buffer: usb_free_urb(urb); error: @@ -272,10 +272,10 @@ static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev) if (urb) { gspca_dev->int_urb = NULL; usb_kill_urb(urb); - usb_buffer_free(gspca_dev->dev, - urb->transfer_buffer_length, - urb->transfer_buffer, - urb->transfer_dma); + usb_free_coherent(gspca_dev->dev, + urb->transfer_buffer_length, + urb->transfer_buffer, + urb->transfer_dma); usb_free_urb(urb); } } @@ -597,10 +597,10 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) gspca_dev->urb[i] = NULL; usb_kill_urb(urb); if (urb->transfer_buffer != NULL) - usb_buffer_free(gspca_dev->dev, - urb->transfer_buffer_length, - urb->transfer_buffer, - urb->transfer_dma); + usb_free_coherent(gspca_dev->dev, + urb->transfer_buffer_length, + urb->transfer_buffer, + urb->transfer_dma); usb_free_urb(urb); } } @@ -721,13 +721,13 @@ static int create_urbs(struct gspca_dev *gspca_dev, return -ENOMEM; } gspca_dev->urb[n] = urb; - urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev, + urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev, bsize, GFP_KERNEL, &urb->transfer_dma); if (urb->transfer_buffer == NULL) { - err("usb_buffer_alloc failed"); + err("usb_alloc_coherent failed"); return -ENOMEM; } urb->dev = gspca_dev->dev; diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index 196f82de48f..b65efe25b31 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c @@ -92,8 +92,8 @@ static int hdpvr_free_queue(struct list_head *q) buf = list_entry(p, struct hdpvr_buffer, buff_list); urb = buf->urb; - usb_buffer_free(urb->dev, urb->transfer_buffer_length, - urb->transfer_buffer, urb->transfer_dma); + usb_free_coherent(urb->dev, urb->transfer_buffer_length, + urb->transfer_buffer, urb->transfer_dma); usb_free_urb(urb); tmp = p->next; list_del(p); @@ -143,8 +143,8 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) } buf->urb = urb; - mem = usb_buffer_alloc(dev->udev, dev->bulk_in_size, GFP_KERNEL, - &urb->transfer_dma); + mem = usb_alloc_coherent(dev->udev, dev->bulk_in_size, GFP_KERNEL, + &urb->transfer_dma); if (!mem) { v4l2_err(&dev->v4l2_dev, "cannot allocate usb transfer buffer\n"); diff --git a/drivers/media/video/tlg2300/pd-video.c b/drivers/media/video/tlg2300/pd-video.c index cf8f18c007e..7bc29065e1a 100644 --- a/drivers/media/video/tlg2300/pd-video.c +++ b/drivers/media/video/tlg2300/pd-video.c @@ -476,10 +476,10 @@ static int prepare_iso_urb(struct video_data *video) goto out; video->urb_array[i] = urb; - mem = usb_buffer_alloc(udev, - ISO_PKT_SIZE * PK_PER_URB, - GFP_KERNEL, - &urb->transfer_dma); + mem = usb_alloc_coherent(udev, + ISO_PKT_SIZE * PK_PER_URB, + GFP_KERNEL, + &urb->transfer_dma); urb->complete = urb_complete_iso; /* handler */ urb->dev = udev; @@ -519,8 +519,8 @@ int alloc_bulk_urbs_generic(struct urb **urb_array, int num, if (urb == NULL) return i; - mem = usb_buffer_alloc(udev, buf_size, gfp_flags, - &urb->transfer_dma); + mem = usb_alloc_coherent(udev, buf_size, gfp_flags, + &urb->transfer_dma); if (mem == NULL) return i; @@ -540,7 +540,7 @@ void free_all_urb_generic(struct urb **urb_array, int num) for (i = 0; i < num; i++) { urb = urb_array[i]; if (urb) { - usb_buffer_free(urb->dev, + usb_free_coherent(urb->dev, urb->transfer_buffer_length, urb->transfer_buffer, urb->transfer_dma); diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index f7aae229375..b9dd74fde21 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c @@ -2493,10 +2493,10 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) } usbvision->sbuf[bufIdx].urb = urb; usbvision->sbuf[bufIdx].data = - usb_buffer_alloc(usbvision->dev, - sb_size, - GFP_KERNEL, - &urb->transfer_dma); + usb_alloc_coherent(usbvision->dev, + sb_size, + GFP_KERNEL, + &urb->transfer_dma); urb->dev = dev; urb->context = usbvision; urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); @@ -2552,10 +2552,10 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { usb_kill_urb(usbvision->sbuf[bufIdx].urb); if (usbvision->sbuf[bufIdx].data){ - usb_buffer_free(usbvision->dev, - sb_size, - usbvision->sbuf[bufIdx].data, - usbvision->sbuf[bufIdx].urb->transfer_dma); + usb_free_coherent(usbvision->dev, + sb_size, + usbvision->sbuf[bufIdx].data, + usbvision->sbuf[bufIdx].urb->transfer_dma); } usb_free_urb(usbvision->sbuf[bufIdx].urb); usbvision->sbuf[bufIdx].urb = NULL; diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 821a9969b7b..53f3ef4635e 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c @@ -739,7 +739,7 @@ static void uvc_free_urb_buffers(struct uvc_streaming *stream) for (i = 0; i < UVC_URBS; ++i) { if (stream->urb_buffer[i]) { - usb_buffer_free(stream->dev->udev, stream->urb_size, + usb_free_coherent(stream->dev->udev, stream->urb_size, stream->urb_buffer[i], stream->urb_dma[i]); stream->urb_buffer[i] = NULL; } @@ -780,7 +780,7 @@ static int uvc_alloc_urb_buffers(struct uvc_streaming *stream, for (; npackets > 1; npackets /= 2) { for (i = 0; i < UVC_URBS; ++i) { stream->urb_size = psize * npackets; - stream->urb_buffer[i] = usb_buffer_alloc( + stream->urb_buffer[i] = usb_alloc_coherent( stream->dev->udev, stream->urb_size, gfp_flags | __GFP_NOWARN, &stream->urb_dma[i]); if (!stream->urb_buffer[i]) { |