Skip to content

Commit 466348a

Browse files
marcospspmladek
authored andcommitted
printk: Use console_is_usable on console_unblank
The macro for_each_console_srcu iterates over all registered consoles. It's implied that all registered consoles have CON_ENABLED flag set, making the check for the flag unnecessary. Call console_is_usable function to fully verify if the given console is usable before calling the ->unblank callback. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Link: https://patch.msgid.link/20251121-printk-cleanup-part2-v2-3-57b8b78647f4@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
1 parent 4c70ab1 commit 466348a

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

kernel/printk/printk.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3331,12 +3331,10 @@ void console_unblank(void)
33313331
*/
33323332
cookie = console_srcu_read_lock();
33333333
for_each_console_srcu(c) {
3334-
short flags = console_srcu_read_flags(c);
3335-
3336-
if (flags & CON_SUSPENDED)
3334+
if (!console_is_usable(c, console_srcu_read_flags(c), true))
33373335
continue;
33383336

3339-
if ((flags & CON_ENABLED) && c->unblank) {
3337+
if (c->unblank) {
33403338
found_unblank = true;
33413339
break;
33423340
}
@@ -3373,12 +3371,10 @@ void console_unblank(void)
33733371

33743372
cookie = console_srcu_read_lock();
33753373
for_each_console_srcu(c) {
3376-
short flags = console_srcu_read_flags(c);
3377-
3378-
if (flags & CON_SUSPENDED)
3374+
if (!console_is_usable(c, console_srcu_read_flags(c), true))
33793375
continue;
33803376

3381-
if ((flags & CON_ENABLED) && c->unblank)
3377+
if (c->unblank)
33823378
c->unblank();
33833379
}
33843380
console_srcu_read_unlock(cookie);

0 commit comments

Comments
 (0)