Commit e4cd8376 authored by Alessandro Rubini's avatar Alessandro Rubini

timeout: kill pp_timeout_z()

It was not a good idea: there is no need to clear a timeout if
it is being re-initialized in the same function anyways. If, OTOH,
we change state, it won't be referenced any more so there's no need
to disable it.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 97bfde82
......@@ -229,7 +229,6 @@ extern void pp_timeout_setall(struct pp_instance *ppi);
extern void pp_timeout_clr(struct pp_instance *ppi, int index);
extern int pp_timeout(struct pp_instance *ppi, int index)
__attribute__((warn_unused_result));
extern int pp_timeout_z(struct pp_instance *ppi, int index);
extern int pp_ms_to_timeout(struct pp_instance *ppi, int index);
/* The channel for an instance must be created and possibly destroyed. */
......
......@@ -21,7 +21,7 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state)
__pp_timeout_set(ppi, PP_TO_EXT_0, wrp->wrStateTimeout);
if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
if (pp_timeout(ppi, PP_TO_EXT_0)) {
/*
* FIXME: We should implement a retry by re-sending
* the "calibrated" message, moving it here from the
......
......@@ -22,7 +22,7 @@ int wr_calibration(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
} else if (pp_timeout(ppi, PP_TO_EXT_0)) {
if (wr_handshake_retry(ppi))
sendmsg = 1;
else
......
......@@ -22,7 +22,7 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
} else if (pp_timeout(ppi, PP_TO_EXT_0)) {
if (wr_handshake_retry(ppi))
sendmsg = 1;
else
......
......@@ -22,7 +22,7 @@ int wr_m_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
} else if (pp_timeout(ppi, PP_TO_EXT_0)) {
if (wr_handshake_retry(ppi))
sendmsg = 1;
else
......
......@@ -26,7 +26,7 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
} else if (pp_timeout(ppi, PP_TO_EXT_0)) {
if (wr_handshake_retry(ppi))
sendmsg = 1;
else
......
......@@ -19,7 +19,7 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
enable = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
} else if (pp_timeout(ppi, PP_TO_EXT_0)) {
if (send_pattern)
wrp->ops->calib_pattern_disable(ppi);
if (wr_handshake_retry(ppi))
......
......@@ -17,7 +17,7 @@ int wr_s_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
enable = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
} else if (pp_timeout(ppi, PP_TO_EXT_0)) {
wrp->ops->locking_disable(ppi);
if (wr_handshake_retry(ppi))
enable = 1;
......
......@@ -119,15 +119,6 @@ int pp_timeout(struct pp_instance *ppi, int index)
return ret;
}
int pp_timeout_z(struct pp_instance *ppi, int index)
{
int ret = pp_timeout(ppi, index);
if (ret)
pp_timeout_clr(ppi, index);
return ret;
}
/* how many ms to wait for the timeout to happen, for ppi->next_delay */
int pp_ms_to_timeout(struct pp_instance *ppi, int index)
{
......
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