Commit 70b234a4 authored by Milton Miller's avatar Milton Miller Committed by Linus Torvalds

[PATCH] hvc_console: Separate the NUL character filtering from get_hvc_chars

Separate the NUL character filtering from get_hvc_chars.
Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 030ffad2
...@@ -41,29 +41,14 @@ int hvc_get_chars(uint32_t vtermno, char *buf, int count) ...@@ -41,29 +41,14 @@ int hvc_get_chars(uint32_t vtermno, char *buf, int count)
unsigned long got; unsigned long got;
if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got, if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got,
(unsigned long *)buf, (unsigned long *)buf+1) == H_Success) { (unsigned long *)buf, (unsigned long *)buf+1) == H_Success)
/*
* Work around a HV bug where it gives us a null
* after every \r. -- paulus
*/
if (got > 0) {
int i;
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; return got;
}
return 0; return 0;
} }
EXPORT_SYMBOL(hvc_get_chars); EXPORT_SYMBOL(hvc_get_chars);
/** /**
* hvc_put_chars: send characters to firmware for denoted vterm adapter * hvc_put_chars: send characters to firmware for denoted vterm adapter
* @vtermno: The vtermno or unit_address of the adapter from which the data * @vtermno: The vtermno or unit_address of the adapter from which the data
......
...@@ -43,8 +43,30 @@ static struct vio_device_id hvc_driver_table[] __devinitdata = { ...@@ -43,8 +43,30 @@ static struct vio_device_id hvc_driver_table[] __devinitdata = {
}; };
MODULE_DEVICE_TABLE(vio, hvc_driver_table); 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 = { static struct hv_ops hvc_get_put_ops = {
.get_chars = hvc_get_chars, .get_chars = filtered_get_chars,
.put_chars = hvc_put_chars, .put_chars = hvc_put_chars,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment