fix setting line discipline on standard uarts
authorMiroslav Ondra <ondra@faster.cz>
Wed, 6 Feb 2019 23:04:32 +0000 (00:04 +0100)
committerMiroslav Ondra <ondra@faster.cz>
Wed, 6 Feb 2019 23:04:32 +0000 (00:04 +0100)
modules/unipi/src/unipi_common.h
modules/unipi/src/unipi_tty.c

index 942c7d9ca87156a914773397a5835e29c6dcd3fc..92b6b88d85f9c4ea4df6bc88ef360d488357529e 100644 (file)
@@ -51,7 +51,7 @@
 #if NEURONSPI_SCHED_REQUIRED > 0
        #include <uapi/linux/sched/types.h>
 #endif
-#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.19:2019:01:23"
+#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.20:2019:02:05"
 
 #define NEURONSPI_MAX_DEVS                             3
 #define NEURONSPI_MAX_UART                             16
index 53dbd9eba7a4366a6064a04761a517809d9cb0f6..2611d821d955cd72ab340ee6902a382523264ecb 100644 (file)
@@ -531,6 +531,15 @@ static void unipi_tty_close(struct tty_struct *tty)
        unipi_tty_trace(KERN_INFO "UNIPI_LDISC: Close OK.");
 }
 
+static int unipi_is_port_unipi(struct tty_struct *tty)
+{
+    struct uart_state *state = tty->driver_data;
+    struct uart_port *uport;
+
+    uport = state->uart_port;
+    return (uport->type == PORT_NEURONSPI);
+}
+
 /**
  *     unipi_tty_open          -       open an ldisc
  *     @tty: terminal to open
@@ -545,6 +554,9 @@ static int unipi_tty_open(struct tty_struct *tty)
 {
        struct unipi_tty_data *ldata;
 
+       if (!unipi_is_port_unipi(tty))
+        goto err;
+        
        /* Currently a malloc failure here can panic */
        ldata = vmalloc(sizeof(*ldata));
        if (!ldata)