From ca3fc48c4c6371563b010636b7992b4bcb29e0e3 Mon Sep 17 00:00:00 2001 From: Miroslav Ondra Date: Thu, 7 Feb 2019 00:04:32 +0100 Subject: [PATCH] fix setting line discipline on standard uarts --- modules/unipi/src/unipi_common.h | 2 +- modules/unipi/src/unipi_tty.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/unipi/src/unipi_common.h b/modules/unipi/src/unipi_common.h index 942c7d9..92b6b88 100644 --- a/modules/unipi/src/unipi_common.h +++ b/modules/unipi/src/unipi_common.h @@ -51,7 +51,7 @@ #if NEURONSPI_SCHED_REQUIRED > 0 #include #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 diff --git a/modules/unipi/src/unipi_tty.c b/modules/unipi/src/unipi_tty.c index 53dbd9e..2611d82 100644 --- a/modules/unipi/src/unipi_tty.c +++ b/modules/unipi/src/unipi_tty.c @@ -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) -- 2.34.1