From: Miroslav Ondra Date: Wed, 6 Feb 2019 23:04:32 +0000 (+0100) Subject: fix setting line discipline on standard uarts X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=ca3fc48c4c6371563b010636b7992b4bcb29e0e3;p=graphit%2Funipi-kernel.git fix setting line discipline on standard uarts --- 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)