diff options
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/con3215.c | 28 | ||||
-rw-r--r-- | drivers/s390/char/sclp_tty.c | 1 | ||||
-rw-r--r-- | drivers/s390/char/sclp_vt220.c | 1 | ||||
-rw-r--r-- | drivers/s390/char/tty3270.c | 34 |
4 files changed, 48 insertions, 16 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 6c0116d48c74..9ffb6d5f17aa 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
@@ -716,10 +716,17 @@ static int raw3215_probe (struct ccw_device *cdev) | |||
716 | static void raw3215_remove (struct ccw_device *cdev) | 716 | static void raw3215_remove (struct ccw_device *cdev) |
717 | { | 717 | { |
718 | struct raw3215_info *raw; | 718 | struct raw3215_info *raw; |
719 | unsigned int line; | ||
719 | 720 | ||
720 | ccw_device_set_offline(cdev); | 721 | ccw_device_set_offline(cdev); |
721 | raw = dev_get_drvdata(&cdev->dev); | 722 | raw = dev_get_drvdata(&cdev->dev); |
722 | if (raw) { | 723 | if (raw) { |
724 | spin_lock(&raw3215_device_lock); | ||
725 | for (line = 0; line < NR_3215; line++) | ||
726 | if (raw3215[line] == raw) | ||
727 | break; | ||
728 | raw3215[line] = NULL; | ||
729 | spin_unlock(&raw3215_device_lock); | ||
723 | dev_set_drvdata(&cdev->dev, NULL); | 730 | dev_set_drvdata(&cdev->dev, NULL); |
724 | raw3215_free_info(raw); | 731 | raw3215_free_info(raw); |
725 | } | 732 | } |
@@ -935,6 +942,19 @@ static int __init con3215_init(void) | |||
935 | console_initcall(con3215_init); | 942 | console_initcall(con3215_init); |
936 | #endif | 943 | #endif |
937 | 944 | ||
945 | static int tty3215_install(struct tty_driver *driver, struct tty_struct *tty) | ||
946 | { | ||
947 | struct raw3215_info *raw; | ||
948 | |||
949 | raw = raw3215[tty->index]; | ||
950 | if (raw == NULL) | ||
951 | return -ENODEV; | ||
952 | |||
953 | tty->driver_data = raw; | ||
954 | |||
955 | return tty_port_install(&raw->port, driver, tty); | ||
956 | } | ||
957 | |||
938 | /* | 958 | /* |
939 | * tty3215_open | 959 | * tty3215_open |
940 | * | 960 | * |
@@ -942,14 +962,9 @@ console_initcall(con3215_init); | |||
942 | */ | 962 | */ |
943 | static int tty3215_open(struct tty_struct *tty, struct file * filp) | 963 | static int tty3215_open(struct tty_struct *tty, struct file * filp) |
944 | { | 964 | { |
945 | struct raw3215_info *raw; | 965 | struct raw3215_info *raw = tty->driver_data; |
946 | int retval; | 966 | int retval; |
947 | 967 | ||
948 | raw = raw3215[tty->index]; | ||
949 | if (raw == NULL) | ||
950 | return -ENODEV; | ||
951 | |||
952 | tty->driver_data = raw; | ||
953 | tty_port_tty_set(&raw->port, tty); | 968 | tty_port_tty_set(&raw->port, tty); |
954 | 969 | ||
955 | tty->low_latency = 0; /* don't use bottom half for pushing chars */ | 970 | tty->low_latency = 0; /* don't use bottom half for pushing chars */ |
@@ -1110,6 +1125,7 @@ static void tty3215_start(struct tty_struct *tty) | |||
1110 | } | 1125 | } |
1111 | 1126 | ||
1112 | static const struct tty_operations tty3215_ops = { | 1127 | static const struct tty_operations tty3215_ops = { |
1128 | .install = tty3215_install, | ||
1113 | .open = tty3215_open, | 1129 | .open = tty3215_open, |
1114 | .close = tty3215_close, | 1130 | .close = tty3215_close, |
1115 | .write = tty3215_write, | 1131 | .write = tty3215_write, |
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 0792c85baafe..30ec09e3d037 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c | |||
@@ -567,6 +567,7 @@ sclp_tty_init(void) | |||
567 | driver->init_termios.c_lflag = ISIG | ECHO; | 567 | driver->init_termios.c_lflag = ISIG | ECHO; |
568 | driver->flags = TTY_DRIVER_REAL_RAW; | 568 | driver->flags = TTY_DRIVER_REAL_RAW; |
569 | tty_set_operations(driver, &sclp_ops); | 569 | tty_set_operations(driver, &sclp_ops); |
570 | tty_port_link_device(&sclp_port, driver, 0); | ||
570 | rc = tty_register_driver(driver); | 571 | rc = tty_register_driver(driver); |
571 | if (rc) { | 572 | if (rc) { |
572 | put_tty_driver(driver); | 573 | put_tty_driver(driver); |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index edfc0fd73dc6..7e60f3d2f3f9 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -691,6 +691,7 @@ static int __init sclp_vt220_tty_init(void) | |||
691 | driver->init_termios = tty_std_termios; | 691 | driver->init_termios = tty_std_termios; |
692 | driver->flags = TTY_DRIVER_REAL_RAW; | 692 | driver->flags = TTY_DRIVER_REAL_RAW; |
693 | tty_set_operations(driver, &sclp_vt220_ops); | 693 | tty_set_operations(driver, &sclp_vt220_ops); |
694 | tty_port_link_device(&sclp_vt220_port, driver, 0); | ||
694 | 695 | ||
695 | rc = tty_register_driver(driver); | 696 | rc = tty_register_driver(driver); |
696 | if (rc) | 697 | if (rc) |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 1928f3458d10..482ee028f842 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -842,17 +842,14 @@ static struct raw3270_fn tty3270_fn = { | |||
842 | }; | 842 | }; |
843 | 843 | ||
844 | /* | 844 | /* |
845 | * This routine is called whenever a 3270 tty is opened. | 845 | * This routine is called whenever a 3270 tty is opened first time. |
846 | */ | 846 | */ |
847 | static int | 847 | static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) |
848 | tty3270_open(struct tty_struct *tty, struct file * filp) | ||
849 | { | 848 | { |
850 | struct raw3270_view *view; | 849 | struct raw3270_view *view; |
851 | struct tty3270 *tp; | 850 | struct tty3270 *tp; |
852 | int i, rc; | 851 | int i, rc; |
853 | 852 | ||
854 | if (tty->count > 1) | ||
855 | return 0; | ||
856 | /* Check if the tty3270 is already there. */ | 853 | /* Check if the tty3270 is already there. */ |
857 | view = raw3270_find_view(&tty3270_fn, | 854 | view = raw3270_find_view(&tty3270_fn, |
858 | tty->index + RAW3270_FIRSTMINOR); | 855 | tty->index + RAW3270_FIRSTMINOR); |
@@ -865,7 +862,7 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
865 | /* why to reassign? */ | 862 | /* why to reassign? */ |
866 | tty_port_tty_set(&tp->port, tty); | 863 | tty_port_tty_set(&tp->port, tty); |
867 | tp->inattr = TF_INPUT; | 864 | tp->inattr = TF_INPUT; |
868 | return 0; | 865 | return tty_port_install(&tp->port, driver, tty); |
869 | } | 866 | } |
870 | if (tty3270_max_index < tty->index + 1) | 867 | if (tty3270_max_index < tty->index + 1) |
871 | tty3270_max_index = tty->index + 1; | 868 | tty3270_max_index = tty->index + 1; |
@@ -895,7 +892,6 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
895 | 892 | ||
896 | tty_port_tty_set(&tp->port, tty); | 893 | tty_port_tty_set(&tp->port, tty); |
897 | tty->low_latency = 0; | 894 | tty->low_latency = 0; |
898 | tty->driver_data = tp; | ||
899 | tty->winsize.ws_row = tp->view.rows - 2; | 895 | tty->winsize.ws_row = tp->view.rows - 2; |
900 | tty->winsize.ws_col = tp->view.cols; | 896 | tty->winsize.ws_col = tp->view.cols; |
901 | 897 | ||
@@ -915,6 +911,15 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
915 | kbd_ascebc(tp->kbd, tp->view.ascebc); | 911 | kbd_ascebc(tp->kbd, tp->view.ascebc); |
916 | 912 | ||
917 | raw3270_activate_view(&tp->view); | 913 | raw3270_activate_view(&tp->view); |
914 | |||
915 | rc = tty_port_install(&tp->port, driver, tty); | ||
916 | if (rc) { | ||
917 | raw3270_put_view(&tp->view); | ||
918 | return rc; | ||
919 | } | ||
920 | |||
921 | tty->driver_data = tp; | ||
922 | |||
918 | return 0; | 923 | return 0; |
919 | } | 924 | } |
920 | 925 | ||
@@ -932,10 +937,17 @@ tty3270_close(struct tty_struct *tty, struct file * filp) | |||
932 | if (tp) { | 937 | if (tp) { |
933 | tty->driver_data = NULL; | 938 | tty->driver_data = NULL; |
934 | tty_port_tty_set(&tp->port, NULL); | 939 | tty_port_tty_set(&tp->port, NULL); |
935 | raw3270_put_view(&tp->view); | ||
936 | } | 940 | } |
937 | } | 941 | } |
938 | 942 | ||
943 | static void tty3270_cleanup(struct tty_struct *tty) | ||
944 | { | ||
945 | struct tty3270 *tp = tty->driver_data; | ||
946 | |||
947 | if (tp) | ||
948 | raw3270_put_view(&tp->view); | ||
949 | } | ||
950 | |||
939 | /* | 951 | /* |
940 | * We always have room. | 952 | * We always have room. |
941 | */ | 953 | */ |
@@ -1737,7 +1749,8 @@ static long tty3270_compat_ioctl(struct tty_struct *tty, | |||
1737 | #endif | 1749 | #endif |
1738 | 1750 | ||
1739 | static const struct tty_operations tty3270_ops = { | 1751 | static const struct tty_operations tty3270_ops = { |
1740 | .open = tty3270_open, | 1752 | .install = tty3270_install, |
1753 | .cleanup = tty3270_cleanup, | ||
1741 | .close = tty3270_close, | 1754 | .close = tty3270_close, |
1742 | .write = tty3270_write, | 1755 | .write = tty3270_write, |
1743 | .put_char = tty3270_put_char, | 1756 | .put_char = tty3270_put_char, |
@@ -1781,7 +1794,7 @@ static int __init tty3270_init(void) | |||
1781 | driver->type = TTY_DRIVER_TYPE_SYSTEM; | 1794 | driver->type = TTY_DRIVER_TYPE_SYSTEM; |
1782 | driver->subtype = SYSTEM_TYPE_TTY; | 1795 | driver->subtype = SYSTEM_TYPE_TTY; |
1783 | driver->init_termios = tty_std_termios; | 1796 | driver->init_termios = tty_std_termios; |
1784 | driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_DYNAMIC_DEV; | 1797 | driver->flags = TTY_DRIVER_RESET_TERMIOS; |
1785 | tty_set_operations(driver, &tty3270_ops); | 1798 | tty_set_operations(driver, &tty3270_ops); |
1786 | ret = tty_register_driver(driver); | 1799 | ret = tty_register_driver(driver); |
1787 | if (ret) { | 1800 | if (ret) { |
@@ -1800,6 +1813,7 @@ tty3270_exit(void) | |||
1800 | driver = tty3270_driver; | 1813 | driver = tty3270_driver; |
1801 | tty3270_driver = NULL; | 1814 | tty3270_driver = NULL; |
1802 | tty_unregister_driver(driver); | 1815 | tty_unregister_driver(driver); |
1816 | put_tty_driver(driver); | ||
1803 | tty3270_del_views(); | 1817 | tty3270_del_views(); |
1804 | } | 1818 | } |
1805 | 1819 | ||