summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2009-06-22 18:32:20 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2009-07-13 00:16:39 +0200
commit6e4061210150d1d6d388c5fba05f6b49a306a27e (patch)
tree7c059e60623fab637b2049bdf59b42040025b00b /drivers/usb/serial/usb-serial.c
parentUSB: add missing class descriptions used in usb/devices file (diff)
downloadlinux-6e4061210150d1d6d388c5fba05f6b49a306a27e.tar.xz
linux-6e4061210150d1d6d388c5fba05f6b49a306a27e.zip
USB: console: Fix regression in usb console on kernel boot
The commit 335f8514f200e63d689113d29cb7253a5c282967 introduced a regression which stopped usb consoles from working correctly as a kernel boot console as well as interactive login device. The addition of the serial_close() which in turn calls tty_port_close_start() will change the reference count of port.count and warn about it. The usb console code had previously incremented the port.count to indicate it was making use of the device as a console and the forced change causes a double open on the usb device which leads to a non obvious kernel oops later on when the tty is freed. To fix the problem instead make use of port->console to track if the port is in fact an active console port to avoid double initialization of the usb serial device. The port.count is incremented and decremented only with in the scope of usb_console_setup() for the purpose of the low level driver initialization. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to '')
-rw-r--r--drivers/usb/serial/usb-serial.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index a84216464ca0..9e6027b3a2e9 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -220,7 +220,8 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
tty->driver_data = port;
tty_port_tty_set(&port->port, tty);
- if (port->port.count == 1) {
+ /* If the console is attached, the device is already open */
+ if (port->port.count == 1 && !port->console) {
/* lock this module before we call it
* this may fail, which means we must bail out,