diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-08-07 15:47:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-13 19:53:13 -0400 |
commit | f7e0405e7416424c2db2155949dca1daa0225089 (patch) | |
tree | 630dd144c063050dd5a071c03fdd3ba21bc9fa09 /drivers/isdn/i4l | |
parent | d2281107457cacf44d60b8a97c5db1af27c3a716 (diff) |
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: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: netdev@vger.kernel.org
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/isdn/i4l')
-rw-r--r-- | drivers/isdn/i4l/isdn_tty.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 576ce4b14f93..b817809f763c 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -1486,6 +1486,18 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
1486 | * ------------------------------------------------------------ | 1486 | * ------------------------------------------------------------ |
1487 | */ | 1487 | */ |
1488 | 1488 | ||
1489 | static int isdn_tty_install(struct tty_driver *driver, struct tty_struct *tty) | ||
1490 | { | ||
1491 | modem_info *info = &dev->mdm.info[tty->index]; | ||
1492 | |||
1493 | if (isdn_tty_paranoia_check(info, tty->name, __func__)) | ||
1494 | return -ENODEV; | ||
1495 | |||
1496 | tty->driver_data = info; | ||
1497 | |||
1498 | return tty_port_install(&info->port, driver, tty); | ||
1499 | } | ||
1500 | |||
1489 | /* | 1501 | /* |
1490 | * This routine is called whenever a serial port is opened. It | 1502 | * This routine is called whenever a serial port is opened. It |
1491 | * enables interrupts for a serial port, linking in its async structure into | 1503 | * 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 | static int | 1507 | static int |
1496 | isdn_tty_open(struct tty_struct *tty, struct file *filp) | 1508 | isdn_tty_open(struct tty_struct *tty, struct file *filp) |
1497 | { | 1509 | { |
1498 | struct tty_port *port; | 1510 | modem_info *info = tty->driver_data; |
1499 | modem_info *info; | 1511 | struct tty_port *port = &info->port; |
1500 | int retval; | 1512 | int retval; |
1501 | 1513 | ||
1502 | info = &dev->mdm.info[tty->index]; | ||
1503 | if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open")) | ||
1504 | return -ENODEV; | ||
1505 | port = &info->port; | ||
1506 | #ifdef ISDN_DEBUG_MODEM_OPEN | 1514 | #ifdef ISDN_DEBUG_MODEM_OPEN |
1507 | printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, | 1515 | printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, |
1508 | port->count); | 1516 | port->count); |
1509 | #endif | 1517 | #endif |
1510 | port->count++; | 1518 | port->count++; |
1511 | tty->driver_data = info; | ||
1512 | port->tty = tty; | 1519 | port->tty = tty; |
1513 | tty->port = port; | ||
1514 | /* | 1520 | /* |
1515 | * Start up serial port | 1521 | * Start up serial port |
1516 | */ | 1522 | */ |
@@ -1738,6 +1744,7 @@ modem_write_profile(atemu *m) | |||
1738 | } | 1744 | } |
1739 | 1745 | ||
1740 | static const struct tty_operations modem_ops = { | 1746 | static const struct tty_operations modem_ops = { |
1747 | .install = isdn_tty_install, | ||
1741 | .open = isdn_tty_open, | 1748 | .open = isdn_tty_open, |
1742 | .close = isdn_tty_close, | 1749 | .close = isdn_tty_close, |
1743 | .write = isdn_tty_write, | 1750 | .write = isdn_tty_write, |