From 03a74dcc7eebe6edd778317e82fafdf71e68488c Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Fri, 23 May 2008 13:04:49 -0700 Subject: serial: fix enable_irq_wake/disable_irq_wake imbalance in serial_core.c enable_irq_wake() and disable_irq_wake() need to be balanced. However, serial_core.c calls these for different conditions during the suspend and resume functions... This is causing a regular WARN_ON() as found at http://www.kerneloops.org/search.php?search=set_irq_wake This patch makes the conditions for triggering the _wake enable/disable sequence identical. Signed-off-by: Arjan van de Ven Cc: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/serial/serial_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/serial/serial_core.c') diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index eab032733790..53b03c629aff 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -2054,6 +2054,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) int uart_resume_port(struct uart_driver *drv, struct uart_port *port) { struct uart_state *state = drv->state + port->line; + struct device *tty_dev; + struct uart_match match = {port, drv}; mutex_lock(&state->mutex); @@ -2063,7 +2065,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) return 0; } - if (!port->suspended) { + tty_dev = device_find_child(port->dev, &match, serial_match_port); + if (!port->suspended && device_may_wakeup(tty_dev)) { disable_irq_wake(port->irq); mutex_unlock(&state->mutex); return 0; -- cgit v1.2.3 From 64e9159f5d2c4edf5fa6425031e556f8fddaf7e6 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 3 Jun 2008 15:18:54 +0100 Subject: serial_core: uart_set_ldisc infrastructure The tty layer provides a callback that is used when the line discipline is changed. Some hardware uses this to configure hardware specific features such as IrDA mode on serial ports. Unfortunately the serial layer does not provide this feature or pass it down to drivers. Blackfin used to hack around this by rewriting the tty ops, but those are now properly shared and const so the hack fails. Instead provide the proper operations. This change plus a follow up from the Blackfin guys is needed to avoid blackfin losing features in this release. Signed-off-by: Alan Cox Signed-off-by: Linus Torvalds --- drivers/serial/serial_core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/serial/serial_core.c') diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 53b03c629aff..951a75ea6e3e 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -1165,6 +1165,15 @@ out: return ret; } +static void uart_set_ldisc(struct tty_struct *tty, int ldisc) +{ + struct uart_state *state = tty->driver_data; + struct uart_port *port = state->port; + + if (port->ops->set_ldisc) + port->ops->set_ldisc(port); +} + static void uart_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { @@ -2288,6 +2297,7 @@ static const struct tty_operations uart_ops = { .unthrottle = uart_unthrottle, .send_xchar = uart_send_xchar, .set_termios = uart_set_termios, + .set_ldisc = uart_set_ldisc, .stop = uart_stop, .start = uart_start, .hangup = uart_hangup, -- cgit v1.2.3 From edeb280e49d38a5330db25463ef45f5466b0058a Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 4 Jun 2008 10:35:03 -0700 Subject: Fix uart_set_ldisc() function type Commit 64e9159f5d2c4edf5fa6425031e556f8fddaf7e6 ("serial_core: uart_set_ldisc infrastructure") introduced the ability for low-level serial drivers to be informed when the tty ldisc changes. However, the actual tty-layer function that does this callback for serial devices was declared with the wrong type, having a spurious and unused 'ldisc' argument. This fixed the resulting compiler warning by just removing it. Acked-by: Blithering Idiot Signed-off-by: Linus Torvalds --- drivers/serial/serial_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/serial/serial_core.c') diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 951a75ea6e3e..c9b64e73c987 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -1165,7 +1165,7 @@ out: return ret; } -static void uart_set_ldisc(struct tty_struct *tty, int ldisc) +static void uart_set_ldisc(struct tty_struct *tty) { struct uart_state *state = tty->driver_data; struct uart_port *port = state->port; -- cgit v1.2.3