summaryrefslogtreecommitdiff
path: root/include/linux/console.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2022-11-16 17:27:14 +0106
committerPetr Mladek <pmladek@suse.com>2022-12-02 11:24:59 +0100
commitd9a4af5690e26afa8a2eb83c575d3a9ef52cde1d (patch)
tree42dfbe9bc1d553682eb6c83b8a6e9cf93081fa41 /include/linux/console.h
parent9e409c4778afbbd44759e56ec4bbed839fd31909 (diff)
printk: Convert console_drivers list to hlist
Replace the open coded single linked list with a hlist so a conversion to SRCU protected list walks can reuse the existing primitives. Co-developed-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20221116162152.193147-3-john.ogness@linutronix.de
Diffstat (limited to 'include/linux/console.h')
-rw-r--r--include/linux/console.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/console.h b/include/linux/console.h
index 8c1686e2c233..7b5f21f9e469 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -15,6 +15,7 @@
#define _LINUX_CONSOLE_H_ 1
#include <linux/atomic.h>
+#include <linux/list.h>
#include <linux/types.h>
struct vc_data;
@@ -154,14 +155,16 @@ struct console {
u64 seq;
unsigned long dropped;
void *data;
- struct console *next;
+ struct hlist_node node;
};
+extern struct hlist_head console_list;
+
/*
* for_each_console() allows you to iterate on each console
*/
#define for_each_console(con) \
- for (con = console_drivers; con != NULL; con = con->next)
+ hlist_for_each_entry(con, &console_list, node)
extern int console_set_on_cmdline;
extern struct console *early_console;
@@ -174,7 +177,6 @@ enum con_flush_mode {
extern int add_preferred_console(char *name, int idx, char *options);
extern void register_console(struct console *);
extern int unregister_console(struct console *);
-extern struct console *console_drivers;
extern void console_lock(void);
extern int console_trylock(void);
extern void console_unlock(void);