diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2010-03-16 17:05:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:32 -0400 |
commit | 92d2c5e4badc622999d3b17e6dfbf6babacb52f6 (patch) | |
tree | 2274b66563bf061359c0a7993cc5163c3c308e11 /drivers/usb/serial/console.c | |
parent | aae86e8adb3bbf5256eebe76500cf7254365753c (diff) |
usb-console: pass baud from console to the initial tty open
The usb console code has had a long standing problem of not being able
to pass the baud rate from the kernel argument console=ttyUSB0,BAUD
down to the initial tty open, unless you were willing to settle for
9600 baud.
The solution is to directly use tty_init_termios() in
usb_console_setup() as this will preserve any changes to the initial
termios setting on future opens.
CC: Alan Cox <alan@linux.intel.com>
CC: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/console.c')
-rw-r--r-- | drivers/usb/serial/console.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 4ea64fef6718..1ee6b2ab0f89 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -66,7 +66,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
66 | struct usb_serial_port *port; | 66 | struct usb_serial_port *port; |
67 | int retval; | 67 | int retval; |
68 | struct tty_struct *tty = NULL; | 68 | struct tty_struct *tty = NULL; |
69 | struct ktermios *termios = NULL, dummy; | 69 | struct ktermios dummy; |
70 | 70 | ||
71 | dbg("%s", __func__); | 71 | dbg("%s", __func__); |
72 | 72 | ||
@@ -141,15 +141,14 @@ static int usb_console_setup(struct console *co, char *options) | |||
141 | goto reset_open_count; | 141 | goto reset_open_count; |
142 | } | 142 | } |
143 | kref_init(&tty->kref); | 143 | kref_init(&tty->kref); |
144 | termios = kzalloc(sizeof(*termios), GFP_KERNEL); | 144 | tty_port_tty_set(&port->port, tty); |
145 | if (!termios) { | 145 | tty->driver = usb_serial_tty_driver; |
146 | tty->index = co->index; | ||
147 | if (tty_init_termios(tty)) { | ||
146 | retval = -ENOMEM; | 148 | retval = -ENOMEM; |
147 | err("no more memory"); | 149 | err("no more memory"); |
148 | goto free_tty; | 150 | goto free_tty; |
149 | } | 151 | } |
150 | memset(&dummy, 0, sizeof(struct ktermios)); | ||
151 | tty->termios = termios; | ||
152 | tty_port_tty_set(&port->port, tty); | ||
153 | } | 152 | } |
154 | 153 | ||
155 | /* only call the device specific open if this | 154 | /* only call the device specific open if this |
@@ -161,16 +160,16 @@ static int usb_console_setup(struct console *co, char *options) | |||
161 | 160 | ||
162 | if (retval) { | 161 | if (retval) { |
163 | err("could not open USB console port"); | 162 | err("could not open USB console port"); |
164 | goto free_termios; | 163 | goto fail; |
165 | } | 164 | } |
166 | 165 | ||
167 | if (serial->type->set_termios) { | 166 | if (serial->type->set_termios) { |
168 | termios->c_cflag = cflag; | 167 | tty->termios->c_cflag = cflag; |
169 | tty_termios_encode_baud_rate(termios, baud, baud); | 168 | tty_termios_encode_baud_rate(tty->termios, baud, baud); |
169 | memset(&dummy, 0, sizeof(struct ktermios)); | ||
170 | serial->type->set_termios(tty, port, &dummy); | 170 | serial->type->set_termios(tty, port, &dummy); |
171 | 171 | ||
172 | tty_port_tty_set(&port->port, NULL); | 172 | tty_port_tty_set(&port->port, NULL); |
173 | kfree(termios); | ||
174 | kfree(tty); | 173 | kfree(tty); |
175 | } | 174 | } |
176 | set_bit(ASYNCB_INITIALIZED, &port->port.flags); | 175 | set_bit(ASYNCB_INITIALIZED, &port->port.flags); |
@@ -185,8 +184,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
185 | mutex_unlock(&serial->disc_mutex); | 184 | mutex_unlock(&serial->disc_mutex); |
186 | return retval; | 185 | return retval; |
187 | 186 | ||
188 | free_termios: | 187 | fail: |
189 | kfree(termios); | ||
190 | tty_port_tty_set(&port->port, NULL); | 188 | tty_port_tty_set(&port->port, NULL); |
191 | free_tty: | 189 | free_tty: |
192 | kfree(tty); | 190 | kfree(tty); |