From: <ke...@us...> - 2003-09-10 08:58:14
|
Update of /cvsroot/linux-vax/kernel-2.5/drivers/char In directory sc8-pr-cvs1:/tmp/cvs-serv13569/drivers/char Modified Files: dz.c dz.h Log Message: Callout serial devices (cua*) disappear completely in 2.5.71. Index: dz.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/char/dz.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- dz.c 28 Aug 2003 22:36:36 -0000 1.13 +++ dz.c 10 Sep 2003 08:58:11 -0000 1.14 @@ -1121,14 +1121,6 @@ } info->flags |= DZ_CLOSING; /* - * Save the termios structure, since this port may have - * separate termios for callout and dialin. - */ - if (info->flags & DZ_NORMAL_ACTIVE) - info->normal_termios = *tty->termios; - if (info->flags & DZ_CALLOUT_ACTIVE) - info->callout_termios = *tty->termios; - /* * Now we wait for the transmit buffer to clear; and we notify the line * discipline to only process XON/XOFF characters. */ @@ -1167,7 +1159,7 @@ wake_up_interruptible(&info->open_wait); } - info->flags &= ~(DZ_NORMAL_ACTIVE | DZ_CALLOUT_ACTIVE | DZ_CLOSING); + info->flags &= ~(DZ_NORMAL_ACTIVE | DZ_CLOSING); wake_up_interruptible(&info->close_wait); restore_flags(flags); @@ -1184,7 +1176,7 @@ shutdown(info); info->event = 0; info->count = 0; - info->flags &= ~(DZ_NORMAL_ACTIVE | DZ_CALLOUT_ACTIVE); + info->flags &= ~DZ_NORMAL_ACTIVE; info->tty = 0; wake_up_interruptible(&info->open_wait); } @@ -1211,47 +1203,18 @@ } /* - * If this is a callout device, then just make sure the normal - * device isn't being used. - */ - if (tty->driver->subtype == SERIAL_TYPE_CALLOUT) { - if (info->flags & DZ_NORMAL_ACTIVE) - return -EBUSY; - - if ((info->flags & DZ_CALLOUT_ACTIVE) && - (info->flags & DZ_SESSION_LOCKOUT) && - (info->session != current->session)) - return -EBUSY; - - if ((info->flags & DZ_CALLOUT_ACTIVE) && - (info->flags & DZ_PGRP_LOCKOUT) && - (info->pgrp != current->pgrp)) - return -EBUSY; - - info->flags |= DZ_CALLOUT_ACTIVE; - return 0; - } - - /* * If non-blocking mode is set, or the port is not enabled, then make * the check up front and then exit. */ if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { - if (info->flags & DZ_CALLOUT_ACTIVE) - return -EBUSY; info->flags |= DZ_NORMAL_ACTIVE; return 0; } - if (info->flags & DZ_CALLOUT_ACTIVE) { - if (info->normal_termios.c_cflag & CLOCAL) - do_clocal = 1; - } else { - if (tty->termios->c_cflag & CLOCAL) + if (tty->termios->c_cflag & CLOCAL) do_clocal = 1; - } /* * Block waiting for the carrier detect and the line to become free @@ -1270,8 +1233,7 @@ retval = -EAGAIN; break; } - if (!(info->flags & DZ_CALLOUT_ACTIVE) && - !(info->flags & DZ_CLOSING) && do_clocal) + if (!(info->flags & DZ_CLOSING) && do_clocal) break; if (signal_pending(current)) { retval = -ERESTARTSYS; @@ -1331,17 +1293,6 @@ if (retval) return retval; - if ((info->count == 1) && (info->flags & DZ_SPLIT_TERMIOS)) { - if (tty->driver->subtype == SERIAL_TYPE_NORMAL) - *tty->termios = info->normal_termios; - else - *tty->termios = info->callout_termios; - change_speed(info); - } - - info->session = current->session; - info->pgrp = current->pgrp; - return 0; } @@ -1350,6 +1301,25 @@ printk("%s%s\n", dz_name, dz_version); } +static struct tty_driver *serial_driver; + +static struct tty_operations serial_ops = { + .open = dz_open, + .close = dz_close, + .write = dz_write, + .flush_chars = dz_flush_chars, + .write_room = dz_write_room, + .chars_in_buffer = dz_chars_in_buffer, + .flush_buffer = dz_flush_buffer, + .ioctl = dz_ioctl, + .throttle = dz_throttle, + .unthrottle = dz_unthrottle, + .send_xchar = dz_send_xchar, + .set_termios = dz_set_termios, + .stop = dz_stop, + .start = dz_start, + .hangup = dz_hangup, +}; int __init dz_init(void) { @@ -1358,68 +1328,28 @@ #ifdef CONFIG_VAX int irq; #endif - show_serial_version(); - memset(&serial_driver, 0, sizeof(struct tty_driver)); - serial_driver.magic = TTY_DRIVER_MAGIC; - serial_driver.owner = THIS_MODULE; -#ifdef CONFIG_VAX - serial_driver.name = "ttyS"; -#else -#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) - serial_driver.name = "ttyS"; -#else - serial_driver.name = "tts/"; -#endif -#endif /* config_vax */ - serial_driver.major = TTY_MAJOR; - serial_driver.minor_start = 64; - serial_driver.num = DZ_NB_PORT; - 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 = B9600 | CS8 | CREAD | HUPCL | - CLOCAL; - serial_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; - serial_driver.refcount = &serial_refcount; - serial_driver.table = serial_table; - serial_driver.termios = serial_termios; - serial_driver.termios_locked = serial_termios_locked; + serial_driver = alloc_tty_driver(DZ_NB_PORT); + if (!serial_driver) + return -ENOMEM; - serial_driver.open = dz_open; - serial_driver.close = dz_close; - serial_driver.write = dz_write; - serial_driver.flush_chars = dz_flush_chars; - serial_driver.write_room = dz_write_room; - serial_driver.chars_in_buffer = dz_chars_in_buffer; - serial_driver.flush_buffer = dz_flush_buffer; - serial_driver.ioctl = dz_ioctl; - serial_driver.throttle = dz_throttle; - serial_driver.unthrottle = dz_unthrottle; - serial_driver.send_xchar = dz_send_xchar; - serial_driver.set_termios = dz_set_termios; - serial_driver.stop = dz_stop; - serial_driver.start = dz_start; - serial_driver.hangup = dz_hangup; + show_serial_version(); - /* - * The callout device is just like normal device except for major - * number and the subtype code. - */ - callout_driver = serial_driver; -#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) - callout_driver.name = "cua"; -#else - callout_driver.name = "cua/"; -#endif - callout_driver.major = TTYAUX_MAJOR; - callout_driver.subtype = SERIAL_TYPE_CALLOUT; + serial_driver->owner = THIS_MODULE; + 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 = B9600 | CS8 | CREAD | HUPCL | + CLOCAL; + serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + tty_set_operations(serial_driver, &serial_ops); - if (tty_register_driver (&serial_driver)) + if (tty_register_driver(serial_driver)) panic("Couldn't register serial driver\n"); - if (tty_register_driver (&callout_driver)) - panic("Couldn't register callout driver\n"); save_flags(flags); cli(); for (i=0; i < DZ_NB_PORT; i++) { @@ -1446,8 +1376,6 @@ info->blocked_open = 0; INIT_WORK(&info->tqueue, do_softint, info); INIT_WORK(&info->tqueue_hangup, do_serial_hangup, info); - info->callout_termios = callout_driver.init_termios; - info->normal_termios = serial_driver.init_termios; init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); @@ -1465,8 +1393,7 @@ info->port, SERIAL); #endif - tty_register_device(&serial_driver, info->line, NULL); - tty_register_device(&callout_driver, info->line, NULL); + tty_register_device(serial_driver, info->line, NULL); } /* Reset the chip */ @@ -1618,7 +1545,7 @@ static struct tty_driver *dz_console_device(struct console *c, int *index) { *index = c->index; - return &serial_driver; + return serial_driver; } static int __init dz_console_setup(struct console *co, char *options) Index: dz.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/char/dz.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dz.h 28 Aug 2003 21:38:02 -0000 1.5 +++ dz.h 10 Sep 2003 08:58:11 -0000 1.6 @@ -168,29 +168,17 @@ struct async_icount icount; /* keep track of things ... */ struct tty_struct *tty; /* tty associated */ - struct work_struct tqueue; - struct work_struct tqueue_hangup; /* Seems to be no longer used */ - struct termios normal_termios; - struct termios callout_termios; + struct work_struct tqueue; /* Queue for BH */ + struct work_struct tqueue_hangup; wait_queue_head_t open_wait; wait_queue_head_t close_wait; - long session; /* Session of opening process */ - long pgrp; /* pgrp of opening process */ - unsigned char is_console; /* flag indicating a serial console */ unsigned char is_initialized; }; static struct dz_serial multi[DZ_NB_PORT]; /* Four serial lines in the DZ chip */ static struct dz_serial *dz_console; -static struct tty_driver serial_driver, callout_driver; - -static struct tty_struct *serial_table[DZ_NB_PORT]; -static struct termios *serial_termios[DZ_NB_PORT]; -static struct termios *serial_termios_locked[DZ_NB_PORT]; - -static int serial_refcount; #ifdef CONFIG_VAX static unsigned char dz_vsbus_rx_int, dz_vsbus_tx_int; |