Skip to contentSkip to conversation

locking: Remove the deprecated lock initializers

PATCH Applied Thomas Gleixner 6 participants 18 messages Jan 23, 2011 – Jan 27, 2011

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover locking: Remove the deprecated lock initializers

SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated since lockdep was merged. Fixup the last pertinacious users and remove the initializers.

Thanks,

tglx

#1 lore raw

PATCH 1/9 alpha: Replace deprecated spinlock initialization

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 arch/alpha/include/asm/rwsem.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/include/asm/rwsem.h +1 -1
Index: linux-2.6/arch/alpha/include/asm/rwsem.h
===================================================================
@@ -39,7 +39,7 @@ struct rw_semaphore {
 };
 
 #define __RWSEM_INITIALIZER(name) \
-	{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
+	{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock),	\
 	LIST_HEAD_INIT((name).wait_list) }
 
 #define DECLARE_RWSEM(name) \
maintainer
#2 lore raw

Re: [patch 1/9] alpha: Replace deprecated spinlock initialization

Quoted 16 lines · Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 arch/alpha/include/asm/rwsem.h |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/arch/alpha/include/asm/rwsem.h
===================================================================

arch/alpha/include/asm/rwsem.h +0 -0
@@ -39,7 +39,7 @@ struct rw_semaphore {
  };

arch/alpha/include/asm/rwsem.h struct rw_semaphore {

Quoted 10 lines
arch/alpha/include/asm/rwsem.h +1 -2
 
  #define __RWSEM_INITIALIZER(name) \
-       { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
+       { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
        LIST_HEAD_INIT((name).wait_list) }
 
  #define DECLARE_RWSEM(name) \
 
 
--

Thanks! I'll apply this.

Matt
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Re: [patch 1/9] alpha: Replace deprecated spinlock initialization

Quoted 3 lines · Matt Turner

On Sun, Jan 23, 2011 at 3:16 PM, Thomas Gleixner <[email protected]> wrote:

Thanks! I'll apply this.

I take it through core/locking in tip as well, because further cleanups depend on it. Git will sort out the identical changes.

Thanks,

tglx

#4 lore raw

PATCH 2/9 cris: Replace deprecated spinlock initialization

In reply to Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 arch/cris/arch-v32/kernel/smp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/cris/arch-v32/kernel/smp.c +3 -1
Index: linux-2.6/arch/cris/arch-v32/kernel/smp.c
===================================================================
@@ -26,7 +26,9 @@
 #define FLUSH_ALL (void*)0xffffffff
 
 /* Vector of locks used for various atomic operations */
-spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};
+spinlock_t cris_atomic_locks[] = {
+	[0 ... LOCK_COUNT - 1] = __SPIN_LOCK_UNLOCKED(cris_atomic_locks)
+};
 
 /* CPU masks */
 cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
#6 lore raw

Re: [patch 2/9] cris: Replace deprecated spinlock initialization

Quoted 9 lines · Jesper Nilsson
Quoted 6 lines · Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

Thanks, I'll add this to the CRIS-tree.

I take it through core/locking in tip as well, because further cleanups depend on it. Git will sort out the identical changes.

Thanks,

tglx

#7 lore raw

PATCH 3/9 mips: Replace deprecated spinlock initialization

In reply to Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 arch/mips/kernel/vpe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/vpe.c +2 -2
Index: linux-2.6/arch/mips/kernel/vpe.c
===================================================================
@@ -148,9 +148,9 @@ struct {
 	spinlock_t tc_list_lock;
 	struct list_head tc_list;	/* Thread contexts */
 } vpecontrol = {
-	.vpe_list_lock	= SPIN_LOCK_UNLOCKED,
+	.vpe_list_lock	= __SPIN_LOCK_UNLOCKED(vpe_list_lock),
 	.vpe_list	= LIST_HEAD_INIT(vpecontrol.vpe_list),
-	.tc_list_lock	= SPIN_LOCK_UNLOCKED,
+	.tc_list_lock	= __SPIN_LOCK_UNLOCKED(tc_list_lock),
 	.tc_list	= LIST_HEAD_INIT(vpecontrol.tc_list)
 };
 
Applied
#8 lore raw

Re: [patch 3/9] mips: Replace deprecated spinlock initialization

Thanks, applied.

Ralf

#9 lore raw

Re: [patch 3/9] mips: Replace deprecated spinlock initialization

Quoted 4 lines · Ralf Baechle

Thanks, applied.

Ralf

I take it through core/locking in tip as well, because further cleanups depend on it. Git will sort out the identical changes.

Thanks,

tglx

#10 lore raw

PATCH 4/9 sparc: Replace deprecated spinlock initialization

In reply to Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 arch/sparc/lib/atomic32.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
@@ -16,7 +16,7 @@
#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
+ [0 ... (ATOMIC_HASH_SIZE-1)] = __SPIN_LOCK_UNLOCKED(__atomic_hash)
};

#else /* SMP */

#12 lore raw

PATCH 5/9 um: Replace deprecated spinlock initialization

