In Linux kernel or device drivers if you are using printk, by default every message we pass with printk is printed on new line.
The simple example, here we want to print the every character of array on single line, but by default if we use below code, it would print each character on new line.
char simplearray[10] = ['H', 'E', 'L', 'L', 'O', 'W', 'O', 'R', 'L', 'D', '\0'];
for (i=0, i<strlen(simplearray), i++) {
printk("%c", simplearray[i]);
}
But we want all the characters on single line. In this situation, KERN_CONT comes to help us. So, if we modify above printk using KERN_CONT as,
for (i=0, i<strlen(simplearray), i++) {
printk(KERN_CONT "%c", simplearray[i]);
}
Now, the above printk will print all the characters on single line as HELLOWORLD
Reference : https://lwn.net/Articles/732420/
The KERN_CONT “log level” is meant to indicate a continuation line; a printk() that lacks that flag is supposed to start a new line in the log. If you want to continue a line, you NEED to use KERN_CONT.