aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 3dda6841e724..80c1f4d8e910 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -721,6 +721,41 @@ static const struct tty_port_operations serial_port_ops = {
721 .dtr_rts = serial_dtr_rts, 721 .dtr_rts = serial_dtr_rts,
722}; 722};
723 723
724/**
725 * serial_install - install tty
726 * @driver: the driver (USB in our case)
727 * @tty: the tty being created
728 *
729 * Create the termios objects for this tty. We use the default USB
730 * serial ones but permit them to be overriddenby serial->type->termios.
731 * This lets us remove all the ugly hackery
732 */
733
734static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
735{
736 int idx = tty->index;
737 struct usb_serial *serial;
738 int retval;
739
740 /* If the termios setup has yet to be done */
741 if (tty->driver->termios[idx] == NULL) {
742 /* perform the standard setup */
743 retval = tty_init_termios(tty);
744 if (retval)
745 return retval;
746 /* allow the driver to update it */
747 serial = usb_serial_get_by_index(tty->index);
748 if (serial->type->init_termios)
749 serial->type->init_termios(tty);
750 usb_serial_put(serial);
751 }
752 /* Final install (we use the default method) */
753 tty_driver_kref_get(driver);
754 tty->count++;
755 driver->ttys[idx] = tty;
756 return 0;
757}
758
724int usb_serial_probe(struct usb_interface *interface, 759int usb_serial_probe(struct usb_interface *interface,
725 const struct usb_device_id *id) 760 const struct usb_device_id *id)
726{ 761{
@@ -1228,7 +1263,8 @@ static const struct tty_operations serial_ops = {
1228 .chars_in_buffer = serial_chars_in_buffer, 1263 .chars_in_buffer = serial_chars_in_buffer,
1229 .tiocmget = serial_tiocmget, 1264 .tiocmget = serial_tiocmget,
1230 .tiocmset = serial_tiocmset, 1265 .tiocmset = serial_tiocmset,
1231 .shutdown = serial_do_free, 1266 .shutdown = serial_do_free,
1267 .install = serial_install,
1232 .proc_fops = &serial_proc_fops, 1268 .proc_fops = &serial_proc_fops,
1233}; 1269};
1234 1270