linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / sound / pci / trident / trident_memory.c
index aff3f87..cf09ea9 100644 (file)
@@ -27,8 +27,6 @@
 #include <asm/io.h>
 #include <linux/pci.h>
 #include <linux/time.h>
-#include <linux/mutex.h>
-
 #include <sound/core.h>
 #include <sound/trident.h>
 
@@ -203,16 +201,16 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident,
 
        
 
-       mutex_lock(&hdr->block_mutex);
+       down(&hdr->block_mutex);
        blk = search_empty(hdr, runtime->dma_bytes);
        if (blk == NULL) {
-               mutex_unlock(&hdr->block_mutex);
+               up(&hdr->block_mutex);
                return NULL;
        }
        if (lastpg(blk) - firstpg(blk) >= sgbuf->pages) {
                snd_printk(KERN_ERR "page calculation doesn't match: allocated pages = %d, trident = %d/%d\n", sgbuf->pages, firstpg(blk), lastpg(blk));
                __snd_util_mem_free(hdr, blk);
-               mutex_unlock(&hdr->block_mutex);
+               up(&hdr->block_mutex);
                return NULL;
        }
                           
@@ -223,12 +221,12 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident,
                unsigned long ptr = (unsigned long)sgbuf->table[idx].buf;
                if (! is_valid_page(addr)) {
                        __snd_util_mem_free(hdr, blk);
-                       mutex_unlock(&hdr->block_mutex);
+                       up(&hdr->block_mutex);
                        return NULL;
                }
                set_tlb_bus(trident, page, ptr, addr);
        }
-       mutex_unlock(&hdr->block_mutex);
+       up(&hdr->block_mutex);
        return blk;
 }
 
@@ -250,10 +248,10 @@ snd_trident_alloc_cont_pages(struct snd_trident *trident,
        hdr = trident->tlb.memhdr;
        snd_assert(hdr != NULL, return NULL);
 
-       mutex_lock(&hdr->block_mutex);
+       down(&hdr->block_mutex);
        blk = search_empty(hdr, runtime->dma_bytes);
        if (blk == NULL) {
-               mutex_unlock(&hdr->block_mutex);
+               up(&hdr->block_mutex);
                return NULL;
        }
                           
@@ -264,12 +262,12 @@ snd_trident_alloc_cont_pages(struct snd_trident *trident,
             ptr += SNDRV_TRIDENT_PAGE_SIZE, addr += SNDRV_TRIDENT_PAGE_SIZE) {
                if (! is_valid_page(addr)) {
                        __snd_util_mem_free(hdr, blk);
-                       mutex_unlock(&hdr->block_mutex);
+                       up(&hdr->block_mutex);
                        return NULL;
                }
                set_tlb_bus(trident, page, ptr, addr);
        }
-       mutex_unlock(&hdr->block_mutex);
+       up(&hdr->block_mutex);
        return blk;
 }
 
@@ -302,13 +300,13 @@ int snd_trident_free_pages(struct snd_trident *trident,
        snd_assert(blk != NULL, return -EINVAL);
 
        hdr = trident->tlb.memhdr;
-       mutex_lock(&hdr->block_mutex);
+       down(&hdr->block_mutex);
        /* reset TLB entries */
        for (page = firstpg(blk); page <= lastpg(blk); page++)
                set_silent_tlb(trident, page);
        /* free memory block */
        __snd_util_mem_free(hdr, blk);
-       mutex_unlock(&hdr->block_mutex);
+       up(&hdr->block_mutex);
        return 0;
 }
 
@@ -334,22 +332,21 @@ snd_trident_synth_alloc(struct snd_trident *hw, unsigned int size)
        struct snd_util_memblk *blk;
        struct snd_util_memhdr *hdr = hw->tlb.memhdr; 
 
-       mutex_lock(&hdr->block_mutex);
+       down(&hdr->block_mutex);
        blk = __snd_util_mem_alloc(hdr, size);
        if (blk == NULL) {
-               mutex_unlock(&hdr->block_mutex);
+               up(&hdr->block_mutex);
                return NULL;
        }
        if (synth_alloc_pages(hw, blk)) {
                __snd_util_mem_free(hdr, blk);
-               mutex_unlock(&hdr->block_mutex);
+               up(&hdr->block_mutex);
                return NULL;
        }
-       mutex_unlock(&hdr->block_mutex);
+       up(&hdr->block_mutex);
        return blk;
 }
 
-EXPORT_SYMBOL(snd_trident_synth_alloc);
 
 /*
  * free a synth sample area
@@ -359,14 +356,13 @@ snd_trident_synth_free(struct snd_trident *hw, struct snd_util_memblk *blk)
 {
        struct snd_util_memhdr *hdr = hw->tlb.memhdr; 
 
-       mutex_lock(&hdr->block_mutex);
+       down(&hdr->block_mutex);
        synth_free_pages(hw, blk);
         __snd_util_mem_free(hdr, blk);
-       mutex_unlock(&hdr->block_mutex);
+       up(&hdr->block_mutex);
        return 0;
 }
 
-EXPORT_SYMBOL(snd_trident_synth_free);
 
 /*
  * reset TLB entry and free kernel page
@@ -488,4 +484,3 @@ int snd_trident_synth_copy_from_user(struct snd_trident *trident,
        return 0;
 }
 
-EXPORT_SYMBOL(snd_trident_synth_copy_from_user);