From: Petr Mladek <pmladek@suse.com>
To: Chris Down <chris@chrisdown.name>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: [PATCH] printk/documentation: Update printk()/_printk() documentation
Date: Fri, 23 Jul 2021 13:09:42 +0200 [thread overview]
Message-ID: <YPqjdqSH5j69FnHV@alley> (raw)
In-Reply-To: <YPbABBSTkN+xNY0w@chrisdown.name>
The commit 337015573718b161 ("printk: Userspace format indexing support")
caused the following warning when building htmldocs:
kernel/printk/printk.c:1: warning: 'printk' not found
The problem is that printk() became a macro that is defined
in include/linux/printk.h instead of kernel/printk.c. The original
function was renamed to _printk().
Fixes: 337015573718b161 ("printk: Userspace format indexing support")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/YPbBfdz9srIpI+bb@chrisdown.name
---
This should do the trick. I do not longer see the warning.
Documentation/core-api/printk-basics.rst | 6 +++---
include/linux/printk.h | 12 ++++++++++++
kernel/printk/printk.c | 3 ++-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/Documentation/core-api/printk-basics.rst b/Documentation/core-api/printk-basics.rst
index 965e4281eddd..3160a73c27b1 100644
--- a/Documentation/core-api/printk-basics.rst
+++ b/Documentation/core-api/printk-basics.rst
@@ -108,8 +108,8 @@ Function reference
==================
.. kernel-doc:: kernel/printk/printk.c
- :functions: printk
+ :functions: _printk
.. kernel-doc:: include/linux/printk.h
- :functions: pr_emerg pr_alert pr_crit pr_err pr_warn pr_notice pr_info
- pr_fmt pr_debug pr_devel pr_cont
+ :functions: printk pr_emerg pr_alert pr_crit pr_err pr_warn
+ pr_notice pr_info pr_fmt pr_debug pr_devel pr_cont
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 2651b82ed352..e0e3411db67b 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -431,6 +431,18 @@ struct pi_entry {
})
+/**
+ * printk - Print a message
+ * @fmt: format string
+ * @...: arguments for the format string
+ *
+ * This macro generates metadata for printk indexing and prints the message
+ * using _printk(). It uses pr_fmt() to generate the format string.
+ *
+ * The default log level is used when a particular one is not part of
+ * the message prefix. pr_<level>() macros are preferred because each
+ * caller should know the exact purpose of the message.
+ */
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
#define printk_deferred(fmt, ...) \
printk_index_wrap(_printk_deferred, fmt, ##__VA_ARGS__)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 765f7af6ce56..2e5559175214 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2187,7 +2187,8 @@ EXPORT_SYMBOL_GPL(vprintk_default);
* _printk - print a kernel message
* @fmt: format string
*
- * This is _printk(). It can be called from any context. We want it to work.
+ * This is printk() implementation. It can be called from any context.
+ * We want it to work.
*
* If printk indexing is enabled, _printk() is called from printk_index_wrap.
* Otherwise, printk is simply #defined to _printk.
--
2.26.2
next prev parent reply other threads:[~2021-07-23 11:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-20 6:24 linux-next: build warning after merge of the printk tree Stephen Rothwell
2021-07-20 12:18 ` Chris Down
2021-07-20 12:22 ` Chris Down
2021-07-23 11:09 ` Petr Mladek [this message]
2021-07-23 11:24 ` [PATCH] printk/documentation: Update printk()/_printk() documentation Petr Mladek
2021-07-25 21:16 ` linux-next: build warning after merge of the printk tree Jonathan Corbet
2021-07-26 12:28 ` Petr Mladek
2021-07-26 13:07 ` Chris Down
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=YPqjdqSH5j69FnHV@alley \
--to=pmladek@suse.com \
--cc=chris@chrisdown.name \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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