mirror of
https://github.com/sysprog21/lkmpg.git
synced 2025-03-13 14:05:10 +08:00
Add newline to last pr_info to force dmesg to flush
dmesg only flushes when it encounter a newline. Without a newline, the line is held in memory pending another printk. In this particular example (example_atomic.c), the last pr_info in atomic_bitwise() prints when another printk happens (either by another module, or __exit for this module. This can be confusing to new learner. This patch adds a newline to the last pr_info forcing dmesg to print to the screen when the module is loaded.
This commit is contained in:
parent
7f88a37f09
commit
e56fc58bf3
@ -50,7 +50,7 @@ static void atomic_bitwise(void)
|
|||||||
pr_info("Bits 4: " BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(word));
|
pr_info("Bits 4: " BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(word));
|
||||||
|
|
||||||
word = 255;
|
word = 255;
|
||||||
pr_info("Bits 5: " BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(word));
|
pr_info("Bits 5: " BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(word));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init example_atomic_init(void)
|
static int __init example_atomic_init(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user