Skip to content

Commit ee3b48d

Browse files
Jiri Slabygregkh
authored andcommitted
TTY: synclinkmp, 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 Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8a3ad10 commit ee3b48d

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

‎drivers/tty/synclinkmp.c‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -711,33 +711,42 @@ static void ldisc_receive_buf(struct tty_struct *tty,
711711

712712
/* tty callbacks */
713713

714-
/* Called when a port is opened. Init and enable port.
715-
*/
716-
static int open(struct tty_struct *tty, struct file *filp)
714+
static int install(struct tty_driver *driver, struct tty_struct *tty)
717715
{
718716
SLMP_INFO *info;
719-
int retval, line;
720-
unsigned long flags;
717+
int line = tty->index;
721718

722-
line = tty->index;
723719
if (line >= synclinkmp_device_count) {
724720
printk("%s(%d): open with invalid line #%d.\n",
725721
__FILE__,__LINE__,line);
726722
return -ENODEV;
727723
}
728724

729725
info = synclinkmp_device_list;
730-
while(info && info->line != line)
726+
while (info && info->line != line)
731727
info = info->next_device;
732728
if (sanity_check(info, tty->name, "open"))
733729
return -ENODEV;
734-
if ( info->init_error ) {
730+
if (info->init_error) {
735731
printk("%s(%d):%s device is not allocated, init error=%d\n",
736-
__FILE__,__LINE__,info->device_name,info->init_error);
732+
__FILE__, __LINE__, info->device_name,
733+
info->init_error);
737734
return -ENODEV;
738735
}
739736

740737
tty->driver_data = info;
738+
739+
return tty_port_install(&info->port, driver, tty);
740+
}
741+
742+
/* Called when a port is opened. Init and enable port.
743+
*/
744+
static int open(struct tty_struct *tty, struct file *filp)
745+
{
746+
SLMP_INFO *info = tty->driver_data;
747+
unsigned long flags;
748+
int retval;
749+
741750
info->port.tty = tty;
742751

743752
if (debug_level >= DEBUG_LEVEL_INFO)
@@ -3881,6 +3890,7 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
38813890
}
38823891

38833892
static const struct tty_operations ops = {
3893+
.install = install,
38843894
.open = open,
38853895
.close = close,
38863896
.write = write,

0 commit comments

Comments
 (0)