diff options
Diffstat (limited to 'sound/synth/util_mem.c')
-rw-r--r-- | sound/synth/util_mem.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c index 5f75bf31bc36..217e8e552a42 100644 --- a/sound/synth/util_mem.c +++ b/sound/synth/util_mem.c | |||
@@ -28,15 +28,15 @@ MODULE_AUTHOR("Takashi Iwai"); | |||
28 | MODULE_DESCRIPTION("Generic memory management routines for soundcard memory allocation"); | 28 | MODULE_DESCRIPTION("Generic memory management routines for soundcard memory allocation"); |
29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
30 | 30 | ||
31 | #define get_memblk(p) list_entry(p, snd_util_memblk_t, list) | 31 | #define get_memblk(p) list_entry(p, struct snd_util_memblk, list) |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * create a new memory manager | 34 | * create a new memory manager |
35 | */ | 35 | */ |
36 | snd_util_memhdr_t * | 36 | struct snd_util_memhdr * |
37 | snd_util_memhdr_new(int memsize) | 37 | snd_util_memhdr_new(int memsize) |
38 | { | 38 | { |
39 | snd_util_memhdr_t *hdr; | 39 | struct snd_util_memhdr *hdr; |
40 | 40 | ||
41 | hdr = kzalloc(sizeof(*hdr), GFP_KERNEL); | 41 | hdr = kzalloc(sizeof(*hdr), GFP_KERNEL); |
42 | if (hdr == NULL) | 42 | if (hdr == NULL) |
@@ -51,7 +51,7 @@ snd_util_memhdr_new(int memsize) | |||
51 | /* | 51 | /* |
52 | * free a memory manager | 52 | * free a memory manager |
53 | */ | 53 | */ |
54 | void snd_util_memhdr_free(snd_util_memhdr_t *hdr) | 54 | void snd_util_memhdr_free(struct snd_util_memhdr *hdr) |
55 | { | 55 | { |
56 | struct list_head *p; | 56 | struct list_head *p; |
57 | 57 | ||
@@ -67,11 +67,11 @@ void snd_util_memhdr_free(snd_util_memhdr_t *hdr) | |||
67 | /* | 67 | /* |
68 | * allocate a memory block (without mutex) | 68 | * allocate a memory block (without mutex) |
69 | */ | 69 | */ |
70 | snd_util_memblk_t * | 70 | struct snd_util_memblk * |
71 | __snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size) | 71 | __snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size) |
72 | { | 72 | { |
73 | snd_util_memblk_t *blk; | 73 | struct snd_util_memblk *blk; |
74 | snd_util_unit_t units, prev_offset; | 74 | unsigned int units, prev_offset; |
75 | struct list_head *p; | 75 | struct list_head *p; |
76 | 76 | ||
77 | snd_assert(hdr != NULL, return NULL); | 77 | snd_assert(hdr != NULL, return NULL); |
@@ -104,20 +104,21 @@ __found: | |||
104 | * create a new memory block with the given size | 104 | * create a new memory block with the given size |
105 | * the block is linked next to prev | 105 | * the block is linked next to prev |
106 | */ | 106 | */ |
107 | snd_util_memblk_t * | 107 | struct snd_util_memblk * |
108 | __snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, | 108 | __snd_util_memblk_new(struct snd_util_memhdr *hdr, unsigned int units, |
109 | struct list_head *prev) | 109 | struct list_head *prev) |
110 | { | 110 | { |
111 | snd_util_memblk_t *blk; | 111 | struct snd_util_memblk *blk; |
112 | 112 | ||
113 | blk = kmalloc(sizeof(snd_util_memblk_t) + hdr->block_extra_size, GFP_KERNEL); | 113 | blk = kmalloc(sizeof(struct snd_util_memblk) + hdr->block_extra_size, |
114 | GFP_KERNEL); | ||
114 | if (blk == NULL) | 115 | if (blk == NULL) |
115 | return NULL; | 116 | return NULL; |
116 | 117 | ||
117 | if (! prev || prev == &hdr->block) | 118 | if (! prev || prev == &hdr->block) |
118 | blk->offset = 0; | 119 | blk->offset = 0; |
119 | else { | 120 | else { |
120 | snd_util_memblk_t *p = get_memblk(prev); | 121 | struct snd_util_memblk *p = get_memblk(prev); |
121 | blk->offset = p->offset + p->size; | 122 | blk->offset = p->offset + p->size; |
122 | } | 123 | } |
123 | blk->size = units; | 124 | blk->size = units; |
@@ -131,10 +132,10 @@ __snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, | |||
131 | /* | 132 | /* |
132 | * allocate a memory block (with mutex) | 133 | * allocate a memory block (with mutex) |
133 | */ | 134 | */ |
134 | snd_util_memblk_t * | 135 | struct snd_util_memblk * |
135 | snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size) | 136 | snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size) |
136 | { | 137 | { |
137 | snd_util_memblk_t *blk; | 138 | struct snd_util_memblk *blk; |
138 | down(&hdr->block_mutex); | 139 | down(&hdr->block_mutex); |
139 | blk = __snd_util_mem_alloc(hdr, size); | 140 | blk = __snd_util_mem_alloc(hdr, size); |
140 | up(&hdr->block_mutex); | 141 | up(&hdr->block_mutex); |
@@ -147,7 +148,7 @@ snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size) | |||
147 | * (without mutex) | 148 | * (without mutex) |
148 | */ | 149 | */ |
149 | void | 150 | void |
150 | __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk) | 151 | __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk) |
151 | { | 152 | { |
152 | list_del(&blk->list); | 153 | list_del(&blk->list); |
153 | hdr->nblocks--; | 154 | hdr->nblocks--; |
@@ -158,7 +159,7 @@ __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk) | |||
158 | /* | 159 | /* |
159 | * free a memory block (with mutex) | 160 | * free a memory block (with mutex) |
160 | */ | 161 | */ |
161 | int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk) | 162 | int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk) |
162 | { | 163 | { |
163 | snd_assert(hdr && blk, return -EINVAL); | 164 | snd_assert(hdr && blk, return -EINVAL); |
164 | 165 | ||
@@ -171,7 +172,7 @@ int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk) | |||
171 | /* | 172 | /* |
172 | * return available memory size | 173 | * return available memory size |
173 | */ | 174 | */ |
174 | int snd_util_mem_avail(snd_util_memhdr_t *hdr) | 175 | int snd_util_mem_avail(struct snd_util_memhdr *hdr) |
175 | { | 176 | { |
176 | unsigned int size; | 177 | unsigned int size; |
177 | down(&hdr->block_mutex); | 178 | down(&hdr->block_mutex); |