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/usb/misc | |
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/usb/misc')
-rw-r--r-- | drivers/usb/misc/appledisplay.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/ftdi-elan.c | 18 | ||||
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 12 | ||||
-rw-r--r-- | drivers/usb/misc/usblcd.c | 8 | ||||
-rw-r--r-- | drivers/usb/misc/usbtest.c | 8 |
5 files changed, 26 insertions, 26 deletions
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index 094f91cbc578..1fa6ce3e4a23 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c | |||
@@ -259,7 +259,7 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
259 | } | 259 | } |
260 | 260 | ||
261 | /* Allocate buffer for interrupt data */ | 261 | /* Allocate buffer for interrupt data */ |
262 | pdata->urbdata = usb_buffer_alloc(pdata->udev, ACD_URB_BUFFER_LEN, | 262 | pdata->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN, |
263 | GFP_KERNEL, &pdata->urb->transfer_dma); | 263 | GFP_KERNEL, &pdata->urb->transfer_dma); |
264 | if (!pdata->urbdata) { | 264 | if (!pdata->urbdata) { |
265 | retval = -ENOMEM; | 265 | retval = -ENOMEM; |
@@ -316,7 +316,7 @@ error: | |||
316 | if (pdata->urb) { | 316 | if (pdata->urb) { |
317 | usb_kill_urb(pdata->urb); | 317 | usb_kill_urb(pdata->urb); |
318 | if (pdata->urbdata) | 318 | if (pdata->urbdata) |
319 | usb_buffer_free(pdata->udev, ACD_URB_BUFFER_LEN, | 319 | usb_free_coherent(pdata->udev, ACD_URB_BUFFER_LEN, |
320 | pdata->urbdata, pdata->urb->transfer_dma); | 320 | pdata->urbdata, pdata->urb->transfer_dma); |
321 | usb_free_urb(pdata->urb); | 321 | usb_free_urb(pdata->urb); |
322 | } | 322 | } |
@@ -337,7 +337,7 @@ static void appledisplay_disconnect(struct usb_interface *iface) | |||
337 | usb_kill_urb(pdata->urb); | 337 | usb_kill_urb(pdata->urb); |
338 | cancel_delayed_work(&pdata->work); | 338 | cancel_delayed_work(&pdata->work); |
339 | backlight_device_unregister(pdata->bd); | 339 | backlight_device_unregister(pdata->bd); |
340 | usb_buffer_free(pdata->udev, ACD_URB_BUFFER_LEN, | 340 | usb_free_coherent(pdata->udev, ACD_URB_BUFFER_LEN, |
341 | pdata->urbdata, pdata->urb->transfer_dma); | 341 | pdata->urbdata, pdata->urb->transfer_dma); |
342 | usb_free_urb(pdata->urb); | 342 | usb_free_urb(pdata->urb); |
343 | kfree(pdata->msgdata); | 343 | kfree(pdata->msgdata); |
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 2300a51d48b7..82e16630a78b 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -734,7 +734,7 @@ static void ftdi_elan_write_bulk_callback(struct urb *urb) | |||
734 | dev_err(&ftdi->udev->dev, "urb=%p write bulk status received: %" | 734 | dev_err(&ftdi->udev->dev, "urb=%p write bulk status received: %" |
735 | "d\n", urb, status); | 735 | "d\n", urb, status); |
736 | } | 736 | } |
737 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 737 | usb_free_coherent(urb->dev, urb->transfer_buffer_length, |
738 | urb->transfer_buffer, urb->transfer_dma); | 738 | urb->transfer_buffer, urb->transfer_dma); |
739 | } | 739 | } |
740 | 740 | ||
@@ -795,7 +795,7 @@ static int ftdi_elan_command_engine(struct usb_ftdi *ftdi) | |||
795 | total_size); | 795 | total_size); |
796 | return -ENOMEM; | 796 | return -ENOMEM; |
797 | } | 797 | } |
798 | buf = usb_buffer_alloc(ftdi->udev, total_size, GFP_KERNEL, | 798 | buf = usb_alloc_coherent(ftdi->udev, total_size, GFP_KERNEL, |
799 | &urb->transfer_dma); | 799 | &urb->transfer_dma); |
800 | if (!buf) { | 800 | if (!buf) { |
801 | dev_err(&ftdi->udev->dev, "could not get a buffer to write %d c" | 801 | dev_err(&ftdi->udev->dev, "could not get a buffer to write %d c" |
@@ -829,7 +829,7 @@ static int ftdi_elan_command_engine(struct usb_ftdi *ftdi) | |||
829 | dev_err(&ftdi->udev->dev, "failed %d to submit urb %p to write " | 829 | dev_err(&ftdi->udev->dev, "failed %d to submit urb %p to write " |
830 | "%d commands totaling %d bytes to the Uxxx\n", retval, | 830 | "%d commands totaling %d bytes to the Uxxx\n", retval, |
831 | urb, command_size, total_size); | 831 | urb, command_size, total_size); |
832 | usb_buffer_free(ftdi->udev, total_size, buf, urb->transfer_dma); | 832 | usb_free_coherent(ftdi->udev, total_size, buf, urb->transfer_dma); |
833 | usb_free_urb(urb); | 833 | usb_free_urb(urb); |
834 | return retval; | 834 | return retval; |
835 | } | 835 | } |
@@ -1167,7 +1167,7 @@ static ssize_t ftdi_elan_write(struct file *file, | |||
1167 | retval = -ENOMEM; | 1167 | retval = -ENOMEM; |
1168 | goto error_1; | 1168 | goto error_1; |
1169 | } | 1169 | } |
1170 | buf = usb_buffer_alloc(ftdi->udev, count, GFP_KERNEL, | 1170 | buf = usb_alloc_coherent(ftdi->udev, count, GFP_KERNEL, |
1171 | &urb->transfer_dma); | 1171 | &urb->transfer_dma); |
1172 | if (!buf) { | 1172 | if (!buf) { |
1173 | retval = -ENOMEM; | 1173 | retval = -ENOMEM; |
@@ -1192,7 +1192,7 @@ static ssize_t ftdi_elan_write(struct file *file, | |||
1192 | exit: | 1192 | exit: |
1193 | return count; | 1193 | return count; |
1194 | error_3: | 1194 | error_3: |
1195 | usb_buffer_free(ftdi->udev, count, buf, urb->transfer_dma); | 1195 | usb_free_coherent(ftdi->udev, count, buf, urb->transfer_dma); |
1196 | error_2: | 1196 | error_2: |
1197 | usb_free_urb(urb); | 1197 | usb_free_urb(urb); |
1198 | error_1: | 1198 | error_1: |
@@ -1968,7 +1968,7 @@ static int ftdi_elan_synchronize_flush(struct usb_ftdi *ftdi) | |||
1968 | "ence\n"); | 1968 | "ence\n"); |
1969 | return -ENOMEM; | 1969 | return -ENOMEM; |
1970 | } | 1970 | } |
1971 | buf = usb_buffer_alloc(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma); | 1971 | buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma); |
1972 | if (!buf) { | 1972 | if (!buf) { |
1973 | dev_err(&ftdi->udev->dev, "could not get a buffer for flush seq" | 1973 | dev_err(&ftdi->udev->dev, "could not get a buffer for flush seq" |
1974 | "uence\n"); | 1974 | "uence\n"); |
@@ -1985,7 +1985,7 @@ static int ftdi_elan_synchronize_flush(struct usb_ftdi *ftdi) | |||
1985 | if (retval) { | 1985 | if (retval) { |
1986 | dev_err(&ftdi->udev->dev, "failed to submit urb containing the " | 1986 | dev_err(&ftdi->udev->dev, "failed to submit urb containing the " |
1987 | "flush sequence\n"); | 1987 | "flush sequence\n"); |
1988 | usb_buffer_free(ftdi->udev, i, buf, urb->transfer_dma); | 1988 | usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma); |
1989 | usb_free_urb(urb); | 1989 | usb_free_urb(urb); |
1990 | return -ENOMEM; | 1990 | return -ENOMEM; |
1991 | } | 1991 | } |
@@ -2011,7 +2011,7 @@ static int ftdi_elan_synchronize_reset(struct usb_ftdi *ftdi) | |||
2011 | "quence\n"); | 2011 | "quence\n"); |
2012 | return -ENOMEM; | 2012 | return -ENOMEM; |
2013 | } | 2013 | } |
2014 | buf = usb_buffer_alloc(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma); | 2014 | buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma); |
2015 | if (!buf) { | 2015 | if (!buf) { |
2016 | dev_err(&ftdi->udev->dev, "could not get a buffer for the reset" | 2016 | dev_err(&ftdi->udev->dev, "could not get a buffer for the reset" |
2017 | " sequence\n"); | 2017 | " sequence\n"); |
@@ -2030,7 +2030,7 @@ static int ftdi_elan_synchronize_reset(struct usb_ftdi *ftdi) | |||
2030 | if (retval) { | 2030 | if (retval) { |
2031 | dev_err(&ftdi->udev->dev, "failed to submit urb containing the " | 2031 | dev_err(&ftdi->udev->dev, "failed to submit urb containing the " |
2032 | "reset sequence\n"); | 2032 | "reset sequence\n"); |
2033 | usb_buffer_free(ftdi->udev, i, buf, urb->transfer_dma); | 2033 | usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma); |
2034 | usb_free_urb(urb); | 2034 | usb_free_urb(urb); |
2035 | return -ENOMEM; | 2035 | return -ENOMEM; |
2036 | } | 2036 | } |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index d3c852363883..7dc9d3c69984 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -239,8 +239,8 @@ static void iowarrior_write_callback(struct urb *urb) | |||
239 | __func__, status); | 239 | __func__, status); |
240 | } | 240 | } |
241 | /* free up our allocated buffer */ | 241 | /* free up our allocated buffer */ |
242 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 242 | usb_free_coherent(urb->dev, urb->transfer_buffer_length, |
243 | urb->transfer_buffer, urb->transfer_dma); | 243 | urb->transfer_buffer, urb->transfer_dma); |
244 | /* tell a waiting writer the interrupt-out-pipe is available again */ | 244 | /* tell a waiting writer the interrupt-out-pipe is available again */ |
245 | atomic_dec(&dev->write_busy); | 245 | atomic_dec(&dev->write_busy); |
246 | wake_up_interruptible(&dev->write_wait); | 246 | wake_up_interruptible(&dev->write_wait); |
@@ -421,8 +421,8 @@ static ssize_t iowarrior_write(struct file *file, | |||
421 | dbg("%s Unable to allocate urb ", __func__); | 421 | dbg("%s Unable to allocate urb ", __func__); |
422 | goto error_no_urb; | 422 | goto error_no_urb; |
423 | } | 423 | } |
424 | buf = usb_buffer_alloc(dev->udev, dev->report_size, | 424 | buf = usb_alloc_coherent(dev->udev, dev->report_size, |
425 | GFP_KERNEL, &int_out_urb->transfer_dma); | 425 | GFP_KERNEL, &int_out_urb->transfer_dma); |
426 | if (!buf) { | 426 | if (!buf) { |
427 | retval = -ENOMEM; | 427 | retval = -ENOMEM; |
428 | dbg("%s Unable to allocate buffer ", __func__); | 428 | dbg("%s Unable to allocate buffer ", __func__); |
@@ -459,8 +459,8 @@ static ssize_t iowarrior_write(struct file *file, | |||
459 | break; | 459 | break; |
460 | } | 460 | } |
461 | error: | 461 | error: |
462 | usb_buffer_free(dev->udev, dev->report_size, buf, | 462 | usb_free_coherent(dev->udev, dev->report_size, buf, |
463 | int_out_urb->transfer_dma); | 463 | int_out_urb->transfer_dma); |
464 | error_no_buffer: | 464 | error_no_buffer: |
465 | usb_free_urb(int_out_urb); | 465 | usb_free_urb(int_out_urb); |
466 | error_no_urb: | 466 | error_no_urb: |
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 90aede90553e..7828c764b323 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -205,8 +205,8 @@ static void lcd_write_bulk_callback(struct urb *urb) | |||
205 | } | 205 | } |
206 | 206 | ||
207 | /* free up our allocated buffer */ | 207 | /* free up our allocated buffer */ |
208 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 208 | usb_free_coherent(urb->dev, urb->transfer_buffer_length, |
209 | urb->transfer_buffer, urb->transfer_dma); | 209 | urb->transfer_buffer, urb->transfer_dma); |
210 | up(&dev->limit_sem); | 210 | up(&dev->limit_sem); |
211 | } | 211 | } |
212 | 212 | ||
@@ -234,7 +234,7 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz | |||
234 | goto err_no_buf; | 234 | goto err_no_buf; |
235 | } | 235 | } |
236 | 236 | ||
237 | buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); | 237 | buf = usb_alloc_coherent(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); |
238 | if (!buf) { | 238 | if (!buf) { |
239 | retval = -ENOMEM; | 239 | retval = -ENOMEM; |
240 | goto error; | 240 | goto error; |
@@ -268,7 +268,7 @@ exit: | |||
268 | error_unanchor: | 268 | error_unanchor: |
269 | usb_unanchor_urb(urb); | 269 | usb_unanchor_urb(urb); |
270 | error: | 270 | error: |
271 | usb_buffer_free(dev->udev, count, buf, urb->transfer_dma); | 271 | usb_free_coherent(dev->udev, count, buf, urb->transfer_dma); |
272 | usb_free_urb(urb); | 272 | usb_free_urb(urb); |
273 | err_no_buf: | 273 | err_no_buf: |
274 | up(&dev->limit_sem); | 274 | up(&dev->limit_sem); |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 9dcc82337ced..16dffe99d9f1 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -202,7 +202,7 @@ static struct urb *simple_alloc_urb ( | |||
202 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 202 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
203 | if (usb_pipein (pipe)) | 203 | if (usb_pipein (pipe)) |
204 | urb->transfer_flags |= URB_SHORT_NOT_OK; | 204 | urb->transfer_flags |= URB_SHORT_NOT_OK; |
205 | urb->transfer_buffer = usb_buffer_alloc (udev, bytes, GFP_KERNEL, | 205 | urb->transfer_buffer = usb_alloc_coherent (udev, bytes, GFP_KERNEL, |
206 | &urb->transfer_dma); | 206 | &urb->transfer_dma); |
207 | if (!urb->transfer_buffer) { | 207 | if (!urb->transfer_buffer) { |
208 | usb_free_urb (urb); | 208 | usb_free_urb (urb); |
@@ -272,8 +272,8 @@ static inline int simple_check_buf(struct usbtest_dev *tdev, struct urb *urb) | |||
272 | 272 | ||
273 | static void simple_free_urb (struct urb *urb) | 273 | static void simple_free_urb (struct urb *urb) |
274 | { | 274 | { |
275 | usb_buffer_free (urb->dev, urb->transfer_buffer_length, | 275 | usb_free_coherent(urb->dev, urb->transfer_buffer_length, |
276 | urb->transfer_buffer, urb->transfer_dma); | 276 | urb->transfer_buffer, urb->transfer_dma); |
277 | usb_free_urb (urb); | 277 | usb_free_urb (urb); |
278 | } | 278 | } |
279 | 279 | ||
@@ -1416,7 +1416,7 @@ static struct urb *iso_alloc_urb ( | |||
1416 | 1416 | ||
1417 | urb->number_of_packets = packets; | 1417 | urb->number_of_packets = packets; |
1418 | urb->transfer_buffer_length = bytes; | 1418 | urb->transfer_buffer_length = bytes; |
1419 | urb->transfer_buffer = usb_buffer_alloc (udev, bytes, GFP_KERNEL, | 1419 | urb->transfer_buffer = usb_alloc_coherent (udev, bytes, GFP_KERNEL, |
1420 | &urb->transfer_dma); | 1420 | &urb->transfer_dma); |
1421 | if (!urb->transfer_buffer) { | 1421 | if (!urb->transfer_buffer) { |
1422 | usb_free_urb (urb); | 1422 | usb_free_urb (urb); |