Skip to content

Commit ee6c49a

Browse files
andy-shevgregkh
authored andcommitted
serial: 8250_exar: Decrease indentation level
Decrease indentation level in some places. No functional change intended. Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Parker Newman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 709bb04 commit ee6c49a

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

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

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -607,28 +607,30 @@ pci_fastcom335_setup(struct exar8250 *priv, struct pci_dev *pcidev,
607607
writeb(32, p + UART_EXAR_TXTRG);
608608
writeb(32, p + UART_EXAR_RXTRG);
609609

610+
/* Skip the initial (per device) setup */
611+
if (idx)
612+
return 0;
613+
610614
/*
611615
* Setup Multipurpose Input/Output pins.
612616
*/
613-
if (idx == 0) {
614-
switch (pcidev->device) {
615-
case PCI_DEVICE_ID_COMMTECH_4222PCI335:
616-
case PCI_DEVICE_ID_COMMTECH_4224PCI335:
617-
writeb(0x78, p + UART_EXAR_MPIOLVL_7_0);
618-
writeb(0x00, p + UART_EXAR_MPIOINV_7_0);
619-
writeb(0x00, p + UART_EXAR_MPIOSEL_7_0);
620-
break;
621-
case PCI_DEVICE_ID_COMMTECH_2324PCI335:
622-
case PCI_DEVICE_ID_COMMTECH_2328PCI335:
623-
writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);
624-
writeb(0xc0, p + UART_EXAR_MPIOINV_7_0);
625-
writeb(0xc0, p + UART_EXAR_MPIOSEL_7_0);
626-
break;
627-
}
628-
writeb(0x00, p + UART_EXAR_MPIOINT_7_0);
629-
writeb(0x00, p + UART_EXAR_MPIO3T_7_0);
630-
writeb(0x00, p + UART_EXAR_MPIOOD_7_0);
617+
switch (pcidev->device) {
618+
case PCI_DEVICE_ID_COMMTECH_4222PCI335:
619+
case PCI_DEVICE_ID_COMMTECH_4224PCI335:
620+
writeb(0x78, p + UART_EXAR_MPIOLVL_7_0);
621+
writeb(0x00, p + UART_EXAR_MPIOINV_7_0);
622+
writeb(0x00, p + UART_EXAR_MPIOSEL_7_0);
623+
break;
624+
case PCI_DEVICE_ID_COMMTECH_2324PCI335:
625+
case PCI_DEVICE_ID_COMMTECH_2328PCI335:
626+
writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);
627+
writeb(0xc0, p + UART_EXAR_MPIOINV_7_0);
628+
writeb(0xc0, p + UART_EXAR_MPIOSEL_7_0);
629+
break;
631630
}
631+
writeb(0x00, p + UART_EXAR_MPIOINT_7_0);
632+
writeb(0x00, p + UART_EXAR_MPIO3T_7_0);
633+
writeb(0x00, p + UART_EXAR_MPIOOD_7_0);
632634

633635
return 0;
634636
}
@@ -853,21 +855,19 @@ static enum cti_port_type cti_get_port_type_xr17v35x(struct exar8250 *priv,
853855
port_flags = exar_ee_read(priv, offset);
854856

855857
port_type = FIELD_GET(CTI_EE_MASK_PORT_FLAGS_TYPE, port_flags);
856-
if (!CTI_PORT_TYPE_VALID(port_type)) {
857-
/*
858-
* If the port type is missing the card assume it is a
859-
* RS232/RS422/RS485 card to be safe.
860-
*
861-
* There is one known board (BEG013) that only has
862-
* 3 of 4 port types written to the EEPROM so this
863-
* acts as a work around.
864-
*/
865-
dev_warn(&pcidev->dev,
866-
"failed to get port %d type from EEPROM\n", port_num);
867-
port_type = CTI_PORT_TYPE_RS232_422_485_HW;
868-
}
858+
if (CTI_PORT_TYPE_VALID(port_type))
859+
return port_type;
869860

870-
return port_type;
861+
/*
862+
* If the port type is missing the card assume it is a
863+
* RS232/RS422/RS485 card to be safe.
864+
*
865+
* There is one known board (BEG013) that only has 3 of 4 port types
866+
* written to the EEPROM so this acts as a work around.
867+
*/
868+
dev_warn(&pcidev->dev, "failed to get port %d type from EEPROM\n", port_num);
869+
870+
return CTI_PORT_TYPE_RS232_422_485_HW;
871871
}
872872

873873
static int cti_rs485_config_mpio_tristate(struct uart_port *port,
@@ -1190,11 +1190,10 @@ static void setup_gpio(struct pci_dev *pcidev, u8 __iomem *p)
11901190
* devices will export them as GPIOs, so we pre-configure them safely
11911191
* as inputs.
11921192
*/
1193-
11941193
u8 dir = 0x00;
11951194

11961195
if ((pcidev->vendor == PCI_VENDOR_ID_EXAR) &&
1197-
(pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL)) {
1196+
(pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL)) {
11981197
// Configure GPIO as inputs for Commtech adapters
11991198
dir = 0xff;
12001199
} else {
@@ -1284,27 +1283,28 @@ static int sealevel_rs485_config(struct uart_port *port, struct ktermios *termio
12841283
if (ret)
12851284
return ret;
12861285

1287-
if (rs485->flags & SER_RS485_ENABLED) {
1288-
old_lcr = readb(p + UART_LCR);
1286+
if (!(rs485->flags & SER_RS485_ENABLED))
1287+
return 0;
12891288

1290-
/* Set EFR[4]=1 to enable enhanced feature registers */
1291-
efr = readb(p + UART_XR_EFR);
1292-
efr |= UART_EFR_ECB;
1293-
writeb(efr, p + UART_XR_EFR);
1289+
old_lcr = readb(p + UART_LCR);
12941290

1295-
/* Set MCR to use DTR as Auto-RS485 Enable signal */
1296-
writeb(UART_MCR_OUT1, p + UART_MCR);
1291+
/* Set EFR[4]=1 to enable enhanced feature registers */
1292+
efr = readb(p + UART_XR_EFR);
1293+
efr |= UART_EFR_ECB;
1294+
writeb(efr, p + UART_XR_EFR);
12971295

1298-
/* Set LCR[7]=1 to enable access to DLD register */
1299-
writeb(old_lcr | UART_LCR_DLAB, p + UART_LCR);
1296+
/* Set MCR to use DTR as Auto-RS485 Enable signal */
1297+
writeb(UART_MCR_OUT1, p + UART_MCR);
13001298

1301-
/* Set DLD[7]=1 for inverted RS485 Enable logic */
1302-
dld = readb(p + UART_EXAR_DLD);
1303-
dld |= UART_EXAR_DLD_485_POLARITY;
1304-
writeb(dld, p + UART_EXAR_DLD);
1299+
/* Set LCR[7]=1 to enable access to DLD register */
1300+
writeb(old_lcr | UART_LCR_DLAB, p + UART_LCR);
13051301

1306-
writeb(old_lcr, p + UART_LCR);
1307-
}
1302+
/* Set DLD[7]=1 for inverted RS485 Enable logic */
1303+
dld = readb(p + UART_EXAR_DLD);
1304+
dld |= UART_EXAR_DLD_485_POLARITY;
1305+
writeb(dld, p + UART_EXAR_DLD);
1306+
1307+
writeb(old_lcr, p + UART_LCR);
13081308

13091309
return 0;
13101310
}

0 commit comments

Comments
 (0)