aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_core.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-12-08 05:38:45 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:28:57 -0500
commit606d099cdd1080bbb50ea50dc52d98252f8f10a1 (patch)
tree80d17450a5fb78effce3f4312f672c058658e004 /drivers/serial/serial_core.c
parentedc6afc5496875a640bef0913604be7550c1795d (diff)
[PATCH] tty: switch to ktermios
This is the grungy swap all the occurrences in the right places patch that goes with the updates. At this point we have the same functionality as before (except that sgttyb() returns speeds not zero) and are ready to begin turning new stuff on providing nobody reports lots of bugs If you are a tty driver author converting an out of tree driver the only impact should be termios->ktermios name changes for the speed/property setting functions from your upper layers. If you are implementing your own TCGETS function before then your driver was broken already and its about to get a whole lot more painful for you so please fix it 8) Also fill in c_ispeed/ospeed on init for most devices, although the current code will do this for you anyway but I'd like eventually to lose that extra paranoia [akpm@osdl.org: bluetooth fix] [mp3@de.ibm.com: sclp fix] [mp3@de.ibm.com: warning fix for tty3270] [hugh@veritas.com: fix tty_ioctl powerpc build] [jdike@addtoit.com: uml: fix ->set_termios declaration] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Acked-by: Peter Oberparleiter <oberpar@de.ibm.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/serial/serial_core.c')
-rw-r--r--drivers/serial/serial_core.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index c67b05e9a4..f84982e508 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -65,7 +65,7 @@ static struct lock_class_key port_lock_key;
65#define uart_console(port) (0) 65#define uart_console(port) (0)
66#endif 66#endif
67 67
68static void uart_change_speed(struct uart_state *state, struct termios *old_termios); 68static void uart_change_speed(struct uart_state *state, struct ktermios *old_termios);
69static void uart_wait_until_sent(struct tty_struct *tty, int timeout); 69static void uart_wait_until_sent(struct tty_struct *tty, int timeout);
70static void uart_change_pm(struct uart_state *state, int pm_state); 70static void uart_change_pm(struct uart_state *state, int pm_state);
71 71
@@ -338,8 +338,8 @@ EXPORT_SYMBOL(uart_update_timeout);
338 * we're actually going to be using. 338 * we're actually going to be using.
339 */ 339 */
340unsigned int 340unsigned int
341uart_get_baud_rate(struct uart_port *port, struct termios *termios, 341uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
342 struct termios *old, unsigned int min, unsigned int max) 342 struct ktermios *old, unsigned int min, unsigned int max)
343{ 343{
344 unsigned int try, baud, altbaud = 38400; 344 unsigned int try, baud, altbaud = 38400;
345 upf_t flags = port->flags & UPF_SPD_MASK; 345 upf_t flags = port->flags & UPF_SPD_MASK;
@@ -421,11 +421,11 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)
421EXPORT_SYMBOL(uart_get_divisor); 421EXPORT_SYMBOL(uart_get_divisor);
422 422
423static void 423static void
424uart_change_speed(struct uart_state *state, struct termios *old_termios) 424uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
425{ 425{
426 struct tty_struct *tty = state->info->tty; 426 struct tty_struct *tty = state->info->tty;
427 struct uart_port *port = state->port; 427 struct uart_port *port = state->port;
428 struct termios *termios; 428 struct ktermios *termios;
429 429
430 /* 430 /*
431 * If we have no tty, termios, or the port does not exist, 431 * If we have no tty, termios, or the port does not exist,
@@ -1139,7 +1139,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1139 return ret; 1139 return ret;
1140} 1140}
1141 1141
1142static void uart_set_termios(struct tty_struct *tty, struct termios *old_termios) 1142static void uart_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1143{ 1143{
1144 struct uart_state *state = tty->driver_data; 1144 struct uart_state *state = tty->driver_data;
1145 unsigned long flags; 1145 unsigned long flags;
@@ -1866,7 +1866,7 @@ int __init
1866uart_set_options(struct uart_port *port, struct console *co, 1866uart_set_options(struct uart_port *port, struct console *co,
1867 int baud, int parity, int bits, int flow) 1867 int baud, int parity, int bits, int flow)
1868{ 1868{
1869 struct termios termios; 1869 struct ktermios termios;
1870 int i; 1870 int i;
1871 1871
1872 /* 1872 /*
@@ -1876,7 +1876,7 @@ uart_set_options(struct uart_port *port, struct console *co,
1876 spin_lock_init(&port->lock); 1876 spin_lock_init(&port->lock);
1877 lockdep_set_class(&port->lock, &port_lock_key); 1877 lockdep_set_class(&port->lock, &port_lock_key);
1878 1878
1879 memset(&termios, 0, sizeof(struct termios)); 1879 memset(&termios, 0, sizeof(struct ktermios));
1880 1880
1881 termios.c_cflag = CREAD | HUPCL | CLOCAL; 1881 termios.c_cflag = CREAD | HUPCL | CLOCAL;
1882 1882
@@ -1991,12 +1991,12 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
1991 * Re-enable the console device after suspending. 1991 * Re-enable the console device after suspending.
1992 */ 1992 */
1993 if (uart_console(port)) { 1993 if (uart_console(port)) {
1994 struct termios termios; 1994 struct ktermios termios;
1995 1995
1996 /* 1996 /*
1997 * First try to use the console cflag setting. 1997 * First try to use the console cflag setting.
1998 */ 1998 */
1999 memset(&termios, 0, sizeof(struct termios)); 1999 memset(&termios, 0, sizeof(struct ktermios));
2000 termios.c_cflag = port->cons->cflag; 2000 termios.c_cflag = port->cons->cflag;
2001 2001
2002 /* 2002 /*
@@ -2189,6 +2189,7 @@ int uart_register_driver(struct uart_driver *drv)
2189 normal->subtype = SERIAL_TYPE_NORMAL; 2189 normal->subtype = SERIAL_TYPE_NORMAL;
2190 normal->init_termios = tty_std_termios; 2190 normal->init_termios = tty_std_termios;
2191 normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 2191 normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
2192 normal->init_termios.c_ispeed = normal->init_termios.c_ospeed = 9600;
2192 normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; 2193 normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
2193 normal->driver_state = drv; 2194 normal->driver_state = drv;
2194 tty_set_operations(normal, &uart_ops); 2195 tty_set_operations(normal, &uart_ops);