summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hao <kexin.hao@windriver.com>2009-01-02 14:44:34 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 19:19:38 +0100
commit39efd191d01b5f1efc3d604baf74233dc525e6a8 (patch)
tree9623a3daa6e136429319008f278e109f016a1ee3
parentAnd here's a patch (to be applied on top of the last) which prevents (diff)
downloadlinux-39efd191d01b5f1efc3d604baf74233dc525e6a8.tar.xz
linux-39efd191d01b5f1efc3d604baf74233dc525e6a8.zip
Add device function for USB serial console
Add device funtion for usb serial console, so we can open /dev/console when we use a usb serial device as console. (Typecast removed as noted by Sergei Shtylyov) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/usb/serial/console.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 5b95009d2fbb..19e24045b137 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -241,12 +241,25 @@ static void usb_console_write(struct console *co,
}
}
+static struct tty_driver *usb_console_device(struct console *co, int *index)
+{
+ struct tty_driver **p = (struct tty_driver **)co->data;
+
+ if (!*p)
+ return NULL;
+
+ *index = co->index;
+ return *p;
+}
+
static struct console usbcons = {
.name = "ttyUSB",
.write = usb_console_write,
+ .device = usb_console_device,
.setup = usb_console_setup,
.flags = CON_PRINTBUFFER,
.index = -1,
+ .data = &usb_serial_tty_driver,
};
void usb_serial_console_disconnect(struct usb_serial *serial)