Re: [PATCH v2 2/7] x86/boot: Introduce helpers for serial I/O

From: Borislav Petkov
Date: Thu Mar 28 2019 - 08:32:50 EST


On Tue, Mar 19, 2019 at 09:43:20PM +0300, Andy Shevchenko wrote:
> As preparatory to enable earlyprintk on non-standard ports on x86,
> introduce serial_in() and serial_out() helpers to perform serial I/O.
>
> No functional change intended.

...

> +/* Assign serial I/O accessors */
> +static void early_serial_use_io_accessors(void)
> +{
> + /* These will always be IO based ports */
> + serial_in = io_serial_in;
> + serial_out = io_serial_out;
> +}

This and the early_serial_use_mmio_accessors() in a later patch is just
silly because you need to export and forward-declare those serial_in and
serial_out function pointers in a bunch of places.

Just define exactly *two* simple functions serial_in() and serial_out()
which have enough logic to decide whether to do serial IO or MMIO and
put all that logic in those functions. No need for all that function
pointer assignment "fun".

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.