aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-01-30 15:14:29 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-02 18:00:56 -0500
commit76f82a7ab3a724791d184e74529e96ad6947a98f (patch)
tree9164783e9e53c7178d8ad8b424b77846db7c9b4f /drivers/usb/serial/usb-serial.c
parent66d450e84ec656ec4b774c41cd8d46b3e48d51df (diff)
USB: serial, use tty_standard_install
But before that we need to reorder the calls so that we don't need to lower the reference counts if usb_autopm_get_interface fails. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 611b206591cb..1e30cc92719c 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -214,15 +214,14 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
214 if (!try_module_get(serial->type->driver.owner)) 214 if (!try_module_get(serial->type->driver.owner))
215 goto error_module_get; 215 goto error_module_get;
216 216
217 /* perform the standard setup */
218 retval = tty_init_termios(tty);
219 if (retval)
220 goto error_init_termios;
221
222 retval = usb_autopm_get_interface(serial->interface); 217 retval = usb_autopm_get_interface(serial->interface);
223 if (retval) 218 if (retval)
224 goto error_get_interface; 219 goto error_get_interface;
225 220
221 retval = tty_standard_install(driver, tty);
222 if (retval)
223 goto error_init_termios;
224
226 mutex_unlock(&serial->disc_mutex); 225 mutex_unlock(&serial->disc_mutex);
227 226
228 /* allow the driver to update the settings */ 227 /* allow the driver to update the settings */
@@ -231,14 +230,11 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
231 230
232 tty->driver_data = port; 231 tty->driver_data = port;
233 232
234 /* Final install (we use the default method) */
235 tty_driver_kref_get(driver);
236 tty->count++;
237 driver->ttys[idx] = tty;
238 return retval; 233 return retval;
239 234
240 error_get_interface:
241 error_init_termios: 235 error_init_termios:
236 usb_autopm_put_interface(serial->interface);
237 error_get_interface:
242 module_put(serial->type->driver.owner); 238 module_put(serial->type->driver.owner);
243 error_module_get: 239 error_module_get:
244 error_no_port: 240 error_no_port: