mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 17:46:40 +07:00
sparc: Make atomic locks raw
SPIN_LOCK_UNLOCKED is deprecated and the locks which protect the atomic operations have no dependency on other locks and the code is well tested so the conversion to a raw lock is safe. Make the lock array static while at it. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ddaf1b27ed
commit
4df286e529
@ -15,8 +15,8 @@
|
|||||||
#define ATOMIC_HASH_SIZE 4
|
#define ATOMIC_HASH_SIZE 4
|
||||||
#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)])
|
#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)])
|
||||||
|
|
||||||
spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
|
static raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
|
||||||
[0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED
|
[0 ... (ATOMIC_HASH_SIZE-1)] = __RAW_SPIN_LOCK_UNLOCKED
|
||||||
};
|
};
|
||||||
|
|
||||||
#else /* SMP */
|
#else /* SMP */
|
||||||
@ -31,11 +31,11 @@ int __atomic_add_return(int i, atomic_t *v)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
||||||
|
|
||||||
ret = (v->counter += i);
|
ret = (v->counter += i);
|
||||||
|
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__atomic_add_return);
|
EXPORT_SYMBOL(__atomic_add_return);
|
||||||
@ -45,12 +45,12 @@ int atomic_cmpxchg(atomic_t *v, int old, int new)
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
||||||
ret = v->counter;
|
ret = v->counter;
|
||||||
if (likely(ret == old))
|
if (likely(ret == old))
|
||||||
v->counter = new;
|
v->counter = new;
|
||||||
|
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(atomic_cmpxchg);
|
EXPORT_SYMBOL(atomic_cmpxchg);
|
||||||
@ -60,11 +60,11 @@ int atomic_add_unless(atomic_t *v, int a, int u)
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
||||||
ret = v->counter;
|
ret = v->counter;
|
||||||
if (ret != u)
|
if (ret != u)
|
||||||
v->counter += a;
|
v->counter += a;
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||||
return ret != u;
|
return ret != u;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(atomic_add_unless);
|
EXPORT_SYMBOL(atomic_add_unless);
|
||||||
@ -74,9 +74,9 @@ void atomic_set(atomic_t *v, int i)
|
|||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
|
||||||
v->counter = i;
|
v->counter = i;
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(atomic_set);
|
EXPORT_SYMBOL(atomic_set);
|
||||||
|
|
||||||
@ -84,10 +84,10 @@ unsigned long ___set_bit(unsigned long *addr, unsigned long mask)
|
|||||||
{
|
{
|
||||||
unsigned long old, flags;
|
unsigned long old, flags;
|
||||||
|
|
||||||
spin_lock_irqsave(ATOMIC_HASH(addr), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
|
||||||
old = *addr;
|
old = *addr;
|
||||||
*addr = old | mask;
|
*addr = old | mask;
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
|
||||||
|
|
||||||
return old & mask;
|
return old & mask;
|
||||||
}
|
}
|
||||||
@ -97,10 +97,10 @@ unsigned long ___clear_bit(unsigned long *addr, unsigned long mask)
|
|||||||
{
|
{
|
||||||
unsigned long old, flags;
|
unsigned long old, flags;
|
||||||
|
|
||||||
spin_lock_irqsave(ATOMIC_HASH(addr), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
|
||||||
old = *addr;
|
old = *addr;
|
||||||
*addr = old & ~mask;
|
*addr = old & ~mask;
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
|
||||||
|
|
||||||
return old & mask;
|
return old & mask;
|
||||||
}
|
}
|
||||||
@ -110,10 +110,10 @@ unsigned long ___change_bit(unsigned long *addr, unsigned long mask)
|
|||||||
{
|
{
|
||||||
unsigned long old, flags;
|
unsigned long old, flags;
|
||||||
|
|
||||||
spin_lock_irqsave(ATOMIC_HASH(addr), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
|
||||||
old = *addr;
|
old = *addr;
|
||||||
*addr = old ^ mask;
|
*addr = old ^ mask;
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
|
||||||
|
|
||||||
return old & mask;
|
return old & mask;
|
||||||
}
|
}
|
||||||
@ -124,10 +124,10 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new)
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u32 prev;
|
u32 prev;
|
||||||
|
|
||||||
spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
|
__raw_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
|
||||||
if ((prev = *ptr) == old)
|
if ((prev = *ptr) == old)
|
||||||
*ptr = new;
|
*ptr = new;
|
||||||
spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
|
__raw_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
|
||||||
|
|
||||||
return (unsigned long)prev;
|
return (unsigned long)prev;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user