aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2005-07-07 20:56:26 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:23:40 -0400
commit70b234a40107596a713e9981c643f2717e31463f (patch)
treee7f0d4382c32b61efd671c051095535767288a30 /drivers/char
parent030ffad23fb28fc29608a3bc21f0c3b88bf28592 (diff)
[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')
-rw-r--r--drivers/char/hvc_vio.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
index 430a2c284ad2..60bb9152b832 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 = {
43}; 43};
44MODULE_DEVICE_TABLE(vio, hvc_driver_table); 44MODULE_DEVICE_TABLE(vio, hvc_driver_table);
45 45
46static int filtered_get_chars(uint32_t vtermno, char *buf, int count)
47{
48 unsigned long got;
49 int i;
50
51 got = hvc_get_chars(vtermno, buf, count);
52
53 /*
54 * Work around a HV bug where it gives us a null
55 * after every \r. -- paulus
56 */
57 for (i = 1; i < got; ++i) {
58 if (buf[i] == 0 && buf[i-1] == '\r') {
59 --got;
60 if (i < got)
61 memmove(&buf[i], &buf[i+1],
62 got - i);
63 }
64 }
65 return got;
66}
67
46static struct hv_ops hvc_get_put_ops = { 68static struct hv_ops hvc_get_put_ops = {
47 .get_chars = hvc_get_chars, 69 .get_chars = filtered_get_chars,
48 .put_chars = hvc_put_chars, 70 .put_chars = hvc_put_chars,
49}; 71};
50 72