aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hvc_vio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/hvc_vio.c')
-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