Skip to content

Commit 393b520

Browse files
pnewman-ctigregkh
authored andcommitted
serial: exar: add optional board_init function
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 <[email protected]> Link: https://lore.kernel.org/r/0e72a3154114c733283ff273bc1e31456ee101f4.1713382717.git.pnewman@connecttech.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 477f6ee commit 393b520

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/tty/serial/8250/8250_exar.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,14 @@ struct exar8250_platform {
177177
* struct exar8250_board - board information
178178
* @num_ports: number of serial ports
179179
* @reg_shift: describes UART register mapping in PCI memory
180-
* @setup: quirk run at ->probe() stage
180+
* @board_init: quirk run once at ->probe() stage before setting up ports
181+
* @setup: quirk run at ->probe() stage for each port
181182
* @exit: quirk run at ->remove() stage
182183
*/
183184
struct exar8250_board {
184185
unsigned int num_ports;
185186
unsigned int reg_shift;
187+
int (*board_init)(struct exar8250 *priv, struct pci_dev *pcidev);
186188
int (*setup)(struct exar8250 *, struct pci_dev *,
187189
struct uart_8250_port *, int);
188190
void (*exit)(struct pci_dev *pcidev);
@@ -773,6 +775,15 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
773775
if (rc)
774776
return rc;
775777

778+
if (board->board_init) {
779+
rc = board->board_init(priv, pcidev);
780+
if (rc) {
781+
dev_err_probe(&pcidev->dev, rc,
782+
"failed to init serial board\n");
783+
return rc;
784+
}
785+
}
786+
776787
for (i = 0; i < nr_ports && i < maxnr; i++) {
777788
rc = board->setup(priv, pcidev, &uart, i);
778789
if (rc) {

0 commit comments

Comments
 (0)