git: 1847e63d63f4 - main - LinuxKPI: add no_printk
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Sep 2024 13:28:04 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1847e63d63f440cfcb2f4ee2c2ee8990f0272d88 commit 1847e63d63f440cfcb2f4ee2c2ee8990f0272d88 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2024-08-27 21:12:08 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2024-08-31 21:36:01 +0000 LinuxKPI: add no_printk Add a version of no_printk(), which seems to be there to have format string checking while never calling the printk. It seems a very weird thing and it needs a return code and for some reason my initial while (0) { } version hadn't worked while porting over new code but could have been further downstream format string problems. if (0) seems to do the job though I would have expected that to more likely simply get optimised out without any futher format checking. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D46463 --- sys/compat/linuxkpi/common/include/linux/printk.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/printk.h b/sys/compat/linuxkpi/common/include/linux/printk.h index 933d5aa6f94a..3840a6e5fb8a 100644 --- a/sys/compat/linuxkpi/common/include/linux/printk.h +++ b/sys/compat/linuxkpi/common/include/linux/printk.h @@ -125,4 +125,11 @@ print_hex_dump_bytes(const char *prefix_str, const int prefix_type, #define pr_info_ratelimited(fmt, ...) \ printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) +#define no_printk(fmt, ...) \ +({ \ + if (0) \ + printk(pr_fmt(fmt), ##__VA_ARGS__); \ + 0; \ +}) + #endif /* _LINUXKPI_LINUX_PRINTK_H_ */