From a64d55a819fa39752c8a6eb821e704139b8a7151 Mon Sep 17 00:00:00 2001 From: hasslesstech Date: Sun, 1 Dec 2024 19:06:10 +0200 Subject: [PATCH] replace printk calls with pr_ macros --- hello1.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hello1.c b/hello1.c index ac30d84..3a455a2 100644 --- a/hello1.c +++ b/hello1.c @@ -76,7 +76,7 @@ static struct TimingList* add_new_node(struct TimingList *tail) static void print_time_diff(struct TimingList *node) { - printk(KERN_EMERG "%lld\n", node->t_after - node->t_before); + pr_info("%lld\n", node->t_after - node->t_before); } void destroy_list(void) @@ -98,14 +98,12 @@ void destroy_list(void) static int __init hello_init(void) { if (msg_count > 10) { - printk(KERN_EMERG "Error: msg_count too large (%d > 10)\n", - msg_count); + pr_err("Error: msg_count too large (%d > 10)\n", msg_count); return -EINVAL; } if (msg_count == 0 || msg_count >= 5) { - printk(KERN_EMERG "Warning: msg_count = %d (msg_count == 0 or 5 <= msg_count <= 10)\n", - msg_count); + pr_warn("Warning: msg_count = %d (msg_count == 0 or 5 <= msg_count <= 10)\n", msg_count); } return 0; @@ -120,7 +118,7 @@ void print_hello(void) current_tail = add_new_node(current_tail); current_tail->t_before = ktime_get(); - printk(KERN_EMERG "Hello, world!\n"); + pr_info("Hello, world!\n"); current_tail->t_after = ktime_get(); } }