From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/4] printf: define printk/no_printk in terms of prints
Date: Fri, 28 Nov 2025 13:50:02 +0100 [thread overview]
Message-ID: <20251128125616.136559-1-a.fatoum@pengutronix.de> (raw)
We will later move printk into its own header while giving it more
Linux-like semantics. Prepare for that by defining no_printf, so users
across the tree can make use of it without including <linux/printk.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/printf.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/printf.h b/include/printf.h
index d111afacb63e..58793bc067dc 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -30,19 +30,20 @@ static inline __printf(1, 2) int printf(const char *fmt, ...)
void __noreturn panic(const char *fmt, ...) __printf(1, 2);
void __noreturn panic_no_stacktrace(const char *fmt, ...) __printf(1, 2);
-#define printk printf
-
/*
- * Dummy printk for disabled debugging statements to use whilst maintaining
+ * Dummy printf for disabled debugging statements to use whilst maintaining
* gcc's format checking.
*/
-#define no_printk(fmt, ...) \
+#define no_printf(fmt, ...) \
({ \
if (0) \
printk(fmt, ##__VA_ARGS__); \
0; \
})
+#define printk printf
+#define no_printk no_printf
+
enum {
DUMP_PREFIX_NONE,
DUMP_PREFIX_ADDRESS,
--
2.47.3
next reply other threads:[~2025-11-28 12:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 12:50 Ahmad Fatoum [this message]
2025-11-28 12:50 ` [PATCH 2/4] bug: add support for CONFIG_DEBUG_BUGVERBOSE Ahmad Fatoum
2025-11-28 12:50 ` [PATCH 3/4] include: move sprintf prototypes to new linux/sprintf.h Ahmad Fatoum
2025-11-28 12:50 ` [PATCH 4/4] console: move non-stdio elements to console.h Ahmad Fatoum
2025-12-01 10:22 ` [PATCH 1/4] printf: define printk/no_printk in terms of prints Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251128125616.136559-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox