
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/drivers/scsi/a100u2w.c            |    2 +-
 25-akpm/drivers/scsi/advansys.c           |    2 +-
 25-akpm/drivers/scsi/cpqfcTSinit.c        |    2 +-
 25-akpm/drivers/scsi/ibmvscsi/rpa_vscsi.c |    2 +-
 25-akpm/drivers/scsi/initio.c             |    4 ++--
 25-akpm/drivers/scsi/sg.c                 |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff -puN drivers/scsi/a100u2w.c~lock-initializer-unifying-batch-2-scsi drivers/scsi/a100u2w.c
--- 25/drivers/scsi/a100u2w.c~lock-initializer-unifying-batch-2-scsi	Thu Oct 28 15:55:15 2004
+++ 25-akpm/drivers/scsi/a100u2w.c	Thu Oct 28 15:55:15 2004
@@ -1078,7 +1078,7 @@ static int __devinit inia100_probe_one(s
 	pHCB->pdev = pdev;
 	pHCB->HCS_Base = port;
 	pHCB->HCS_BIOS = bios;
-	pHCB->BitAllocFlagLock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&pHCB->BitAllocFlagLock);
 
 	/* Get total memory needed for SCB */
 	sz = ORC_MAXQUEUE * sizeof(ORC_SCB);
diff -puN drivers/scsi/advansys.c~lock-initializer-unifying-batch-2-scsi drivers/scsi/advansys.c
--- 25/drivers/scsi/advansys.c~lock-initializer-unifying-batch-2-scsi	Thu Oct 28 15:55:15 2004
+++ 25-akpm/drivers/scsi/advansys.c	Thu Oct 28 15:55:15 2004
@@ -4567,7 +4567,7 @@ advansys_detect(struct scsi_host_templat
             boardp->id = asc_board_count - 1;
 
             /* Initialize spinlock. */
-            boardp->lock = SPIN_LOCK_UNLOCKED;
+            spin_lock_init(&boardp->lock);
 
             /*
              * Handle both narrow and wide boards.
diff -puN drivers/scsi/cpqfcTSinit.c~lock-initializer-unifying-batch-2-scsi drivers/scsi/cpqfcTSinit.c
--- 25/drivers/scsi/cpqfcTSinit.c~lock-initializer-unifying-batch-2-scsi	Thu Oct 28 15:55:15 2004
+++ 25-akpm/drivers/scsi/cpqfcTSinit.c	Thu Oct 28 15:55:15 2004
@@ -367,7 +367,7 @@ int cpqfcTS_detect(Scsi_Host_Template *S
       Cpqfc_initHBAdata( cpqfcHBAdata, PciDev ); // fill MOST fields
      
       cpqfcHBAdata->HBAnum = NumberOfAdapters;
-      cpqfcHBAdata->hba_spinlock = SPIN_LOCK_UNLOCKED;
+      spin_lock_init(&cpqfcHBAdata->hba_spinlock);
 
       // request necessary resources and check for conflicts
       if( request_irq( HostAdapter->irq,
diff -puN drivers/scsi/ibmvscsi/rpa_vscsi.c~lock-initializer-unifying-batch-2-scsi drivers/scsi/ibmvscsi/rpa_vscsi.c
--- 25/drivers/scsi/ibmvscsi/rpa_vscsi.c~lock-initializer-unifying-batch-2-scsi	Thu Oct 28 15:55:15 2004
+++ 25-akpm/drivers/scsi/ibmvscsi/rpa_vscsi.c	Thu Oct 28 15:55:15 2004
@@ -204,7 +204,7 @@ int ibmvscsi_init_crq_queue(struct crq_q
 	}
 
 	queue->cur = 0;
-	queue->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&queue->lock);
 
 	tasklet_init(&hostdata->srp_task, (void *)ibmvscsi_task,
 		     (unsigned long)hostdata);
diff -puN drivers/scsi/initio.c~lock-initializer-unifying-batch-2-scsi drivers/scsi/initio.c
--- 25/drivers/scsi/initio.c~lock-initializer-unifying-batch-2-scsi	Thu Oct 28 15:55:15 2004
+++ 25-akpm/drivers/scsi/initio.c	Thu Oct 28 15:55:15 2004
@@ -679,7 +679,7 @@ int init_tulip(HCS * pCurHcb, SCB * scbp
 
 	pCurHcb->HCS_NumScbs = tul_num_scb;
 	pCurHcb->HCS_Semaph = 1;
-	pCurHcb->HCS_SemaphLock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&pCurHcb->HCS_SemaphLock);
 	pCurHcb->HCS_JSStatus0 = 0;
 	pCurHcb->HCS_Scb = scbp;
 	pCurHcb->HCS_NxtPend = scbp;
@@ -694,7 +694,7 @@ int init_tulip(HCS * pCurHcb, SCB * scbp
 	pCurHcb->HCS_ScbEnd = pTmpScb;
 	pCurHcb->HCS_FirstAvail = scbp;
 	pCurHcb->HCS_LastAvail = pPrevScb;
-	pCurHcb->HCS_AvailLock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&pCurHcb->HCS_AvailLock);
 	pCurHcb->HCS_FirstPend = NULL;
 	pCurHcb->HCS_LastPend = NULL;
 	pCurHcb->HCS_FirstBusy = NULL;
diff -puN drivers/scsi/sg.c~lock-initializer-unifying-batch-2-scsi drivers/scsi/sg.c
--- 25/drivers/scsi/sg.c~lock-initializer-unifying-batch-2-scsi	Thu Oct 28 15:55:15 2004
+++ 25-akpm/drivers/scsi/sg.c	Thu Oct 28 15:55:15 2004
@@ -2423,7 +2423,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
 		return NULL;
 	memset(sfp, 0, sizeof (Sg_fd));
 	init_waitqueue_head(&sfp->read_wait);
-	sfp->rq_list_lock = RW_LOCK_UNLOCKED;
+	rwlock_init(&sfp->rq_list_lock);
 
 	sfp->timeout = SG_DEFAULT_TIMEOUT;
 	sfp->timeout_user = SG_DEFAULT_TIMEOUT_USER;
_
