linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup
@ 2012-05-27 16:48 Shuah Khan
  2012-05-27 20:51 ` Joe Perches
  0 siblings, 1 reply; 10+ messages in thread
From: Shuah Khan @ 2012-05-27 16:48 UTC (permalink / raw)
  To: tglx, mingo, hpa; +Cc: shuahkhan, x86, LKML

Change early_serial_init() to call kstrtoul() instead of calling obsoleted
simple_strtoul().

Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
---
 arch/x86/kernel/early_printk.c |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 9b9f18b..a078f4d 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -119,22 +119,27 @@ static __init void early_serial_init(char *s)
 	unsigned char c;
 	unsigned divisor;
 	unsigned baud = DEFAULT_BAUD;
-	char *e;
+	unsigned long val;
+	ssize_t ret;
 
 	if (*s == ',')
 		++s;
 
 	if (*s) {
-		unsigned port;
+		unsigned port = 0;
 		if (!strncmp(s, "0x", 2)) {
-			early_serial_base = simple_strtoul(s, &e, 16);
+			ret = kstrtoul(s, 16, &val);
+			if (!ret)
+				early_serial_base = val;
 		} else {
 			static const int __initconst bases[] = { 0x3f8, 0x2f8 };
 
 			if (!strncmp(s, "ttyS", 4))
 				s += 4;
-			port = simple_strtoul(s, &e, 10);
-			if (port > 1 || s == e)
+			ret = kstrtoul(s, 10, &val);
+			if (!ret)
+				port = val;
+			if (port > 1)
 				port = 0;
 			early_serial_base = bases[port];
 		}
@@ -149,8 +154,10 @@ static __init void early_serial_init(char *s)
 	outb(0x3, early_serial_base + MCR);	/* DTR + RTS */
 
 	if (*s) {
-		baud = simple_strtoul(s, &e, 0);
-		if (baud == 0 || s == e)
+		ret = kstrtoul(s, 0, &val);
+		if (!ret)
+			baud = val;
+		if (baud == 0)
 			baud = DEFAULT_BAUD;
 	}
 
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-07-22 13:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 16:48 [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup Shuah Khan
2012-05-27 20:51 ` Joe Perches
2012-05-29 20:41   ` Shuah Khan
2012-05-31  0:40     ` [PATCH RESEND] " Shuah Khan
2012-06-06 15:15       ` [tip:x86/cleanups] x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint() tip-bot for Shuah Khan
2012-06-22 14:24         ` Ingo Molnar
2012-06-25 17:17           ` Shuah Khan
2012-06-29 12:50             ` Ingo Molnar
2012-06-22 14:40       ` [tip:x86/cleanups] Revert "x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()" tip-bot for Ingo Molnar
2012-07-22 13:58       ` [tip:x86/platform] " tip-bot for Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).