From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
"David S. Miller" <davem@davemloft.net>,
sparclinux@vger.kernel.org
Subject: [patch 08/16] sparc: Make atomic locks raw
Date: Fri, 06 Nov 2009 22:41:39 +0000 [thread overview]
Message-ID: <20091106223806.721945005@linutronix.de> (raw)
In-Reply-To: 20091106223547.784916750@linutronix.de
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>
Cc: David S. Miller <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
---
arch/sparc/lib/atomic32.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
Index: linux-2.6/arch/sparc/lib/atomic32.c
=================================--- linux-2.6.orig/arch/sparc/lib/atomic32.c
+++ linux-2.6/arch/sparc/lib/atomic32.c
@@ -15,8 +15,8 @@
#define ATOMIC_HASH_SIZE 4
#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)])
-spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
- [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED
+static raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
+ [0 ... (ATOMIC_HASH_SIZE-1)] = __RAW_SPIN_LOCK_UNLOCKED
};
#else /* SMP */
@@ -31,11 +31,11 @@ int __atomic_add_return(int i, atomic_t
{
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = (v->counter += i);
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret;
}
EXPORT_SYMBOL(__atomic_add_return);
@@ -45,12 +45,12 @@ int atomic_cmpxchg(atomic_t *v, int old,
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = v->counter;
if (likely(ret = old))
v->counter = new;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret;
}
EXPORT_SYMBOL(atomic_cmpxchg);
@@ -60,11 +60,11 @@ int atomic_add_unless(atomic_t *v, int a
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = v->counter;
if (ret != u)
v->counter += a;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret != u;
}
EXPORT_SYMBOL(atomic_add_unless);
@@ -74,9 +74,9 @@ void atomic_set(atomic_t *v, int i)
{
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
v->counter = i;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
}
EXPORT_SYMBOL(atomic_set);
@@ -84,10 +84,10 @@ unsigned long ___set_bit(unsigned long *
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old | mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -97,10 +97,10 @@ unsigned long ___clear_bit(unsigned long
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old & ~mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -110,10 +110,10 @@ unsigned long ___change_bit(unsigned lon
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old ^ mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -124,10 +124,10 @@ unsigned long __cmpxchg_u32(volatile u32
unsigned long flags;
u32 prev;
- spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
if ((prev = *ptr) = old)
*ptr = new;
- spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
return (unsigned long)prev;
}
WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
"David S. Miller" <davem@davemloft.net>,
sparclinux@vger.kernel.org
Subject: [patch 08/16] sparc: Make atomic locks raw
Date: Fri, 06 Nov 2009 22:41:39 -0000 [thread overview]
Message-ID: <20091106223806.721945005@linutronix.de> (raw)
In-Reply-To: 20091106223547.784916750@linutronix.de
[-- Attachment #1: sparc-make-atomic-locks-raw.patch --]
[-- Type: text/plain, Size: 4076 bytes --]
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>
Cc: David S. Miller <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
---
arch/sparc/lib/atomic32.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
Index: linux-2.6/arch/sparc/lib/atomic32.c
===================================================================
--- linux-2.6.orig/arch/sparc/lib/atomic32.c
+++ linux-2.6/arch/sparc/lib/atomic32.c
@@ -15,8 +15,8 @@
#define ATOMIC_HASH_SIZE 4
#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)])
-spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
- [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED
+static raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
+ [0 ... (ATOMIC_HASH_SIZE-1)] = __RAW_SPIN_LOCK_UNLOCKED
};
#else /* SMP */
@@ -31,11 +31,11 @@ int __atomic_add_return(int i, atomic_t
{
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = (v->counter += i);
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret;
}
EXPORT_SYMBOL(__atomic_add_return);
@@ -45,12 +45,12 @@ int atomic_cmpxchg(atomic_t *v, int old,
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = v->counter;
if (likely(ret == old))
v->counter = new;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret;
}
EXPORT_SYMBOL(atomic_cmpxchg);
@@ -60,11 +60,11 @@ int atomic_add_unless(atomic_t *v, int a
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = v->counter;
if (ret != u)
v->counter += a;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret != u;
}
EXPORT_SYMBOL(atomic_add_unless);
@@ -74,9 +74,9 @@ void atomic_set(atomic_t *v, int i)
{
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
v->counter = i;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
}
EXPORT_SYMBOL(atomic_set);
@@ -84,10 +84,10 @@ unsigned long ___set_bit(unsigned long *
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old | mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -97,10 +97,10 @@ unsigned long ___clear_bit(unsigned long
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old & ~mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -110,10 +110,10 @@ unsigned long ___change_bit(unsigned lon
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old ^ mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -124,10 +124,10 @@ unsigned long __cmpxchg_u32(volatile u32
unsigned long flags;
u32 prev;
- spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
if ((prev = *ptr) == old)
*ptr = new;
- spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
return (unsigned long)prev;
}
next prev parent reply other threads:[~2009-11-06 22:41 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-06 22:41 [patch 00/16] Remove old style lock initializers Thomas Gleixner
2009-11-06 22:41 ` [patch 01/16] arm: Replace old style lock initializer Thomas Gleixner
2009-11-06 22:41 ` [patch 02/16] mips: Replace old style spin " Thomas Gleixner
2009-11-06 22:41 ` [patch 03/16] net: Replace old style " Thomas Gleixner
2009-11-07 6:17 ` David Miller
2009-11-06 22:41 ` [patch 04/16] cred: " Thomas Gleixner
2009-11-06 22:41 ` [patch 05/16] pci: " Thomas Gleixner
2009-11-06 23:06 ` Jesse Barnes
2009-11-06 22:41 ` [patch 06/16] sound: " Thomas Gleixner
2009-11-07 9:20 ` Takashi Iwai
2009-11-06 22:41 ` [patch 07/16] um: " Thomas Gleixner
2009-11-09 2:13 ` Américo Wang
2009-11-06 22:41 ` Thomas Gleixner [this message]
2009-11-06 22:41 ` [patch 08/16] sparc: Make atomic locks raw Thomas Gleixner
2009-11-07 6:16 ` David Miller
2009-11-07 6:16 ` David Miller
2009-11-06 22:41 ` [patch 09/16] powerpc: Replace old style lock initializer Thomas Gleixner
2009-11-06 22:41 ` Thomas Gleixner
2009-11-06 22:55 ` Benjamin Herrenschmidt
2009-11-06 22:55 ` Benjamin Herrenschmidt
2009-11-08 7:55 ` Stephen Rothwell
2009-11-08 7:55 ` Stephen Rothwell
2009-11-09 5:15 ` Stephen Rothwell
2009-11-09 5:15 ` Stephen Rothwell
2009-11-09 8:53 ` Benjamin Herrenschmidt
2009-11-09 8:53 ` Benjamin Herrenschmidt
2009-11-06 22:41 ` [patch 10/16] parisc: Replace old style lock init Thomas Gleixner
2009-11-06 22:41 ` Thomas Gleixner
2009-11-08 5:06 ` Kyle McMartin
2009-11-08 16:11 ` Thomas Gleixner
2009-11-06 22:41 ` [patch 11/16] alpha: Replace old style lock initializer Thomas Gleixner
2009-11-06 22:42 ` [patch 12/16] ia64: " Thomas Gleixner
2009-11-06 22:42 ` Thomas Gleixner
2009-11-06 22:42 ` [patch 13/16] sh: " Thomas Gleixner
2009-11-06 22:42 ` Thomas Gleixner
2009-11-09 1:49 ` Paul Mundt
2009-11-09 1:49 ` Paul Mundt
2009-11-06 22:42 ` [patch 14/16] sparc: " Thomas Gleixner
2009-11-06 22:42 ` Thomas Gleixner
2009-11-07 6:18 ` David Miller
2009-11-07 6:18 ` David Miller
2009-11-07 6:20 ` David Miller
2009-11-07 6:20 ` David Miller
2009-11-07 12:16 ` Thomas Gleixner
2009-11-07 12:16 ` Thomas Gleixner
2009-11-08 6:45 ` David Miller
2009-11-08 6:45 ` David Miller
2009-11-06 22:42 ` [patch 15/16] xtensa: " Thomas Gleixner
2009-11-10 9:34 ` Chris Zankel
2009-11-06 22:42 ` [patch 16/16] locking: Remove old style lock initializers Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091106223806.721945005@linutronix.de \
--to=tglx@linutronix.de \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=sparclinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.