Commit bf73bd35 authored by Stephen Boyd's avatar Stephen Boyd Committed by Greg Kroah-Hartman

hvc_dcc: Simplify put_chars()/get_chars() loops

Casting and anding with 0xff is unnecessary in
hvc_dcc_put_chars() since buf is already a char[].
__dcc_get_char() can't return an int less than 0 since it only
returns a char. Simplify the if statement in hvc_dcc_get_chars()
to take this into account.

Cc: Daniel Walker <dwalker@codeaurora.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a9963201
...@@ -89,7 +89,7 @@ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count) ...@@ -89,7 +89,7 @@ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
while (__dcc_getstatus() & DCC_STATUS_TX) while (__dcc_getstatus() & DCC_STATUS_TX)
cpu_relax(); cpu_relax();
__dcc_putchar((char)(buf[i] & 0xFF)); __dcc_putchar(buf[i]);
} }
return count; return count;
...@@ -99,15 +99,11 @@ static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count) ...@@ -99,15 +99,11 @@ static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
{ {
int i; int i;
for (i = 0; i < count; ++i) { for (i = 0; i < count; ++i)
int c = -1;
if (__dcc_getstatus() & DCC_STATUS_RX) if (__dcc_getstatus() & DCC_STATUS_RX)
c = __dcc_getchar(); buf[i] = __dcc_getchar();
if (c < 0) else
break; break;
buf[i] = c;
}
return i; return i;
} }
......
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