In reply to Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 arch/um/drivers/ubd_kern.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/ubd_kern.c +1 -1
Index: linux-2.6/arch/um/drivers/ubd_kern.c
===================================================================
@@ -185,7 +185,7 @@ struct ubd {
 	.no_cow =               0, \
 	.shared =		0, \
 	.cow =			DEFAULT_COW, \
-	.lock =			SPIN_LOCK_UNLOCKED,	\
+	.lock =			__SPIN_LOCK_UNLOCKED(ubd_devs.lock), \
 	.request =		NULL, \
 	.start_sg =		0, \
 	.end_sg =		0, \
#13 lore raw

PATCH 6/9 xtensa: Replace deprecated spinlock initialization

In reply to Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 arch/xtensa/include/asm/rwsem.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/include/asm/rwsem.h +1 -1
Index: linux-2.6/arch/xtensa/include/asm/rwsem.h
===================================================================
@@ -38,7 +38,7 @@ struct rw_semaphore {
 };
 
 #define __RWSEM_INITIALIZER(name) \
-	{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
+	{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock),	\
 	  LIST_HEAD_INIT((name).wait_list) }
 
 #define DECLARE_RWSEM(name)		\
#14 lore raw

PATCH 7/9 kthread: Replace deprecated spinlock initialization

In reply to Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 include/linux/kthread.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kthread.h +1 -1
Index: linux-2.6/include/linux/kthread.h
===================================================================
@@ -64,7 +64,7 @@ struct kthread_work {
 };
 
 #define KTHREAD_WORKER_INIT(worker)	{				\
-	.lock = SPIN_LOCK_UNLOCKED,					\
+	.lock = __SPIN_LOCK_UNLOCKED((worker).lock),			\
 	.work_list = LIST_HEAD_INIT((worker).work_list),		\
 	}
 
#15 lore raw

PATCH 8/9 cred: Replace deprecated spinlock initialization

In reply to Thomas Gleixner

SPIN_LOCK_UNLOCK is deprecated. Use the lockdep capable variant instead.

---
 kernel/cred.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cred.c +1 -1
Index: linux-2.6/kernel/cred.c
===================================================================
@@ -35,7 +35,7 @@ static struct kmem_cache *cred_jar;
 static struct thread_group_cred init_tgcred = {
 	.usage	= ATOMIC_INIT(2),
 	.tgid	= 0,
-	.lock	= SPIN_LOCK_UNLOCKED,
+	.lock	= __SPIN_LOCK_UNLOCKED(init_cred.tgcred.lock),
 };
 #endif
 
#16 lore raw

PATCH 9/9 locking: Remove deprecated lock initializers

In reply to Thomas Gleixner

Last users are gone. Remove the leftovers.

---
 Documentation/spinlocks.txt    |   24 +-----------------------
 include/linux/rwlock_types.h   |    8 --------
 include/linux/spinlock_types.h |    8 --------
 scripts/checkpatch.pl          |    5 -----
 4 files changed, 1 insertion(+), 44 deletions(-)
Documentation/spinlocks.txt +1 -23
Index: linux-2.6/Documentation/spinlocks.txt
===================================================================
@@ -86,7 +86,7 @@ to change the variables it has to get an
 
 The routines look the same as above:
 
-   rwlock_t xxx_lock = RW_LOCK_UNLOCKED;
+   rwlock_t xxx_lock = __RW_LOCK_UNLOCKED(xxx_lock);
 
 	unsigned long flags;
 
@@ -196,25 +196,3 @@ appropriate:
 
 For static initialization, use DEFINE_SPINLOCK() / DEFINE_RWLOCK() or
 __SPIN_LOCK_UNLOCKED() / __RW_LOCK_UNLOCKED() as appropriate.
-
-SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated.  These interfere
-with lockdep state tracking.
-
-Most of the time, you can simply turn:
-	static spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED;
-into:
-	static DEFINE_SPINLOCK(xxx_lock);
-
-Static structure member variables go from:
-
-	struct foo bar {
-		.lock	=	SPIN_LOCK_UNLOCKED;
-	};
-
-to:
-
-	struct foo bar {
-		.lock	=	__SPIN_LOCK_UNLOCKED(bar.lock);
-	};
-
-Declaration of static rw_locks undergo a similar transformation.
include/linux/rwlock_types.h +0 -8
Index: linux-2.6/include/linux/rwlock_types.h
===================================================================
@@ -43,14 +43,6 @@ typedef struct {
 				RW_DEP_MAP_INIT(lockname) }
 #endif
 
-/*
- * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence
- * deprecated.
- *
- * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate.
- */
-#define RW_LOCK_UNLOCKED	__RW_LOCK_UNLOCKED(old_style_rw_init)
-
 #define DEFINE_RWLOCK(x)	rwlock_t x = __RW_LOCK_UNLOCKED(x)
 
 #endif /* __LINUX_RWLOCK_TYPES_H */
include/linux/spinlock_types.h +0 -8
Index: linux-2.6/include/linux/spinlock_types.h
===================================================================
@@ -81,14 +81,6 @@ typedef struct spinlock {
 #define __SPIN_LOCK_UNLOCKED(lockname) \
 	(spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
 
-/*
- * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence
- * deprecated.
- * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as
- * appropriate.
- */
-#define SPIN_LOCK_UNLOCKED	__SPIN_LOCK_UNLOCKED(old_style_spin_init)
-
 #define DEFINE_SPINLOCK(x)	spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
 
 #include <linux/rwlock_types.h>
scripts/checkpatch.pl +0 -5
Index: linux-2.6/scripts/checkpatch.pl
===================================================================
@@ -2654,11 +2654,6 @@ sub process {
 			WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
 		}
 
-# SPIN_LOCK_UNLOCKED & RW_LOCK_UNLOCKED are deprecated
-		if ($line =~ /\b(SPIN_LOCK_UNLOCKED|RW_LOCK_UNLOCKED)/) {
-			ERROR("Use of $1 is deprecated: see Documentation/spinlocks.txt\n" . $herecurr);
-		}
-
 # warn about #if 0
 		if ($line =~ /^.\s*\#\s*if\s+0\b/) {
 			CHK("if this code is redundant consider removing it\n" .