]> err.no Git - linux-2.6/blobdiff - sound/core/memory.c
[PATCH] parport: add NetMOS 9805 support
[linux-2.6] / sound / core / memory.c
index 20860fec936440c4918d63839cf3b3c8981cfb85..1622893d00a228df4f1f46f17d4af8f875b82c25 100644 (file)
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(snd_alloc_vmalloc_lock);
 #define VMALLOC_MAGIC 0x87654320
 static snd_info_entry_t *snd_memory_info_entry;
 
-void snd_memory_init(void)
+void __init snd_memory_init(void)
 {
        snd_alloc_kmalloc = 0;
        snd_alloc_vmalloc = 0;
@@ -89,7 +89,7 @@ void snd_memory_done(void)
        }
 }
 
-static void *__snd_kmalloc(size_t size, int flags, void *caller)
+static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *caller)
 {
        unsigned long cpu_flags;
        struct snd_alloc_track *t;
@@ -111,12 +111,12 @@ static void *__snd_kmalloc(size_t size, int flags, void *caller)
 }
 
 #define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0));
-void *snd_hidden_kmalloc(size_t size, int flags)
+void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags)
 {
        return _snd_kmalloc(size, flags);
 }
 
-void *snd_hidden_kcalloc(size_t n, size_t size, int flags)
+void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags)
 {
        void *ret = NULL;
        if (n != 0 && size > INT_MAX / n)
@@ -184,6 +184,20 @@ void snd_hidden_vfree(void *obj)
        snd_wrapper_vfree(obj);
 }
 
+char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags)
+{
+       int len;
+       char *buf;
+
+       if (!s) return NULL;
+
+       len = strlen(s) + 1;
+       buf = _snd_kmalloc(len, flags);
+       if (buf)
+               memcpy(buf, s, len);
+       return buf;
+}
+
 static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer)
 {
        snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc);
@@ -214,35 +228,8 @@ int __exit snd_memory_info_done(void)
        return 0;
 }
 
-#else
-
-#define _snd_kmalloc kmalloc
-
 #endif /* CONFIG_SND_DEBUG_MEMORY */
 
-/**
- * snd_kmalloc_strdup - copy the string
- * @string: the original string
- * @flags: allocation conditions, GFP_XXX
- *
- * Allocates a memory chunk via kmalloc() and copies the string to it.
- *
- * Returns the pointer, or NULL if no enoguh memory.
- */
-char *snd_kmalloc_strdup(const char *string, int flags)
-{
-       size_t len;
-       char *ptr;
-
-       if (!string)
-               return NULL;
-       len = strlen(string) + 1;
-       ptr = _snd_kmalloc(len, flags);
-       if (ptr)
-               memcpy(ptr, string, len);
-       return ptr;
-}
-
 /**
  * copy_to_user_fromio - copy data from mmio-space to user-space
  * @dst: the destination pointer on user-space