aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@kernel.org>2015-12-04 14:24:40 -0800
committerLuis R. Rodriguez <mcgrof@kernel.org>2016-02-11 08:42:16 -0800
commit373e2ea4a0176319158d868617a98aa0fceb10b8 (patch)
tree3e8bd1aa104458b5c064ad45051dc804dff6d862
parente1ec5ade0a8cdb3e1adf2b4e33b4a4e112c529f5 (diff)
downloadlinker-tables-373e2ea4a0176319158d868617a98aa0fceb10b8.tar.gz
kernel.h: add pr_info()
This will make it easier to place code from this mockup code upstream, and likewise to later update this mockup project with upstream code. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
-rw-r--r--init.c14
-rw-r--r--kasan.c4
-rw-r--r--kernel.h2
-rw-r--r--sort-init.c8
-rw-r--r--start_kernel.c2
-rw-r--r--tables.h2
-rw-r--r--x86.c14
7 files changed, 24 insertions, 22 deletions
diff --git a/init.c b/init.c
index d4db485..566e279 100644
--- a/init.c
+++ b/init.c
@@ -9,7 +9,7 @@
static bool x86_init_supports_subarch(struct x86_init_fn *fn)
{
if (!fn->supp_hardware_subarch) {
- printf("Init sequence fails to declares supported subarchs: %s\n", fn->name);
+ pr_info("Init sequence fails to declares supported subarchs: %s\n", fn->name);
WARN_ON(1);
}
if (BIT(boot_params.hdr.hardware_subarch) & fn->supp_hardware_subarch)
@@ -24,7 +24,7 @@ void early_init(void)
unsigned int num_inits = table_num_entries(X86_INIT_FNS);
- printf("Number of init entries: %d\n", num_inits);
+ pr_info("Number of init entries: %d\n", num_inits);
for_each_table_entry(init_fn, X86_INIT_FNS) {
if (!x86_init_supports_subarch(init_fn))
@@ -39,9 +39,9 @@ void early_init(void)
if (init_fn->flags & INIT_DETECTED) {
init_fn->flags |= INIT_DETECTED;
- printf("Initializing %s ...\n", init_fn->name);
+ pr_info("Initializing %s ...\n", init_fn->name);
init_fn->early_init();
- printf("Completed initializing %s !\n", init_fn->name);
+ pr_info("Completed initializing %s !\n", init_fn->name);
if (init_fn->flags & INIT_FINISH_IF_DETECTED)
break;
}
@@ -54,9 +54,9 @@ void late_init(void)
for_each_table_entry(init_fn, X86_INIT_FNS) {
if ((init_fn->flags & INIT_DETECTED) && init_fn->late_init) {
- printf("Running late init for %s ...\n", init_fn->name);
+ pr_info("Running late init for %s ...\n", init_fn->name);
init_fn->late_init();
- printf("Completed late initializing of %s !\n", init_fn->name);
+ pr_info("Completed late initializing of %s !\n", init_fn->name);
}
}
}
@@ -67,7 +67,7 @@ void setup_arch_init(void)
for_each_table_entry(init_fn, X86_INIT_FNS) {
if ((init_fn->flags & INIT_DETECTED) && init_fn->setup_arch) {
- printf("Running setup_arch for %s ...\n", init_fn->name);
+ pr_info("Running setup_arch for %s ...\n", init_fn->name);
init_fn->setup_arch();
}
}
diff --git a/kasan.c b/kasan.c
index 370bcd6..92f0e6f 100644
--- a/kasan.c
+++ b/kasan.c
@@ -6,12 +6,12 @@
#include "bootparam.h"
void kasan_early_init(void) {
- printf("Early init for Kasan...\n");
+ pr_info("Early init for Kasan...\n");
}
void kasan_init(void)
{
- printf("Calling setup_arch work for Kasan...\n");
+ pr_info("Calling setup_arch work for Kasan...\n");
}
X86_INIT_EARLY_PC(kasan, NULL, NULL, kasan_early_init, kasan_init, NULL);
diff --git a/kernel.h b/kernel.h
index 5fa76a7..9ffc05c 100644
--- a/kernel.h
+++ b/kernel.h
@@ -2,6 +2,8 @@
#define BIT(nr) (1UL << (nr))
+#define pr_info(fmt, ...) printf(fmt, ##__VA_ARGS__)
+
#define BUG() do { \
fprintf(stderr, "----------------------------------------------------------\n"); \
fprintf (stderr, "BUG on %s at %s: %i\n", __func__, __FILE__, __LINE__); \
diff --git a/sort-init.c b/sort-init.c
index 6765bd3..3450a4b 100644
--- a/sort-init.c
+++ b/sort-init.c
@@ -1,4 +1,4 @@
-#include <stdio.h> /* for NULL and printf */
+#include <stdio.h> /* for NULL and pr_info */
#include <string.h> /* for memmove */
#include "x86_init_fn.h"
@@ -56,7 +56,7 @@ void check_table_entries(struct x86_init_fn *start,
q = find_dependents_of(start, finish, p);
x = find_dependents_of(start, finish, q);
if (p == x) {
- printf("CYCLIC DEPENDENCY FOUND! %pS depends on %pS and vice-versa. BREAKING IT.\n",
+ pr_info("CYCLIC DEPENDENCY FOUND! %pS depends on %pS and vice-versa. BREAKING IT.\n",
p->name, q->name);
/* Heavy handed way..*/
x->depend = 0;
@@ -86,7 +86,7 @@ void check_table_entries(struct x86_init_fn *start,
*/
q = find_dependents_of(start, finish, p);
if (q && q > p) {
- printf("EXECUTION ORDER INVALID! %s should be called before %s!\n",
+ pr_info("EXECUTION ORDER INVALID! %s should be called before %s!\n",
p->name, q->name);
}
@@ -96,7 +96,7 @@ void check_table_entries(struct x86_init_fn *start,
* strong semantics, so lets avoid these.
*/
if (q && q->order_level > p->order_level) {
- printf("INVALID ORDER LEVEL! %s should have an order level <= be called before %s!\n",
+ pr_info("INVALID ORDER LEVEL! %s should have an order level <= be called before %s!\n",
p->name, q->name);
}
}
diff --git a/start_kernel.c b/start_kernel.c
index 52ff8e5..a409926 100644
--- a/start_kernel.c
+++ b/start_kernel.c
@@ -5,7 +5,7 @@
void start_kernel(void)
{
- printf("Calling start_kernel()...\n");
+ pr_info("Calling start_kernel()...\n");
setup_arch();
late_init();
diff --git a/tables.h b/tables.h
index 3a5b06a..6fa9174 100644
--- a/tables.h
+++ b/tables.h
@@ -142,7 +142,7 @@
* struct frob *frob;
*
* for_each_table(frob, FROBNICATORS) {
- * printf("Calling frobnicator \"%s\"\n", frob->name);
+ * pr_info("Calling frobnicator \"%s\"\n", frob->name);
* frob->frob();
* }
* }
diff --git a/x86.c b/x86.c
index ce2adbf..2d1cfda 100644
--- a/x86.c
+++ b/x86.c
@@ -15,22 +15,22 @@ void x86_64_start_reservations(void)
{
switch (boot_params.hdr.hardware_subarch) {
case X86_SUBARCH_PC:
- printf("Booting bare metal\n");
+ pr_info("Booting bare metal\n");
break;
case X86_SUBARCH_LGUEST:
- printf("Booting lguest not supported\n");
+ pr_info("Booting lguest not supported\n");
BUG();
case X86_SUBARCH_XEN:
- printf("Booting a Xen guest\n");
+ pr_info("Booting a Xen guest\n");
break;
case X86_SUBARCH_INTEL_MID:
- printf("Booting Intel MID not supported\n");
+ pr_info("Booting Intel MID not supported\n");
BUG();
case X86_SUBARCH_CE4100:
- printf("Booting Intel CE4100 not supported\n");
+ pr_info("Booting Intel CE4100 not supported\n");
BUG();
default:
- printf("Booting sunsupported x86 hardware subarch\n");
+ pr_info("Booting sunsupported x86 hardware subarch\n");
BUG();
}
@@ -49,7 +49,7 @@ static void x86_64_start_kernel(void)
void startup_64(void)
{
- printf("Initializing x86 bare metal world\n");
+ pr_info("Initializing x86 bare metal world\n");
x86_64_start_kernel();
}