diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-09-01 11:39:22 -0400 |
---|---|---|
committer | Live-CD User <linux@linux.site> | 2009-09-19 16:13:40 -0400 |
commit | 7e29bb4b779f4f35385e6f21994758845bf14d23 (patch) | |
tree | 393c102e66ad3bba2b5d27d88770b57ab23a2606 /drivers/usb/serial/usb-serial.c | |
parent | cc56cd0157753c04a987888a2f793803df661a40 (diff) |
usb-serial: fix termios initialization logic
This patch (as1288) fixes the initialization logic in
serial_install(). A new tty always needs to have a termios
initialized no matter what, not just in the case where the lower
driver will override the termios settings.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 7d207d91a6a8..1bc0a24b896b 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -210,22 +210,21 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty) | |||
210 | if (!try_module_get(serial->type->driver.owner)) | 210 | if (!try_module_get(serial->type->driver.owner)) |
211 | goto error_module_get; | 211 | goto error_module_get; |
212 | 212 | ||
213 | /* perform the standard setup */ | ||
214 | retval = tty_init_termios(tty); | ||
215 | if (retval) | ||
216 | goto error_init_termios; | ||
217 | |||
213 | retval = usb_autopm_get_interface(serial->interface); | 218 | retval = usb_autopm_get_interface(serial->interface); |
214 | if (retval) | 219 | if (retval) |
215 | goto error_get_interface; | 220 | goto error_get_interface; |
216 | 221 | ||
217 | /* If the termios setup has yet to be done */ | ||
218 | if (tty->driver->termios[idx] == NULL) { | ||
219 | /* perform the standard setup */ | ||
220 | retval = tty_init_termios(tty); | ||
221 | if (retval) | ||
222 | goto error_init_termios; | ||
223 | /* allow the driver to update it */ | ||
224 | if (serial->type->init_termios) | ||
225 | serial->type->init_termios(tty); | ||
226 | } | ||
227 | mutex_unlock(&serial->disc_mutex); | 222 | mutex_unlock(&serial->disc_mutex); |
228 | 223 | ||
224 | /* allow the driver to update the settings */ | ||
225 | if (serial->type->init_termios) | ||
226 | serial->type->init_termios(tty); | ||
227 | |||
229 | tty->driver_data = port; | 228 | tty->driver_data = port; |
230 | 229 | ||
231 | /* Final install (we use the default method) */ | 230 | /* Final install (we use the default method) */ |
@@ -234,9 +233,8 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty) | |||
234 | driver->ttys[idx] = tty; | 233 | driver->ttys[idx] = tty; |
235 | return retval; | 234 | return retval; |
236 | 235 | ||
237 | error_init_termios: | ||
238 | usb_autopm_put_interface(serial->interface); | ||
239 | error_get_interface: | 236 | error_get_interface: |
237 | error_init_termios: | ||
240 | module_put(serial->type->driver.owner); | 238 | module_put(serial->type->driver.owner); |
241 | error_module_get: | 239 | error_module_get: |
242 | error_no_port: | 240 | error_no_port: |