git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
sound
/
synth
/
util_mem.c
diff --git
a/sound/synth/util_mem.c
b/sound/synth/util_mem.c
index
8b131a1
..
1d9b11f
100644
(file)
--- a/
sound/synth/util_mem.c
+++ b/
sound/synth/util_mem.c
@@
-18,6
+18,7
@@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <linux/mutex.h>
#include <sound/driver.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <sound/driver.h>
#include <linux/init.h>
#include <linux/slab.h>
@@
-28,21
+29,21
@@
MODULE_AUTHOR("Takashi Iwai");
MODULE_DESCRIPTION("Generic memory management routines for soundcard memory allocation");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Generic memory management routines for soundcard memory allocation");
MODULE_LICENSE("GPL");
-#define get_memblk(p) list_entry(p, s
nd_util_memblk_t
, list)
+#define get_memblk(p) list_entry(p, s
truct snd_util_memblk
, list)
/*
* create a new memory manager
*/
/*
* create a new memory manager
*/
-s
nd_util_memhdr_t
*
+s
truct snd_util_memhdr
*
snd_util_memhdr_new(int memsize)
{
snd_util_memhdr_new(int memsize)
{
- s
nd_util_memhdr_t
*hdr;
+ s
truct snd_util_memhdr
*hdr;
- hdr = k
calloc(1,
sizeof(*hdr), GFP_KERNEL);
+ hdr = k
zalloc(
sizeof(*hdr), GFP_KERNEL);
if (hdr == NULL)
return NULL;
hdr->size = memsize;
if (hdr == NULL)
return NULL;
hdr->size = memsize;
-
init_MUTEX
(&hdr->block_mutex);
+
mutex_init
(&hdr->block_mutex);
INIT_LIST_HEAD(&hdr->block);
return hdr;
INIT_LIST_HEAD(&hdr->block);
return hdr;
@@
-51,7
+52,7
@@
snd_util_memhdr_new(int memsize)
/*
* free a memory manager
*/
/*
* free a memory manager
*/
-void snd_util_memhdr_free(s
nd_util_memhdr_t
*hdr)
+void snd_util_memhdr_free(s
truct snd_util_memhdr
*hdr)
{
struct list_head *p;
{
struct list_head *p;
@@
-67,11
+68,11
@@
void snd_util_memhdr_free(snd_util_memhdr_t *hdr)
/*
* allocate a memory block (without mutex)
*/
/*
* allocate a memory block (without mutex)
*/
-s
nd_util_memblk_t
*
-__snd_util_mem_alloc(s
nd_util_memhdr_t
*hdr, int size)
+s
truct snd_util_memblk
*
+__snd_util_mem_alloc(s
truct snd_util_memhdr
*hdr, int size)
{
{
- s
nd_util_memblk_t
*blk;
-
snd_util_unit_
t units, prev_offset;
+ s
truct snd_util_memblk
*blk;
+
unsigned in
t units, prev_offset;
struct list_head *p;
snd_assert(hdr != NULL, return NULL);
struct list_head *p;
snd_assert(hdr != NULL, return NULL);
@@
-104,20
+105,21
@@
__found:
* create a new memory block with the given size
* the block is linked next to prev
*/
* create a new memory block with the given size
* the block is linked next to prev
*/
-s
nd_util_memblk_t
*
-__snd_util_memblk_new(s
nd_util_memhdr_t *hdr, snd_util_unit_
t units,
+s
truct snd_util_memblk
*
+__snd_util_memblk_new(s
truct snd_util_memhdr *hdr, unsigned in
t units,
struct list_head *prev)
{
struct list_head *prev)
{
- s
nd_util_memblk_t
*blk;
+ s
truct snd_util_memblk
*blk;
- blk = kmalloc(sizeof(snd_util_memblk_t) + hdr->block_extra_size, GFP_KERNEL);
+ blk = kmalloc(sizeof(struct snd_util_memblk) + hdr->block_extra_size,
+ GFP_KERNEL);
if (blk == NULL)
return NULL;
if (! prev || prev == &hdr->block)
blk->offset = 0;
else {
if (blk == NULL)
return NULL;
if (! prev || prev == &hdr->block)
blk->offset = 0;
else {
- s
nd_util_memblk_t
*p = get_memblk(prev);
+ s
truct snd_util_memblk
*p = get_memblk(prev);
blk->offset = p->offset + p->size;
}
blk->size = units;
blk->offset = p->offset + p->size;
}
blk->size = units;
@@
-131,13
+133,13
@@
__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units,
/*
* allocate a memory block (with mutex)
*/
/*
* allocate a memory block (with mutex)
*/
-s
nd_util_memblk_t
*
-snd_util_mem_alloc(s
nd_util_memhdr_t
*hdr, int size)
+s
truct snd_util_memblk
*
+snd_util_mem_alloc(s
truct snd_util_memhdr
*hdr, int size)
{
{
- s
nd_util_memblk_t
*blk;
-
down
(&hdr->block_mutex);
+ s
truct snd_util_memblk
*blk;
+
mutex_lock
(&hdr->block_mutex);
blk = __snd_util_mem_alloc(hdr, size);
blk = __snd_util_mem_alloc(hdr, size);
-
up
(&hdr->block_mutex);
+
mutex_unlock
(&hdr->block_mutex);
return blk;
}
return blk;
}
@@
-147,7
+149,7
@@
snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size)
* (without mutex)
*/
void
* (without mutex)
*/
void
-__snd_util_mem_free(s
nd_util_memhdr_t *hdr, snd_util_memblk_t
*blk)
+__snd_util_mem_free(s
truct snd_util_memhdr *hdr, struct snd_util_memblk
*blk)
{
list_del(&blk->list);
hdr->nblocks--;
{
list_del(&blk->list);
hdr->nblocks--;
@@
-158,25
+160,25
@@
__snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk)
/*
* free a memory block (with mutex)
*/
/*
* free a memory block (with mutex)
*/
-int snd_util_mem_free(s
nd_util_memhdr_t *hdr, snd_util_memblk_t
*blk)
+int snd_util_mem_free(s
truct snd_util_memhdr *hdr, struct snd_util_memblk
*blk)
{
snd_assert(hdr && blk, return -EINVAL);
{
snd_assert(hdr && blk, return -EINVAL);
-
down
(&hdr->block_mutex);
+
mutex_lock
(&hdr->block_mutex);
__snd_util_mem_free(hdr, blk);
__snd_util_mem_free(hdr, blk);
-
up
(&hdr->block_mutex);
+
mutex_unlock
(&hdr->block_mutex);
return 0;
}
/*
* return available memory size
*/
return 0;
}
/*
* return available memory size
*/
-int snd_util_mem_avail(s
nd_util_memhdr_t
*hdr)
+int snd_util_mem_avail(s
truct snd_util_memhdr
*hdr)
{
unsigned int size;
{
unsigned int size;
-
down
(&hdr->block_mutex);
+
mutex_lock
(&hdr->block_mutex);
size = hdr->size - hdr->used;
size = hdr->size - hdr->used;
-
up
(&hdr->block_mutex);
+
mutex_unlock
(&hdr->block_mutex);
return size;
}
return size;
}