
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.

This patch removes also a double init in icom.c

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/serial/icom.c         |    1 -
 25-akpm/drivers/serial/mpc52xx_uart.c |    4 ++--
 25-akpm/drivers/serial/sn_console.c   |    2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff -puN drivers/serial/icom.c~lock-initializer-unifying-batch-2-drivers-serial drivers/serial/icom.c
--- 25/drivers/serial/icom.c~lock-initializer-unifying-batch-2-drivers-serial	2004-11-03 20:26:37.276961736 -0800
+++ 25-akpm/drivers/serial/icom.c	2004-11-03 20:26:37.287960064 -0800
@@ -1656,7 +1656,6 @@ static int __init icom_init(void)
 	int ret;
 
 	spin_lock_init(&icom_lock);
-	icom_lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
 
 	ret = uart_register_driver(&icom_uart_driver);
 	if (ret)
diff -puN drivers/serial/mpc52xx_uart.c~lock-initializer-unifying-batch-2-drivers-serial drivers/serial/mpc52xx_uart.c
--- 25/drivers/serial/mpc52xx_uart.c~lock-initializer-unifying-batch-2-drivers-serial	2004-11-03 20:26:37.279961280 -0800
+++ 25-akpm/drivers/serial/mpc52xx_uart.c	2004-11-03 20:26:37.288959912 -0800
@@ -640,7 +640,7 @@ mpc52xx_console_setup(struct console *co
 	
 	/* Basic port init. Needed since we use some uart_??? func before
 	 * real init for early access */
-	port->lock	= SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&port->lock);
 	port->uartclk	= __res.bi_ipbfreq / 2; /* Look at CTLR doc */
 	port->ops	= &mpc52xx_uart_ops;
 	port->mapbase	= MPC52xx_PSCx(co->index);
@@ -724,7 +724,7 @@ mpc52xx_uart_probe(struct ocp_device *oc
 	port = &mpc52xx_uart_ports[idx];
 
 	/* Init the port structure */
-	port->lock	= SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&port->lock);
 	port->mapbase	= ocp->def->paddr;
 	port->irq	= ocp->def->irq;
 	port->uartclk	= __res.bi_ipbfreq / 2; /* Look at CTLR doc */
diff -puN drivers/serial/sn_console.c~lock-initializer-unifying-batch-2-drivers-serial drivers/serial/sn_console.c
--- 25/drivers/serial/sn_console.c~lock-initializer-unifying-batch-2-drivers-serial	2004-11-03 20:26:37.281960976 -0800
+++ 25-akpm/drivers/serial/sn_console.c	2004-11-03 20:26:37.290959608 -0800
@@ -853,7 +853,7 @@ static int __init sn_sal_module_init(voi
 		return -ENODEV;
 	}
 
-	sal_console_port.sc_port.lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&sal_console_port.sc_port.lock);
 
 	/* Setup the port struct with the minimum needed */
 	sal_console_port.sc_port.membase = (char *)1;	/* just needs to be non-zero */
_
