Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a3ad104 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

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: default avatarJiri Slaby <jslaby@suse.cz>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f7e0405e
Loading
Loading
Loading
Loading
+26 −18
Original line number Diff line number Diff line
@@ -3362,24 +3362,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
	
}	/* end of block_til_ready() */

/* mgsl_open()
 *
 *	Called when a port is opened.  Init and enable port.
 *	Perform serial-specific initialization for the tty structure.
 *
 * Arguments:		tty	pointer to tty info structure
 *			filp	associated file pointer
 *
 * Return Value:	0 if success, otherwise error code
 */
static int mgsl_open(struct tty_struct *tty, struct file * filp)
static int mgsl_install(struct tty_driver *driver, struct tty_struct *tty)
{
	struct mgsl_struct *info;
	int 			retval, line;
	unsigned long flags;
	int line = tty->index;

	/* 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);
@@ -3392,8 +3380,27 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
		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()
 *
 *	Called when a port is opened.  Init and enable port.
 *	Perform serial-specific initialization for the tty structure.
 *
 * Arguments:		tty	pointer to tty info structure
 *			filp	associated file pointer
 *
 * Return Value:	0 if success, otherwise error code
 */
static int mgsl_open(struct tty_struct *tty, struct file * filp)
{
	struct mgsl_struct *info = tty->driver_data;
	unsigned long flags;
	int retval;

	info->port.tty = tty;
		
	if (debug_level >= DEBUG_LEVEL_INFO)
@@ -4297,6 +4304,7 @@ static struct mgsl_struct* mgsl_allocate_device(void)
}	/* end of mgsl_allocate_device()*/

static const struct tty_operations mgsl_ops = {
	.install = mgsl_install,
	.open = mgsl_open,
	.close = mgsl_close,
	.write = mgsl_write,