Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / arch / blackfin / mm / sram-alloc.c
index eb63ab3..5732da2 100644 (file)
@@ -1,30 +1,9 @@
 /*
- * File:         arch/blackfin/mm/sram-alloc.c
- * Based on:
- * Author:
+ * SRAM allocator for Blackfin on-chip memory
  *
- * Created:
- * Description:  SRAM allocator for Blackfin L1 and L2 memory
+ * Copyright 2004-2009 Analog Devices Inc.
  *
- * Modified:
- *               Copyright 2004-2008 Analog Devices Inc.
- *
- * Bugs:         Enter bugs at http://blackfin.uclinux.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see the file COPYING, or write
- * to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * Licensed under the GPL-2 or later.
  */
 
 #include <linux/module.h>
@@ -423,7 +402,7 @@ void *l1_data_A_sram_alloc(size_t size)
        void *addr;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
 
@@ -432,7 +411,6 @@ void *l1_data_A_sram_alloc(size_t size)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
-       put_cpu();
 
        pr_debug("Allocated address in l1_data_A_sram_alloc is 0x%lx+0x%lx\n",
                 (long unsigned int)addr, size);
@@ -451,7 +429,7 @@ int l1_data_A_sram_free(const void *addr)
        int ret;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
 
@@ -460,7 +438,6 @@ int l1_data_A_sram_free(const void *addr)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
-       put_cpu();
 
        return ret;
 #else
@@ -476,7 +453,7 @@ void *l1_data_B_sram_alloc(size_t size)
        void *addr;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
 
@@ -485,7 +462,6 @@ void *l1_data_B_sram_alloc(size_t size)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
-       put_cpu();
 
        pr_debug("Allocated address in l1_data_B_sram_alloc is 0x%lx+0x%lx\n",
                 (long unsigned int)addr, size);
@@ -504,7 +480,7 @@ int l1_data_B_sram_free(const void *addr)
        int ret;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
 
@@ -513,7 +489,6 @@ int l1_data_B_sram_free(const void *addr)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
-       put_cpu();
 
        return ret;
 #else
@@ -561,7 +536,7 @@ void *l1_inst_sram_alloc(size_t size)
        void *addr;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags);
 
@@ -570,7 +545,6 @@ void *l1_inst_sram_alloc(size_t size)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags);
-       put_cpu();
 
        pr_debug("Allocated address in l1_inst_sram_alloc is 0x%lx+0x%lx\n",
                 (long unsigned int)addr, size);
@@ -589,7 +563,7 @@ int l1_inst_sram_free(const void *addr)
        int ret;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags);
 
@@ -598,7 +572,6 @@ int l1_inst_sram_free(const void *addr)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags);
-       put_cpu();
 
        return ret;
 #else
@@ -614,7 +587,7 @@ void *l1sram_alloc(size_t size)
        void *addr;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
 
@@ -623,7 +596,6 @@ void *l1sram_alloc(size_t size)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
-       put_cpu();
 
        return addr;
 }
@@ -635,7 +607,7 @@ void *l1sram_alloc_max(size_t *psize)
        void *addr;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
 
@@ -644,7 +616,6 @@ void *l1sram_alloc_max(size_t *psize)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
-       put_cpu();
 
        return addr;
 }
@@ -656,7 +627,7 @@ int l1sram_free(const void *addr)
        int ret;
        unsigned int cpu;
 
-       cpu = get_cpu();
+       cpu = smp_processor_id();
        /* add mutex operation */
        spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
 
@@ -665,7 +636,6 @@ int l1sram_free(const void *addr)
 
        /* add mutex operation */
        spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
-       put_cpu();
 
        return ret;
 }