Skip to content

Commit e56fc58

Browse files
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.
1 parent 7f88a37 commit e56fc58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/example_atomic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void atomic_bitwise(void)
5050
pr_info("Bits 4: " BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(word));
5151

5252
word = 255;
53-
pr_info("Bits 5: " BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(word));
53+
pr_info("Bits 5: " BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(word));
5454
}
5555

5656
static int __init example_atomic_init(void)

0 commit comments

Comments
 (0)