Commit 1fcbba3d authored by Martin Schwidefsky's avatar Martin Schwidefsky

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: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent b7fef2dd
...@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) ...@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
int i, rc; int i, rc;
/* Check if the tty3270 is already there. */ /* Check if the tty3270 is already there. */
view = raw3270_find_view(&tty3270_fn, tty->index); view = raw3270_find_view(&tty3270_fn, tty->index + RAW3270_FIRSTMINOR);
if (!IS_ERR(view)) { if (!IS_ERR(view)) {
tp = container_of(view, struct tty3270, view); tp = container_of(view, struct tty3270, view);
tty->driver_data = tp; tty->driver_data = tp;
...@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) ...@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
tp->inattr = TF_INPUT; tp->inattr = TF_INPUT;
return tty_port_install(&tp->port, driver, tty); return tty_port_install(&tp->port, driver, tty);
} }
if (tty3270_max_index < tty->index) if (tty3270_max_index < tty->index + 1)
tty3270_max_index = tty->index; tty3270_max_index = tty->index + 1;
/* Allocate tty3270 structure on first open. */ /* Allocate tty3270 structure on first open. */
tp = tty3270_alloc_view(); tp = tty3270_alloc_view();
if (IS_ERR(tp)) if (IS_ERR(tp))
return PTR_ERR(tp); return PTR_ERR(tp);
rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index); rc = raw3270_add_view(&tp->view, &tty3270_fn,
tty->index + RAW3270_FIRSTMINOR);
if (rc) { if (rc) {
tty3270_free_view(tp); tty3270_free_view(tp);
return rc; return rc;
...@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = { ...@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = {
void tty3270_create_cb(int minor) void tty3270_create_cb(int minor)
{ {
tty_register_device(tty3270_driver, minor, NULL); tty_register_device(tty3270_driver, minor - RAW3270_FIRSTMINOR, NULL);
} }
void tty3270_destroy_cb(int minor) void tty3270_destroy_cb(int minor)
{ {
tty_unregister_device(tty3270_driver, minor); tty_unregister_device(tty3270_driver, minor - RAW3270_FIRSTMINOR);
} }
struct raw3270_notifier tty3270_notifier = struct raw3270_notifier tty3270_notifier =
...@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void) ...@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void)
driver->driver_name = "tty3270"; driver->driver_name = "tty3270";
driver->name = "3270/tty"; driver->name = "3270/tty";
driver->major = IBM_TTY3270_MAJOR; driver->major = IBM_TTY3270_MAJOR;
driver->minor_start = 0; driver->minor_start = RAW3270_FIRSTMINOR;
driver->name_base = RAW3270_FIRSTMINOR;
driver->type = TTY_DRIVER_TYPE_SYSTEM; driver->type = TTY_DRIVER_TYPE_SYSTEM;
driver->subtype = SYSTEM_TYPE_TTY; driver->subtype = SYSTEM_TYPE_TTY;
driver->init_termios = tty_std_termios; driver->init_termios = tty_std_termios;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment