@@ -695,7 +695,6 @@ static int cti_read_osc_freq(struct exar8250 *priv, u8 eeprom_offset)
695
695
{
696
696
u16 lower_word ;
697
697
u16 upper_word ;
698
- int osc_freq ;
699
698
700
699
lower_word = exar_ee_read (priv , eeprom_offset );
701
700
// Check if EEPROM word was blank
@@ -706,10 +705,8 @@ static int cti_read_osc_freq(struct exar8250 *priv, u8 eeprom_offset)
706
705
if (upper_word == 0xFFFF )
707
706
return - EIO ;
708
707
709
- osc_freq = FIELD_PREP (CTI_EE_MASK_OSC_FREQ_LOWER , lower_word ) |
710
- FIELD_PREP (CTI_EE_MASK_OSC_FREQ_UPPER , upper_word );
711
-
712
- return osc_freq ;
708
+ return FIELD_PREP (CTI_EE_MASK_OSC_FREQ_LOWER , lower_word ) |
709
+ FIELD_PREP (CTI_EE_MASK_OSC_FREQ_UPPER , upper_word );
713
710
}
714
711
715
712
/**
@@ -890,6 +887,19 @@ static int cti_rs485_config_mpio_tristate(struct uart_port *port,
890
887
return cti_tristate_disable (priv , port -> port_id );
891
888
}
892
889
890
+ static void cti_board_init_osc_freq (struct exar8250 * priv , struct pci_dev * pcidev , u8 eeprom_offset )
891
+ {
892
+ int osc_freq ;
893
+
894
+ osc_freq = cti_read_osc_freq (priv , eeprom_offset );
895
+ if (osc_freq <= 0 ) {
896
+ dev_warn (& pcidev -> dev , "failed to read OSC freq from EEPROM, using default\n" );
897
+ osc_freq = CTI_DEFAULT_PCI_OSC_FREQ ;
898
+ }
899
+
900
+ priv -> osc_freq = osc_freq ;
901
+ }
902
+
893
903
static int cti_port_setup_common (struct exar8250 * priv ,
894
904
struct pci_dev * pcidev ,
895
905
int idx , unsigned int offset ,
@@ -1095,19 +1105,9 @@ static int cti_board_init_xr17v35x(struct exar8250 *priv,
1095
1105
return 0 ;
1096
1106
}
1097
1107
1098
- static int cti_board_init_xr17v25x (struct exar8250 * priv ,
1099
- struct pci_dev * pcidev )
1108
+ static int cti_board_init_xr17v25x (struct exar8250 * priv , struct pci_dev * pcidev )
1100
1109
{
1101
- int osc_freq ;
1102
-
1103
- osc_freq = cti_read_osc_freq (priv , CTI_EE_OFF_XR17V25X_OSC_FREQ );
1104
- if (osc_freq < 0 ) {
1105
- dev_warn (& pcidev -> dev ,
1106
- "failed to read osc freq from EEPROM, using default\n" );
1107
- osc_freq = CTI_DEFAULT_PCI_OSC_FREQ ;
1108
- }
1109
-
1110
- priv -> osc_freq = osc_freq ;
1110
+ cti_board_init_osc_freq (priv , pcidev , CTI_EE_OFF_XR17V25X_OSC_FREQ );
1111
1111
1112
1112
/* enable interrupts on cards that need the "PLX fix" */
1113
1113
switch (pcidev -> subsystem_device ) {
@@ -1123,19 +1123,9 @@ static int cti_board_init_xr17v25x(struct exar8250 *priv,
1123
1123
return 0 ;
1124
1124
}
1125
1125
1126
- static int cti_board_init_xr17c15x (struct exar8250 * priv ,
1127
- struct pci_dev * pcidev )
1126
+ static int cti_board_init_xr17c15x (struct exar8250 * priv , struct pci_dev * pcidev )
1128
1127
{
1129
- int osc_freq ;
1130
-
1131
- osc_freq = cti_read_osc_freq (priv , CTI_EE_OFF_XR17C15X_OSC_FREQ );
1132
- if (osc_freq <= 0 ) {
1133
- dev_warn (& pcidev -> dev ,
1134
- "failed to read osc freq from EEPROM, using default\n" );
1135
- osc_freq = CTI_DEFAULT_PCI_OSC_FREQ ;
1136
- }
1137
-
1138
- priv -> osc_freq = osc_freq ;
1128
+ cti_board_init_osc_freq (priv , pcidev , CTI_EE_OFF_XR17C15X_OSC_FREQ );
1139
1129
1140
1130
/* enable interrupts on cards that need the "PLX fix" */
1141
1131
switch (pcidev -> subsystem_device ) {
0 commit comments