From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/3] include: printk: retire printk_once for pr_debug_once
Date: Thu, 2 Feb 2023 13:57:38 +0100 [thread overview]
Message-ID: <20230202125738.233147-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230202125738.233147-1-a.fatoum@pengutronix.de>
printk is just printf and KERN_DEBUG is just "", so printk_once(KERN_DEBUG
doesn't do what's promised. Replace instead with pr_debug_once, which
does what one would expect.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/printk.h | 10 ----------
lib/list_sort.c | 5 ++---
scripts/bareboxenv.c | 2 +-
3 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/include/printk.h b/include/printk.h
index 90c45afd9fc7..6f8635fae2c0 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -31,16 +31,6 @@ void __attribute__((noreturn)) panic(const char *fmt, ...);
#define printk printf
-#define printk_once(fmt, ...) \
-({ \
- static bool __print_once ; \
- \
- if (!__print_once) { \
- __print_once = true; \
- printk(fmt, ##__VA_ARGS__); \
- } \
-})
-
enum {
DUMP_PREFIX_NONE,
DUMP_PREFIX_ADDRESS,
diff --git a/lib/list_sort.c b/lib/list_sort.c
index 77ddadb3d6ac..eea87f834ca4 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -4,6 +4,7 @@
#include <linux/kernel.h>
#define EXPORT_SYMBOL(x)
#else
+#define pr_fmt(fmt) "list_sort: " fmt
#include <common.h>
#include <malloc.h>
#endif
@@ -129,9 +130,7 @@ void list_sort(void *priv, struct list_head *head,
}
if (lev > max_lev) {
if (unlikely(lev >= ARRAY_SIZE(part)-1)) {
- printk_once(KERN_DEBUG "list passed to"
- " list_sort() too long for"
- " efficiency\n");
+ pr_debug_once("list passed to too long for efficient sorting\n");
lev--;
}
max_lev = lev;
diff --git a/scripts/bareboxenv.c b/scripts/bareboxenv.c
index f1706a5e175b..e954447015c5 100644
--- a/scripts/bareboxenv.c
+++ b/scripts/bareboxenv.c
@@ -20,7 +20,7 @@
#include "compiler.h"
#define debug(...)
-#define printk_once(...)
+#define pr_debug_once(...)
/* Find out if the last character of a string matches the one given.
* Don't underrun the buffer if the string length is 0.
--
2.30.2
prev parent reply other threads:[~2023-02-02 12:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 12:57 [PATCH master 1/3] include: linux/printk: implement pr_*_once macros Ahmad Fatoum
2023-02-02 12:57 ` [PATCH master 2/3] fs: tftp: print message when NIC can't keep us with TFTP windowsize Ahmad Fatoum
2023-02-02 12:57 ` Ahmad Fatoum [this message]
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=20230202125738.233147-3-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