Commit efd393c8 authored by Alessandro Rubini's avatar Alessandro Rubini

eeprom: don't pass redundant parameters to eeprom_phtrans

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 4ed88edb
......@@ -227,7 +227,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
return 0;
}
int8_t eeprom_phtrans(uint8_t i2cif, uint8_t i2c_addr, uint32_t * val,
int eeprom_phtrans(uint32_t * val,
uint8_t write)
{
int8_t ret;
......
......@@ -213,7 +213,7 @@ static int calib_t24p_master(uint32_t *value)
{
int rv;
rv = eeprom_phtrans(WRPC_FMC_I2C, FMC_EEPROM_ADR, value, 0);
rv = eeprom_phtrans(value, 0);
if(rv < 0) {
pp_printf("Error %d while reading EEPROM\n", rv);
return rv;
......@@ -241,9 +241,9 @@ static int calib_t24p_slave(uint32_t *value)
* Let's see if we have a matching value in EEPROM:
* accept a 200ps difference, otherwise rewrite eeprom
*/
rv = eeprom_phtrans(WRPC_FMC_I2C, FMC_EEPROM_ADR, &prev, 0 /* rd */);
rv = eeprom_phtrans(&prev, 0 /* rd */);
if (rv < 0 || (prev < *value - 200) || (prev > *value + 200)) {
rv = eeprom_phtrans(WRPC_FMC_I2C, FMC_EEPROM_ADR, value, 1);
rv = eeprom_phtrans(value, 1);
pp_printf("Wrote new t24p value: %d ps (%s)\n", *value,
rv < 0 ? "Failed" : "Success");
}
......
......@@ -381,7 +381,7 @@ int eeprom_match_sfp(struct s_sfpinfo * sfp)
* Phase transition ("calibration" file)
*/
#define VALIDITY_BIT 0x80000000
int8_t eeprom_phtrans(uint8_t i2cif, uint8_t i2c_addr, uint32_t * valp,
int eeprom_phtrans(uint32_t * valp,
uint8_t write)
{
int ret = -1;
......
......@@ -34,7 +34,7 @@ int eeprom_match_sfp(struct s_sfpinfo *sfp);
int eeprom_get_sfp(struct s_sfpinfo * sfp,
uint8_t add, uint8_t pos);
int8_t eeprom_phtrans(uint8_t i2cif, uint8_t i2c_addr, uint32_t * val,
int eeprom_phtrans(uint32_t * val,
uint8_t write);
int8_t eeprom_init_erase(uint8_t i2cif, uint8_t i2c_addr);
......
......@@ -27,9 +27,9 @@ static int cmd_calibration(const char *args[])
if (args[0] && !strcasecmp(args[0], "force")) {
if (measure_t24p(&trans) < 0)
return -1;
return eeprom_phtrans(WRPC_FMC_I2C, FMC_EEPROM_ADR, &trans, 1);
return eeprom_phtrans(&trans, 1);
} else if (!args[0]) {
if (eeprom_phtrans(WRPC_FMC_I2C, FMC_EEPROM_ADR, &trans, 0) > 0) {
if (eeprom_phtrans(&trans, 0) > 0) {
mprintf("Found phase transition in EEPROM: %dps\n",
trans);
cal_phase_transition = trans;
......@@ -39,8 +39,7 @@ static int cmd_calibration(const char *args[])
if (measure_t24p(&trans) < 0)
return -1;
cal_phase_transition = trans;
return eeprom_phtrans(WRPC_FMC_I2C, FMC_EEPROM_ADR,
&trans, 1);
return eeprom_phtrans(&trans, 1);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment