summaryrefslogtreecommitdiff
path: root/kernel/printk
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2022-11-16 19:21:29 +0300
committerPetr Mladek <pmladek@suse.com>2022-12-02 13:25:00 +0300
commit12f1da5fc4c728dc690a2fe3f4197d62f3a6fa7b (patch)
tree3648bb752a3f2fb696821f9e1225ed8c1347996e /kernel/printk
parenteb7f1ed2509c6223d960a7d69644a8eb506b13d0 (diff)
downloadlinux-12f1da5fc4c728dc690a2fe3f4197d62f3a6fa7b.tar.xz
printk: console_is_usable: use console_srcu_read_flags
All users of console_is_usable() are SRCU iterators. Use the appropriate wrapper function to locklessly read the flags. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20221116162152.193147-18-john.ogness@linutronix.de
Diffstat (limited to 'kernel/printk')
-rw-r--r--kernel/printk/printk.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index abdbd3ffb068..853a86c94ee0 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2709,11 +2709,13 @@ static bool abandon_console_lock_in_panic(void)
* Check if the given console is currently capable and allowed to print
* records.
*
- * Requires the console_lock.
+ * Requires the console_srcu_read_lock.
*/
static inline bool console_is_usable(struct console *con)
{
- if (!(con->flags & CON_ENABLED))
+ short flags = console_srcu_read_flags(con);
+
+ if (!(flags & CON_ENABLED))
return false;
if (!con->write)
@@ -2724,8 +2726,7 @@ static inline bool console_is_usable(struct console *con)
* allocated. So unless they're explicitly marked as being able to
* cope (CON_ANYTIME) don't call them until this CPU is officially up.
*/
- if (!cpu_online(raw_smp_processor_id()) &&
- !(con->flags & CON_ANYTIME))
+ if (!cpu_online(raw_smp_processor_id()) && !(flags & CON_ANYTIME))
return false;
return true;