summaryrefslogtreecommitdiff
path: root/arch/x86/lib/misc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 05:41:10 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 05:41:10 +0400
commit014d595c23f33dd8e2a996cc62239fb279047f1b (patch)
tree2bd1ef0341423de2cd312de7407dd9afb59c4e49 /arch/x86/lib/misc.c
parentae795fe760e20a7c6ad0f2cd24fc31afad73f427 (diff)
parenta17bce4d1dce8f3cf714bc2e5d8e4bac009dc077 (diff)
downloadlinux-014d595c23f33dd8e2a996cc62239fb279047f1b.tar.xz
Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 boot changes from Ingo Molnar: "Two changes that prettify and compactify the SMP bootup output from: smpboot: Booting Node 0, Processors #1 #2 #3 OK smpboot: Booting Node 1, Processors #4 #5 #6 #7 OK smpboot: Booting Node 2, Processors #8 #9 #10 #11 OK smpboot: Booting Node 3, Processors #12 #13 #14 #15 OK Brought up 16 CPUs to something like: x86: Booting SMP configuration: .... node #0, CPUs: #1 #2 #3 .... node #1, CPUs: #4 #5 #6 #7 .... node #2, CPUs: #8 #9 #10 #11 .... node #3, CPUs: #12 #13 #14 #15 x86: Booted up 4 nodes, 16 CPUs" * 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot: Further compress CPUs bootup message x86: Improve the printout of the SMP bootup CPU table
Diffstat (limited to 'arch/x86/lib/misc.c')
-rw-r--r--arch/x86/lib/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/lib/misc.c b/arch/x86/lib/misc.c
new file mode 100644
index 000000000000..76b373af03f0
--- /dev/null
+++ b/arch/x86/lib/misc.c
@@ -0,0 +1,21 @@
+/*
+ * Count the digits of @val including a possible sign.
+ *
+ * (Typed on and submitted from hpa's mobile phone.)
+ */
+int num_digits(int val)
+{
+ int m = 10;
+ int d = 1;
+
+ if (val < 0) {
+ d++;
+ val = -val;
+ }
+
+ while (val >= m) {
+ m *= 10;
+ d++;
+ }
+ return d;
+}