public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: parker@finest.io
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	 linux-serial <linux-serial@vger.kernel.org>,
	 Parker Newman <pnewman@connecttech.com>
Subject: Re: [PATCH v2 4/7] serial: exar: add optional board_setup function
Date: Fri, 12 Apr 2024 13:08:58 +0300 (EEST)	[thread overview]
Message-ID: <385ccf17-199e-13cb-e003-8b583252cab8@linux.intel.com> (raw)
In-Reply-To: <69677365f4c753cbe6b5c028f530db49e6712ab3.1712863999.git.pnewman@connecttech.com>

On Thu, 11 Apr 2024, parker@finest.io wrote:

> From: Parker Newman <pnewman@connecttech.com>
> 
> Adds an optional "board_setup" function pointer to struct
> exar8250_board. This gets called once during probe prior to setting up
> the ports.
> 
> Signed-off-by: Parker Newman <pnewman@connecttech.com>
> ---
>  drivers/tty/serial/8250/8250_exar.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index 9915a99cb7c6..b30f3855652a 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -143,7 +143,7 @@
>   *
>   * MPIO		Port	Function
>   * ----		----	--------
> - * 0		2 	Mode bit 0
> + * 0		2	Mode bit 0

Unrelated change.

>   * 1		2	Mode bit 1
>   * 2		2	Terminate bus
>   * 3		-	<reserved>
> @@ -179,22 +179,24 @@ struct exar8250_platform {
>  	int (*rs485_config)(struct uart_port *port, struct ktermios *termios,
>  			    struct serial_rs485 *rs485);
>  	const struct serial_rs485 *rs485_supported;
> -	int (*register_gpio)(struct pci_dev *, struct uart_8250_port *);
> -	void (*unregister_gpio)(struct uart_8250_port *);
> +	int (*register_gpio)(struct pci_dev *pcidev, struct uart_8250_port *port);
> +	void (*unregister_gpio)(struct uart_8250_port *port);
>  };
> 
>  /**
>   * struct exar8250_board - board information
>   * @num_ports: number of serial ports
>   * @reg_shift: describes UART register mapping in PCI memory
> - * @setup: quirk run at ->probe() stage
> + * @board_setup: quirk run once at ->probe() stage before setting up ports
> + * @setup: quirk run at ->probe() stage for each port
>   * @exit: quirk run at ->remove() stage
>   */
>  struct exar8250_board {
>  	unsigned int num_ports;
>  	unsigned int reg_shift;
> -	int	(*setup)(struct exar8250 *, struct pci_dev *,
> -			 struct uart_8250_port *, int);
> +	int     (*board_setup)(struct exar8250 *priv);
> +	int	(*setup)(struct exar8250 *priv, struct pci_dev *pcidev,
> +			 struct uart_8250_port *port, int idx);
>  	void	(*exit)(struct pci_dev *pcidev);
>  };
> 
> @@ -966,6 +968,15 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
>  	if (rc)
>  		return rc;
> 
> +	if (board->board_setup) {
> +		rc = board->board_setup(priv);

Could this be called board_init() as having both ->board_setup() and 
->setup() is bit confusing.

> +		if (rc) {
> +			pci_err(pcidev,
> +				"failed to setup serial board: %d\n", rc);

pci_err() belongs to pci subsystem. Please use dev_err() or return 
dev_err_probe().

> +			return rc;
> +		}
> +	}
> +
>  	for (i = 0; i < nr_ports && i < maxnr; i++) {
>  		rc = board->setup(priv, pcidev, &uart, i);
>  		if (rc) {


-- 
 i.


  reply	other threads:[~2024-04-12 10:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 20:25 [PATCH v2 0/7] serial: exar: add Connect Tech serial cards to Exar driver parker
2024-04-11 20:25 ` [PATCH v2 1/7] serial: exar: adding missing CTI and Exar PCI ids parker
2024-04-11 20:25 ` [PATCH v2 2/7] serial: exar: add support for reading from Exar EEPROM parker
2024-04-12  5:26   ` Greg Kroah-Hartman
2024-04-12 12:58     ` Parker Newman
2024-04-12 10:36   ` Ilpo Järvinen
2024-04-12 13:06     ` Parker Newman
2024-04-11 20:25 ` [PATCH v2 3/7] serial: exar: add support for config/set single MPIO parker
2024-04-12  5:29   ` Greg Kroah-Hartman
2024-04-12 13:05     ` Parker Newman
2024-04-12 10:20   ` Ilpo Järvinen
2024-04-12 13:36     ` Parker Newman
2024-04-12 13:44       ` Ilpo Järvinen
2024-04-11 20:25 ` [PATCH v2 4/7] serial: exar: add optional board_setup function parker
2024-04-12 10:08   ` Ilpo Järvinen [this message]
2024-04-12 13:50     ` Parker Newman
2024-04-11 20:25 ` [PATCH v2 5/7] serial: exar: add some CTI helper functions parker
2024-04-12 10:48   ` Ilpo Järvinen
2024-04-12 13:57     ` Parker Newman
2024-04-12 14:09       ` Ilpo Järvinen
2024-04-11 20:25 ` [PATCH v2 6/7] serial: exar: add CTI board and port setup functions parker
2024-04-12 10:57   ` Ilpo Järvinen
2024-04-12 15:19     ` Parker Newman
2024-04-12 15:28       ` Greg Kroah-Hartman
2024-04-12 15:39         ` Parker Newman
2024-04-11 20:25 ` [PATCH v2 7/7] serial: exar: fix: fix crash during shutdown if setup fails parker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=385ccf17-199e-13cb-e003-8b583252cab8@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=parker@finest.io \
    --cc=pnewman@connecttech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox