mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-24 14:33:31 +00:00
mesh: Pull all function calls out of the K_MSEC macro
The K_MSEC macro evaluates its argument twice, which causes double evaluation of some function calls in the mesh stack. This removes all instances of function calls inside K_MSEC macros in the mesh stack. This is port of 040b14366ebbf58d49fc21d02dc6ec9aa51e90d9
This commit is contained in:
committed by
Łukasz Rymanowski
parent
68e7bb8065
commit
6681f63b32
@@ -585,9 +585,11 @@ done:
|
||||
|
||||
static void friend_recv_delay(struct bt_mesh_friend *frnd)
|
||||
{
|
||||
int32_t delay = recv_delay(frnd);
|
||||
|
||||
frnd->pending_req = 1;
|
||||
k_delayed_work_submit(&frnd->timer, recv_delay(frnd));
|
||||
BT_DBG("Waiting RecvDelay of %d ms", (int) recv_delay(frnd));
|
||||
k_delayed_work_submit(&frnd->timer, K_MSEC(delay));
|
||||
BT_DBG("Waiting RecvDelay of %d ms", delay);
|
||||
}
|
||||
|
||||
int bt_mesh_friend_sub_add(struct bt_mesh_net_rx *rx,
|
||||
@@ -932,6 +934,7 @@ int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct os_mbuf *buf)
|
||||
struct bt_mesh_ctl_friend_req *msg = (void *)buf->om_data;
|
||||
struct bt_mesh_friend *frnd = NULL;
|
||||
uint32_t poll_to;
|
||||
int32_t delay;
|
||||
int i, err;
|
||||
|
||||
if (rx->net_if == BT_MESH_NET_IF_LOCAL) {
|
||||
@@ -1022,9 +1025,8 @@ init_friend:
|
||||
clear_procedure_start(frnd);
|
||||
}
|
||||
|
||||
k_delayed_work_submit(&frnd->timer,
|
||||
offer_delay(frnd, rx->ctx.recv_rssi,
|
||||
msg->criteria));
|
||||
delay = offer_delay(frnd, rx->ctx.recv_rssi, msg->criteria);
|
||||
k_delayed_work_submit(&frnd->timer, K_MSEC(delay));
|
||||
|
||||
enqueue_offer(frnd, rx->ctx.recv_rssi);
|
||||
|
||||
|
||||
@@ -923,7 +923,9 @@ int bt_mesh_lpn_friend_sub_cfm(struct bt_mesh_net_rx *rx,
|
||||
}
|
||||
|
||||
if (!lpn->sent_req) {
|
||||
k_delayed_work_submit(&lpn->timer, poll_timeout(lpn));
|
||||
int32_t timeout = poll_timeout(lpn);
|
||||
|
||||
k_delayed_work_submit(&lpn->timer, K_MSEC(timeout));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1009,7 +1011,9 @@ int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx,
|
||||
}
|
||||
|
||||
if (!lpn->sent_req) {
|
||||
k_delayed_work_submit(&lpn->timer, poll_timeout(lpn));
|
||||
int32_t timeout = poll_timeout(lpn);
|
||||
|
||||
k_delayed_work_submit(&lpn->timer, K_MSEC(timeout));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1109,6 +1109,7 @@ static void seg_rx_reset(struct seg_rx *rx, bool full_reset)
|
||||
static void seg_ack(struct ble_npl_event *work)
|
||||
{
|
||||
struct seg_rx *rx = ble_npl_event_get_arg(work);
|
||||
int32_t timeout;
|
||||
|
||||
BT_DBG("rx %p", rx);
|
||||
|
||||
@@ -1126,7 +1127,8 @@ static void seg_ack(struct ble_npl_event *work)
|
||||
send_ack(rx->sub, rx->dst, rx->src, rx->ttl, &rx->seq_auth,
|
||||
rx->block, rx->obo);
|
||||
|
||||
k_delayed_work_submit(&rx->ack, ack_timeout(rx));
|
||||
timeout = ack_timeout(rx);
|
||||
k_delayed_work_submit(&rx->ack, K_MSEC(timeout));
|
||||
}
|
||||
|
||||
static inline bool sdu_len_is_ok(bool ctl, uint8_t seg_n)
|
||||
@@ -1409,7 +1411,9 @@ found_rx:
|
||||
|
||||
if (!k_delayed_work_remaining_get(&rx->ack) &&
|
||||
!bt_mesh_lpn_established()) {
|
||||
k_delayed_work_submit(&rx->ack, ack_timeout(rx));
|
||||
int32_t timeout = ack_timeout(rx);
|
||||
|
||||
k_delayed_work_submit(&rx->ack, K_MSEC(timeout));
|
||||
}
|
||||
|
||||
/* Allocated segment here */
|
||||
|
||||
Reference in New Issue
Block a user