spin_unlock_irqrestore(&srmcons_callback_lock, flags);
}
-static kdev_t
-srm_console_device(struct console *co)
+static struct tty_driver *
+srm_console_device(struct console *co, int *index)
{
- return mk_kdev(srmcons_driver.major,
- srmcons_driver.minor_start + co->index);
+ *index = co->index;
+ return &srmcons_driver;
}
static int __init
static int simcons_init (struct console *, char *);
static void simcons_write (struct console *, const char *, unsigned);
-static kdev_t simcons_console_device (struct console *);
+static struct tty_driver *simcons_console_device (struct console *, int *);
struct console hpsim_cons = {
.name = "simcons",
}
}
-static kdev_t
-simcons_console_device (struct console *c)
+static struct tty_driver *simcons_console_device (struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, 64 + c->index);
+ extern struct tty_driver hp_serial_driver;
+ *index = c->index;
+ return &hp_serial_driver;
}
{ 0, 0}
};
-static struct tty_driver serial_driver, callout_driver;
+static struct tty_driver hp_serial_driver, callout_driver;
static int serial_refcount;
static struct async_struct *IRQ_ports[NR_IRQS];
/* Initialize the tty_driver structure */
- memset(&serial_driver, 0, sizeof(struct tty_driver));
- serial_driver.magic = TTY_DRIVER_MAGIC;
- serial_driver.driver_name = "simserial";
- serial_driver.name = "ttyS";
- serial_driver.major = TTY_MAJOR;
- serial_driver.minor_start = 64;
- serial_driver.num = 1;
- serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
- serial_driver.subtype = SERIAL_TYPE_NORMAL;
- serial_driver.init_termios = tty_std_termios;
- serial_driver.init_termios.c_cflag =
+ memset(&hp_serial_driver, 0, sizeof(struct tty_driver));
+ hp_serial_driver.magic = TTY_DRIVER_MAGIC;
+ hp_serial_driver.driver_name = "simserial";
+ hp_serial_driver.name = "ttyS";
+ hp_serial_driver.major = TTY_MAJOR;
+ hp_serial_driver.minor_start = 64;
+ hp_serial_driver.num = 1;
+ hp_serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
+ hp_serial_driver.subtype = SERIAL_TYPE_NORMAL;
+ hp_serial_driver.init_termios = tty_std_termios;
+ hp_serial_driver.init_termios.c_cflag =
B9600 | CS8 | CREAD | HUPCL | CLOCAL;
- serial_driver.flags = TTY_DRIVER_REAL_RAW;
- serial_driver.refcount = &serial_refcount;
- serial_driver.table = serial_table;
- serial_driver.termios = serial_termios;
- serial_driver.termios_locked = serial_termios_locked;
-
- serial_driver.open = rs_open;
- serial_driver.close = rs_close;
- serial_driver.write = rs_write;
- serial_driver.put_char = rs_put_char;
- serial_driver.flush_chars = rs_flush_chars;
- serial_driver.write_room = rs_write_room;
- serial_driver.chars_in_buffer = rs_chars_in_buffer;
- serial_driver.flush_buffer = rs_flush_buffer;
- serial_driver.ioctl = rs_ioctl;
- serial_driver.throttle = rs_throttle;
- serial_driver.unthrottle = rs_unthrottle;
- serial_driver.send_xchar = rs_send_xchar;
- serial_driver.set_termios = rs_set_termios;
- serial_driver.stop = rs_stop;
- serial_driver.start = rs_start;
- serial_driver.hangup = rs_hangup;
- serial_driver.break_ctl = rs_break;
- serial_driver.wait_until_sent = rs_wait_until_sent;
- serial_driver.read_proc = rs_read_proc;
+ hp_serial_driver.flags = TTY_DRIVER_REAL_RAW;
+ hp_serial_driver.refcount = &serial_refcount;
+ hp_serial_driver.table = serial_table;
+ hp_serial_driver.termios = serial_termios;
+ hp_serial_driver.termios_locked = serial_termios_locked;
+
+ hp_serial_driver.open = rs_open;
+ hp_serial_driver.close = rs_close;
+ hp_serial_driver.write = rs_write;
+ hp_serial_driver.put_char = rs_put_char;
+ hp_serial_driver.flush_chars = rs_flush_chars;
+ hp_serial_driver.write_room = rs_write_room;
+ hp_serial_driver.chars_in_buffer = rs_chars_in_buffer;
+ hp_serial_driver.flush_buffer = rs_flush_buffer;
+ hp_serial_driver.ioctl = rs_ioctl;
+ hp_serial_driver.throttle = rs_throttle;
+ hp_serial_driver.unthrottle = rs_unthrottle;
+ hp_serial_driver.send_xchar = rs_send_xchar;
+ hp_serial_driver.set_termios = rs_set_termios;
+ hp_serial_driver.stop = rs_stop;
+ hp_serial_driver.start = rs_start;
+ hp_serial_driver.hangup = rs_hangup;
+ hp_serial_driver.break_ctl = rs_break;
+ hp_serial_driver.wait_until_sent = rs_wait_until_sent;
+ hp_serial_driver.read_proc = rs_read_proc;
/*
* Let's have a little bit of fun !
* The callout device is just like normal device except for
* major number and the subtype code.
*/
- callout_driver = serial_driver;
+ callout_driver = hp_serial_driver;
callout_driver.name = "cua";
callout_driver.major = TTYAUX_MAJOR;
callout_driver.subtype = SERIAL_TYPE_CALLOUT;
callout_driver.read_proc = 0;
callout_driver.proc_entry = 0;
- if (tty_register_driver(&serial_driver))
+ if (tty_register_driver(&hp_serial_driver))
panic("Couldn't register simserial driver\n");
if (tty_register_driver(&callout_driver))
/* debug console - write-only */
static struct console sun3x_debug = {
- "debug",
- sun3x_prom_write, /* write */
- NULL, /* read */
- NULL, /* device */
- NULL, /* unblank */
- NULL, /* setup */
- CON_PRINTBUFFER,
- -1,
- 0,
- NULL
+ .name = "debug",
+ .write = sun3x_prom_write,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
};
void sun3x_prom_init(void)
serial_out(info, UART_IER, ier);
}
-static kdev_t serial_console_device(struct console *c)
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return MKDEV(TTY_MAJOR, 64 + c->index);
+ *index = c->index - SERIAL_DEV_OFFSET;
+ return &serial_driver;
}
/*
serial_outp(&scr_info, VAC_UART_INT_MASK, ier);
}
-static kdev_t serial_console_device(struct console *c)
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return MKDEV(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &serial_driver;
}
/*
}
}
-static kdev_t gdb_console_dev(struct console *con)
-{
- return MKDEV(1, 3); /* /dev/null */
-}
-
static void gdb_console_write(struct console *con, const char *s, unsigned n)
{
gdb_puts(s);
static struct console gdb_console = {
.name = "gdb",
.write = gdb_console_write,
- .device = gdb_console_dev,
.flags = CON_PRINTBUFFER,
.index = -1
};
return c;
}
-static kdev_t siccuart_console_device(struct console *c)
+static struct tty_driver *siccuart_console_device(struct console *c, int *index)
{
- return MKDEV(SERIAL_SICC_MAJOR, SERIAL_SICC_MINOR + c->index);
+ *index = c->index;
+ return &siccnormal_driver;
}
-
static int __init siccuart_console_setup(struct console *co, char *options)
{
struct SICC_port *port;
static kdev_t serial_console_device(struct console *c)
{
- return mk_kdev(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &serial_driver;
}
static void serial_console_write(struct console *c, const char *s,
unsigned count);
-static kdev_t serial_console_device(struct console *c);
+static struct tty_driver *serial_console_device(struct console *c, int *index)
#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
static unsigned long break_pressed; /* break, really ... */
}
#endif
-static kdev_t serial_console_device(struct console *c)
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return MKDEV(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &serial_driver;
}
/*
sh_bios_console_write(s, count);
}
-static kdev_t sh_console_device(struct console *c)
-{
- /* /dev/null */
- return mk_kdev(MEM_MAJOR, 3);
-}
-
/*
* Setup initial baud/bits/parity. We do two things here:
* - construct a cflag setting for the first rs_open()
static struct console sh_console = {
.name = "bios",
.write = sh_console_write,
- .device = sh_console_device,
.setup = sh_console_setup,
.flags = CON_PRINTBUFFER,
.index = -1,
.set_termios = set_termios
};
-static kdev_t console_device(struct console *c)
+static struct tty_driver *console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, c->index);
+ *index = c->index;
+ return &console_driver;
}
static int console_setup(struct console *co, char *options)
len -= write (buf, len);
}
-static kdev_t memcons_device (struct console *co)
+extern struct tty_driver tty_driver;
+static struct tty_driver *memcons_device (struct console *co, int *index)
{
- return MKDEV (TTY_MAJOR, 64 + co->index);
+ *index = co->index;
+ return &tty_driver;
}
static struct console memcons =
return V850_SIM_SYSCALL (read, 0, buf, len);
}
-static kdev_t simcons_device (struct console *c)
+extern struct tty_driver tty_driver;
+static struct tty_driver *simcons_device (struct console *c, int *index)
{
- return mk_kdev (TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &tty_driver;
}
static struct console simcons =
custom.intena = IF_SETCLR | (intena & IF_TBE);
}
-static kdev_t serial_console_device(struct console *c)
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, 64);
+ *index = 0;
+ return &serial_driver;
}
static struct console sercons = {
}
}
-static kdev_t dz_console_device(struct console *c)
+static struct tty_driver *dz_console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &serial_driver;
}
static int __init dz_console_setup(struct console *co, char *options)
}
}
-static kdev_t hvc_console_device(struct console *c)
+static struct tty_driver *hvc_console_device(struct console *c, int *index)
{
- return mk_kdev(HVC_MAJOR, HVC_MINOR + c->index);
+ *index = c->index;
+ return &hvc_driver;
}
static int __init hvc_console_setup(struct console *co, char *options)
parport_release (dev);
}
-static kdev_t lp_console_device (struct console *c)
-{
- return mk_kdev(LP_MAJOR, CONSOLE_LP);
-}
-
static struct console lpcons = {
.name = "lp",
.write = lp_console_write,
- .device = lp_console_device,
.flags = CON_PRINTBUFFER,
};
}
}
-static kdev_t lp_old98_console_device(struct console *console)
-{
- return mk_kdev(LP_MAJOR, 0);
-}
-
static struct console lp_old98_console = {
.name = "lp_old98",
.write = lp_old98_console_write,
- .device = lp_old98_console_device,
.flags = CON_PRINTBUFFER,
.index = -1,
};
local_irq_restore(flags);
}
-static kdev_t serial167_console_device(struct console *c)
+static struct tty_driver *serial167_console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &cy_serial_driver;
}
}
}
-static kdev_t serial_console_device(struct console *c)
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &rs_driver;
}
static __init int serial_console_setup(struct console *co, char *options)
put_string(sercons_port, s, count);
}
-static kdev_t serial_console_device(struct console *c)
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return mk_kdev(SCI_MAJOR, SCI_MINOR_START + c->index);
+ *index = c->index;
+ return &sci_driver;
}
/*
if (IS_TTY_DEV(device)) {
if (!current->tty)
return -ENXIO;
- device = to_kdev_t(current->tty->device);
+ driver = current->tty->driver;
+ index = current->tty->index;
filp->f_flags |= O_NONBLOCK; /* Don't let /dev/tty block */
/* noctty = 1; */
+ goto got_driver;
}
#ifdef CONFIG_VT
if (IS_CONSOLE_DEV(device)) {
extern int fg_console;
- device = mk_kdev(TTY_MAJOR, fg_console + 1);
+ extern struct tty_driver console_driver;
+ driver = &console_driver;
+ index = fg_console;
noctty = 1;
+ goto got_driver;
}
#endif
if (IS_SYSCONS_DEV(device)) {
struct console *c = console_drivers;
- while(c && !c->device)
- c = c->next;
- if (!c)
- return -ENODEV;
- device = c->device(c);
- filp->f_flags |= O_NONBLOCK; /* Don't let /dev/console block */
- noctty = 1;
+ for (c = console_drivers; c; c = c->next) {
+ if (!c->device)
+ continue;
+ driver = c->device(c, &index);
+ if (!driver)
+ continue;
+ /* Don't let /dev/console block */
+ filp->f_flags |= O_NONBLOCK;
+ noctty = 1;
+ goto got_driver;
+ }
+ return -ENODEV;
}
if (IS_PTMX_DEV(device)) {
driver = get_tty_driver(kdev_t_to_nr(device), &index);
if (!driver)
return -ENODEV;
-
+got_driver:
retval = init_dev(driver, index, &tty);
if (retval)
return retval;
local_irq_restore(flags);
}
-static kdev_t scc_console_device(struct console *c)
+static struct tty_driver *scc_console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, SCC_MINOR_BASE + c->index);
+ *index = c->index;
+ return &scc_driver;
}
clear_bit(0, &printing);
}
-static kdev_t vt_console_device(struct console *c)
+struct tty_driver console_driver;
+
+static struct tty_driver *vt_console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, c->index ? c->index : fg_console + 1);
+ *index = c->index ? c->index-1 : fg_console;
+ return &console_driver;
}
struct console vt_console_driver = {
* the appropriate escape-sequence.
*/
-struct tty_driver console_driver;
static int console_refcount;
static int __init con_init(void)
/* Don't disable the transmitter. */
}
-static kdev_t serial_console_device(struct console *c)
+extern struct tty_driver serial_driver;
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &serial_driver;
}
/*
}
}
-static kdev_t
-con3215_device(struct console *c)
+static struct tty_driver *con3215_device(struct console *c, int *index)
{
- return mk_kdev(TTY_MAJOR, c->index + 64 );
+ *index = c->index;
+ return &tty3215_driver;
}
/*
* Can't have this driver a module & support console at the same time
*/
#ifdef CONFIG_TN3270_CONSOLE
-static kdev_t tub3270_con_device(struct console *);
+static struct tty_driver *tub3270_con_device(struct console *, int *);
static void tub3270_con_unblank(void);
static void tub3270_con_write(struct console *, const char *,
unsigned int);
#endif
-static kdev_t
-tub3270_con_device(struct console *conp)
+static struct tty_driver *tub3270_con_device(struct console *conp, int *index)
{
- return tub_mkdev(IBM_TTY3270_MAJOR, conp->index + 1);
+ *index = conp->index + 1;
+ extern struct tty_driver tty3270_driver;
+ return &tty3270_driver;
}
static void
}
-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;
}
}
#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;
}
*/
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;
}
/**
}
-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;
}
rs_fair_output();
}
-static kdev_t zs_console_device(struct console *con)
+static struct tty_driver *zs_console_device(struct console *con, int *index)
{
- return MKDEV(TTY_MAJOR, 64 + con->index);
+ *index = con->index;
+ return &serial_driver;
}
}
}
-static kdev_t serial_console_device(struct console *c)
+static struct tty_driver *serial_console_device(struct console *c, int *index)
{
- return MKDEV(TTY_MAJOR, 64 + c->index);
+ *index = c->index;
+ return &serial_driver;
}
/*
char name[8];
void (*write)(struct console *, const char *, unsigned);
int (*read)(struct console *, const char *, unsigned);
- kdev_t (*device)(struct console *);
+ struct tty_driver *(*device)(struct console *, int *);
void (*unblank)(void);
int (*setup)(struct console *, char *);
short flags;
int *flow);
int uart_set_options(struct uart_port *port, struct console *co, int baud,
int parity, int bits, int flow);
-kdev_t uart_console_device(struct console *co);
+struct tty_driver *uart_console_device(struct console *co, int *index);
/*
* Port/driver registration/removal