Skip to contentSkip to conversation

printk: add dummy printk_force_console_enter/exit helpers

PATCH Superseded Arnd Bergmann 4 participants 5 messages Nov 12, 2024 – Nov 13, 2024 Printk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk: add dummy printk_force_console_enter/exit helpers

From: Arnd Bergmann <[email protected]>

The newly added interface is broken when PRINTK is disabled:

drivers/tty/sysrq.c: In function '__handle_sysrq':
drivers/tty/sysrq.c:601:9: error: implicit declaration of function 'printk_force_console_enter' [-Wimplicit-function-declaration]

  601 |         printk_force_console_enter();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/sysrq.c:611:25: error: implicit declaration of function 'printk_force_console_exit' [-Wimplicit-function-declaration]
  611 |                         printk_force_console_exit();
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~

Add empty stub functions for both.

Fixes ed76c07c6885 ("printk: Introduce FORCE_CON flag")
---
 include/linux/printk.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/linux/printk.h +8 -0
index 232e5fd06701..0f2d7bdcea54 100644
@@ -232,6 +232,14 @@ static inline void printk_deferred_exit(void)
 {
 }
 
+static void printk_force_console_enter(void)
+{
+}
+
+static void printk_force_console_exit(void)
+{
+}
+
 static inline int printk_ratelimit(void)
 {
 	return 0;
Signature · 1 line
2.39.5
#1 lore raw

PATCH v2 1/1 printk: add dummy printk_force_console_enter/exit helpers

From: Arnd Bergmann <[email protected]>

The newly added interface is broken when PRINTK is disabled:

drivers/tty/sysrq.c: In function '__handle_sysrq':
drivers/tty/sysrq.c:601:9: error: implicit declaration of function 'printk_force_console_enter' [-Wimplicit-function-declaration]

  601 |         printk_force_console_enter();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/sysrq.c:611:25: error: implicit declaration of function 'printk_force_console_exit' [-Wimplicit-function-declaration]
  611 |                         printk_force_console_exit();
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~

Add empty stub functions for both.

Fixes ed76c07c6885 ("printk: Introduce FORCE_CON flag")

---
v2: realized I sent the wrong version that was missing 'inline'.

---
 include/linux/printk.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/linux/printk.h +8 -0
index 232e5fd06701..4217a9f412b2 100644
@@ -232,6 +232,14 @@ static inline void printk_deferred_exit(void)
 {
 }
 
+static inline void printk_force_console_enter(void)
+{
+}
+
+static inline void printk_force_console_exit(void)
+{
+}
+
 static inline int printk_ratelimit(void)
 {
 	return 0;
Signature · 1 line
2.39.5
Reviewed-by on v2 1/1
#2 lore raw
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added interface is broken when PRINTK is disabled:

drivers/tty/sysrq.c: In function '__handle_sysrq':
drivers/tty/sysrq.c:601:9: error: implicit declaration of function 'printk_force_console_enter' [-Wimplicit-function-declaration]

Quoted 7 lines
  601 |         printk_force_console_enter();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/sysrq.c:611:25: error: implicit declaration of function 'printk_force_console_exit' [-Wimplicit-function-declaration]
  611 |                         printk_force_console_exit();
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~

Add empty stub functions for both.

Does it compile with make W=1 without warnings/errors? If so, I am okay with the approach.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Reviewed-by Tested-by on v2 1/1
#3 lore raw
In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added interface is broken when PRINTK is disabled:

drivers/tty/sysrq.c: In function '__handle_sysrq':
drivers/tty/sysrq.c:601:9: error: implicit declaration of function 'printk_force_console_enter' [-Wimplicit-function-declaration] 601 |         printk_force_console_enter();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/tty/sysrq.c:611:25: error: implicit declaration of function 'printk_force_console_exit' [-Wimplicit-function-declaration] 611 |                         printk_force_console_exit(); |                         ^~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 1 line

Add empty stub functions for both.

Ouch, indeed, my fault. After disabling prinkt I saw the build errors. Thanks for fixing it!

Quoted 28 lines
Fixes ed76c07c6885 ("printk: Introduce FORCE_CON flag")

---
v2: realized I sent the wrong version that was missing 'inline'.
---
 include/linux/printk.h | 8 ++++++++

 1 file changed, 8 insertions(+)
include/linux/printk.h +0 -0
index 232e5fd06701..4217a9f412b2 100644
@@ -232,6 +232,14 @@ static inline void printk_deferred_exit(void)
  {
  }

include/linux/printk.h +8 -0
+static inline void printk_force_console_enter(void)
+{
+}
+
+static inline void printk_force_console_exit(void)
+{
+}
+

 static inline int printk_ratelimit(void)
 {
  return 0;

maintainer
#4 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added interface is broken when PRINTK is disabled:

drivers/tty/sysrq.c: In function '__handle_sysrq':
drivers/tty/sysrq.c:601:9: error: implicit declaration of function 'printk_force_console_enter' [-Wimplicit-function-declaration]

  601 |         printk_force_console_enter();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/sysrq.c:611:25: error: implicit declaration of function 'printk_force_console_exit' [-Wimplicit-function-declaration]
  611 |                         printk_force_console_exit();
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 4 lines

Add empty stub functions for both.

Fixes ed76c07c6885 ("printk: Introduce FORCE_CON flag")

Thanks a lot for the fix!

I have just pushed it into printk/linux.git,
branch for-6.13-force-console.

Best Regards,
Petr