Skip to content

Commit 4349cf0

Browse files
marcospspmladek
authored andcommitted
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>
1 parent 286b113 commit 4349cf0

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

include/linux/console.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ static inline bool console_is_registered(const struct console *con)
603603
extern void nbcon_cpu_emergency_enter(void);
604604
extern void nbcon_cpu_emergency_exit(void);
605605
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);
606608
extern bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt);
607609
extern bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt);
608610
extern void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt);
@@ -655,6 +657,8 @@ static inline bool console_is_usable(struct console *con, short flags, bool use_
655657
static inline void nbcon_cpu_emergency_enter(void) { }
656658
static inline void nbcon_cpu_emergency_exit(void) { }
657659
static inline bool nbcon_can_proceed(struct nbcon_write_context *wctxt) { return false; }
660+
static inline void nbcon_write_context_set_buf(struct nbcon_write_context *wctxt,
661+
char *buf, unsigned int len) { }
658662
static inline bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt) { return false; }
659663
static inline bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt) { return false; }
660664
static inline void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt) { }

kernel/printk/nbcon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,8 @@ static bool __nbcon_context_update_unsafe(struct nbcon_context *ctxt, bool unsaf
854854
return nbcon_context_can_proceed(ctxt, &cur);
855855
}
856856

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)
859859
{
860860
struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt);
861861
struct console *con = ctxt->console;

0 commit comments

Comments
 (0)