mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-14 21:01:29 +00:00
Blackfin: simplify SMP handling in SRAM code
There is no need to use {get,put}_cpu() when we already have a spinlock to protect against multiple processors running simultaneously. Signed-off-by: Yi Li <yi.li@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
0b39db28b9
commit
54536c5c6a
@ -402,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);
|
||||
|
||||
@ -411,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);
|
||||
@ -430,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);
|
||||
|
||||
@ -439,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
|
||||
@ -455,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);
|
||||
|
||||
@ -464,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);
|
||||
@ -483,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);
|
||||
|
||||
@ -492,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
|
||||
@ -540,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);
|
||||
|
||||
@ -549,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);
|
||||
@ -568,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);
|
||||
|
||||
@ -577,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
|
||||
@ -593,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);
|
||||
|
||||
@ -602,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;
|
||||
}
|
||||
@ -614,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);
|
||||
|
||||
@ -623,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;
|
||||
}
|
||||
@ -635,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);
|
||||
|
||||
@ -644,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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user