Commit f7e0405e authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

TTY: i4l, add tty install

This has two outcomes:
* we give the TTY layer a tty_port
* we do not find the info structure every time open is called on that
  tty

The "tty->port = port" assignment is not needed anymore since it
happens in tty_port_install implicitly.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: netdev@vger.kernel.org
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d2281107
...@@ -1486,6 +1486,18 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -1486,6 +1486,18 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
* ------------------------------------------------------------ * ------------------------------------------------------------
*/ */
static int isdn_tty_install(struct tty_driver *driver, struct tty_struct *tty)
{
modem_info *info = &dev->mdm.info[tty->index];
if (isdn_tty_paranoia_check(info, tty->name, __func__))
return -ENODEV;
tty->driver_data = info;
return tty_port_install(&info->port, driver, tty);
}
/* /*
* This routine is called whenever a serial port is opened. It * This routine is called whenever a serial port is opened. It
* enables interrupts for a serial port, linking in its async structure into * enables interrupts for a serial port, linking in its async structure into
...@@ -1495,22 +1507,16 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -1495,22 +1507,16 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
static int static int
isdn_tty_open(struct tty_struct *tty, struct file *filp) isdn_tty_open(struct tty_struct *tty, struct file *filp)
{ {
struct tty_port *port; modem_info *info = tty->driver_data;
modem_info *info; struct tty_port *port = &info->port;
int retval; int retval;
info = &dev->mdm.info[tty->index];
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open"))
return -ENODEV;
port = &info->port;
#ifdef ISDN_DEBUG_MODEM_OPEN #ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name,
port->count); port->count);
#endif #endif
port->count++; port->count++;
tty->driver_data = info;
port->tty = tty; port->tty = tty;
tty->port = port;
/* /*
* Start up serial port * Start up serial port
*/ */
...@@ -1738,6 +1744,7 @@ modem_write_profile(atemu *m) ...@@ -1738,6 +1744,7 @@ modem_write_profile(atemu *m)
} }
static const struct tty_operations modem_ops = { static const struct tty_operations modem_ops = {
.install = isdn_tty_install,
.open = isdn_tty_open, .open = isdn_tty_open,
.close = isdn_tty_close, .close = isdn_tty_close,
.write = isdn_tty_write, .write = isdn_tty_write,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment