mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-27 22:51:31 +00:00
TTY: synclink, 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>
This commit is contained in:
parent
f7e0405e74
commit
8a3ad10475
1 changed files with 26 additions and 18 deletions
|
@ -3362,6 +3362,29 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
|
||||||
|
|
||||||
} /* end of block_til_ready() */
|
} /* end of block_til_ready() */
|
||||||
|
|
||||||
|
static int mgsl_install(struct tty_driver *driver, struct tty_struct *tty)
|
||||||
|
{
|
||||||
|
struct mgsl_struct *info;
|
||||||
|
int line = tty->index;
|
||||||
|
|
||||||
|
/* verify range of specified line number */
|
||||||
|
if (line >= mgsl_device_count) {
|
||||||
|
printk("%s(%d):mgsl_open with invalid line #%d.\n",
|
||||||
|
__FILE__, __LINE__, line);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find the info structure for the specified line */
|
||||||
|
info = mgsl_device_list;
|
||||||
|
while (info && info->line != line)
|
||||||
|
info = info->next_device;
|
||||||
|
if (mgsl_paranoia_check(info, tty->name, "mgsl_open"))
|
||||||
|
return -ENODEV;
|
||||||
|
tty->driver_data = info;
|
||||||
|
|
||||||
|
return tty_port_install(&info->port, driver, tty);
|
||||||
|
}
|
||||||
|
|
||||||
/* mgsl_open()
|
/* mgsl_open()
|
||||||
*
|
*
|
||||||
* Called when a port is opened. Init and enable port.
|
* Called when a port is opened. Init and enable port.
|
||||||
|
@ -3374,26 +3397,10 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
|
||||||
*/
|
*/
|
||||||
static int mgsl_open(struct tty_struct *tty, struct file * filp)
|
static int mgsl_open(struct tty_struct *tty, struct file * filp)
|
||||||
{
|
{
|
||||||
struct mgsl_struct *info;
|
struct mgsl_struct *info = tty->driver_data;
|
||||||
int retval, line;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
int retval;
|
||||||
|
|
||||||
/* verify range of specified line number */
|
|
||||||
line = tty->index;
|
|
||||||
if (line >= mgsl_device_count) {
|
|
||||||
printk("%s(%d):mgsl_open with invalid line #%d.\n",
|
|
||||||
__FILE__,__LINE__,line);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find the info structure for the specified line */
|
|
||||||
info = mgsl_device_list;
|
|
||||||
while(info && info->line != line)
|
|
||||||
info = info->next_device;
|
|
||||||
if (mgsl_paranoia_check(info, tty->name, "mgsl_open"))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
tty->driver_data = info;
|
|
||||||
info->port.tty = tty;
|
info->port.tty = tty;
|
||||||
|
|
||||||
if (debug_level >= DEBUG_LEVEL_INFO)
|
if (debug_level >= DEBUG_LEVEL_INFO)
|
||||||
|
@ -4297,6 +4304,7 @@ static struct mgsl_struct* mgsl_allocate_device(void)
|
||||||
} /* end of mgsl_allocate_device()*/
|
} /* end of mgsl_allocate_device()*/
|
||||||
|
|
||||||
static const struct tty_operations mgsl_ops = {
|
static const struct tty_operations mgsl_ops = {
|
||||||
|
.install = mgsl_install,
|
||||||
.open = mgsl_open,
|
.open = mgsl_open,
|
||||||
.close = mgsl_close,
|
.close = mgsl_close,
|
||||||
.write = mgsl_write,
|
.write = mgsl_write,
|
||||||
|
|
Loading…
Reference in a new issue