Commit 241b7600 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] tty_driver refcounting

arch/ppc/8260_io/uart.c converted to dynamic allocation
parent 850a46e6
......@@ -74,7 +74,7 @@
static char *serial_name = "CPM UART driver";
static char *serial_version = "0.02";
static struct tty_driver serial_driver;
static struct tty_driver *serial_driver;
static int serial_console_setup(struct console *co, char *options);
/*
......@@ -2394,7 +2394,7 @@ void kgdb_map_scc(void)
static kdev_t serial_console_device(struct console *c)
{
*index = c->index;
return &serial_driver;
return serial_driver;
}
......@@ -2423,6 +2423,26 @@ long __init console_8xx_init(long kmem_start, long kmem_end)
*/
static int baud_idx;
static struct tty_operations rs_8xx_ops = {
.open = rs_8xx_open,
.close = rs_8xx_close,
.write = rs_8xx_write,
.put_char = rs_8xx_put_char,
.write_room = rs_8xx_write_room,
.chars_in_buffer = rs_8xx_chars_in_buffer,
.flush_buffer = rs_8xx_flush_buffer,
.ioctl = rs_8xx_ioctl,
.throttle = rs_8xx_throttle,
.unthrottle = rs_8xx_unthrottle,
.send_xchar = rs_8xx_send_xchar,
.set_termios = rs_8xx_set_termios,
.stop = rs_8xx_stop,
.start = rs_8xx_start,
.hangup = rs_8xx_hangup,
.wait_until_sent = rs_8xx_wait_until_sent,
.read_proc = rs_8xx_read_proc,
};
/*
* The serial driver boot-time initialization code!
*/
......@@ -2442,45 +2462,27 @@ int __init rs_8xx_init(void)
volatile immap_t *immap;
volatile iop8260_t *io;
serial_driver = alloc_tty_driver(NR_PORTS);
if (!serial_driver)
return -ENOMEM;
show_serial_version();
/* Initialize the tty_driver structure */
/*memset(&serial_driver, 0, sizeof(struct tty_driver));*/
__clear_user(&serial_driver,sizeof(struct tty_driver));
serial_driver.magic = TTY_DRIVER_MAGIC;
serial_driver.driver_name = "serial";
serial_driver.devfs_name = "tts/";
serial_driver.name = "ttyS";
serial_driver.major = TTY_MAJOR;
serial_driver.minor_start = 64;
serial_driver.num = NR_PORTS;
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 =
serial_driver->driver_name = "serial";
serial_driver->devfs_name = "tts/";
serial_driver->name = "ttyS";
serial_driver->major = TTY_MAJOR;
serial_driver->minor_start = 64;
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 =
baud_idx | CS8 | CREAD | HUPCL | CLOCAL;
serial_driver.flags = TTY_DRIVER_REAL_RAW;
serial_driver.open = rs_8xx_open;
serial_driver.close = rs_8xx_close;
serial_driver.write = rs_8xx_write;
serial_driver.put_char = rs_8xx_put_char;
serial_driver.write_room = rs_8xx_write_room;
serial_driver.chars_in_buffer = rs_8xx_chars_in_buffer;
serial_driver.flush_buffer = rs_8xx_flush_buffer;
serial_driver.ioctl = rs_8xx_ioctl;
serial_driver.throttle = rs_8xx_throttle;
serial_driver.unthrottle = rs_8xx_unthrottle;
serial_driver.send_xchar = rs_8xx_send_xchar;
serial_driver.set_termios = rs_8xx_set_termios;
serial_driver.stop = rs_8xx_stop;
serial_driver.start = rs_8xx_start;
serial_driver.hangup = rs_8xx_hangup;
serial_driver.wait_until_sent = rs_8xx_wait_until_sent;
serial_driver.read_proc = rs_8xx_read_proc;
if (tty_register_driver(&serial_driver))
serial_driver->flags = TTY_DRIVER_REAL_RAW;
tty_set_operations(serial_driver, &rs_8xx_ops);
if (tty_register_driver(serial_driver))
panic("Couldn't register serial driver\n");
immap = immr;
......
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