diff options
author | Milton Miller <miltonm@bga.com> | 2005-07-07 17:56:26 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-07 18:23:40 -0700 |
commit | 70b234a40107596a713e9981c643f2717e31463f (patch) | |
tree | e7f0d4382c32b61efd671c051095535767288a30 /drivers/char/hvc_vio.c | |
parent | 030ffad23fb28fc29608a3bc21f0c3b88bf28592 (diff) | |
download | op-kernel-dev-70b234a40107596a713e9981c643f2717e31463f.zip op-kernel-dev-70b234a40107596a713e9981c643f2717e31463f.tar.gz |
[PATCH] hvc_console: Separate the NUL character filtering from get_hvc_chars
Separate the NUL character filtering from get_hvc_chars.
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/hvc_vio.c')
-rw-r--r-- | drivers/char/hvc_vio.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c index 430a2c2..60bb915 100644 --- a/drivers/char/hvc_vio.c +++ b/drivers/char/hvc_vio.c @@ -43,8 +43,30 @@ static struct vio_device_id hvc_driver_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(vio, hvc_driver_table); +static int filtered_get_chars(uint32_t vtermno, char *buf, int count) +{ + unsigned long got; + int i; + + got = hvc_get_chars(vtermno, buf, count); + + /* + * Work around a HV bug where it gives us a null + * after every \r. -- paulus + */ + for (i = 1; i < got; ++i) { + if (buf[i] == 0 && buf[i-1] == '\r') { + --got; + if (i < got) + memmove(&buf[i], &buf[i+1], + got - i); + } + } + return got; +} + static struct hv_ops hvc_get_put_ops = { - .get_chars = hvc_get_chars, + .get_chars = filtered_get_chars, .put_chars = hvc_put_chars, }; |