From: Ingo Molnar Teach special (dual-initialized) locking code to the lock validator. Has no effect on non-lockdep kernels. Signed-off-by: Ingo Molnar Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton --- drivers/serial/serial_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff -puN drivers/serial/serial_core.c~lock-validator-special-locking-serial drivers/serial/serial_core.c --- devel/drivers/serial/serial_core.c~lock-validator-special-locking-serial 2006-05-29 18:13:10.000000000 -0700 +++ devel-akpm/drivers/serial/serial_core.c 2006-05-29 18:13:10.000000000 -0700 @@ -1845,6 +1845,12 @@ static const struct baud_rates baud_rate { 0, B38400 } }; +/* + * lockdep: port->lock is initialized in two places, but we + * want only one lock-type: + */ +static struct lockdep_type_key port_lock_key; + /** * uart_set_options - setup the serial console parameters * @port: pointer to the serial ports uart_port structure @@ -1865,7 +1871,7 @@ uart_set_options(struct uart_port *port, * Ensure that the serial console lock is initialised * early. */ - spin_lock_init(&port->lock); + spin_lock_init_key(&port->lock, &port_lock_key); memset(&termios, 0, sizeof(struct termios)); @@ -2250,7 +2256,7 @@ int uart_add_one_port(struct uart_driver * initialised. */ if (!(uart_console(port) && (port->cons->flags & CON_ENABLED))) - spin_lock_init(&port->lock); + spin_lock_init_key(&port->lock, &port_lock_key); uart_configure_port(drv, state, port); _