在 2024/4/5 1:59, Jason Gunthorpe 写道:
On Thu, Apr 04, 2024 at 08:03:35PM +0200, Zhu Yanjun wrote:
Because this driver will finally call printk function to output the logs,
the header file include/linux/printk.h needs be included.
In include/linux/printk.h, pr_fmt is defined.
This doesn't make sense, printk.h has:
#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif
Before or after printk.h should not have an impact.
Sorry. The previous mail is not sent successfully. I resend it.
#ifndef pr_fmt
...
#endif
The above will not undefine pr_fmt.
#undef pr_fmt will undefine pr_fmt.
This link explains the above in details.
https://www.techonthenet.com/c_language/directives/ifndef.php
Why would you want to undefine it? The point is to #define it to the
rxe specific value. If it is already set to the rxe specific value
before including printk.h then it will work fine?
Got your point. There are about more 130 header files that define pr_fmt
in the kernel include directory. And these header files are included one
another. Is there any tool to clarify the including relationship between
these header files?
Thanks a lot
Zhu Yanjun
Jason