From: 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 Acked-by: Ingo Molnar Signed-off-by: Andrew Morton --- 25-akpm/drivers/char/rio/rio_linux.c | 8 ++++---- 25-akpm/drivers/char/rio/rioboot.c | 4 ++-- 25-akpm/drivers/char/rio/rioctrl.c | 2 +- 25-akpm/drivers/char/rio/rioinit.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff -puN drivers/char/rio/rioboot.c~lock-initializer-unifying-batch-2-rio drivers/char/rio/rioboot.c --- 25/drivers/char/rio/rioboot.c~lock-initializer-unifying-batch-2-rio Thu Oct 28 15:53:52 2004 +++ 25-akpm/drivers/char/rio/rioboot.c Thu Oct 28 15:53:52 2004 @@ -580,14 +580,14 @@ register struct DownLoad *rbp; HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN]; HostP->UnixRups[RupN].Id = RupN+1; HostP->UnixRups[RupN].BaseSysPort = NO_PORT; - HostP->UnixRups[RupN].RupLock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&HostP->UnixRups[RupN].RupLock); } for ( RupN = 0; RupNUnixRups[RupN+MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup; HostP->UnixRups[RupN+MAX_RUP].Id = 0; HostP->UnixRups[RupN+MAX_RUP].BaseSysPort = NO_PORT; - HostP->UnixRups[RupN+MAX_RUP].RupLock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&HostP->UnixRups[RupN+MAX_RUP].RupLock); } /* diff -puN drivers/char/rio/rioctrl.c~lock-initializer-unifying-batch-2-rio drivers/char/rio/rioctrl.c --- 25/drivers/char/rio/rioctrl.c~lock-initializer-unifying-batch-2-rio Thu Oct 28 15:53:52 2004 +++ 25-akpm/drivers/char/rio/rioctrl.c Thu Oct 28 15:53:52 2004 @@ -1203,7 +1203,7 @@ RIO_DEBUG_CTRL, if (su) p->RIOPortp[loop]->TtyP = &p->channel[loop]; #endif - p->RIOPortp[loop]->portSem = SPIN_LOCK_UNLOCKED; + spin_lock_init(&p->RIOPortp[loop]->portSem); p->RIOPortp[loop]->InUse = NOT_INUSE; } diff -puN drivers/char/rio/rioinit.c~lock-initializer-unifying-batch-2-rio drivers/char/rio/rioinit.c --- 25/drivers/char/rio/rioinit.c~lock-initializer-unifying-batch-2-rio Thu Oct 28 15:53:52 2004 +++ 25-akpm/drivers/char/rio/rioinit.c Thu Oct 28 15:53:52 2004 @@ -1444,7 +1444,7 @@ struct rio_info * p; } RIODefaultName(p, HostP, rup); } - HostP->UnixRups[rup].RupLock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&HostP->UnixRups[rup].RupLock); } } } diff -puN drivers/char/rio/rio_linux.c~lock-initializer-unifying-batch-2-rio drivers/char/rio/rio_linux.c --- 25/drivers/char/rio/rio_linux.c~lock-initializer-unifying-batch-2-rio Thu Oct 28 15:53:52 2004 +++ 25-akpm/drivers/char/rio/rio_linux.c Thu Oct 28 15:53:52 2004 @@ -979,7 +979,7 @@ static int rio_init_datastructures (void port->gs.close_delay = HZ/2; port->gs.closing_wait = 30 * HZ; port->gs.rd = &rio_real_driver; - port->portSem = SPIN_LOCK_UNLOCKED; + spin_lock_init(&port->portSem); /* * Initializing wait queue */ @@ -1141,7 +1141,7 @@ static int __init rio_init(void) hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; - hp->HostLock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&hp->HostLock); rio_reset_interrupt (hp); rio_start_card_running (hp); @@ -1199,7 +1199,7 @@ static int __init rio_init(void) hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; - hp->HostLock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&hp->HostLock); rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); @@ -1249,7 +1249,7 @@ static int __init rio_init(void) * Moreover, the ISA card will work with the * special PCI copy anyway. -- REW */ hp->Mode = 0; - hp->HostLock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&hp->HostLock); vpdp = get_VPD_PROM (hp); rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n"); _