diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-04-12 07:17:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:38 -0400 |
commit | 997ea58eb92f9970b8af7aae48800d0ef43b9423 (patch) | |
tree | 65e021973e5a48ad7290d5be1f441940566468ad /drivers/media/video | |
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/video')
-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 |
9 files changed, 49 insertions, 49 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 8c140c01c5e6..a2a0f79a84f3 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) | |||
177 | usb_unlink_urb(urb); | 177 | usb_unlink_urb(urb); |
178 | 178 | ||
179 | if (dev->isoc_ctl.transfer_buffer[i]) { | 179 | if (dev->isoc_ctl.transfer_buffer[i]) { |
180 | usb_buffer_free(dev->usbdev, | 180 | usb_free_coherent(dev->usbdev, |
181 | urb->transfer_buffer_length, | 181 | urb->transfer_buffer_length, |
182 | dev->isoc_ctl.transfer_buffer[i], | 182 | dev->isoc_ctl.transfer_buffer[i], |
183 | urb->transfer_dma); | 183 | urb->transfer_dma); |
@@ -247,7 +247,7 @@ int au0828_init_isoc(struct au0828_dev *dev, int max_packets, | |||
247 | } | 247 | } |
248 | dev->isoc_ctl.urb[i] = urb; | 248 | dev->isoc_ctl.urb[i] = urb; |
249 | 249 | ||
250 | dev->isoc_ctl.transfer_buffer[i] = usb_buffer_alloc(dev->usbdev, | 250 | dev->isoc_ctl.transfer_buffer[i] = usb_alloc_coherent(dev->usbdev, |
251 | sb_size, GFP_KERNEL, &urb->transfer_dma); | 251 | sb_size, GFP_KERNEL, &urb->transfer_dma); |
252 | if (!dev->isoc_ctl.transfer_buffer[i]) { | 252 | if (!dev->isoc_ctl.transfer_buffer[i]) { |
253 | printk("unable to allocate %i bytes for transfer" | 253 | 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 b24eee115e7e..6ccd87d5fb98 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) | |||
679 | usb_unlink_urb(urb); | 679 | usb_unlink_urb(urb); |
680 | 680 | ||
681 | if (dev->video_mode.isoc_ctl.transfer_buffer[i]) { | 681 | if (dev->video_mode.isoc_ctl.transfer_buffer[i]) { |
682 | usb_buffer_free(dev->udev, | 682 | usb_free_coherent(dev->udev, |
683 | urb->transfer_buffer_length, | 683 | urb->transfer_buffer_length, |
684 | dev->video_mode.isoc_ctl. | 684 | dev->video_mode.isoc_ctl. |
685 | transfer_buffer[i], | 685 | transfer_buffer[i], |
686 | urb->transfer_dma); | 686 | urb->transfer_dma); |
687 | } | 687 | } |
688 | usb_free_urb(urb); | 688 | usb_free_urb(urb); |
689 | dev->video_mode.isoc_ctl.urb[i] = NULL; | 689 | dev->video_mode.isoc_ctl.urb[i] = NULL; |
@@ -770,8 +770,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, | |||
770 | dev->video_mode.isoc_ctl.urb[i] = urb; | 770 | dev->video_mode.isoc_ctl.urb[i] = urb; |
771 | 771 | ||
772 | dev->video_mode.isoc_ctl.transfer_buffer[i] = | 772 | dev->video_mode.isoc_ctl.transfer_buffer[i] = |
773 | usb_buffer_alloc(dev->udev, sb_size, GFP_KERNEL, | 773 | usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL, |
774 | &urb->transfer_dma); | 774 | &urb->transfer_dma); |
775 | if (!dev->video_mode.isoc_ctl.transfer_buffer[i]) { | 775 | if (!dev->video_mode.isoc_ctl.transfer_buffer[i]) { |
776 | cx231xx_err("unable to allocate %i bytes for transfer" | 776 | cx231xx_err("unable to allocate %i bytes for transfer" |
777 | " buffer %i%s\n", | 777 | " buffer %i%s\n", |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index a41cc5566778..d4a95546504d 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) | |||
966 | usb_unlink_urb(urb); | 966 | usb_unlink_urb(urb); |
967 | 967 | ||
968 | if (dev->isoc_ctl.transfer_buffer[i]) { | 968 | if (dev->isoc_ctl.transfer_buffer[i]) { |
969 | usb_buffer_free(dev->udev, | 969 | usb_free_coherent(dev->udev, |
970 | urb->transfer_buffer_length, | 970 | urb->transfer_buffer_length, |
971 | dev->isoc_ctl.transfer_buffer[i], | 971 | dev->isoc_ctl.transfer_buffer[i], |
972 | urb->transfer_dma); | 972 | urb->transfer_dma); |
@@ -1041,7 +1041,7 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets, | |||
1041 | } | 1041 | } |
1042 | dev->isoc_ctl.urb[i] = urb; | 1042 | dev->isoc_ctl.urb[i] = urb; |
1043 | 1043 | ||
1044 | dev->isoc_ctl.transfer_buffer[i] = usb_buffer_alloc(dev->udev, | 1044 | dev->isoc_ctl.transfer_buffer[i] = usb_alloc_coherent(dev->udev, |
1045 | sb_size, GFP_KERNEL, &urb->transfer_dma); | 1045 | sb_size, GFP_KERNEL, &urb->transfer_dma); |
1046 | if (!dev->isoc_ctl.transfer_buffer[i]) { | 1046 | if (!dev->isoc_ctl.transfer_buffer[i]) { |
1047 | em28xx_err("unable to allocate %i bytes for transfer" | 1047 | 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 43ac4af8d3ed..fce8d9492641 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) | |||
117 | return -ENOMEM; | 117 | return -ENOMEM; |
118 | } | 118 | } |
119 | gspca_dev->urb[n] = urb; | 119 | gspca_dev->urb[n] = urb; |
120 | urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev, | 120 | urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev, |
121 | SD_PKT_SZ * SD_NPKT, | 121 | SD_PKT_SZ * SD_NPKT, |
122 | GFP_KERNEL, | 122 | GFP_KERNEL, |
123 | &urb->transfer_dma); | 123 | &urb->transfer_dma); |
124 | 124 | ||
125 | if (urb->transfer_buffer == NULL) { | 125 | if (urb->transfer_buffer == NULL) { |
126 | err("usb_buffer_alloc failed"); | 126 | err("usb_alloc_coherent failed"); |
127 | return -ENOMEM; | 127 | return -ENOMEM; |
128 | } | 128 | } |
129 | urb->dev = gspca_dev->dev; | 129 | urb->dev = gspca_dev->dev; |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 222af479150b..00713f81d1e2 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, | |||
213 | goto error; | 213 | goto error; |
214 | } | 214 | } |
215 | 215 | ||
216 | buffer = usb_buffer_alloc(dev, ep->wMaxPacketSize, | 216 | buffer = usb_alloc_coherent(dev, ep->wMaxPacketSize, |
217 | GFP_KERNEL, &urb->transfer_dma); | 217 | GFP_KERNEL, &urb->transfer_dma); |
218 | if (!buffer) { | 218 | if (!buffer) { |
219 | ret = -ENOMEM; | 219 | ret = -ENOMEM; |
@@ -232,10 +232,10 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev, | |||
232 | return ret; | 232 | return ret; |
233 | 233 | ||
234 | error_submit: | 234 | error_submit: |
235 | usb_buffer_free(dev, | 235 | usb_free_coherent(dev, |
236 | urb->transfer_buffer_length, | 236 | urb->transfer_buffer_length, |
237 | urb->transfer_buffer, | 237 | urb->transfer_buffer, |
238 | urb->transfer_dma); | 238 | urb->transfer_dma); |
239 | error_buffer: | 239 | error_buffer: |
240 | usb_free_urb(urb); | 240 | usb_free_urb(urb); |
241 | error: | 241 | error: |
@@ -272,10 +272,10 @@ static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev) | |||
272 | if (urb) { | 272 | if (urb) { |
273 | gspca_dev->int_urb = NULL; | 273 | gspca_dev->int_urb = NULL; |
274 | usb_kill_urb(urb); | 274 | usb_kill_urb(urb); |
275 | usb_buffer_free(gspca_dev->dev, | 275 | usb_free_coherent(gspca_dev->dev, |
276 | urb->transfer_buffer_length, | 276 | urb->transfer_buffer_length, |
277 | urb->transfer_buffer, | 277 | urb->transfer_buffer, |
278 | urb->transfer_dma); | 278 | urb->transfer_dma); |
279 | usb_free_urb(urb); | 279 | usb_free_urb(urb); |
280 | } | 280 | } |
281 | } | 281 | } |
@@ -597,10 +597,10 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) | |||
597 | gspca_dev->urb[i] = NULL; | 597 | gspca_dev->urb[i] = NULL; |
598 | usb_kill_urb(urb); | 598 | usb_kill_urb(urb); |
599 | if (urb->transfer_buffer != NULL) | 599 | if (urb->transfer_buffer != NULL) |
600 | usb_buffer_free(gspca_dev->dev, | 600 | usb_free_coherent(gspca_dev->dev, |
601 | urb->transfer_buffer_length, | 601 | urb->transfer_buffer_length, |
602 | urb->transfer_buffer, | 602 | urb->transfer_buffer, |
603 | urb->transfer_dma); | 603 | urb->transfer_dma); |
604 | usb_free_urb(urb); | 604 | usb_free_urb(urb); |
605 | } | 605 | } |
606 | } | 606 | } |
@@ -721,13 +721,13 @@ static int create_urbs(struct gspca_dev *gspca_dev, | |||
721 | return -ENOMEM; | 721 | return -ENOMEM; |
722 | } | 722 | } |
723 | gspca_dev->urb[n] = urb; | 723 | gspca_dev->urb[n] = urb; |
724 | urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev, | 724 | urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev, |
725 | bsize, | 725 | bsize, |
726 | GFP_KERNEL, | 726 | GFP_KERNEL, |
727 | &urb->transfer_dma); | 727 | &urb->transfer_dma); |
728 | 728 | ||
729 | if (urb->transfer_buffer == NULL) { | 729 | if (urb->transfer_buffer == NULL) { |
730 | err("usb_buffer_alloc failed"); | 730 | err("usb_alloc_coherent failed"); |
731 | return -ENOMEM; | 731 | return -ENOMEM; |
732 | } | 732 | } |
733 | urb->dev = gspca_dev->dev; | 733 | urb->dev = gspca_dev->dev; |
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index 196f82de48f0..b65efe25b31d 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) | |||
92 | buf = list_entry(p, struct hdpvr_buffer, buff_list); | 92 | buf = list_entry(p, struct hdpvr_buffer, buff_list); |
93 | 93 | ||
94 | urb = buf->urb; | 94 | urb = buf->urb; |
95 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 95 | usb_free_coherent(urb->dev, urb->transfer_buffer_length, |
96 | urb->transfer_buffer, urb->transfer_dma); | 96 | urb->transfer_buffer, urb->transfer_dma); |
97 | usb_free_urb(urb); | 97 | usb_free_urb(urb); |
98 | tmp = p->next; | 98 | tmp = p->next; |
99 | list_del(p); | 99 | list_del(p); |
@@ -143,8 +143,8 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) | |||
143 | } | 143 | } |
144 | buf->urb = urb; | 144 | buf->urb = urb; |
145 | 145 | ||
146 | mem = usb_buffer_alloc(dev->udev, dev->bulk_in_size, GFP_KERNEL, | 146 | mem = usb_alloc_coherent(dev->udev, dev->bulk_in_size, GFP_KERNEL, |
147 | &urb->transfer_dma); | 147 | &urb->transfer_dma); |
148 | if (!mem) { | 148 | if (!mem) { |
149 | v4l2_err(&dev->v4l2_dev, | 149 | v4l2_err(&dev->v4l2_dev, |
150 | "cannot allocate usb transfer buffer\n"); | 150 | "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 cf8f18c007e6..7bc29065e1ad 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) | |||
476 | goto out; | 476 | goto out; |
477 | 477 | ||
478 | video->urb_array[i] = urb; | 478 | video->urb_array[i] = urb; |
479 | mem = usb_buffer_alloc(udev, | 479 | mem = usb_alloc_coherent(udev, |
480 | ISO_PKT_SIZE * PK_PER_URB, | 480 | ISO_PKT_SIZE * PK_PER_URB, |
481 | GFP_KERNEL, | 481 | GFP_KERNEL, |
482 | &urb->transfer_dma); | 482 | &urb->transfer_dma); |
483 | 483 | ||
484 | urb->complete = urb_complete_iso; /* handler */ | 484 | urb->complete = urb_complete_iso; /* handler */ |
485 | urb->dev = udev; | 485 | urb->dev = udev; |
@@ -519,8 +519,8 @@ int alloc_bulk_urbs_generic(struct urb **urb_array, int num, | |||
519 | if (urb == NULL) | 519 | if (urb == NULL) |
520 | return i; | 520 | return i; |
521 | 521 | ||
522 | mem = usb_buffer_alloc(udev, buf_size, gfp_flags, | 522 | mem = usb_alloc_coherent(udev, buf_size, gfp_flags, |
523 | &urb->transfer_dma); | 523 | &urb->transfer_dma); |
524 | if (mem == NULL) | 524 | if (mem == NULL) |
525 | return i; | 525 | return i; |
526 | 526 | ||
@@ -540,7 +540,7 @@ void free_all_urb_generic(struct urb **urb_array, int num) | |||
540 | for (i = 0; i < num; i++) { | 540 | for (i = 0; i < num; i++) { |
541 | urb = urb_array[i]; | 541 | urb = urb_array[i]; |
542 | if (urb) { | 542 | if (urb) { |
543 | usb_buffer_free(urb->dev, | 543 | usb_free_coherent(urb->dev, |
544 | urb->transfer_buffer_length, | 544 | urb->transfer_buffer_length, |
545 | urb->transfer_buffer, | 545 | urb->transfer_buffer, |
546 | urb->transfer_dma); | 546 | urb->transfer_dma); |
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index f7aae2293758..b9dd74fde212 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) | |||
2493 | } | 2493 | } |
2494 | usbvision->sbuf[bufIdx].urb = urb; | 2494 | usbvision->sbuf[bufIdx].urb = urb; |
2495 | usbvision->sbuf[bufIdx].data = | 2495 | usbvision->sbuf[bufIdx].data = |
2496 | usb_buffer_alloc(usbvision->dev, | 2496 | usb_alloc_coherent(usbvision->dev, |
2497 | sb_size, | 2497 | sb_size, |
2498 | GFP_KERNEL, | 2498 | GFP_KERNEL, |
2499 | &urb->transfer_dma); | 2499 | &urb->transfer_dma); |
2500 | urb->dev = dev; | 2500 | urb->dev = dev; |
2501 | urb->context = usbvision; | 2501 | urb->context = usbvision; |
2502 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); | 2502 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); |
@@ -2552,10 +2552,10 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) | |||
2552 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { | 2552 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { |
2553 | usb_kill_urb(usbvision->sbuf[bufIdx].urb); | 2553 | usb_kill_urb(usbvision->sbuf[bufIdx].urb); |
2554 | if (usbvision->sbuf[bufIdx].data){ | 2554 | if (usbvision->sbuf[bufIdx].data){ |
2555 | usb_buffer_free(usbvision->dev, | 2555 | usb_free_coherent(usbvision->dev, |
2556 | sb_size, | 2556 | sb_size, |
2557 | usbvision->sbuf[bufIdx].data, | 2557 | usbvision->sbuf[bufIdx].data, |
2558 | usbvision->sbuf[bufIdx].urb->transfer_dma); | 2558 | usbvision->sbuf[bufIdx].urb->transfer_dma); |
2559 | } | 2559 | } |
2560 | usb_free_urb(usbvision->sbuf[bufIdx].urb); | 2560 | usb_free_urb(usbvision->sbuf[bufIdx].urb); |
2561 | usbvision->sbuf[bufIdx].urb = NULL; | 2561 | usbvision->sbuf[bufIdx].urb = NULL; |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 821a9969b7bf..53f3ef4635eb 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) | |||
739 | 739 | ||
740 | for (i = 0; i < UVC_URBS; ++i) { | 740 | for (i = 0; i < UVC_URBS; ++i) { |
741 | if (stream->urb_buffer[i]) { | 741 | if (stream->urb_buffer[i]) { |
742 | usb_buffer_free(stream->dev->udev, stream->urb_size, | 742 | usb_free_coherent(stream->dev->udev, stream->urb_size, |
743 | stream->urb_buffer[i], stream->urb_dma[i]); | 743 | stream->urb_buffer[i], stream->urb_dma[i]); |
744 | stream->urb_buffer[i] = NULL; | 744 | stream->urb_buffer[i] = NULL; |
745 | } | 745 | } |
@@ -780,7 +780,7 @@ static int uvc_alloc_urb_buffers(struct uvc_streaming *stream, | |||
780 | for (; npackets > 1; npackets /= 2) { | 780 | for (; npackets > 1; npackets /= 2) { |
781 | for (i = 0; i < UVC_URBS; ++i) { | 781 | for (i = 0; i < UVC_URBS; ++i) { |
782 | stream->urb_size = psize * npackets; | 782 | stream->urb_size = psize * npackets; |
783 | stream->urb_buffer[i] = usb_buffer_alloc( | 783 | stream->urb_buffer[i] = usb_alloc_coherent( |
784 | stream->dev->udev, stream->urb_size, | 784 | stream->dev->udev, stream->urb_size, |
785 | gfp_flags | __GFP_NOWARN, &stream->urb_dma[i]); | 785 | gfp_flags | __GFP_NOWARN, &stream->urb_dma[i]); |
786 | if (!stream->urb_buffer[i]) { | 786 | if (!stream->urb_buffer[i]) { |