From: Parker Newman <parker@finest.io>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: Parker Newman <pnewman@connecttech.com>
Subject: [PATCH v4 3/7] serial: exar: add optional board_init function
Date: Wed, 17 Apr 2024 16:31:25 -0400 [thread overview]
Message-ID: <0e72a3154114c733283ff273bc1e31456ee101f4.1713382717.git.pnewman@connecttech.com> (raw)
In-Reply-To: <cover.1713382717.git.pnewman@connecttech.com>
From: Parker Newman <pnewman@connecttech.com>
Add an optional "board_init()" function pointer to struct exar8250_board
which is called once during probe prior to setting up the ports. It will
be used in subsequent patches of this series.
Signed-off-by: Parker Newman <pnewman@connecttech.com>
---
Changes in v3:
- Renamed board_setup to board_init.
- Changed pci_err to dev_err_probe
- Added note above about checkpatch fixes
Changes in v4:
- Removed checkpatch fixes, they will be in their own patch at the end
- Added pcidev to board_init() args to avoid needing to add to priv
drivers/tty/serial/8250/8250_exar.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index 72385c7d2eda..f14f73d250bb 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -177,12 +177,14 @@ struct exar8250_platform {
* 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_init: 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 (*board_init)(struct exar8250 *priv, struct pci_dev *pcidev);
int (*setup)(struct exar8250 *, struct pci_dev *,
struct uart_8250_port *, int);
void (*exit)(struct pci_dev *pcidev);
@@ -773,6 +775,15 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
if (rc)
return rc;
+ if (board->board_init) {
+ rc = board->board_init(priv, pcidev);
+ if (rc) {
+ dev_err_probe(&pcidev->dev, rc,
+ "failed to init serial board\n");
+ return rc;
+ }
+ }
+
for (i = 0; i < nr_ports && i < maxnr; i++) {
rc = board->setup(priv, pcidev, &uart, i);
if (rc) {
--
2.43.2
next prev parent reply other threads:[~2024-04-17 20:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 20:31 [PATCH v4 0/7] serial: exar: add Connect Tech serial cards to Exar driver Parker Newman
2024-04-17 20:31 ` [PATCH v4 1/7] serial: exar: remove old Connect Tech setup Parker Newman
2024-04-17 20:31 ` [PATCH v4 2/7] serial: exar: added a exar_get_nr_ports function Parker Newman
2024-04-18 11:32 ` Ilpo Järvinen
2024-04-17 20:31 ` Parker Newman [this message]
2024-04-18 11:32 ` [PATCH v4 3/7] serial: exar: add optional board_init function Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 4/7] serial: exar: moved generic_rs485 further up in 8250_exar.c Parker Newman
2024-04-18 11:37 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 5/7] serial: exar: add CTI cards to exar_get_nr_ports Parker Newman
2024-04-18 11:43 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 6/7] serial: exar: add CTI specific setup code Parker Newman
2024-04-18 5:29 ` kernel test robot
2024-04-18 5:42 ` Greg Kroah-Hartman
2024-04-18 13:20 ` Ilpo Järvinen
2024-04-18 14:21 ` Parker Newman
2024-04-18 16:29 ` Ilpo Järvinen
2024-04-18 17:03 ` Parker Newman
2024-04-18 17:25 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 7/7] serial: exar: fix checkpach warnings Parker Newman
2024-04-18 6:25 ` [PATCH v4 0/7] serial: exar: add Connect Tech serial cards to Exar driver Greg Kroah-Hartman
2024-04-18 12:40 ` Parker Newman
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=0e72a3154114c733283ff273bc1e31456ee101f4.1713382717.git.pnewman@connecttech.com \
--to=parker@finest.io \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).