TTY: termios structure was included in 'struct tty' with kernel 3.7. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Tue, 12 Feb 2013 11:52:03 +0100
branchstable-1.5
changeset 2518 e5640f5e10a2
parent 2517 b5214d8e48d1
child 2519 0c506726e03d
TTY: termios structure was included in 'struct tty' with kernel 3.7.
tty/module.c
--- a/tty/module.c	Tue Feb 12 11:34:54 2013 +0100
+++ b/tty/module.c	Tue Feb 12 11:52:03 2013 +0100
@@ -192,6 +192,7 @@
     int ret;
     tcflag_t cflag;
     struct tty_struct *tty;
+    struct ktermios *termios;
 
     t->minor = minor;
     t->tx_read_idx = 0;
@@ -215,8 +216,16 @@
     // Tell the device-specific implementation about the initial cflags
     tty = tty_driver->ttys[minor];
 
-    if (tty && tty->termios) { // already opened before
-        cflag = tty->termios->c_cflag;
+    termios =
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
+        &tty->termios
+#else
+        tty->termios
+#endif
+        ;
+
+    if (tty && termios) { // already opened before
+        cflag = termios->c_cflag;
     } else {
         cflag = tty_driver->init_termios.c_cflag;
     }
@@ -575,24 +584,33 @@
 {
     ec_tty_t *t = (ec_tty_t *) tty->driver_data;
     int ret;
+    struct ktermios *termios;
 
 #if EC_TTY_DEBUG >= 2
     printk(KERN_INFO PFX "%s().\n", __func__);
 #endif
 
-    if (tty->termios->c_cflag == old_termios->c_cflag)
+    termios =
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
+        &tty->termios
+#else
+        tty->termios
+#endif
+        ;
+
+    if (termios->c_cflag == old_termios->c_cflag)
         return;
 
 #if EC_TTY_DEBUG >= 2
     printk(KERN_INFO "cflag changed from %x to %x.\n",
-            old_termios->c_cflag, tty->termios->c_cflag);
-#endif
-
-    ret = t->ops.cflag_changed(t->cb_data, tty->termios->c_cflag);
+            old_termios->c_cflag, termios->c_cflag);
+#endif
+
+    ret = t->ops.cflag_changed(t->cb_data, termios->c_cflag);
     if (ret) {
         printk(KERN_ERR PFX "ERROR: cflag 0x%x not accepted.\n",
-                tty->termios->c_cflag);
-        tty->termios->c_cflag = old_termios->c_cflag;
+                termios->c_cflag);
+        termios->c_cflag = old_termios->c_cflag;
     }
 }