[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMC3AhYbxA0Nbp8q@kroah.com>
Date: Wed, 9 Jun 2021 14:41:38 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiri Slaby <jirislaby@...nel.org>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Subject: Re: [PATCH v1 2/3] serial: 8250_exar: Extract exar_get_platform()
helper
On Tue, Jun 08, 2021 at 05:42:38PM +0300, Andy Shevchenko wrote:
> We would like to use DMI matching in other functions as well.
> Hence, extract it as exar_get_platform() helper function.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> drivers/tty/serial/8250/8250_exar.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index bd4e9f6ac29c..3ffeedc29c83 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -501,23 +501,27 @@ static const struct dmi_system_id exar_platforms[] = {
> {}
> };
>
> +static const struct exar8250_platform *exar_get_platform(void)
> +{
> + const struct dmi_system_id *dmi_match;
> +
> + dmi_match = dmi_first_match(exar_platforms);
> + if (dmi_match)
> + return dmi_match->driver_data;
> +
> + return &exar8250_default_platform;
> +}
> +
> static int
> pci_xr17v35x_setup(struct exar8250 *priv, struct pci_dev *pcidev,
> struct uart_8250_port *port, int idx)
> {
> - const struct exar8250_platform *platform;
> - const struct dmi_system_id *dmi_match;
> + const struct exar8250_platform *platform = exar_get_platform();
> unsigned int offset = idx * 0x400;
> unsigned int baud = 7812500;
> u8 __iomem *p;
> int ret;
>
> - dmi_match = dmi_first_match(exar_platforms);
> - if (dmi_match)
> - platform = dmi_match->driver_data;
> - else
> - platform = &exar8250_default_platform;
> -
> port->port.uartclk = baud * 16;
> port->port.rs485_config = platform->rs485_config;
>
> --
> 2.30.2
>
Do not mix "fixes with features" in a single series, as I now have to
pick it apart and apply it to different branches by hand :(
Please do different series for the two different things if at all
possible.
thanks,
greg k-h
Powered by blists - more mailing lists