Re: [PATCH v2 3/7] serial: exar: add support for config/set single MPIO

Parker Newman
2024-04-12T13:05:53Z

On Fri, 12 Apr 2024 07:29:16 +0200
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> On Thu, Apr 11, 2024 at 04:25:41PM -0400, parker@finest.io wrote:
> > +/**
> > + * exar_mpio_config() - Configure an EXar MPIO as input or output
> > + * @priv: Device's private structure
> > + * @mpio_num: MPIO number/offset to configure
> > + * @output: Configure as output if true, inout if false
> > + *
> > + * Configure a single MPIO as an input or output and disable trisate.
> > + * If configuring as output it is reccomended to set value with
> > + * exar_mpio_set prior to calling this function to ensure default state.
> > + *
> > + * Return: 0 on success, negative error code on failure
> > + */
> > +static int exar_mpio_config(struct exar8250 *priv,
> > + unsigned int mpio_num, bool output)
>
> When you have a bool in a function, every time you read the code you
> have to go and figure out what that boolean means.
>
> Have 2 functions:
> exar_mpio_config_input()
> exar_mpio_config_output()
>
> and then have THEM call this function with the bool set or not. That
> way when reading the code you know exactly what is happening.
>
> Same with other functions in this patch. Naming is hard, make it easy
> please.

Good feedback thanks.

> thanks,
>
> greg k-h