diff options
Diffstat (limited to 'sound/synth/util_mem.c')
-rw-r--r-- | sound/synth/util_mem.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c index 217e8e552a42..1d9b11f345f8 100644 --- a/sound/synth/util_mem.c +++ b/sound/synth/util_mem.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/mutex.h> | ||
21 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
@@ -42,7 +43,7 @@ snd_util_memhdr_new(int memsize) | |||
42 | if (hdr == NULL) | 43 | if (hdr == NULL) |
43 | return NULL; | 44 | return NULL; |
44 | hdr->size = memsize; | 45 | hdr->size = memsize; |
45 | init_MUTEX(&hdr->block_mutex); | 46 | mutex_init(&hdr->block_mutex); |
46 | INIT_LIST_HEAD(&hdr->block); | 47 | INIT_LIST_HEAD(&hdr->block); |
47 | 48 | ||
48 | return hdr; | 49 | return hdr; |
@@ -136,9 +137,9 @@ struct snd_util_memblk * | |||
136 | snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size) | 137 | snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size) |
137 | { | 138 | { |
138 | struct snd_util_memblk *blk; | 139 | struct snd_util_memblk *blk; |
139 | down(&hdr->block_mutex); | 140 | mutex_lock(&hdr->block_mutex); |
140 | blk = __snd_util_mem_alloc(hdr, size); | 141 | blk = __snd_util_mem_alloc(hdr, size); |
141 | up(&hdr->block_mutex); | 142 | mutex_unlock(&hdr->block_mutex); |
142 | return blk; | 143 | return blk; |
143 | } | 144 | } |
144 | 145 | ||
@@ -163,9 +164,9 @@ int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk) | |||
163 | { | 164 | { |
164 | snd_assert(hdr && blk, return -EINVAL); | 165 | snd_assert(hdr && blk, return -EINVAL); |
165 | 166 | ||
166 | down(&hdr->block_mutex); | 167 | mutex_lock(&hdr->block_mutex); |
167 | __snd_util_mem_free(hdr, blk); | 168 | __snd_util_mem_free(hdr, blk); |
168 | up(&hdr->block_mutex); | 169 | mutex_unlock(&hdr->block_mutex); |
169 | return 0; | 170 | return 0; |
170 | } | 171 | } |
171 | 172 | ||
@@ -175,9 +176,9 @@ int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk) | |||
175 | int snd_util_mem_avail(struct snd_util_memhdr *hdr) | 176 | int snd_util_mem_avail(struct snd_util_memhdr *hdr) |
176 | { | 177 | { |
177 | unsigned int size; | 178 | unsigned int size; |
178 | down(&hdr->block_mutex); | 179 | mutex_lock(&hdr->block_mutex); |
179 | size = hdr->size - hdr->used; | 180 | size = hdr->size - hdr->used; |
180 | up(&hdr->block_mutex); | 181 | mutex_unlock(&hdr->block_mutex); |
181 | return size; | 182 | return size; |
182 | } | 183 | } |
183 | 184 | ||