Re: [PATCH 4/8] printk: Cleanup _braille_(un)register_console() wrappers
From: Marcos Paulo de Souza
Date: Thu Feb 19 2026 - 13:50:52 EST
On Fri, 2026-02-06 at 17:49 +0100, Petr Mladek wrote:
> The _braille_(un)register_console() wrappers currently attempt to
> hide
> implementation details like the CON_BRL flag and pc->brl_options.
> This
> forces callers to handle an unconventional tri-state return value (0
> for
> NOP, >0 for success, <0 for error), which makes the control flow
> harder
> to follow and non-standard.
>
> Refactor the wrappers to use standard kernel return codes (0 for
> success,
> -ERRCODE on failure). Move the responsibility of checking brl_options
> to the caller to make the logic more explicit.
>
> Additionally, move the assignment of the CON_BRL flag from the
> internal
> wrapper to braille_register_console(). This aligns it with how
> CON_ENABLED is handled. To maintain symmetry and fix a potential bug
> where flags might persist after removal, explicitly clear both
> CON_ENABLED and CON_BRL in braille_unregister_console().
>
> Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
> ---
I had a very similar patch locally, thanks a lot for cleaning this up!
Reviewed-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>