Commit 32995f14 authored by Alessandro Rubini's avatar Alessandro Rubini

general: don't set ppi->next_delay when not needed

A number of states were setting ppi->next_delay before re-setting
it to a different value, or setting it on a state change (which now
occurs immediately)
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent ebb2fbfb
......@@ -12,7 +12,6 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
WR_DSPOR(ppi)->wrPortState = WRS_CALIBRATED;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
pp_timeout_set(ppi, PP_TO_EXT_0,
WR_DSPOR(ppi)->wrStateTimeout);
}
......
......@@ -30,7 +30,5 @@ int wr_link_on(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->next_state = PPS_SLAVE;
else
ppi->next_state = PPS_MASTER;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
return 0;
}
......@@ -13,7 +13,6 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
WR_DSPOR(ppi)->wrPortState = WRS_RESP_CALIB_REQ;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
if (WR_DSPOR(ppi)->otherNodeCalSendPattern) {
wr_calibration_pattern_enable(ppi, 0, 0, 0);
pp_timeout_set(ppi, PP_TO_EXT_0,
......
......@@ -12,7 +12,6 @@ int wr_s_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_UNCALIBRATED;
WR_DSPOR(ppi)->wrPortState = WRS_S_LOCK;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
wr_locking_enable(ppi);
pp_timeout_set(ppi, PP_TO_EXT_0, WR_S_LOCK_TIMEOUT_MS);
}
......
......@@ -16,6 +16,5 @@ int pp_faulty(struct pp_instance *ppi, unsigned char *pkt, int plen)
DSPOR(ppi)->portState = PPS_FAULTY;
PP_PRINTF("Faulty state detected\n");
ppi->next_state = PPS_INITIALIZING;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS * 4;
return 0;
}
......@@ -81,11 +81,9 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->next_state = PPS_LISTENING;
else
ppi->next_state = PPS_MASTER;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
return 0;
failure:
ppi->next_state = PPS_FAULTY;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
return ret;
}
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