diff options
-rw-r--r-- | arch/ppc64/kernel/hvconsole.c | 19 | ||||
-rw-r--r-- | drivers/char/hvc_vio.c | 24 |
2 files changed, 25 insertions, 18 deletions
diff --git a/arch/ppc64/kernel/hvconsole.c b/arch/ppc64/kernel/hvconsole.c index 9d8876d92eb9..138e128a3886 100644 --- a/arch/ppc64/kernel/hvconsole.c +++ b/arch/ppc64/kernel/hvconsole.c | |||
@@ -41,29 +41,14 @@ int hvc_get_chars(uint32_t vtermno, char *buf, int count) | |||
41 | unsigned long got; | 41 | unsigned long got; |
42 | 42 | ||
43 | if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got, | 43 | if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got, |
44 | (unsigned long *)buf, (unsigned long *)buf+1) == H_Success) { | 44 | (unsigned long *)buf, (unsigned long *)buf+1) == H_Success) |
45 | /* | ||
46 | * Work around a HV bug where it gives us a null | ||
47 | * after every \r. -- paulus | ||
48 | */ | ||
49 | if (got > 0) { | ||
50 | int i; | ||
51 | for (i = 1; i < got; ++i) { | ||
52 | if (buf[i] == 0 && buf[i-1] == '\r') { | ||
53 | --got; | ||
54 | if (i < got) | ||
55 | memmove(&buf[i], &buf[i+1], | ||
56 | got - i); | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | return got; | 45 | return got; |
61 | } | ||
62 | return 0; | 46 | return 0; |
63 | } | 47 | } |
64 | 48 | ||
65 | EXPORT_SYMBOL(hvc_get_chars); | 49 | EXPORT_SYMBOL(hvc_get_chars); |
66 | 50 | ||
51 | |||
67 | /** | 52 | /** |
68 | * hvc_put_chars: send characters to firmware for denoted vterm adapter | 53 | * hvc_put_chars: send characters to firmware for denoted vterm adapter |
69 | * @vtermno: The vtermno or unit_address of the adapter from which the data | 54 | * @vtermno: The vtermno or unit_address of the adapter from which the data |
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 | }; |
44 | MODULE_DEVICE_TABLE(vio, hvc_driver_table); | 44 | MODULE_DEVICE_TABLE(vio, hvc_driver_table); |
45 | 45 | ||
46 | static 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 | |||
46 | static struct hv_ops hvc_get_put_ops = { | 68 | static 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 | ||