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

Greg Kroah-Hartman
2024-04-12T05:29:19Z

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.

thanks,

greg k-h