aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
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/net
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/net')
-rw-r--r--drivers/net/can/usb/ems_usb.c18
-rw-r--r--drivers/net/usb/ipheth.c24
-rw-r--r--drivers/net/usb/kaweth.c12
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.c8
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c10
5 files changed, 34 insertions, 38 deletions
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index d800b598ae3d..25a5c7eea948 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -516,8 +516,8 @@ static void ems_usb_write_bulk_callback(struct urb *urb)
516 netdev = dev->netdev; 516 netdev = dev->netdev;
517 517
518 /* free up our allocated buffer */ 518 /* free up our allocated buffer */
519 usb_buffer_free(urb->dev, urb->transfer_buffer_length, 519 usb_free_coherent(urb->dev, urb->transfer_buffer_length,
520 urb->transfer_buffer, urb->transfer_dma); 520 urb->transfer_buffer, urb->transfer_dma);
521 521
522 atomic_dec(&dev->active_tx_urbs); 522 atomic_dec(&dev->active_tx_urbs);
523 523
@@ -614,8 +614,8 @@ static int ems_usb_start(struct ems_usb *dev)
614 return -ENOMEM; 614 return -ENOMEM;
615 } 615 }
616 616
617 buf = usb_buffer_alloc(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, 617 buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
618 &urb->transfer_dma); 618 &urb->transfer_dma);
619 if (!buf) { 619 if (!buf) {
620 dev_err(netdev->dev.parent, 620 dev_err(netdev->dev.parent,
621 "No memory left for USB buffer\n"); 621 "No memory left for USB buffer\n");
@@ -635,8 +635,8 @@ static int ems_usb_start(struct ems_usb *dev)
635 netif_device_detach(dev->netdev); 635 netif_device_detach(dev->netdev);
636 636
637 usb_unanchor_urb(urb); 637 usb_unanchor_urb(urb);
638 usb_buffer_free(dev->udev, RX_BUFFER_SIZE, buf, 638 usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
639 urb->transfer_dma); 639 urb->transfer_dma);
640 break; 640 break;
641 } 641 }
642 642
@@ -777,7 +777,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
777 goto nomem; 777 goto nomem;
778 } 778 }
779 779
780 buf = usb_buffer_alloc(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma); 780 buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma);
781 if (!buf) { 781 if (!buf) {
782 dev_err(netdev->dev.parent, "No memory left for USB buffer\n"); 782 dev_err(netdev->dev.parent, "No memory left for USB buffer\n");
783 usb_free_urb(urb); 783 usb_free_urb(urb);
@@ -820,7 +820,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
820 */ 820 */
821 if (!context) { 821 if (!context) {
822 usb_unanchor_urb(urb); 822 usb_unanchor_urb(urb);
823 usb_buffer_free(dev->udev, size, buf, urb->transfer_dma); 823 usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
824 824
825 dev_warn(netdev->dev.parent, "couldn't find free context\n"); 825 dev_warn(netdev->dev.parent, "couldn't find free context\n");
826 826
@@ -845,7 +845,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
845 can_free_echo_skb(netdev, context->echo_index); 845 can_free_echo_skb(netdev, context->echo_index);
846 846
847 usb_unanchor_urb(urb); 847 usb_unanchor_urb(urb);
848 usb_buffer_free(dev->udev, size, buf, urb->transfer_dma); 848 usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
849 dev_kfree_skb(skb); 849 dev_kfree_skb(skb);
850 850
851 atomic_dec(&dev->active_tx_urbs); 851 atomic_dec(&dev->active_tx_urbs);
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 418825d26f90..197c352c47fb 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -128,17 +128,13 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
128 if (rx_urb == NULL) 128 if (rx_urb == NULL)
129 goto free_tx_urb; 129 goto free_tx_urb;
130 130
131 tx_buf = usb_buffer_alloc(iphone->udev, 131 tx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,
132 IPHETH_BUF_SIZE, 132 GFP_KERNEL, &tx_urb->transfer_dma);
133 GFP_KERNEL,
134 &tx_urb->transfer_dma);
135 if (tx_buf == NULL) 133 if (tx_buf == NULL)
136 goto free_rx_urb; 134 goto free_rx_urb;
137 135
138 rx_buf = usb_buffer_alloc(iphone->udev, 136 rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,
139 IPHETH_BUF_SIZE, 137 GFP_KERNEL, &rx_urb->transfer_dma);
140 GFP_KERNEL,
141 &rx_urb->transfer_dma);
142 if (rx_buf == NULL) 138 if (rx_buf == NULL)
143 goto free_tx_buf; 139 goto free_tx_buf;
144 140
@@ -150,8 +146,8 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
150 return 0; 146 return 0;
151 147
152free_tx_buf: 148free_tx_buf:
153 usb_buffer_free(iphone->udev, IPHETH_BUF_SIZE, tx_buf, 149 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, tx_buf,
154 tx_urb->transfer_dma); 150 tx_urb->transfer_dma);
155free_rx_urb: 151free_rx_urb:
156 usb_free_urb(rx_urb); 152 usb_free_urb(rx_urb);
157free_tx_urb: 153free_tx_urb:
@@ -162,10 +158,10 @@ error_nomem:
162 158
163static void ipheth_free_urbs(struct ipheth_device *iphone) 159static void ipheth_free_urbs(struct ipheth_device *iphone)
164{ 160{
165 usb_buffer_free(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf, 161 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf,
166 iphone->rx_urb->transfer_dma); 162 iphone->rx_urb->transfer_dma);
167 usb_buffer_free(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf, 163 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,
168 iphone->tx_urb->transfer_dma); 164 iphone->tx_urb->transfer_dma);
169 usb_free_urb(iphone->rx_urb); 165 usb_free_urb(iphone->rx_urb);
170 usb_free_urb(iphone->tx_urb); 166 usb_free_urb(iphone->tx_urb);
171} 167}
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index c4c334d9770f..a3eb7be51d53 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1156,13 +1156,13 @@ err_fw:
1156 if (!kaweth->irq_urb) 1156 if (!kaweth->irq_urb)
1157 goto err_tx_and_rx; 1157 goto err_tx_and_rx;
1158 1158
1159 kaweth->intbuffer = usb_buffer_alloc( kaweth->dev, 1159 kaweth->intbuffer = usb_alloc_coherent( kaweth->dev,
1160 INTBUFFERSIZE, 1160 INTBUFFERSIZE,
1161 GFP_KERNEL, 1161 GFP_KERNEL,
1162 &kaweth->intbufferhandle); 1162 &kaweth->intbufferhandle);
1163 if (!kaweth->intbuffer) 1163 if (!kaweth->intbuffer)
1164 goto err_tx_and_rx_and_irq; 1164 goto err_tx_and_rx_and_irq;
1165 kaweth->rx_buf = usb_buffer_alloc( kaweth->dev, 1165 kaweth->rx_buf = usb_alloc_coherent( kaweth->dev,
1166 KAWETH_BUF_SIZE, 1166 KAWETH_BUF_SIZE,
1167 GFP_KERNEL, 1167 GFP_KERNEL,
1168 &kaweth->rxbufferhandle); 1168 &kaweth->rxbufferhandle);
@@ -1203,9 +1203,9 @@ err_fw:
1203 1203
1204err_intfdata: 1204err_intfdata:
1205 usb_set_intfdata(intf, NULL); 1205 usb_set_intfdata(intf, NULL);
1206 usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle); 1206 usb_free_coherent(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
1207err_all_but_rxbuf: 1207err_all_but_rxbuf:
1208 usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle); 1208 usb_free_coherent(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
1209err_tx_and_rx_and_irq: 1209err_tx_and_rx_and_irq:
1210 usb_free_urb(kaweth->irq_urb); 1210 usb_free_urb(kaweth->irq_urb);
1211err_tx_and_rx: 1211err_tx_and_rx:
@@ -1242,8 +1242,8 @@ static void kaweth_disconnect(struct usb_interface *intf)
1242 usb_free_urb(kaweth->tx_urb); 1242 usb_free_urb(kaweth->tx_urb);
1243 usb_free_urb(kaweth->irq_urb); 1243 usb_free_urb(kaweth->irq_urb);
1244 1244
1245 usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle); 1245 usb_free_coherent(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
1246 usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle); 1246 usb_free_coherent(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
1247 1247
1248 free_netdev(netdev); 1248 free_netdev(netdev);
1249} 1249}
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index e1c2fcaa8bed..a1f5444f7ccd 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -202,7 +202,7 @@ resubmit:
202 return; 202 return;
203 203
204free: 204free:
205 usb_buffer_free(aru->udev, 64, urb->transfer_buffer, urb->transfer_dma); 205 usb_free_coherent(aru->udev, 64, urb->transfer_buffer, urb->transfer_dma);
206} 206}
207 207
208static void ar9170_usb_rx_completed(struct urb *urb) 208static void ar9170_usb_rx_completed(struct urb *urb)
@@ -283,7 +283,7 @@ static int ar9170_usb_alloc_rx_irq_urb(struct ar9170_usb *aru)
283 if (!urb) 283 if (!urb)
284 goto out; 284 goto out;
285 285
286 ibuf = usb_buffer_alloc(aru->udev, 64, GFP_KERNEL, &urb->transfer_dma); 286 ibuf = usb_alloc_coherent(aru->udev, 64, GFP_KERNEL, &urb->transfer_dma);
287 if (!ibuf) 287 if (!ibuf)
288 goto out; 288 goto out;
289 289
@@ -296,8 +296,8 @@ static int ar9170_usb_alloc_rx_irq_urb(struct ar9170_usb *aru)
296 err = usb_submit_urb(urb, GFP_KERNEL); 296 err = usb_submit_urb(urb, GFP_KERNEL);
297 if (err) { 297 if (err) {
298 usb_unanchor_urb(urb); 298 usb_unanchor_urb(urb);
299 usb_buffer_free(aru->udev, 64, urb->transfer_buffer, 299 usb_free_coherent(aru->udev, 64, urb->transfer_buffer,
300 urb->transfer_dma); 300 urb->transfer_dma);
301 } 301 }
302 302
303out: 303out:
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index d91ad1a612af..c257940b71b6 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -664,15 +664,15 @@ static struct urb *alloc_rx_urb(struct zd_usb *usb)
664 urb = usb_alloc_urb(0, GFP_KERNEL); 664 urb = usb_alloc_urb(0, GFP_KERNEL);
665 if (!urb) 665 if (!urb)
666 return NULL; 666 return NULL;
667 buffer = usb_buffer_alloc(udev, USB_MAX_RX_SIZE, GFP_KERNEL, 667 buffer = usb_alloc_coherent(udev, USB_MAX_RX_SIZE, GFP_KERNEL,
668 &urb->transfer_dma); 668 &urb->transfer_dma);
669 if (!buffer) { 669 if (!buffer) {
670 usb_free_urb(urb); 670 usb_free_urb(urb);
671 return NULL; 671 return NULL;
672 } 672 }
673 673
674 usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, EP_DATA_IN), 674 usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, EP_DATA_IN),
675 buffer, USB_MAX_RX_SIZE, 675 buffer, USB_MAX_RX_SIZE,
676 rx_urb_complete, usb); 676 rx_urb_complete, usb);
677 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 677 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
678 678
@@ -683,8 +683,8 @@ static void free_rx_urb(struct urb *urb)
683{ 683{
684 if (!urb) 684 if (!urb)
685 return; 685 return;
686 usb_buffer_free(urb->dev, urb->transfer_buffer_length, 686 usb_free_coherent(urb->dev, urb->transfer_buffer_length,
687 urb->transfer_buffer, urb->transfer_dma); 687 urb->transfer_buffer, urb->transfer_dma);
688 usb_free_urb(urb); 688 usb_free_urb(urb);
689} 689}
690 690