Skip to content

Commit

Permalink
kdb: Use for_each_console() helper
Browse files Browse the repository at this point in the history
Replace open coded single-linked list iteration loop with for_each_console()
helper in use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
  • Loading branch information
Andy Shevchenko authored and Daniel Thompson committed Jan 31, 2020
1 parent a4f8a7f commit dc2c733
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions kernel/debug/kdb/kdb_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap)
int this_cpu, old_cpu;
char *cp, *cp2, *cphold = NULL, replaced_byte = ' ';
char *moreprompt = "more> ";
struct console *c = console_drivers;
struct console *c;
unsigned long uninitialized_var(flags);

/* Serialize kdb_printf if multiple cpus try to write at once.
Expand Down Expand Up @@ -698,10 +698,9 @@ int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap)
cp2++;
}
}
while (c) {
for_each_console(c) {
c->write(c, cp, retlen - (cp - kdb_buffer));
touch_nmi_watchdog();
c = c->next;
}
}
if (logging) {
Expand Down Expand Up @@ -752,7 +751,6 @@ int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap)
moreprompt = "more> ";

kdb_input_flush();
c = console_drivers;

if (dbg_io_ops && !dbg_io_ops->is_console) {
len = strlen(moreprompt);
Expand All @@ -762,10 +760,9 @@ int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap)
cp++;
}
}
while (c) {
for_each_console(c) {
c->write(c, moreprompt, strlen(moreprompt));
touch_nmi_watchdog();
c = c->next;
}

if (logging)
Expand Down

0 comments on commit dc2c733

Please sign in to comment.