Skip to content

Commit 794c8e8

Browse files
jognesspmladek
authored andcommitted
efi: earlycon: use console_is_registered()
The CON_ENABLED status of a console is a runtime setting that does not involve the console driver. Drivers must not assume that if the console is disabled then proper hardware management is not needed. For the EFI earlycon case, it is about remapping/unmapping memory for the framebuffer. Use console_is_registered() instead of checking CON_ENABLED. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20221116162152.193147-25-john.ogness@linutronix.de
1 parent de61a1a commit 794c8e8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/firmware/efi/earlycon.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ static void *efi_fb;
2929
*/
3030
static int __init efi_earlycon_remap_fb(void)
3131
{
32-
/* bail if there is no bootconsole or it has been disabled already */
33-
if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
32+
/* bail if there is no bootconsole or it was unregistered already */
33+
if (!earlycon_console || !console_is_registered(earlycon_console))
3434
return 0;
3535

3636
efi_fb = memremap(fb_base, screen_info.lfb_size,
@@ -42,8 +42,8 @@ early_initcall(efi_earlycon_remap_fb);
4242

4343
static int __init efi_earlycon_unmap_fb(void)
4444
{
45-
/* unmap the bootconsole fb unless keep_bootcon has left it enabled */
46-
if (efi_fb && !(earlycon_console->flags & CON_ENABLED))
45+
/* unmap the bootconsole fb unless keep_bootcon left it registered */
46+
if (efi_fb && !console_is_registered(earlycon_console))
4747
memunmap(efi_fb);
4848
return 0;
4949
}

0 commit comments

Comments
 (0)