From 386ba8b8ee71be5387e4ecd132621f305239b25c Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Fri, 8 Jan 2010 10:34:29 +0100 Subject: [PATCH] Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26 or 2.6.27, respectively. --- tty/module.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tty/module.c b/tty/module.c index a7c92055..bf506d3a 100644 --- a/tty/module.c +++ b/tty/module.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "../master/globals.h" #include "../include/ectty.h" @@ -379,7 +380,11 @@ static int ec_tty_write( /*****************************************************************************/ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static int ec_tty_put_char(struct tty_struct *tty, unsigned char ch) +#else static void ec_tty_put_char(struct tty_struct *tty, unsigned char ch) +#endif { ec_tty_t *t = (ec_tty_t *) tty->driver_data; @@ -390,8 +395,14 @@ static void ec_tty_put_char(struct tty_struct *tty, unsigned char ch) if (ec_tty_tx_space(t)) { t->tx_buffer[t->tx_write_idx] = ch; t->tx_write_idx = (t->tx_write_idx + 1) % EC_TTY_TX_BUFFER_SIZE; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + return 1; +#endif } else { printk(KERN_WARNING PFX "%s(): Dropped a byte!\n", __func__); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + return 0; +#endif } } @@ -506,11 +517,19 @@ static void ec_tty_hangup(struct tty_struct *tty) /*****************************************************************************/ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) +static int ec_tty_break(struct tty_struct *tty, int break_state) +#else static void ec_tty_break(struct tty_struct *tty, int break_state) +#endif { #if EC_TTY_DEBUG >= 2 printk(KERN_INFO PFX "%s(break_state = %i).\n", __func__, break_state); #endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + return -EIO; // not implemented +#endif } /*****************************************************************************/