
From: <tglx@linutronix.de>

To make spinlock/rwlock initialization consistent all over the kernel,
this patch converts explicit lock-initializers into spin_lock_init() and
rwlock_init() calls.

Currently, spinlocks and rwlocks are initialized in two different ways:

  lock = SPIN_LOCK_UNLOCKED
  spin_lock_init(&lock)
  
  rwlock = RW_LOCK_UNLOCKED
  rwlock_init(&rwlock)

this patch converts all explicit lock initializations to
spin_lock_init() or rwlock_init(). (Besides consistency this also helps
automatic lock validators and debugging code.)

The conversion was done with a script, it was verified manually and it
was reviewed, compiled and tested as far as possible on x86, ARM, PPC.

There is no runtime overhead or actual code change resulting out of this
patch, because spin_lock_init() and rwlock_init() are macros and are
thus equivalent to the explicit initialization method.

That's the second batch of the unifying patches.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/cifs/cifsfs.c           |    4 ++--
 25-akpm/fs/cifs/misc.c             |    2 +-
 25-akpm/fs/dcache.c                |    2 +-
 25-akpm/fs/file_table.c            |    2 +-
 25-akpm/fs/reiserfs/super.c        |    2 +-
 25-akpm/fs/xfs/linux-2.6/xfs_vfs.c |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff -puN fs/cifs/cifsfs.c~lock-initializer-unifying-batch-2-filesystems fs/cifs/cifsfs.c
--- 25/fs/cifs/cifsfs.c~lock-initializer-unifying-batch-2-filesystems	Thu Oct 28 15:55:28 2004
+++ 25-akpm/fs/cifs/cifsfs.c	Thu Oct 28 15:55:28 2004
@@ -748,8 +748,8 @@ init_cifs(void)
 	GlobalCurrentXid = 0;
 	GlobalTotalActiveXid = 0;
 	GlobalMaxActiveXid = 0;
-	GlobalSMBSeslock = RW_LOCK_UNLOCKED;
-	GlobalMid_Lock = SPIN_LOCK_UNLOCKED;
+	rwlock_init(&GlobalSMBSeslock);
+	spin_lock_init(&GlobalMid_Lock);
 
 	rc = cifs_init_inodecache();
 	if (!rc) {
diff -puN fs/cifs/misc.c~lock-initializer-unifying-batch-2-filesystems fs/cifs/misc.c
--- 25/fs/cifs/misc.c~lock-initializer-unifying-batch-2-filesystems	Thu Oct 28 15:55:28 2004
+++ 25-akpm/fs/cifs/misc.c	Thu Oct 28 15:55:28 2004
@@ -124,7 +124,7 @@ tconInfoAlloc(void)
 		INIT_LIST_HEAD(&ret_buf->openFileList);
 		init_MUTEX(&ret_buf->tconSem);
 #ifdef CONFIG_CIFS_STATS
-		ret_buf->stat_lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&ret_buf->stat_lock);
 #endif
 		write_unlock(&GlobalSMBSeslock);
 	}
diff -puN fs/dcache.c~lock-initializer-unifying-batch-2-filesystems fs/dcache.c
--- 25/fs/dcache.c~lock-initializer-unifying-batch-2-filesystems	Thu Oct 28 15:55:28 2004
+++ 25-akpm/fs/dcache.c	Thu Oct 28 15:55:28 2004
@@ -733,7 +733,7 @@ struct dentry *d_alloc(struct dentry * p
 
 	atomic_set(&dentry->d_count, 1);
 	dentry->d_flags = DCACHE_UNHASHED;
-	dentry->d_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dentry->d_lock);
 	dentry->d_inode = NULL;
 	dentry->d_parent = NULL;
 	dentry->d_sb = NULL;
diff -puN fs/file_table.c~lock-initializer-unifying-batch-2-filesystems fs/file_table.c
--- 25/fs/file_table.c~lock-initializer-unifying-batch-2-filesystems	Thu Oct 28 15:55:28 2004
+++ 25-akpm/fs/file_table.c	Thu Oct 28 15:55:28 2004
@@ -82,7 +82,7 @@ static int old_max;
 			atomic_set(&f->f_count, 1);
 			f->f_uid = current->fsuid;
 			f->f_gid = current->fsgid;
-			f->f_owner.lock = RW_LOCK_UNLOCKED;
+			rwlock_init(&f->f_owner.lock);
 			/* f->f_version: 0 */
 			INIT_LIST_HEAD(&f->f_list);
 			return f;
diff -puN fs/reiserfs/super.c~lock-initializer-unifying-batch-2-filesystems fs/reiserfs/super.c
--- 25/fs/reiserfs/super.c~lock-initializer-unifying-batch-2-filesystems	Thu Oct 28 15:55:28 2004
+++ 25-akpm/fs/reiserfs/super.c	Thu Oct 28 15:55:28 2004
@@ -1636,7 +1636,7 @@ static int reiserfs_fill_super (struct s
     reiserfs_proc_info_init( s );
 
     init_waitqueue_head (&(sbi->s_wait));
-    sbi->bitmap_lock = SPIN_LOCK_UNLOCKED;
+    spin_lock_init(&sbi->bitmap_lock);
 
     return (0);
 
diff -puN fs/xfs/linux-2.6/xfs_vfs.c~lock-initializer-unifying-batch-2-filesystems fs/xfs/linux-2.6/xfs_vfs.c
--- 25/fs/xfs/linux-2.6/xfs_vfs.c~lock-initializer-unifying-batch-2-filesystems	Thu Oct 28 15:55:28 2004
+++ 25-akpm/fs/xfs/linux-2.6/xfs_vfs.c	Thu Oct 28 15:55:28 2004
@@ -250,7 +250,7 @@ vfs_allocate( void )
 	vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
 	bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
 	INIT_LIST_HEAD(&vfsp->vfs_sync_list);
-	vfsp->vfs_sync_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&vfsp->vfs_sync_lock);
 	init_waitqueue_head(&vfsp->vfs_wait_sync_task);
 	init_waitqueue_head(&vfsp->vfs_wait_single_sync_task);
 	return vfsp;
_
