From 6c6a2334a1e8af7c3eaab992732825fa9ade77cf Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Mon, 4 Sep 2006 00:04:20 +0400 Subject: [SERIAL] Make uart_line_info() correctly tell MMIO from I/O port /proc/tty/driver/serial incorrectly claims that UARTs having iotype of UPIO_MEM32, UPIO_AU, or UPIO_TSI are I/O mapped. Signed-off-by: Sergei Shtylyov Signed-off-by: Russell King --- drivers/serial/serial_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/serial/serial_core.c') diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 5f7ba1adb30..d7e28ab4c31 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -1662,16 +1662,16 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) struct uart_port *port = state->port; char stat_buf[32]; unsigned int status; - int ret; + int mmio, ret; if (!port) return 0; + mmio = port->iotype >= UPIO_MEM; ret = sprintf(buf, "%d: uart:%s %s%08lX irq:%d", port->line, uart_type(port), - port->iotype == UPIO_MEM ? "mmio:0x" : "port:", - port->iotype == UPIO_MEM ? port->mapbase : - (unsigned long) port->iobase, + mmio ? "mmio:0x" : "port:", + mmio ? port->mapbase : (unsigned long) port->iobase, port->irq); if (port->type == PORT_UNKNOWN) { -- cgit v1.2.3 From 80e3c2b659515ef236f33f691ff5b22ae90ae8e4 Mon Sep 17 00:00:00 2001 From: Ram Gupta Date: Mon, 14 Aug 2006 23:05:29 -0700 Subject: [SERIAL] returning proper error from serial core driver Fix the issue of returning 0 even in case of error from uart_set_info function. Now it returns the error EBUSY when it can not set new port. Signed-off-by: Ram Gupta Signed-off-by: Andrew Morton Signed-off-by: Russell King --- drivers/serial/serial_core.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/serial/serial_core.c') diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index d7e28ab4c31..d814bb1dcb0 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -792,6 +792,7 @@ static int uart_set_info(struct uart_state *state, * We failed anyway. */ retval = -EBUSY; + goto exit; // Added to return the correct error -Ram Gupta } } -- cgit v1.2.3 From a6b93a908508810c5d51dd9b390283345af6f2d9 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 1 Oct 2006 17:17:40 +0100 Subject: [SERIAL] Fix oops when removing suspended serial port A serial card might have been removed when the system is resumed. This results in a suspended port being shut down, which results in the ports shutdown method being called twice in a row. This causes BUGs. Avoid this by tracking the suspended state separately from the initialised state. Signed-off-by: Russell King --- drivers/serial/serial_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/serial/serial_core.c') diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index d814bb1dcb0..397147a7054 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -1940,6 +1940,9 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) if (state->info && state->info->flags & UIF_INITIALIZED) { const struct uart_ops *ops = port->ops; + state->info->flags = (state->info->flags & ~UIF_INITIALIZED) + | UIF_SUSPENDED; + spin_lock_irq(&port->lock); ops->stop_tx(port); ops->set_mctrl(port, 0); @@ -2006,7 +2009,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) console_start(port->cons); } - if (state->info && state->info->flags & UIF_INITIALIZED) { + if (state->info && state->info->flags & UIF_SUSPENDED) { const struct uart_ops *ops = port->ops; int ret; @@ -2018,15 +2021,17 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) ops->set_mctrl(port, port->mctrl); ops->start_tx(port); spin_unlock_irq(&port->lock); + state->info->flags |= UIF_INITIALIZED; } else { /* * Failed to resume - maybe hardware went away? * Clear the "initialized" flag so we won't try * to call the low level drivers shutdown method. */ - state->info->flags &= ~UIF_INITIALIZED; uart_shutdown(state); } + + state->info->flags &= ~UIF_SUSPENDED; } mutex_unlock(&state->mutex); -- cgit v1.2.3