Commit 26b40e13 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by James Bottomley

[PATCH] Lock initializer unifying Batch 2 (SCSI)

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: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent aa2ee036
......@@ -1078,7 +1078,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
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);
......
......@@ -4567,7 +4567,7 @@ advansys_detect(struct scsi_host_template *tpnt)
boardp->id = asc_board_count - 1;
/* Initialize spinlock. */
boardp->lock = SPIN_LOCK_UNLOCKED;
spin_lock_init(&boardp->lock);
/*
* Handle both narrow and wide boards.
......
......@@ -367,7 +367,7 @@ int cpqfcTS_detect(Scsi_Host_Template *ScsiHostTemplate)
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,
......
......@@ -204,7 +204,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
}
queue->cur = 0;
queue->lock = SPIN_LOCK_UNLOCKED;
spin_lock_init(&queue->lock);
tasklet_init(&hostdata->srp_task, (void *)ibmvscsi_task,
(unsigned long)hostdata);
......
......@@ -679,7 +679,7 @@ int init_tulip(HCS * pCurHcb, SCB * scbp, int tul_num_scb, BYTE * pbBiosAdr, int
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, int tul_num_scb, BYTE * pbBiosAdr, int
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;
......
......@@ -2440,7 +2440,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment