Skip to content

Commit 1fcbba3

Browse files
author
Martin Schwidefsky
committed
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>
1 parent b7fef2d commit 1fcbba3

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎drivers/s390/char/tty3270.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
915915
int i, rc;
916916

917917
/* 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);
919919
if (!IS_ERR(view)) {
920920
tp = container_of(view, struct tty3270, view);
921921
tty->driver_data = tp;
@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
927927
tp->inattr = TF_INPUT;
928928
return tty_port_install(&tp->port, driver, tty);
929929
}
930-
if (tty3270_max_index < tty->index)
931-
tty3270_max_index = tty->index;
930+
if (tty3270_max_index < tty->index + 1)
931+
tty3270_max_index = tty->index + 1;
932932

933933
/* Allocate tty3270 structure on first open. */
934934
tp = tty3270_alloc_view();
935935
if (IS_ERR(tp))
936936
return PTR_ERR(tp);
937937

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);
939940
if (rc) {
940941
tty3270_free_view(tp);
941942
return rc;
@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = {
18461847

18471848
void tty3270_create_cb(int minor)
18481849
{
1849-
tty_register_device(tty3270_driver, minor, NULL);
1850+
tty_register_device(tty3270_driver, minor - RAW3270_FIRSTMINOR, NULL);
18501851
}
18511852

18521853
void tty3270_destroy_cb(int minor)
18531854
{
1854-
tty_unregister_device(tty3270_driver, minor);
1855+
tty_unregister_device(tty3270_driver, minor - RAW3270_FIRSTMINOR);
18551856
}
18561857

18571858
struct raw3270_notifier tty3270_notifier =
@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void)
18841885
driver->driver_name = "tty3270";
18851886
driver->name = "3270/tty";
18861887
driver->major = IBM_TTY3270_MAJOR;
1887-
driver->minor_start = 0;
1888+
driver->minor_start = RAW3270_FIRSTMINOR;
1889+
driver->name_base = RAW3270_FIRSTMINOR;
18881890
driver->type = TTY_DRIVER_TYPE_SYSTEM;
18891891
driver->subtype = SYSTEM_TYPE_TTY;
18901892
driver->init_termios = tty_std_termios;

0 commit comments

Comments
 (0)