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

[PATCH] Lock initializer unifying: drivers/serial

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: 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 9c901073
...@@ -1656,7 +1656,6 @@ static int __init icom_init(void) ...@@ -1656,7 +1656,6 @@ static int __init icom_init(void)
int ret; int ret;
spin_lock_init(&icom_lock); spin_lock_init(&icom_lock);
icom_lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
ret = uart_register_driver(&icom_uart_driver); ret = uart_register_driver(&icom_uart_driver);
if (ret) if (ret)
......
...@@ -640,7 +640,7 @@ mpc52xx_console_setup(struct console *co, char *options) ...@@ -640,7 +640,7 @@ mpc52xx_console_setup(struct console *co, char *options)
/* Basic port init. Needed since we use some uart_??? func before /* Basic port init. Needed since we use some uart_??? func before
* real init for early access */ * 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->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
port->ops = &mpc52xx_uart_ops; port->ops = &mpc52xx_uart_ops;
port->mapbase = MPC52xx_PSCx(co->index); port->mapbase = MPC52xx_PSCx(co->index);
...@@ -724,7 +724,7 @@ mpc52xx_uart_probe(struct ocp_device *ocp) ...@@ -724,7 +724,7 @@ mpc52xx_uart_probe(struct ocp_device *ocp)
port = &mpc52xx_uart_ports[idx]; port = &mpc52xx_uart_ports[idx];
/* Init the port structure */ /* Init the port structure */
port->lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&port->lock);
port->mapbase = ocp->def->paddr; port->mapbase = ocp->def->paddr;
port->irq = ocp->def->irq; port->irq = ocp->def->irq;
port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
......
...@@ -853,7 +853,7 @@ static int __init sn_sal_module_init(void) ...@@ -853,7 +853,7 @@ static int __init sn_sal_module_init(void)
return -ENODEV; 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 */ /* Setup the port struct with the minimum needed */
sal_console_port.sc_port.membase = (char *)1; /* just needs to be non-zero */ sal_console_port.sc_port.membase = (char *)1; /* just needs to be non-zero */
......
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