summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/memory.c53
-rw-r--r--sound/core/misc.c9
-rw-r--r--sound/core/sound.c5
-rw-r--r--sound/core/wrappers.c10
4 files changed, 10 insertions, 67 deletions
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 7d8e2ee..b993436 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -47,19 +47,14 @@ struct snd_alloc_track {
#define snd_alloc_track_entry(obj) (struct snd_alloc_track *)((char*)obj - (unsigned long)((struct snd_alloc_track *)0)->data)
static long snd_alloc_kmalloc;
-static long snd_alloc_vmalloc;
static LIST_HEAD(snd_alloc_kmalloc_list);
-static LIST_HEAD(snd_alloc_vmalloc_list);
static DEFINE_SPINLOCK(snd_alloc_kmalloc_lock);
-static DEFINE_SPINLOCK(snd_alloc_vmalloc_lock);
#define KMALLOC_MAGIC 0x87654321
-#define VMALLOC_MAGIC 0x87654320
static snd_info_entry_t *snd_memory_info_entry;
void __init snd_memory_init(void)
{
snd_alloc_kmalloc = 0;
- snd_alloc_vmalloc = 0;
}
void snd_memory_done(void)
@@ -69,8 +64,6 @@ void snd_memory_done(void)
if (snd_alloc_kmalloc > 0)
snd_printk(KERN_ERR "Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc);
- if (snd_alloc_vmalloc > 0)
- snd_printk(KERN_ERR "Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc);
list_for_each_prev(head, &snd_alloc_kmalloc_list) {
t = list_entry(head, struct snd_alloc_track, list);
if (t->magic != KMALLOC_MAGIC) {
@@ -79,14 +72,6 @@ void snd_memory_done(void)
}
snd_printk(KERN_ERR "kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
}
- list_for_each_prev(head, &snd_alloc_vmalloc_list) {
- t = list_entry(head, struct snd_alloc_track, list);
- if (t->magic != VMALLOC_MAGIC) {
- snd_printk(KERN_ERR "Corrupted vmalloc\n");
- break;
- }
- snd_printk(KERN_ERR "vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
- }
}
static void *__snd_kmalloc(size_t size, gfp_t flags, void *caller)
@@ -153,43 +138,6 @@ void snd_hidden_kfree(const void *obj)
snd_wrapper_kfree(obj);
}
-void *snd_hidden_vmalloc(unsigned long size)
-{
- void *ptr;
- ptr = snd_wrapper_vmalloc(size + sizeof(struct snd_alloc_track));
- if (ptr) {
- struct snd_alloc_track *t = (struct snd_alloc_track *)ptr;
- t->magic = VMALLOC_MAGIC;
- t->caller = __builtin_return_address(0);
- spin_lock(&snd_alloc_vmalloc_lock);
- list_add_tail(&t->list, &snd_alloc_vmalloc_list);
- spin_unlock(&snd_alloc_vmalloc_lock);
- t->size = size;
- snd_alloc_vmalloc += size;
- ptr = t->data;
- }
- return ptr;
-}
-
-void snd_hidden_vfree(void *obj)
-{
- struct snd_alloc_track *t;
- if (obj == NULL)
- return;
- t = snd_alloc_track_entry(obj);
- if (t->magic != VMALLOC_MAGIC) {
- snd_printk(KERN_ERR "bad vfree (called from %p)\n", __builtin_return_address(0));
- return;
- }
- spin_lock(&snd_alloc_vmalloc_lock);
- list_del(&t->list);
- spin_unlock(&snd_alloc_vmalloc_lock);
- t->magic = 0;
- snd_alloc_vmalloc -= t->size;
- obj = t;
- snd_wrapper_vfree(obj);
-}
-
char *snd_hidden_kstrdup(const char *s, gfp_t flags)
{
int len;
@@ -207,7 +155,6 @@ char *snd_hidden_kstrdup(const char *s, gfp_t flags)
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);
- snd_iprintf(buffer, "vmalloc: %li bytes\n", snd_alloc_vmalloc);
}
int __init snd_memory_info_init(void)
diff --git a/sound/core/misc.c b/sound/core/misc.c
index 11a7675..3eddfde 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -23,8 +23,17 @@
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/time.h>
+#include <linux/ioport.h>
#include <sound/core.h>
+void release_and_free_resource(struct resource *res)
+{
+ if (res) {
+ release_resource(res);
+ kfree_nocheck(res);
+ }
+}
+
#ifdef CONFIG_SND_VERBOSE_PRINTK
void snd_verbose_printk(const char *file, int line, const char *format, ...)
{
diff --git a/sound/core/sound.c b/sound/core/sound.c
index bc8ad00..e94eebd 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -407,8 +407,6 @@ EXPORT_SYMBOL(snd_unregister_oss_device);
EXPORT_SYMBOL(snd_hidden_kmalloc);
EXPORT_SYMBOL(snd_hidden_kcalloc);
EXPORT_SYMBOL(snd_hidden_kfree);
-EXPORT_SYMBOL(snd_hidden_vmalloc);
-EXPORT_SYMBOL(snd_hidden_vfree);
EXPORT_SYMBOL(snd_hidden_kstrdup);
#endif
EXPORT_SYMBOL(copy_to_user_fromio);
@@ -487,6 +485,7 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl_compat);
EXPORT_SYMBOL(snd_ctl_elem_read);
EXPORT_SYMBOL(snd_ctl_elem_write);
/* misc.c */
+EXPORT_SYMBOL(release_and_free_resource);
#ifdef CONFIG_SND_VERBOSE_PRINTK
EXPORT_SYMBOL(snd_verbose_printk);
#endif
@@ -497,6 +496,4 @@ EXPORT_SYMBOL(snd_verbose_printd);
#ifdef CONFIG_SND_DEBUG_MEMORY
EXPORT_SYMBOL(snd_wrapper_kmalloc);
EXPORT_SYMBOL(snd_wrapper_kfree);
-EXPORT_SYMBOL(snd_wrapper_vmalloc);
-EXPORT_SYMBOL(snd_wrapper_vfree);
#endif
diff --git a/sound/core/wrappers.c b/sound/core/wrappers.c
index 296b716..19e8990 100644
--- a/sound/core/wrappers.c
+++ b/sound/core/wrappers.c
@@ -36,15 +36,5 @@ void snd_wrapper_kfree(const void *obj)
{
kfree(obj);
}
-
-void *snd_wrapper_vmalloc(unsigned long size)
-{
- return vmalloc(size);
-}
-
-void snd_wrapper_vfree(void *obj)
-{
- vfree(obj);
-}
#endif
OpenPOWER on IntegriCloud