aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/synclinkmp.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-08-07 15:48:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-13 19:53:14 -0400
commitee3b48da84261ce37ef339e27e353a512c93ce5f (patch)
tree0855bf3849c5a523ae95493bd17e4869792385ef /drivers/tty/synclinkmp.c
parent8a3ad1047593f1f6f431140f7dd9748423c51cd1 (diff)
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>
Diffstat (limited to 'drivers/tty/synclinkmp.c')
-rw-r--r--drivers/tty/synclinkmp.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index 95fd4e20b96..53429c890a8 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -711,15 +711,11 @@ static void ldisc_receive_buf(struct tty_struct *tty,
711 711
712/* tty callbacks */ 712/* tty callbacks */
713 713
714/* Called when a port is opened. Init and enable port. 714static int install(struct tty_driver *driver, struct tty_struct *tty)
715 */
716static int open(struct tty_struct *tty, struct file *filp)
717{ 715{
718 SLMP_INFO *info; 716 SLMP_INFO *info;
719 int retval, line; 717 int line = tty->index;
720 unsigned long flags;
721 718
722 line = tty->index;
723 if (line >= synclinkmp_device_count) { 719 if (line >= synclinkmp_device_count) {
724 printk("%s(%d): open with invalid line #%d.\n", 720 printk("%s(%d): open with invalid line #%d.\n",
725 __FILE__,__LINE__,line); 721 __FILE__,__LINE__,line);
@@ -727,17 +723,30 @@ static int open(struct tty_struct *tty, struct file *filp)
727 } 723 }
728 724
729 info = synclinkmp_device_list; 725 info = synclinkmp_device_list;
730 while(info && info->line != line) 726 while (info && info->line != line)
731 info = info->next_device; 727 info = info->next_device;
732 if (sanity_check(info, tty->name, "open")) 728 if (sanity_check(info, tty->name, "open"))
733 return -ENODEV; 729 return -ENODEV;
734 if ( info->init_error ) { 730 if (info->init_error) {
735 printk("%s(%d):%s device is not allocated, init error=%d\n", 731 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);
737 return -ENODEV; 734 return -ENODEV;
738 } 735 }
739 736
740 tty->driver_data = info; 737 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 */
744static 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
741 info->port.tty = tty; 750 info->port.tty = tty;
742 751
743 if (debug_level >= DEBUG_LEVEL_INFO) 752 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -3881,6 +3890,7 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
3881} 3890}
3882 3891
3883static const struct tty_operations ops = { 3892static const struct tty_operations ops = {
3893 .install = install,
3884 .open = open, 3894 .open = open,
3885 .close = close, 3895 .close = close,
3886 .write = write, 3896 .write = write,