Commit e27a8a21 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Linus Torvalds

[PATCH] Lock initializer unifying: RIO

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 avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 330c54ca
...@@ -979,7 +979,7 @@ static int rio_init_datastructures (void) ...@@ -979,7 +979,7 @@ static int rio_init_datastructures (void)
port->gs.close_delay = HZ/2; port->gs.close_delay = HZ/2;
port->gs.closing_wait = 30 * HZ; port->gs.closing_wait = 30 * HZ;
port->gs.rd = &rio_real_driver; port->gs.rd = &rio_real_driver;
port->portSem = SPIN_LOCK_UNLOCKED; spin_lock_init(&port->portSem);
/* /*
* Initializing wait queue * Initializing wait queue
*/ */
...@@ -1141,7 +1141,7 @@ static int __init rio_init(void) ...@@ -1141,7 +1141,7 @@ static int __init rio_init(void)
hp->Type = RIO_PCI; hp->Type = RIO_PCI;
hp->Copy = rio_pcicopy; hp->Copy = rio_pcicopy;
hp->Mode = RIO_PCI_BOOT_FROM_RAM; hp->Mode = RIO_PCI_BOOT_FROM_RAM;
hp->HostLock = SPIN_LOCK_UNLOCKED; spin_lock_init(&hp->HostLock);
rio_reset_interrupt (hp); rio_reset_interrupt (hp);
rio_start_card_running (hp); rio_start_card_running (hp);
...@@ -1199,7 +1199,7 @@ static int __init rio_init(void) ...@@ -1199,7 +1199,7 @@ static int __init rio_init(void)
hp->Type = RIO_PCI; hp->Type = RIO_PCI;
hp->Copy = rio_pcicopy; hp->Copy = rio_pcicopy;
hp->Mode = RIO_PCI_BOOT_FROM_RAM; 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, "Ivec: %x\n", hp->Ivec);
rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode);
...@@ -1249,7 +1249,7 @@ static int __init rio_init(void) ...@@ -1249,7 +1249,7 @@ static int __init rio_init(void)
* Moreover, the ISA card will work with the * Moreover, the ISA card will work with the
* special PCI copy anyway. -- REW */ * special PCI copy anyway. -- REW */
hp->Mode = 0; hp->Mode = 0;
hp->HostLock = SPIN_LOCK_UNLOCKED; spin_lock_init(&hp->HostLock);
vpdp = get_VPD_PROM (hp); vpdp = get_VPD_PROM (hp);
rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n"); rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n");
......
...@@ -580,14 +580,14 @@ register struct DownLoad *rbp; ...@@ -580,14 +580,14 @@ register struct DownLoad *rbp;
HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN]; HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN];
HostP->UnixRups[RupN].Id = RupN+1; HostP->UnixRups[RupN].Id = RupN+1;
HostP->UnixRups[RupN].BaseSysPort = NO_PORT; HostP->UnixRups[RupN].BaseSysPort = NO_PORT;
HostP->UnixRups[RupN].RupLock = SPIN_LOCK_UNLOCKED; spin_lock_init(&HostP->UnixRups[RupN].RupLock);
} }
for ( RupN = 0; RupN<LINKS_PER_UNIT; RupN++ ) { for ( RupN = 0; RupN<LINKS_PER_UNIT; RupN++ ) {
HostP->UnixRups[RupN+MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup; HostP->UnixRups[RupN+MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup;
HostP->UnixRups[RupN+MAX_RUP].Id = 0; HostP->UnixRups[RupN+MAX_RUP].Id = 0;
HostP->UnixRups[RupN+MAX_RUP].BaseSysPort = NO_PORT; 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);
} }
/* /*
......
...@@ -1203,7 +1203,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1203,7 +1203,7 @@ RIO_DEBUG_CTRL, if (su)
p->RIOPortp[loop]->TtyP = &p->channel[loop]; p->RIOPortp[loop]->TtyP = &p->channel[loop];
#endif #endif
p->RIOPortp[loop]->portSem = SPIN_LOCK_UNLOCKED; spin_lock_init(&p->RIOPortp[loop]->portSem);
p->RIOPortp[loop]->InUse = NOT_INUSE; p->RIOPortp[loop]->InUse = NOT_INUSE;
} }
......
...@@ -1444,7 +1444,7 @@ struct rio_info * p; ...@@ -1444,7 +1444,7 @@ struct rio_info * p;
} }
RIODefaultName(p, HostP, rup); RIODefaultName(p, HostP, rup);
} }
HostP->UnixRups[rup].RupLock = SPIN_LOCK_UNLOCKED; spin_lock_init(&HostP->UnixRups[rup].RupLock);
} }
} }
} }
......
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