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 /sound | |
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 'sound')
-rw-r--r-- | sound/usb/ua101.c | 16 | ||||
-rw-r--r-- | sound/usb/usbaudio.c | 18 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 14 |
3 files changed, 24 insertions, 24 deletions
diff --git a/sound/usb/ua101.c b/sound/usb/ua101.c index 3d458d3b9962..d700e32dee24 100644 --- a/sound/usb/ua101.c +++ b/sound/usb/ua101.c | |||
@@ -41,7 +41,7 @@ MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); | |||
41 | /* | 41 | /* |
42 | * This magic value optimizes memory usage efficiency for the UA-101's packet | 42 | * This magic value optimizes memory usage efficiency for the UA-101's packet |
43 | * sizes at all sample rates, taking into account the stupid cache pool sizes | 43 | * sizes at all sample rates, taking into account the stupid cache pool sizes |
44 | * that usb_buffer_alloc() uses. | 44 | * that usb_alloc_coherent() uses. |
45 | */ | 45 | */ |
46 | #define DEFAULT_QUEUE_LENGTH 21 | 46 | #define DEFAULT_QUEUE_LENGTH 21 |
47 | 47 | ||
@@ -1056,7 +1056,7 @@ static int alloc_stream_buffers(struct ua101 *ua, struct ua101_stream *stream) | |||
1056 | (unsigned int)MAX_QUEUE_LENGTH); | 1056 | (unsigned int)MAX_QUEUE_LENGTH); |
1057 | 1057 | ||
1058 | /* | 1058 | /* |
1059 | * The cache pool sizes used by usb_buffer_alloc() (128, 512, 2048) are | 1059 | * The cache pool sizes used by usb_alloc_coherent() (128, 512, 2048) are |
1060 | * quite bad when used with the packet sizes of this device (e.g. 280, | 1060 | * quite bad when used with the packet sizes of this device (e.g. 280, |
1061 | * 520, 624). Therefore, we allocate and subdivide entire pages, using | 1061 | * 520, 624). Therefore, we allocate and subdivide entire pages, using |
1062 | * a smaller buffer only for the last chunk. | 1062 | * a smaller buffer only for the last chunk. |
@@ -1067,8 +1067,8 @@ static int alloc_stream_buffers(struct ua101 *ua, struct ua101_stream *stream) | |||
1067 | packets = min(remaining_packets, packets_per_page); | 1067 | packets = min(remaining_packets, packets_per_page); |
1068 | size = packets * stream->max_packet_bytes; | 1068 | size = packets * stream->max_packet_bytes; |
1069 | stream->buffers[i].addr = | 1069 | stream->buffers[i].addr = |
1070 | usb_buffer_alloc(ua->dev, size, GFP_KERNEL, | 1070 | usb_alloc_coherent(ua->dev, size, GFP_KERNEL, |
1071 | &stream->buffers[i].dma); | 1071 | &stream->buffers[i].dma); |
1072 | if (!stream->buffers[i].addr) | 1072 | if (!stream->buffers[i].addr) |
1073 | return -ENOMEM; | 1073 | return -ENOMEM; |
1074 | stream->buffers[i].size = size; | 1074 | stream->buffers[i].size = size; |
@@ -1088,10 +1088,10 @@ static void free_stream_buffers(struct ua101 *ua, struct ua101_stream *stream) | |||
1088 | unsigned int i; | 1088 | unsigned int i; |
1089 | 1089 | ||
1090 | for (i = 0; i < ARRAY_SIZE(stream->buffers); ++i) | 1090 | for (i = 0; i < ARRAY_SIZE(stream->buffers); ++i) |
1091 | usb_buffer_free(ua->dev, | 1091 | usb_free_coherent(ua->dev, |
1092 | stream->buffers[i].size, | 1092 | stream->buffers[i].size, |
1093 | stream->buffers[i].addr, | 1093 | stream->buffers[i].addr, |
1094 | stream->buffers[i].dma); | 1094 | stream->buffers[i].dma); |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | static int alloc_stream_urbs(struct ua101 *ua, struct ua101_stream *stream, | 1097 | static int alloc_stream_urbs(struct ua101 *ua, struct ua101_stream *stream, |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 11b0826b8fe6..9d2274ce01d5 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -985,9 +985,9 @@ static void release_urb_ctx(struct snd_urb_ctx *u) | |||
985 | { | 985 | { |
986 | if (u->urb) { | 986 | if (u->urb) { |
987 | if (u->buffer_size) | 987 | if (u->buffer_size) |
988 | usb_buffer_free(u->subs->dev, u->buffer_size, | 988 | usb_free_coherent(u->subs->dev, u->buffer_size, |
989 | u->urb->transfer_buffer, | 989 | u->urb->transfer_buffer, |
990 | u->urb->transfer_dma); | 990 | u->urb->transfer_dma); |
991 | usb_free_urb(u->urb); | 991 | usb_free_urb(u->urb); |
992 | u->urb = NULL; | 992 | u->urb = NULL; |
993 | } | 993 | } |
@@ -1008,8 +1008,8 @@ static void release_substream_urbs(struct snd_usb_substream *subs, int force) | |||
1008 | release_urb_ctx(&subs->dataurb[i]); | 1008 | release_urb_ctx(&subs->dataurb[i]); |
1009 | for (i = 0; i < SYNC_URBS; i++) | 1009 | for (i = 0; i < SYNC_URBS; i++) |
1010 | release_urb_ctx(&subs->syncurb[i]); | 1010 | release_urb_ctx(&subs->syncurb[i]); |
1011 | usb_buffer_free(subs->dev, SYNC_URBS * 4, | 1011 | usb_free_coherent(subs->dev, SYNC_URBS * 4, |
1012 | subs->syncbuf, subs->sync_dma); | 1012 | subs->syncbuf, subs->sync_dma); |
1013 | subs->syncbuf = NULL; | 1013 | subs->syncbuf = NULL; |
1014 | subs->nurbs = 0; | 1014 | subs->nurbs = 0; |
1015 | } | 1015 | } |
@@ -1113,8 +1113,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri | |||
1113 | if (!u->urb) | 1113 | if (!u->urb) |
1114 | goto out_of_memory; | 1114 | goto out_of_memory; |
1115 | u->urb->transfer_buffer = | 1115 | u->urb->transfer_buffer = |
1116 | usb_buffer_alloc(subs->dev, u->buffer_size, GFP_KERNEL, | 1116 | usb_alloc_coherent(subs->dev, u->buffer_size, GFP_KERNEL, |
1117 | &u->urb->transfer_dma); | 1117 | &u->urb->transfer_dma); |
1118 | if (!u->urb->transfer_buffer) | 1118 | if (!u->urb->transfer_buffer) |
1119 | goto out_of_memory; | 1119 | goto out_of_memory; |
1120 | u->urb->pipe = subs->datapipe; | 1120 | u->urb->pipe = subs->datapipe; |
@@ -1126,8 +1126,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri | |||
1126 | 1126 | ||
1127 | if (subs->syncpipe) { | 1127 | if (subs->syncpipe) { |
1128 | /* allocate and initialize sync urbs */ | 1128 | /* allocate and initialize sync urbs */ |
1129 | subs->syncbuf = usb_buffer_alloc(subs->dev, SYNC_URBS * 4, | 1129 | subs->syncbuf = usb_alloc_coherent(subs->dev, SYNC_URBS * 4, |
1130 | GFP_KERNEL, &subs->sync_dma); | 1130 | GFP_KERNEL, &subs->sync_dma); |
1131 | if (!subs->syncbuf) | 1131 | if (!subs->syncbuf) |
1132 | goto out_of_memory; | 1132 | goto out_of_memory; |
1133 | for (i = 0; i < SYNC_URBS; i++) { | 1133 | for (i = 0; i < SYNC_URBS; i++) { |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 9e28b20cb2ce..61b2d8fd0331 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1047,8 +1047,8 @@ static struct snd_rawmidi_ops snd_usbmidi_input_ops = { | |||
1047 | static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb, | 1047 | static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb, |
1048 | unsigned int buffer_length) | 1048 | unsigned int buffer_length) |
1049 | { | 1049 | { |
1050 | usb_buffer_free(umidi->dev, buffer_length, | 1050 | usb_free_coherent(umidi->dev, buffer_length, |
1051 | urb->transfer_buffer, urb->transfer_dma); | 1051 | urb->transfer_buffer, urb->transfer_dma); |
1052 | usb_free_urb(urb); | 1052 | usb_free_urb(urb); |
1053 | } | 1053 | } |
1054 | 1054 | ||
@@ -1099,8 +1099,8 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, | |||
1099 | pipe = usb_rcvbulkpipe(umidi->dev, ep_info->in_ep); | 1099 | pipe = usb_rcvbulkpipe(umidi->dev, ep_info->in_ep); |
1100 | length = usb_maxpacket(umidi->dev, pipe, 0); | 1100 | length = usb_maxpacket(umidi->dev, pipe, 0); |
1101 | for (i = 0; i < INPUT_URBS; ++i) { | 1101 | for (i = 0; i < INPUT_URBS; ++i) { |
1102 | buffer = usb_buffer_alloc(umidi->dev, length, GFP_KERNEL, | 1102 | buffer = usb_alloc_coherent(umidi->dev, length, GFP_KERNEL, |
1103 | &ep->urbs[i]->transfer_dma); | 1103 | &ep->urbs[i]->transfer_dma); |
1104 | if (!buffer) { | 1104 | if (!buffer) { |
1105 | snd_usbmidi_in_endpoint_delete(ep); | 1105 | snd_usbmidi_in_endpoint_delete(ep); |
1106 | return -ENOMEM; | 1106 | return -ENOMEM; |
@@ -1190,9 +1190,9 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | |||
1190 | break; | 1190 | break; |
1191 | } | 1191 | } |
1192 | for (i = 0; i < OUTPUT_URBS; ++i) { | 1192 | for (i = 0; i < OUTPUT_URBS; ++i) { |
1193 | buffer = usb_buffer_alloc(umidi->dev, | 1193 | buffer = usb_alloc_coherent(umidi->dev, |
1194 | ep->max_transfer, GFP_KERNEL, | 1194 | ep->max_transfer, GFP_KERNEL, |
1195 | &ep->urbs[i].urb->transfer_dma); | 1195 | &ep->urbs[i].urb->transfer_dma); |
1196 | if (!buffer) { | 1196 | if (!buffer) { |
1197 | snd_usbmidi_out_endpoint_delete(ep); | 1197 | snd_usbmidi_out_endpoint_delete(ep); |
1198 | return -ENOMEM; | 1198 | return -ENOMEM; |