diff options
| author | Alexander Viro <viro@parcelfarce.linux.theplanet.co.uk> | 2003-04-24 08:38:39 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-24 08:38:39 -0700 |
| commit | 4310d2e1ef9d2fa109ee2b6a01cf47e81acc3432 (patch) | |
| tree | 1502bca99251d19704f6006f4ce11a2aeddf1fc0 /drivers/serial | |
| parent | b7d752fb6dc63357ed6673181a8afd4b169488df (diff) | |
[PATCH] console cleanup (2/2)
Console drivers cleanup. In current tree interaction between
console and tty layer sits in the ->device() method of struct console.
It takes a pointer to console and returns device number of its tty
device. open(2) on /dev/console goes through the list of registered
consoles, picks the first one that has ->device() and remaps the device
number to console->device(console). Then it proceeds with normal
opening of tty. This is the only caller of ->device().
Cleanup: let ->device() return a pair (pointer to tty_driver, index
of tty in question) instead of device number. Note that
a) the first thing tty_open() does with remapped device number is
conversion to such pair.
b) console driver _knows_ which tty_driver we want - one that
implements tty interface to the same physical device (i.e. the part of
the same driver).
c) current code expects the result of ->device() to be a device
number of tty device - anything else is immediate -ENODEV from tty_open();
might as well have NULL ->device in that driver.
Console drivers converted, (the only) caller updated.
Diffstat (limited to 'drivers/serial')
| -rw-r--r-- | drivers/serial/68328serial.c | 5 | ||||
| -rw-r--r-- | drivers/serial/68360serial.c | 5 | ||||
| -rw-r--r-- | drivers/serial/core.c | 10 | ||||
| -rw-r--r-- | drivers/serial/mcfserial.c | 5 |
4 files changed, 15 insertions, 10 deletions
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c index ca48aacc6081..99577bb73f85 100644 --- a/drivers/serial/68328serial.c +++ b/drivers/serial/68328serial.c @@ -1662,9 +1662,10 @@ int m68328_console_setup(struct console *cp, char *arg) } -static kdev_t m68328_console_device(struct console *c) +static struct tty_driver *m68328_console_device(struct console *c, int *index) { - return mk_kdev(TTY_MAJOR, 64 + c->index); + *index = c->index; + return &serial_driver; } diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index 892e0cdc4942..bb5cfd74db8b 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c @@ -2521,9 +2521,10 @@ void kgdb_map_scc(void) } #endif -static kdev_t serial_console_device(struct console *c) +static struct tty_struct *serial_console_device(struct console *c, int *index) { - return MKDEV(TTY_MAJOR, 64 + c->index); + *index = c->index; + return &serial_driver; } diff --git a/drivers/serial/core.c b/drivers/serial/core.c index 7359f3f71b14..0d8c7601af30 100644 --- a/drivers/serial/core.c +++ b/drivers/serial/core.c @@ -2187,17 +2187,19 @@ int uart_register_driver(struct uart_driver *drv) */ void uart_unregister_driver(struct uart_driver *drv) { - tty_unregister_driver(drv->tty_driver); - + struct tty_driver *p = drv->tty_driver; + drv->tty_driver = NULL; + tty_unregister_driver(p); kfree(drv->state); kfree(drv->tty_driver->termios); kfree(drv->tty_driver); } -kdev_t uart_console_device(struct console *co) +struct tty_driver *uart_console_device(struct console *co, int *index) { struct uart_driver *p = co->data; - return mk_kdev(p->major, p->minor + co->index); + *index = co->index; + return p->tty_driver; } /** diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c index 120aec80864f..088f71298eae 100644 --- a/drivers/serial/mcfserial.c +++ b/drivers/serial/mcfserial.c @@ -1785,9 +1785,10 @@ int mcfrs_console_setup(struct console *cp, char *arg) } -static kdev_t mcfrs_console_device(struct console *c) +static struct tty_driver *mcfrs_console_device(struct console *c, int *index) { - return mk_kdev(TTY_MAJOR, 64 + c->index); + *index = c->index; + return &mcfrs_serial_driver; } |
