I would like to prefix my drivers (debug) output with its name, i.e. [myDriver] Actual message
. Since it is tiresome to write printk(level NAMEMACRO "Actual message\n")
every time I was thinking of overwriting printk
/pr_*
to actually include the [myDriver]
part. However I can not think of a way to do this. In the best case the solution would not force me to change the printk
/pr_*
calls in the code (With changed calls this becomes trivial).
Is this possible? (Since I included other headers which in turn include the printk
header it will always be defined this rules out not linking to the original as suggested in a different so answer)
Are there any reasons why current drivers do not at this to the text? (Is there another way to filter dmesg by driver?)
I am somewhat aware of dev_dbg
but I have not found anything dev specific for warnings in general so I will use printk
/pr_err
for that.