@@ -627,6 +627,8 @@ pci_fastcom335_setup(struct exar8250 *priv, struct pci_dev *pcidev,
627627 writeb (0xc0 , p + UART_EXAR_MPIOINV_7_0 );
628628 writeb (0xc0 , p + UART_EXAR_MPIOSEL_7_0 );
629629 break ;
630+ default :
631+ break ;
630632 }
631633 writeb (0x00 , p + UART_EXAR_MPIOINT_7_0 );
632634 writeb (0x00 , p + UART_EXAR_MPIO3T_7_0 );
@@ -723,8 +725,6 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
723725 struct pci_dev * pcidev ,
724726 unsigned int port_num )
725727{
726- enum cti_port_type port_type ;
727-
728728 switch (pcidev -> subsystem_device ) {
729729 // RS232 only cards
730730 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232 :
@@ -734,24 +734,17 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
734734 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_232_NS :
735735 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_232 :
736736 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_232_NS :
737- port_type = CTI_PORT_TYPE_RS232 ;
738- break ;
737+ return CTI_PORT_TYPE_RS232 ;
739738 // 1x RS232, 1x RS422/RS485
740739 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1 :
741- port_type = (port_num == 0 ) ?
742- CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
743- break ;
740+ return (port_num == 0 ) ? CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
744741 // 2x RS232, 2x RS422/RS485
745742 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2 :
746- port_type = (port_num < 2 ) ?
747- CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
748- break ;
743+ return (port_num < 2 ) ? CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
749744 // 4x RS232, 4x RS422/RS485
750745 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 :
751746 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4_SP :
752- port_type = (port_num < 4 ) ?
753- CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
754- break ;
747+ return (port_num < 4 ) ? CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
755748 // RS232/RS422/RS485 HW (jumper) selectable
756749 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 :
757750 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4 :
@@ -774,32 +767,24 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
774767 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_XP_OPTO :
775768 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4_XPRS_OPTO :
776769 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP :
777- port_type = CTI_PORT_TYPE_RS232_422_485_HW ;
778- break ;
770+ return CTI_PORT_TYPE_RS232_422_485_HW ;
779771 // RS422/RS485 HW (jumper) selectable
780772 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 :
781773 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 :
782774 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 :
783775 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_485 :
784776 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_485 :
785- port_type = CTI_PORT_TYPE_RS422_485 ;
786- break ;
777+ return CTI_PORT_TYPE_RS422_485 ;
787778 // 6x RS232, 2x RS422/RS485
788779 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_6_2_SP :
789- port_type = (port_num < 6 ) ?
790- CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
791- break ;
780+ return (port_num < 6 ) ? CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
792781 // 2x RS232, 6x RS422/RS485
793782 case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_6_SP :
794- port_type = (port_num < 2 ) ?
795- CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
796- break ;
783+ return (port_num < 2 ) ? CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485 ;
797784 default :
798785 dev_err (& pcidev -> dev , "unknown/unsupported device\n" );
799- port_type = CTI_PORT_TYPE_NONE ;
786+ return CTI_PORT_TYPE_NONE ;
800787 }
801-
802- return port_type ;
803788}
804789
805790/**
@@ -816,20 +801,15 @@ static enum cti_port_type cti_get_port_type_fpga(struct exar8250 *priv,
816801 struct pci_dev * pcidev ,
817802 unsigned int port_num )
818803{
819- enum cti_port_type port_type ;
820-
821804 switch (pcidev -> device ) {
822805 case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X :
823806 case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X :
824807 case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_16 :
825- port_type = CTI_PORT_TYPE_RS232_422_485_HW ;
826- break ;
808+ return CTI_PORT_TYPE_RS232_422_485_HW ;
827809 default :
828810 dev_err (& pcidev -> dev , "unknown/unsupported device\n" );
829811 return CTI_PORT_TYPE_NONE ;
830812 }
831-
832- return port_type ;
833813}
834814
835815/**
@@ -1493,35 +1473,33 @@ static irqreturn_t exar_misc_handler(int irq, void *data)
14931473 return IRQ_HANDLED ;
14941474}
14951475
1496- static unsigned int exar_get_nr_ports (struct exar8250_board * board ,
1497- struct pci_dev * pcidev )
1476+ static unsigned int exar_get_nr_ports (struct exar8250_board * board , struct pci_dev * pcidev )
14981477{
1499- unsigned int nr_ports = 0 ;
1500-
1501- if (pcidev -> vendor == PCI_VENDOR_ID_ACCESSIO ) {
1502- nr_ports = BIT (((pcidev -> device & 0x38 ) >> 3 ) - 1 );
1503- } else if (board -> num_ports > 0 ) {
1504- // Check if board struct overrides number of ports
1505- nr_ports = board -> num_ports ;
1506- } else if (pcidev -> vendor == PCI_VENDOR_ID_EXAR ) {
1507- // Exar encodes # ports in last nibble of PCI Device ID ex. 0358
1508- nr_ports = pcidev -> device & 0x0f ;
1509- } else if (pcidev -> vendor == PCI_VENDOR_ID_CONNECT_TECH ) {
1510- // Handle CTI FPGA cards
1478+ if (pcidev -> vendor == PCI_VENDOR_ID_ACCESSIO )
1479+ return BIT (((pcidev -> device & 0x38 ) >> 3 ) - 1 );
1480+
1481+ // Check if board struct overrides number of ports
1482+ if (board -> num_ports > 0 )
1483+ return board -> num_ports ;
1484+
1485+ // Exar encodes # ports in last nibble of PCI Device ID ex. 0358
1486+ if (pcidev -> vendor == PCI_VENDOR_ID_EXAR )
1487+ return pcidev -> device & 0x0f ;
1488+
1489+ // Handle CTI FPGA cards
1490+ if (pcidev -> vendor == PCI_VENDOR_ID_CONNECT_TECH ) {
15111491 switch (pcidev -> device ) {
15121492 case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X :
15131493 case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X :
1514- nr_ports = 12 ;
1515- break ;
1494+ return 12 ;
15161495 case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_16 :
1517- nr_ports = 16 ;
1518- break ;
1496+ return 16 ;
15191497 default :
1520- break ;
1498+ return 0 ;
15211499 }
15221500 }
15231501
1524- return nr_ports ;
1502+ return 0 ;
15251503}
15261504
15271505static int
0 commit comments