Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

printk: nbcon: Export nbcon_write_context_set_buf

This function will be used in the next patch to allow a driver to set
both the message and message length of a nbcon_write_context. This is
necessary because the function also initializes the ->unsafe_takeover
struct member. By using this helper we ensure that the struct is
initialized correctly.

Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Link: https://patch.msgid.link/20251016-nbcon-kgdboc-v6-4-866aac60a80e@suse.com
Signed-off-by: Petr Mladek <pmladek@suse.com>

authored by

Marcos Paulo de Souza and committed by
Petr Mladek
4349cf0d 286b113d

+6 -2
+4
include/linux/console.h
··· 603 603 extern void nbcon_cpu_emergency_enter(void); 604 604 extern void nbcon_cpu_emergency_exit(void); 605 605 extern bool nbcon_can_proceed(struct nbcon_write_context *wctxt); 606 + extern void nbcon_write_context_set_buf(struct nbcon_write_context *wctxt, 607 + char *buf, unsigned int len); 606 608 extern bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt); 607 609 extern bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt); 608 610 extern void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt); ··· 657 655 static inline void nbcon_cpu_emergency_enter(void) { } 658 656 static inline void nbcon_cpu_emergency_exit(void) { } 659 657 static inline bool nbcon_can_proceed(struct nbcon_write_context *wctxt) { return false; } 658 + static inline void nbcon_write_context_set_buf(struct nbcon_write_context *wctxt, 659 + char *buf, unsigned int len) { } 660 660 static inline bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt) { return false; } 661 661 static inline bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt) { return false; } 662 662 static inline void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt) { }
+2 -2
kernel/printk/nbcon.c
··· 854 854 return nbcon_context_can_proceed(ctxt, &cur); 855 855 } 856 856 857 - static void nbcon_write_context_set_buf(struct nbcon_write_context *wctxt, 858 - char *buf, unsigned int len) 857 + void nbcon_write_context_set_buf(struct nbcon_write_context *wctxt, 858 + char *buf, unsigned int len) 859 859 { 860 860 struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt); 861 861 struct console *con = ctxt->console;