Messages in this thread Patch in this message | | | Date | Wed, 18 Jan 2006 01:19:35 +0900 (JST) | Subject | [PATCH] serial: initialize spinlock for port failed to setup console | From | Atsushi Nemoto <> |
| |
It seems serial_core intend to initialize port->lock just once for each ports. This is done in uart_set_options() for console, and in uart_add_one_port() for other ports. But there is a case the port->lock is not initialized by serial_core. If the setup function for the console was failed, it will not call uart_set_options() but the port is marked as console (uart_console(port) returns 1). It can happen if console was PCI port which can not detected at the time of register_console.
This patch is to initialize port->lock for such console port. With this change, most of spin_lock_init() (some of them are labeled "Temporary fix.") in low-level serial drivers can be omitted.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 9437704..211701d 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -2235,7 +2235,7 @@ int uart_add_one_port(struct uart_driver * If this port is a console, then the spinlock is already * initialised. */ - if (!uart_console(port)) + if (!(uart_console(port) && (port->cons->flags & CON_ENABLED))) spin_lock_init(&port->lock); uart_configure_port(drv, state, port); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |