Skip to content

Commit 717a565

Browse files
KAGA-KOKOpmladek
authored andcommitted
console: Use BIT() macros for @flags values
Rather than manually calculating powers of 2, use the BIT() macros. Also take this opportunatity to cleanup and restructure the value comments into proper kerneldoc comments. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2364b40 commit 717a565

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

include/linux/console.h

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define _LINUX_CONSOLE_H_ 1
1616

1717
#include <linux/atomic.h>
18+
#include <linux/bits.h>
1819
#include <linux/rculist.h>
1920
#include <linux/types.h>
2021

@@ -125,18 +126,43 @@ static inline int con_debug_leave(void)
125126
/*
126127
* The interface for a console, or any other device that wants to capture
127128
* console messages (printer driver?)
128-
*
129-
* If a console driver is marked CON_BOOT then it will be auto-unregistered
130-
* when the first real console is registered. This is for early-printk drivers.
131129
*/
132130

133-
#define CON_PRINTBUFFER (1)
134-
#define CON_CONSDEV (2) /* Preferred console, /dev/console */
135-
#define CON_ENABLED (4)
136-
#define CON_BOOT (8)
137-
#define CON_ANYTIME (16) /* Safe to call when cpu is offline */
138-
#define CON_BRL (32) /* Used for a braille device */
139-
#define CON_EXTENDED (64) /* Use the extended output format a la /dev/kmsg */
131+
/**
132+
* cons_flags - General console flags
133+
* @CON_PRINTBUFFER: Used by newly registered consoles to avoid duplicate
134+
* output of messages that were already shown by boot
135+
* consoles or read by userspace via syslog() syscall.
136+
* @CON_CONSDEV: Indicates that the console driver is backing
137+
* /dev/console.
138+
* @CON_ENABLED: Indicates if a console is allowed to print records. If
139+
* false, the console also will not advance to later
140+
* records.
141+
* @CON_BOOT: Marks the console driver as early console driver which
142+
* is used during boot before the real driver becomes
143+
* available. It will be automatically unregistered
144+
* when the real console driver is registered unless
145+
* "keep_bootcon" parameter is used.
146+
* @CON_ANYTIME: A misnomed historical flag which tells the core code
147+
* that the legacy @console::write callback can be invoked
148+
* on a CPU which is marked OFFLINE. That is misleading as
149+
* it suggests that there is no contextual limit for
150+
* invoking the callback. The original motivation was
151+
* readiness of the per-CPU areas.
152+
* @CON_BRL: Indicates a braille device which is exempt from
153+
* receiving the printk spam for obvious reasons.
154+
* @CON_EXTENDED: The console supports the extended output format of
155+
* /dev/kmesg which requires a larger output buffer.
156+
*/
157+
enum cons_flags {
158+
CON_PRINTBUFFER = BIT(0),
159+
CON_CONSDEV = BIT(1),
160+
CON_ENABLED = BIT(2),
161+
CON_BOOT = BIT(3),
162+
CON_ANYTIME = BIT(4),
163+
CON_BRL = BIT(5),
164+
CON_EXTENDED = BIT(6),
165+
};
140166

141167
struct console {
142168
char name[16];

0 commit comments

Comments
 (0)