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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8a3ad10475
commit
ee3b48da84
@@ -711,15 +711,11 @@ static void ldisc_receive_buf(struct tty_struct *tty,
|
|||||||
|
|
||||||
/* tty callbacks */
|
/* tty callbacks */
|
||||||
|
|
||||||
/* Called when a port is opened. Init and enable port.
|
static int install(struct tty_driver *driver, struct tty_struct *tty)
|
||||||
*/
|
|
||||||
static int open(struct tty_struct *tty, struct file *filp)
|
|
||||||
{
|
{
|
||||||
SLMP_INFO *info;
|
SLMP_INFO *info;
|
||||||
int retval, line;
|
int line = tty->index;
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
line = tty->index;
|
|
||||||
if (line >= synclinkmp_device_count) {
|
if (line >= synclinkmp_device_count) {
|
||||||
printk("%s(%d): open with invalid line #%d.\n",
|
printk("%s(%d): open with invalid line #%d.\n",
|
||||||
__FILE__,__LINE__,line);
|
__FILE__,__LINE__,line);
|
||||||
@@ -727,17 +723,30 @@ static int open(struct tty_struct *tty, struct file *filp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
info = synclinkmp_device_list;
|
info = synclinkmp_device_list;
|
||||||
while(info && info->line != line)
|
while (info && info->line != line)
|
||||||
info = info->next_device;
|
info = info->next_device;
|
||||||
if (sanity_check(info, tty->name, "open"))
|
if (sanity_check(info, tty->name, "open"))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if ( info->init_error ) {
|
if (info->init_error) {
|
||||||
printk("%s(%d):%s device is not allocated, init error=%d\n",
|
printk("%s(%d):%s device is not allocated, init error=%d\n",
|
||||||
__FILE__,__LINE__,info->device_name,info->init_error);
|
__FILE__, __LINE__, info->device_name,
|
||||||
|
info->init_error);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
tty->driver_data = info;
|
tty->driver_data = info;
|
||||||
|
|
||||||
|
return tty_port_install(&info->port, driver, tty);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Called when a port is opened. Init and enable port.
|
||||||
|
*/
|
||||||
|
static int open(struct tty_struct *tty, struct file *filp)
|
||||||
|
{
|
||||||
|
SLMP_INFO *info = tty->driver_data;
|
||||||
|
unsigned long flags;
|
||||||
|
int retval;
|
||||||
|
|
||||||
info->port.tty = tty;
|
info->port.tty = tty;
|
||||||
|
|
||||||
if (debug_level >= DEBUG_LEVEL_INFO)
|
if (debug_level >= DEBUG_LEVEL_INFO)
|
||||||
@@ -3881,6 +3890,7 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct tty_operations ops = {
|
static const struct tty_operations ops = {
|
||||||
|
.install = install,
|
||||||
.open = open,
|
.open = open,
|
||||||
.close = close,
|
.close = close,
|
||||||
.write = write,
|
.write = write,
|
||||||
|
Reference in New Issue
Block a user