Re: [PATCH v6 4/4] kdb: Switch to use safer dbg_io_ops over console APIs

From: Doug Anderson
Date: Thu Jun 04 2020 - 17:12:41 EST


Hi,

On Thu, Jun 4, 2020 at 3:02 AM Sumit Garg <sumit.garg@xxxxxxxxxx> wrote:
>
> @@ -433,7 +432,8 @@ static int kgdboc_earlycon_get_char(void)
> {
> char c;
>
> - if (!earlycon->read(earlycon, &c, 1))
> + if (!kgdboc_earlycon_io_ops.cons->read(kgdboc_earlycon_io_ops.cons,
> + &c, 1))
> return NO_POLL_CHAR;
>
> return c;
> @@ -441,7 +441,8 @@ static int kgdboc_earlycon_get_char(void)
>
> static void kgdboc_earlycon_put_char(u8 chr)
> {
> - earlycon->write(earlycon, &chr, 1);
> + kgdboc_earlycon_io_ops.cons->write(kgdboc_earlycon_io_ops.cons, &chr,
> + 1);
> }

The get_char / put_char functions are pretty unwieldy now. If it were
me I would have done:

struct console *con = kgdboc_earlycon_io_ops.cons;

...and then used it so the lines didn't wrap in such a terrible way. ;-)

I'm not sure if I'd spin just for that, though.

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>

-Doug