@@ -627,6 +627,8 @@ pci_fastcom335_setup(struct exar8250 *priv, struct pci_dev *pcidev,
627
627
writeb (0xc0 , p + UART_EXAR_MPIOINV_7_0 );
628
628
writeb (0xc0 , p + UART_EXAR_MPIOSEL_7_0 );
629
629
break ;
630
+ default :
631
+ break ;
630
632
}
631
633
writeb (0x00 , p + UART_EXAR_MPIOINT_7_0 );
632
634
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
723
725
struct pci_dev * pcidev ,
724
726
unsigned int port_num )
725
727
{
726
- enum cti_port_type port_type ;
727
-
728
728
switch (pcidev -> subsystem_device ) {
729
729
// RS232 only cards
730
730
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
734
734
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_232_NS :
735
735
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_232 :
736
736
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 ;
739
738
// 1x RS232, 1x RS422/RS485
740
739
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 ;
744
741
// 2x RS232, 2x RS422/RS485
745
742
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 ;
749
744
// 4x RS232, 4x RS422/RS485
750
745
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 :
751
746
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 ;
755
748
// RS232/RS422/RS485 HW (jumper) selectable
756
749
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 :
757
750
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
774
767
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_XP_OPTO :
775
768
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4_XPRS_OPTO :
776
769
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 ;
779
771
// RS422/RS485 HW (jumper) selectable
780
772
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 :
781
773
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 :
782
774
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 :
783
775
case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_485 :
784
776
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 ;
787
778
// 6x RS232, 2x RS422/RS485
788
779
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 ;
792
781
// 2x RS232, 6x RS422/RS485
793
782
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 ;
797
784
default :
798
785
dev_err (& pcidev -> dev , "unknown/unsupported device\n" );
799
- port_type = CTI_PORT_TYPE_NONE ;
786
+ return CTI_PORT_TYPE_NONE ;
800
787
}
801
-
802
- return port_type ;
803
788
}
804
789
805
790
/**
@@ -816,20 +801,15 @@ static enum cti_port_type cti_get_port_type_fpga(struct exar8250 *priv,
816
801
struct pci_dev * pcidev ,
817
802
unsigned int port_num )
818
803
{
819
- enum cti_port_type port_type ;
820
-
821
804
switch (pcidev -> device ) {
822
805
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X :
823
806
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X :
824
807
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 ;
827
809
default :
828
810
dev_err (& pcidev -> dev , "unknown/unsupported device\n" );
829
811
return CTI_PORT_TYPE_NONE ;
830
812
}
831
-
832
- return port_type ;
833
813
}
834
814
835
815
/**
@@ -1493,35 +1473,33 @@ static irqreturn_t exar_misc_handler(int irq, void *data)
1493
1473
return IRQ_HANDLED ;
1494
1474
}
1495
1475
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 )
1498
1477
{
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 ) {
1511
1491
switch (pcidev -> device ) {
1512
1492
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X :
1513
1493
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X :
1514
- nr_ports = 12 ;
1515
- break ;
1494
+ return 12 ;
1516
1495
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_16 :
1517
- nr_ports = 16 ;
1518
- break ;
1496
+ return 16 ;
1519
1497
default :
1520
- break ;
1498
+ return 0 ;
1521
1499
}
1522
1500
}
1523
1501
1524
- return nr_ports ;
1502
+ return 0 ;
1525
1503
}
1526
1504
1527
1505
static int
0 commit comments