From: Simon Glass <simon.glass@canonical.com>
The ext4l code defines pr_warn_once(), printk_ratelimited(), and
pr_notice_ratelimited() locally instead of in the common printk header.
Move these macros to linux/printk.h where they belong with the other
printk macros. Also add additional _once and _ratelimited variants for
consistency.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 8 +++-----
include/linux/printk.h | 11 +++++++++++
2 files changed, 14 insertions(+), 5 deletions(-)
@@ -936,7 +936,7 @@ struct dx_hash_info {
/* BUILD_BUG_ON is in linux/build_bug.h */
/* WARN_ON, WARN_ON_ONCE, WARN_ONCE are in linux/bug.h */
-#define pr_warn_once(fmt, ...) do { } while (0)
+/* pr_warn_once is in linux/printk.h */
/* lockdep stubs */
#define lockdep_assert_held_read(l) do { (void)(l); } while (0)
@@ -2435,8 +2435,7 @@ struct folio_iter {
/* xchg - exchange value atomically */
#define xchg(ptr, new) ({ typeof(*(ptr)) __old = *(ptr); *(ptr) = (new); __old; })
-/* printk_ratelimited - just use regular printk */
-#define printk_ratelimited(fmt, ...) do { } while (0)
+/* printk_ratelimited is in linux/printk.h */
/* mapping_set_error - record error in address_space */
#define mapping_set_error(m, e) do { (void)(m); (void)(e); } while (0)
@@ -2635,8 +2634,7 @@ int bh_read(struct buffer_head *bh, int flags);
#define free_pages(addr, order) free((void *)(addr))
#define get_order(size) ilog2(roundup_pow_of_two((size) / PAGE_SIZE))
-/* Ratelimited printk for journal.c */
-#define pr_notice_ratelimited(fmt, ...) pr_notice(fmt, ##__VA_ARGS__)
+/* pr_notice_ratelimited is in linux/printk.h */
/*
* Stubs for mmp.c
@@ -84,6 +84,17 @@
#define printk_once(fmt, ...) \
printk(fmt, ##__VA_ARGS__)
+/* _once variants - just call the base function (no actual once tracking) */
+#define pr_warn_once(fmt, ...) pr_warn(fmt, ##__VA_ARGS__)
+#define pr_info_once(fmt, ...) pr_info(fmt, ##__VA_ARGS__)
+#define pr_notice_once(fmt, ...) pr_notice(fmt, ##__VA_ARGS__)
+
+/* _ratelimited variants - just call the base function (no rate limiting) */
+#define printk_ratelimited(fmt, ...) printk(fmt, ##__VA_ARGS__)
+#define pr_notice_ratelimited(fmt, ...) pr_notice(fmt, ##__VA_ARGS__)
+#define pr_warn_ratelimited(fmt, ...) pr_warn(fmt, ##__VA_ARGS__)
+#define pr_err_ratelimited(fmt, ...) pr_err(fmt, ##__VA_ARGS__)
+
struct va_format {
const char *fmt;
va_list *va;