From 7b1241d0725b0f98d0494120d7fe7913c63ef91a Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Mon, 16 Dec 2013 08:54:07 +0100 Subject: [PATCH] sllin: Add version dependent access to termios in tty_struct Signed-off-by: Alexander Stein --- sllin/sllin.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sllin/sllin.c b/sllin/sllin.c index 3e020b1..e05564c 100644 --- a/sllin/sllin.c +++ b/sllin/sllin.c @@ -62,6 +62,7 @@ #include #include #include +#include #include "linux/lin_bus.h" /* Should be in include/linux/tty.h */ @@ -206,22 +207,31 @@ const unsigned char sllin_id_parity_table[] = { */ static int sltty_change_speed(struct tty_struct *tty, unsigned speed) { - struct ktermios old_termios; + struct ktermios old_termios, termios; int cflag; mutex_lock(&tty->termios_mutex); - old_termios = *(tty->termios); +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0) + old_termios = termios = *(tty->termios); +#else + old_termios = termios = tty->termios; +#endif cflag = CS8 | CREAD | CLOCAL | HUPCL; cflag &= ~(CBAUD | CIBAUD); cflag |= BOTHER; - tty->termios->c_cflag = cflag; - tty->termios->c_oflag = 0; - tty->termios->c_lflag = 0; + termios.c_cflag = cflag; + termios.c_oflag = 0; + termios.c_lflag = 0; /* Enable interrupt when UART-Break or Framing error received */ - tty->termios->c_iflag = BRKINT | INPCK; + termios.c_iflag = BRKINT | INPCK; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0) + *(tty->termios) = termios; +#else + tty->termios = termios; +#endif tty_encode_baud_rate(tty, speed, speed); -- 2.39.2