summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0017-printk-Make-console_is_usable-available-to-nbcon.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:31 +0000
commitf7bf6055eb1e7ff603f0907b18ece35c72b05302 (patch)
tree13ac5b481056384a3ccc7979b86a42d208fcacdc /debian/patches-rt/0017-printk-Make-console_is_usable-available-to-nbcon.patch
parentMerging upstream version 6.8.9. (diff)
downloadlinux-f7bf6055eb1e7ff603f0907b18ece35c72b05302.tar.xz
linux-f7bf6055eb1e7ff603f0907b18ece35c72b05302.zip
Adding debian version 6.8.9-1.debian/6.8.9-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0017-printk-Make-console_is_usable-available-to-nbcon.patch')
-rw-r--r--debian/patches-rt/0017-printk-Make-console_is_usable-available-to-nbcon.patch103
1 files changed, 103 insertions, 0 deletions
diff --git a/debian/patches-rt/0017-printk-Make-console_is_usable-available-to-nbcon.patch b/debian/patches-rt/0017-printk-Make-console_is_usable-available-to-nbcon.patch
new file mode 100644
index 0000000000..8334063ed5
--- /dev/null
+++ b/debian/patches-rt/0017-printk-Make-console_is_usable-available-to-nbcon.patch
@@ -0,0 +1,103 @@
+From: John Ogness <john.ogness@linutronix.de>
+Date: Tue, 12 Sep 2023 13:25:41 +0000
+Subject: [PATCH 17/48] printk: Make console_is_usable() available to nbcon
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.8/older/patches-6.8.2-rt11.tar.xz
+
+Move console_is_usable() as-is into internal.h so that it can
+be used by nbcon printing functions as well.
+
+Signed-off-by: John Ogness <john.ogness@linutronix.de>
+Reviewed-by: Petr Mladek <pmladek@suse.com>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/printk/internal.h | 32 ++++++++++++++++++++++++++++++++
+ kernel/printk/printk.c | 30 ------------------------------
+ 2 files changed, 32 insertions(+), 30 deletions(-)
+
+--- a/kernel/printk/internal.h
++++ b/kernel/printk/internal.h
+@@ -85,6 +85,36 @@ bool nbcon_alloc(struct console *con);
+ void nbcon_init(struct console *con);
+ void nbcon_free(struct console *con);
+
++/*
++ * Check if the given console is currently capable and allowed to print
++ * records.
++ *
++ * Requires the console_srcu_read_lock.
++ */
++static inline bool console_is_usable(struct console *con)
++{
++ short flags = console_srcu_read_flags(con);
++
++ if (!(flags & CON_ENABLED))
++ return false;
++
++ if ((flags & CON_SUSPENDED))
++ return false;
++
++ if (!con->write)
++ return false;
++
++ /*
++ * Console drivers may assume that per-cpu resources have been
++ * 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()) && !(flags & CON_ANYTIME))
++ return false;
++
++ return true;
++}
++
+ #else
+
+ #define PRINTK_PREFIX_MAX 0
+@@ -106,6 +136,8 @@ static inline bool nbcon_alloc(struct co
+ static inline void nbcon_init(struct console *con) { }
+ static inline void nbcon_free(struct console *con) { }
+
++static inline bool console_is_usable(struct console *con) { return false; }
++
+ #endif /* CONFIG_PRINTK */
+
+ extern struct printk_buffers printk_shared_pbufs;
+--- a/kernel/printk/printk.c
++++ b/kernel/printk/printk.c
+@@ -2702,36 +2702,6 @@ int is_console_locked(void)
+ }
+ EXPORT_SYMBOL(is_console_locked);
+
+-/*
+- * Check if the given console is currently capable and allowed to print
+- * records.
+- *
+- * Requires the console_srcu_read_lock.
+- */
+-static inline bool console_is_usable(struct console *con)
+-{
+- short flags = console_srcu_read_flags(con);
+-
+- if (!(flags & CON_ENABLED))
+- return false;
+-
+- if ((flags & CON_SUSPENDED))
+- return false;
+-
+- if (!con->write)
+- return false;
+-
+- /*
+- * Console drivers may assume that per-cpu resources have been
+- * 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()) && !(flags & CON_ANYTIME))
+- return false;
+-
+- return true;
+-}
+-
+ static void __console_unlock(void)
+ {
+ console_locked = 0;