diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-03-21 08:07:18 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-03-21 08:35:39 -0400 |
commit | 1fcbba3d65dff8ce9d25e644fcc86fa8c629de7d (patch) | |
tree | 88a18253aeaf7acddb5429788463634ecd2749c0 /drivers/s390 | |
parent | b7fef2dd7217d9e3f35c948e87297451e55c9709 (diff) |
s390/3270: fix minor_start issue
The 3270 device nodes 227/0 and 228/0 are special. 227/0 is never used,
and 228/0 is used to redirect full screen applications from /dev/3270/tub
to the real device node of the 3270 terminal.
To keep the device names /dev/3270/tty<x> consistent with the minor number
the device driver sets minor_start to 0 and skips minor 0. That makes the
tty index equivalent to the minor number. But doing so seems to causes
problems with init scripts.
A better solution is to set minor_start to the correct value of 1 and
set name_base to 1 as well. tty_register_device will then automatically
create the correct tty name.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/tty3270.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index b907dba24025..cee69dac3e18 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
915 | int i, rc; | 915 | int i, rc; |
916 | 916 | ||
917 | /* Check if the tty3270 is already there. */ | 917 | /* Check if the tty3270 is already there. */ |
918 | view = raw3270_find_view(&tty3270_fn, tty->index); | 918 | view = raw3270_find_view(&tty3270_fn, tty->index + RAW3270_FIRSTMINOR); |
919 | if (!IS_ERR(view)) { | 919 | if (!IS_ERR(view)) { |
920 | tp = container_of(view, struct tty3270, view); | 920 | tp = container_of(view, struct tty3270, view); |
921 | tty->driver_data = tp; | 921 | tty->driver_data = tp; |
@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
927 | tp->inattr = TF_INPUT; | 927 | tp->inattr = TF_INPUT; |
928 | return tty_port_install(&tp->port, driver, tty); | 928 | return tty_port_install(&tp->port, driver, tty); |
929 | } | 929 | } |
930 | if (tty3270_max_index < tty->index) | 930 | if (tty3270_max_index < tty->index + 1) |
931 | tty3270_max_index = tty->index; | 931 | tty3270_max_index = tty->index + 1; |
932 | 932 | ||
933 | /* Allocate tty3270 structure on first open. */ | 933 | /* Allocate tty3270 structure on first open. */ |
934 | tp = tty3270_alloc_view(); | 934 | tp = tty3270_alloc_view(); |
935 | if (IS_ERR(tp)) | 935 | if (IS_ERR(tp)) |
936 | return PTR_ERR(tp); | 936 | return PTR_ERR(tp); |
937 | 937 | ||
938 | rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index); | 938 | rc = raw3270_add_view(&tp->view, &tty3270_fn, |
939 | tty->index + RAW3270_FIRSTMINOR); | ||
939 | if (rc) { | 940 | if (rc) { |
940 | tty3270_free_view(tp); | 941 | tty3270_free_view(tp); |
941 | return rc; | 942 | return rc; |
@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = { | |||
1846 | 1847 | ||
1847 | void tty3270_create_cb(int minor) | 1848 | void tty3270_create_cb(int minor) |
1848 | { | 1849 | { |
1849 | tty_register_device(tty3270_driver, minor, NULL); | 1850 | tty_register_device(tty3270_driver, minor - RAW3270_FIRSTMINOR, NULL); |
1850 | } | 1851 | } |
1851 | 1852 | ||
1852 | void tty3270_destroy_cb(int minor) | 1853 | void tty3270_destroy_cb(int minor) |
1853 | { | 1854 | { |
1854 | tty_unregister_device(tty3270_driver, minor); | 1855 | tty_unregister_device(tty3270_driver, minor - RAW3270_FIRSTMINOR); |
1855 | } | 1856 | } |
1856 | 1857 | ||
1857 | struct raw3270_notifier tty3270_notifier = | 1858 | struct raw3270_notifier tty3270_notifier = |
@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void) | |||
1884 | driver->driver_name = "tty3270"; | 1885 | driver->driver_name = "tty3270"; |
1885 | driver->name = "3270/tty"; | 1886 | driver->name = "3270/tty"; |
1886 | driver->major = IBM_TTY3270_MAJOR; | 1887 | driver->major = IBM_TTY3270_MAJOR; |
1887 | driver->minor_start = 0; | 1888 | driver->minor_start = RAW3270_FIRSTMINOR; |
1889 | driver->name_base = RAW3270_FIRSTMINOR; | ||
1888 | driver->type = TTY_DRIVER_TYPE_SYSTEM; | 1890 | driver->type = TTY_DRIVER_TYPE_SYSTEM; |
1889 | driver->subtype = SYSTEM_TYPE_TTY; | 1891 | driver->subtype = SYSTEM_TYPE_TTY; |
1890 | driver->init_termios = tty_std_termios; | 1892 | driver->init_termios = tty_std_termios; |