[PATCH 2/3] hvc_dcc: Simplify put_chars()/get_chars() loops

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stephen Boyd
Date: Monday, December 20, 2010 - 1:08 pm

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: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/char/hvc_dcc.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/char/hvc_dcc.c b/drivers/char/hvc_dcc.c
index 155ec10..ad23cc8 100644
--- a/drivers/char/hvc_dcc.c
+++ b/drivers/char/hvc_dcc.c
@@ -89,7 +89,7 @@ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
 		while (__dcc_getstatus() & DCC_STATUS_TX)
 			cpu_relax();
 
-		__dcc_putchar((char)(buf[i] & 0xFF));
+		__dcc_putchar(buf[i]);
 	}
 
 	return count;
@@ -99,15 +99,11 @@ static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
 {
 	int i;
 
-	for (i = 0; i < count; ++i) {
-		int c = -1;
-
+	for (i = 0; i < count; ++i)
 		if (__dcc_getstatus() & DCC_STATUS_RX)
-			c = __dcc_getchar();
-		if (c < 0)
+			buf[i] = __dcc_getchar();
+		else
 			break;
-		buf[i] = c;
-	}
 
 	return i;
 }
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] hvc_dcc: Simplify assembly for v6 and v7 ARM, Stephen Boyd, (Fri Dec 17, 10:16 pm)
Re: [PATCH] hvc_dcc: Simplify assembly for v6 and v7 ARM, Daniel Walker, (Mon Dec 20, 10:51 am)
Re: [PATCH] hvc_dcc: Simplify assembly for v6 and v7 ARM, Stephen Boyd, (Mon Dec 20, 11:39 am)
Re: [PATCH] hvc_dcc: Simplify assembly for v6 and v7 ARM, Nicolas Pitre, (Mon Dec 20, 11:46 am)
[PATCH 0/3] hvc_dcc cleanups and fixes, Stephen Boyd, (Mon Dec 20, 1:08 pm)
[PATCH 2/3] hvc_dcc: Simplify put_chars()/get_chars() loops, Stephen Boyd, (Mon Dec 20, 1:08 pm)