summaryrefslogtreecommitdiff
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorAlexander Viro <viro@www.linux.org.uk>2003-04-23 04:18:59 -0700
committerChristoph Hellwig <hch@lst.de>2003-04-23 04:18:59 -0700
commit345127472f366d63f50fdf29b9dd84e70a084bd7 (patch)
treee1f47d76d696923a8c1d8baa05e75f97748fda56 /drivers/char/tty_io.c
parent07462df3687e6a58846911460f4f4833fbe3d587 (diff)
[PATCH] tty cleanups (6/12)
tty->tty_index added; we initialize it with minor(tty->device) - tty->driver->minor_start. Majority of remaining tty->device uses had that form and are switched to use of tty->index.
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r--drivers/char/tty_io.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 2bbf720033f1..e9b991cdf922 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -172,8 +172,7 @@ static inline void free_tty_struct(struct tty_struct *tty)
kfree(tty);
}
-#define TTY_NUMBER(tty) (minor((tty)->device) - (tty)->driver->minor_start + \
- (tty)->driver->name_base)
+#define TTY_NUMBER(tty) ((tty)->index + (tty)->driver->name_base)
char *tty_name(struct tty_struct *tty, char *buf)
{
@@ -843,6 +842,7 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
initialize_tty_struct(tty);
tty->device = device;
tty->driver = driver;
+ tty->index = idx;
sprintf(tty->name, "%s%d",
driver->name, idx + driver->name_base);
@@ -872,6 +872,7 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
o_tty->device = mk_kdev(driver->other->major,
driver->other->minor_start + idx);
o_tty->driver = driver->other;
+ o_tty->index = idx;
sprintf(o_tty->name, "%s%d",
driver->other->name, idx + driver->other->name_base);
@@ -1069,7 +1070,7 @@ static void release_dev(struct file * filp)
tty_fasync(-1, filp, 0);
- idx = minor(tty->device) - tty->driver->minor_start;
+ idx = tty->index;
pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER);
o_tty = tty->link;
@@ -1519,7 +1520,7 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
return 0;
#ifdef CONFIG_VT
if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) {
- unsigned int currcons = minor(tty->device) - tty->driver->minor_start;
+ unsigned int currcons = tty->index;
if (vc_resize(currcons, tmp_ws.ws_col, tmp_ws.ws_row))
return -ENXIO;
}