aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2014-08-13 06:01:30 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-08-15 03:01:17 -0400
commite512d56c799517f33b301d81e9a5e0ebf30c2d1e (patch)
tree5bcbcd7da9d5ee77b2abb8870b8f6ad4556ed648 /drivers/s390
parent7bb1cdbfe2b07d9272b4b132511c82527314b00f (diff)
s390/3215: fix tty output containing tabs
git commit 37f81fa1f63ad38e16125526bb2769ae0ea8d332 "n_tty: do O_ONLCR translation as a single write" surfaced a bug in the 3215 device driver. In combination this broke tab expansion for tty ouput. The cause is an asymmetry in the behaviour of tty3215_ops->write vs tty3215_ops->put_char. The put_char function scans for '\t' but the write function does not. As the driver has logic for the '\t' expansion remove XTABS from c_oflag of the initial termios as well. Reported-by: Stephen Powell <zlinuxman@wowway.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/con3215.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index a6d47e5eee9e..c43aca69fb30 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -1035,12 +1035,26 @@ static int tty3215_write(struct tty_struct * tty,
1035 const unsigned char *buf, int count) 1035 const unsigned char *buf, int count)
1036{ 1036{
1037 struct raw3215_info *raw; 1037 struct raw3215_info *raw;
1038 int i, written;
1038 1039
1039 if (!tty) 1040 if (!tty)
1040 return 0; 1041 return 0;
1041 raw = (struct raw3215_info *) tty->driver_data; 1042 raw = (struct raw3215_info *) tty->driver_data;
1042 raw3215_write(raw, buf, count); 1043 written = count;
1043 return count; 1044 while (count > 0) {
1045 for (i = 0; i < count; i++)
1046 if (buf[i] == '\t' || buf[i] == '\n')
1047 break;
1048 raw3215_write(raw, buf, i);
1049 count -= i;
1050 buf += i;
1051 if (count > 0) {
1052 raw3215_putchar(raw, *buf);
1053 count--;
1054 buf++;
1055 }
1056 }
1057 return written;
1044} 1058}
1045 1059
1046/* 1060/*
@@ -1188,7 +1202,7 @@ static int __init tty3215_init(void)
1188 driver->subtype = SYSTEM_TYPE_TTY; 1202 driver->subtype = SYSTEM_TYPE_TTY;
1189 driver->init_termios = tty_std_termios; 1203 driver->init_termios = tty_std_termios;
1190 driver->init_termios.c_iflag = IGNBRK | IGNPAR; 1204 driver->init_termios.c_iflag = IGNBRK | IGNPAR;
1191 driver->init_termios.c_oflag = ONLCR | XTABS; 1205 driver->init_termios.c_oflag = ONLCR;
1192 driver->init_termios.c_lflag = ISIG; 1206 driver->init_termios.c_lflag = ISIG;
1193 driver->flags = TTY_DRIVER_REAL_RAW; 1207 driver->flags = TTY_DRIVER_REAL_RAW;
1194 tty_set_operations(driver, &tty3215_ops); 1208 tty_set_operations(driver, &tty3215_ops);