aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-04-12 07:17:25 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:38 -0400
commit997ea58eb92f9970b8af7aae48800d0ef43b9423 (patch)
tree65e021973e5a48ad7290d5be1f441940566468ad /drivers/usb/class
parent48679c6d772b1459a2945729e3a1256ac78fcabf (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/usb/class')
-rw-r--r--drivers/usb/class/cdc-acm.c22
-rw-r--r--drivers/usb/class/cdc-wdm.c38
-rw-r--r--drivers/usb/class/usblp.c2
3 files changed, 31 insertions, 31 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 5e1a253b08a0..0c2f14ff9696 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -892,7 +892,7 @@ static void acm_write_buffers_free(struct acm *acm)
892 struct usb_device *usb_dev = interface_to_usbdev(acm->control); 892 struct usb_device *usb_dev = interface_to_usbdev(acm->control);
893 893
894 for (wb = &acm->wb[0], i = 0; i < ACM_NW; i++, wb++) 894 for (wb = &acm->wb[0], i = 0; i < ACM_NW; i++, wb++)
895 usb_buffer_free(usb_dev, acm->writesize, wb->buf, wb->dmah); 895 usb_free_coherent(usb_dev, acm->writesize, wb->buf, wb->dmah);
896} 896}
897 897
898static void acm_read_buffers_free(struct acm *acm) 898static void acm_read_buffers_free(struct acm *acm)
@@ -901,8 +901,8 @@ static void acm_read_buffers_free(struct acm *acm)
901 int i, n = acm->rx_buflimit; 901 int i, n = acm->rx_buflimit;
902 902
903 for (i = 0; i < n; i++) 903 for (i = 0; i < n; i++)
904 usb_buffer_free(usb_dev, acm->readsize, 904 usb_free_coherent(usb_dev, acm->readsize,
905 acm->rb[i].base, acm->rb[i].dma); 905 acm->rb[i].base, acm->rb[i].dma);
906} 906}
907 907
908/* Little helper: write buffers allocate */ 908/* Little helper: write buffers allocate */
@@ -912,13 +912,13 @@ static int acm_write_buffers_alloc(struct acm *acm)
912 struct acm_wb *wb; 912 struct acm_wb *wb;
913 913
914 for (wb = &acm->wb[0], i = 0; i < ACM_NW; i++, wb++) { 914 for (wb = &acm->wb[0], i = 0; i < ACM_NW; i++, wb++) {
915 wb->buf = usb_buffer_alloc(acm->dev, acm->writesize, GFP_KERNEL, 915 wb->buf = usb_alloc_coherent(acm->dev, acm->writesize, GFP_KERNEL,
916 &wb->dmah); 916 &wb->dmah);
917 if (!wb->buf) { 917 if (!wb->buf) {
918 while (i != 0) { 918 while (i != 0) {
919 --i; 919 --i;
920 --wb; 920 --wb;
921 usb_buffer_free(acm->dev, acm->writesize, 921 usb_free_coherent(acm->dev, acm->writesize,
922 wb->buf, wb->dmah); 922 wb->buf, wb->dmah);
923 } 923 }
924 return -ENOMEM; 924 return -ENOMEM;
@@ -1177,7 +1177,7 @@ made_compressed_probe:
1177 tty_port_init(&acm->port); 1177 tty_port_init(&acm->port);
1178 acm->port.ops = &acm_port_ops; 1178 acm->port.ops = &acm_port_ops;
1179 1179
1180 buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); 1180 buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma);
1181 if (!buf) { 1181 if (!buf) {
1182 dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)\n"); 1182 dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)\n");
1183 goto alloc_fail2; 1183 goto alloc_fail2;
@@ -1210,11 +1210,11 @@ made_compressed_probe:
1210 for (i = 0; i < num_rx_buf; i++) { 1210 for (i = 0; i < num_rx_buf; i++) {
1211 struct acm_rb *rb = &(acm->rb[i]); 1211 struct acm_rb *rb = &(acm->rb[i]);
1212 1212
1213 rb->base = usb_buffer_alloc(acm->dev, readsize, 1213 rb->base = usb_alloc_coherent(acm->dev, readsize,
1214 GFP_KERNEL, &rb->dma); 1214 GFP_KERNEL, &rb->dma);
1215 if (!rb->base) { 1215 if (!rb->base) {
1216 dev_dbg(&intf->dev, 1216 dev_dbg(&intf->dev,
1217 "out of memory (read bufs usb_buffer_alloc)\n"); 1217 "out of memory (read bufs usb_alloc_coherent)\n");
1218 goto alloc_fail7; 1218 goto alloc_fail7;
1219 } 1219 }
1220 } 1220 }
@@ -1306,7 +1306,7 @@ alloc_fail7:
1306alloc_fail5: 1306alloc_fail5:
1307 acm_write_buffers_free(acm); 1307 acm_write_buffers_free(acm);
1308alloc_fail4: 1308alloc_fail4:
1309 usb_buffer_free(usb_dev, ctrlsize, acm->ctrl_buffer, acm->ctrl_dma); 1309 usb_free_coherent(usb_dev, ctrlsize, acm->ctrl_buffer, acm->ctrl_dma);
1310alloc_fail2: 1310alloc_fail2:
1311 kfree(acm); 1311 kfree(acm);
1312alloc_fail: 1312alloc_fail:
@@ -1356,8 +1356,8 @@ static void acm_disconnect(struct usb_interface *intf)
1356 stop_data_traffic(acm); 1356 stop_data_traffic(acm);
1357 1357
1358 acm_write_buffers_free(acm); 1358 acm_write_buffers_free(acm);
1359 usb_buffer_free(usb_dev, acm->ctrlsize, acm->ctrl_buffer, 1359 usb_free_coherent(usb_dev, acm->ctrlsize, acm->ctrl_buffer,
1360 acm->ctrl_dma); 1360 acm->ctrl_dma);
1361 acm_read_buffers_free(acm); 1361 acm_read_buffers_free(acm);
1362 1362
1363 if (!acm->combined_interfaces) 1363 if (!acm->combined_interfaces)
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 189141ca4e05..094c76b5de17 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -276,14 +276,14 @@ static void free_urbs(struct wdm_device *desc)
276 276
277static void cleanup(struct wdm_device *desc) 277static void cleanup(struct wdm_device *desc)
278{ 278{
279 usb_buffer_free(interface_to_usbdev(desc->intf), 279 usb_free_coherent(interface_to_usbdev(desc->intf),
280 desc->wMaxPacketSize, 280 desc->wMaxPacketSize,
281 desc->sbuf, 281 desc->sbuf,
282 desc->validity->transfer_dma); 282 desc->validity->transfer_dma);
283 usb_buffer_free(interface_to_usbdev(desc->intf), 283 usb_free_coherent(interface_to_usbdev(desc->intf),
284 desc->wMaxCommand, 284 desc->wMaxCommand,
285 desc->inbuf, 285 desc->inbuf,
286 desc->response->transfer_dma); 286 desc->response->transfer_dma);
287 kfree(desc->orq); 287 kfree(desc->orq);
288 kfree(desc->irq); 288 kfree(desc->irq);
289 kfree(desc->ubuf); 289 kfree(desc->ubuf);
@@ -705,17 +705,17 @@ next_desc:
705 if (!desc->ubuf) 705 if (!desc->ubuf)
706 goto err; 706 goto err;
707 707
708 desc->sbuf = usb_buffer_alloc(interface_to_usbdev(intf), 708 desc->sbuf = usb_alloc_coherent(interface_to_usbdev(intf),
709 desc->wMaxPacketSize, 709 desc->wMaxPacketSize,
710 GFP_KERNEL, 710 GFP_KERNEL,
711 &desc->validity->transfer_dma); 711 &desc->validity->transfer_dma);
712 if (!desc->sbuf) 712 if (!desc->sbuf)
713 goto err; 713 goto err;
714 714
715 desc->inbuf = usb_buffer_alloc(interface_to_usbdev(intf), 715 desc->inbuf = usb_alloc_coherent(interface_to_usbdev(intf),
716 desc->bMaxPacketSize0, 716 desc->bMaxPacketSize0,
717 GFP_KERNEL, 717 GFP_KERNEL,
718 &desc->response->transfer_dma); 718 &desc->response->transfer_dma);
719 if (!desc->inbuf) 719 if (!desc->inbuf)
720 goto err2; 720 goto err2;
721 721
@@ -742,15 +742,15 @@ out:
742 return rv; 742 return rv;
743err3: 743err3:
744 usb_set_intfdata(intf, NULL); 744 usb_set_intfdata(intf, NULL);
745 usb_buffer_free(interface_to_usbdev(desc->intf), 745 usb_free_coherent(interface_to_usbdev(desc->intf),
746 desc->bMaxPacketSize0, 746 desc->bMaxPacketSize0,
747 desc->inbuf, 747 desc->inbuf,
748 desc->response->transfer_dma); 748 desc->response->transfer_dma);
749err2: 749err2:
750 usb_buffer_free(interface_to_usbdev(desc->intf), 750 usb_free_coherent(interface_to_usbdev(desc->intf),
751 desc->wMaxPacketSize, 751 desc->wMaxPacketSize,
752 desc->sbuf, 752 desc->sbuf,
753 desc->validity->transfer_dma); 753 desc->validity->transfer_dma);
754err: 754err:
755 free_urbs(desc); 755 free_urbs(desc);
756 kfree(desc->ubuf); 756 kfree(desc->ubuf);
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 93b5f85d7ceb..2250095db0a0 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -27,7 +27,7 @@
27 * v0.11 - add proto_bias option (Pete Zaitcev) 27 * v0.11 - add proto_bias option (Pete Zaitcev)
28 * v0.12 - add hpoj.sourceforge.net ioctls (David Paschal) 28 * v0.12 - add hpoj.sourceforge.net ioctls (David Paschal)
29 * v0.13 - alloc space for statusbuf (<status> not on stack); 29 * v0.13 - alloc space for statusbuf (<status> not on stack);
30 * use usb_buffer_alloc() for read buf & write buf; 30 * use usb_alloc_coherent() for read buf & write buf;
31 * none - Maintained in Linux kernel after v0.13 31 * none - Maintained in Linux kernel after v0.13
32 */ 32 */
33 33