Re: [PATCH] [v2] printk: add dummy printk_force_console_enter/exit helpers

From: Marcos Paulo de Souza
Date: Tue Nov 12 2024 - 17:37:40 EST


On Tue, 2024-11-12 at 15:29 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> 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.

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

Reviewed-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>
Tested-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>

>
> Fixes: ed76c07c6885 ("printk: Introduce FORCE_CON flag")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> v2: realized I sent the wrong version that was missing 'inline'.
> ---
>  include/linux/printk.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 232e5fd06701..4217a9f412b2 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -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;