]> rtime.felk.cvut.cz Git - linux-lin.git/commitdiff
sllin: Add version dependent access to termios in tty_struct
authorAlexander Stein <alexander.stein@systec-electronic.com>
Mon, 16 Dec 2013 07:54:07 +0000 (08:54 +0100)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Thu, 16 Jan 2014 23:51:00 +0000 (00:51 +0100)
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
sllin/sllin.c

index 3e020b1a07ce93d2f1856fa1fdcc0e992d3d4406..e05564cf33598d7839ece2a71c0b68cc1a0bc803 100644 (file)
@@ -62,6 +62,7 @@
 #include <linux/can.h>
 #include <linux/kthread.h>
 #include <linux/hrtimer.h>
+#include <linux/version.h>
 #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);