[PATCH] tty/n_gsm: fix bug in tiocmset

From: Nikola Diklic-Perin
Date: Fri Sep 23 2011 - 04:59:52 EST


From: Nikola Diklic-Perin <diklic.perin.nikola@xxxxxxxxx>

Clear bitmask was not inverted before masking modem_tx.

Calling ioctl(fd, TIOCMBIC, TIOCM_RTS) results in:

[ 197.430000] pre_modem_tx: 0x00000006
[ 197.430000] clear: 0x00000004
[ 197.430000] set: 0x00000000
[ 197.440000] post_modem_tx: 0x00000004

which is wrong.

Signed-off-by: Nikola Diklic-Perin <diklic.perin.nikola@xxxxxxxxx>
---
--- a/drivers/tty/n_gsm.c 2011-09-22 18:19:16.592480805 +0200
+++ b/drivers/tty/n_gsm.c 2011-09-21 16:15:29.506800052 +0200
@@ -2982,7 +2982,7 @@ static int gsmtty_tiocmset(struct tty_st
struct gsm_dlci *dlci = tty->driver_data;
unsigned int modem_tx = dlci->modem_tx;

- modem_tx &= clear;
+ modem_tx &= ~clear;
modem_tx |= set;

if (modem_tx != dlci->modem_tx) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/