Skip to content

Commit 7d9e266

Browse files
Jonathan Corbetpmladek
authored andcommitted
printk: Move the printk() kerneldoc comment to its new home
Commit 3370155 ("printk: Userspace format indexing support") turned printk() into a macro, but left the kerneldoc comment for it with the (now) _printk() function, resulting in this docs-build warning: kernel/printk/printk.c:1: warning: 'printk' not found Move the kerneldoc comment back next to the (now) macro it's meant to describe and have the docs build find it there. Fixes: 3370155 ("printk: Userspace format indexing support") Signed-off-by: Jonathan Corbet <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0f0aa84 commit 7d9e266

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

Documentation/core-api/printk-basics.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ also ``CONFIG_DYNAMIC_DEBUG`` in the case of pr_debug()) is defined.
107107
Function reference
108108
==================
109109

110-
.. kernel-doc:: kernel/printk/printk.c
111-
:functions: printk
112-
113110
.. kernel-doc:: include/linux/printk.h
114-
:functions: pr_emerg pr_alert pr_crit pr_err pr_warn pr_notice pr_info
111+
:functions: printk pr_emerg pr_alert pr_crit pr_err pr_warn pr_notice pr_info
115112
pr_fmt pr_debug pr_devel pr_cont

include/linux/printk.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,30 @@ struct pi_entry {
431431
})
432432

433433

434+
/**
435+
* printk - print a kernel message
436+
* @fmt: format string
437+
*
438+
* This is printk(). It can be called from any context. We want it to work.
439+
*
440+
* If printk indexing is enabled, _printk() is called from printk_index_wrap.
441+
* Otherwise, printk is simply #defined to _printk.
442+
*
443+
* We try to grab the console_lock. If we succeed, it's easy - we log the
444+
* output and call the console drivers. If we fail to get the semaphore, we
445+
* place the output into the log buffer and return. The current holder of
446+
* the console_sem will notice the new output in console_unlock(); and will
447+
* send it to the consoles before releasing the lock.
448+
*
449+
* One effect of this deferred printing is that code which calls printk() and
450+
* then changes console_loglevel may break. This is because console_loglevel
451+
* is inspected when the actual printing occurs.
452+
*
453+
* See also:
454+
* printf(3)
455+
*
456+
* See the vsnprintf() documentation for format string extensions over C99.
457+
*/
434458
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
435459
#define printk_deferred(fmt, ...) \
436460
printk_index_wrap(_printk_deferred, fmt, ##__VA_ARGS__)

kernel/printk/printk.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,30 +2183,6 @@ int vprintk_default(const char *fmt, va_list args)
21832183
}
21842184
EXPORT_SYMBOL_GPL(vprintk_default);
21852185

2186-
/**
2187-
* _printk - print a kernel message
2188-
* @fmt: format string
2189-
*
2190-
* This is _printk(). It can be called from any context. We want it to work.
2191-
*
2192-
* If printk indexing is enabled, _printk() is called from printk_index_wrap.
2193-
* Otherwise, printk is simply #defined to _printk.
2194-
*
2195-
* We try to grab the console_lock. If we succeed, it's easy - we log the
2196-
* output and call the console drivers. If we fail to get the semaphore, we
2197-
* place the output into the log buffer and return. The current holder of
2198-
* the console_sem will notice the new output in console_unlock(); and will
2199-
* send it to the consoles before releasing the lock.
2200-
*
2201-
* One effect of this deferred printing is that code which calls printk() and
2202-
* then changes console_loglevel may break. This is because console_loglevel
2203-
* is inspected when the actual printing occurs.
2204-
*
2205-
* See also:
2206-
* printf(3)
2207-
*
2208-
* See the vsnprintf() documentation for format string extensions over C99.
2209-
*/
22102186
asmlinkage __visible int _printk(const char *fmt, ...)
22112187
{
22122188
va_list args;

0 commit comments

Comments
 (0)