Commit b7049d88 authored by John Ogness's avatar John Ogness Committed by Petr Mladek

printk: nbcon: Remove return value for write_atomic()

The return value of write_atomic() does not provide any useful
information. On the contrary, it makes things more complicated
for the caller to appropriately deal with the information.

Change write_atomic() to not have a return value. If the
message did not get printed due to loss of ownership, the
caller will notice this on its own. If ownership was not lost,
it will be assumed that the driver successfully printed the
message and the sequence number for that console will be
incremented.
Signed-off-by: default avatarJohn Ogness <john.ogness@linutronix.de>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-7-john.ogness@linutronix.deSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
parent 8c9dab2c
...@@ -345,7 +345,7 @@ struct console { ...@@ -345,7 +345,7 @@ struct console {
struct hlist_node node; struct hlist_node node;
/* nbcon console specific members */ /* nbcon console specific members */
bool (*write_atomic)(struct console *con, void (*write_atomic)(struct console *con,
struct nbcon_write_context *wctxt); struct nbcon_write_context *wctxt);
atomic_t __private nbcon_state; atomic_t __private nbcon_state;
atomic_long_t __private nbcon_seq; atomic_long_t __private nbcon_seq;
......
...@@ -885,7 +885,6 @@ static bool nbcon_emit_next_record(struct nbcon_write_context *wctxt) ...@@ -885,7 +885,6 @@ static bool nbcon_emit_next_record(struct nbcon_write_context *wctxt)
unsigned long con_dropped; unsigned long con_dropped;
struct nbcon_state cur; struct nbcon_state cur;
unsigned long dropped; unsigned long dropped;
bool done;
/* /*
* The printk buffers are filled within an unsafe section. This * The printk buffers are filled within an unsafe section. This
...@@ -925,16 +924,16 @@ static bool nbcon_emit_next_record(struct nbcon_write_context *wctxt) ...@@ -925,16 +924,16 @@ static bool nbcon_emit_next_record(struct nbcon_write_context *wctxt)
wctxt->unsafe_takeover = cur.unsafe_takeover; wctxt->unsafe_takeover = cur.unsafe_takeover;
if (con->write_atomic) { if (con->write_atomic) {
done = con->write_atomic(con, wctxt); con->write_atomic(con, wctxt);
} else { } else {
nbcon_context_release(ctxt); /*
* This function should never be called for legacy consoles.
* Handle it as if ownership was lost and try to continue.
*/
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
done = false; nbcon_context_release(ctxt);
}
/* If not done, the emit was aborted. */
if (!done)
return false; return false;
}
/* /*
* Since any dropped message was successfully output, reset the * Since any dropped message was successfully output, reset the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment