Bluetooth: Controller: Add 'U' to unsigned variable assignments

Add 'U' to a value when assigning it to an unsigned
variable.
MISRA-C rule 7.2

Relates to commit b97db52de7 ("misra-c: Add 'U' to
unsigned variable assignments in subsys/").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2022-09-08 07:30:27 +05:30 committed by Carles Cufí
commit 38905eb0ab
3 changed files with 45 additions and 40 deletions

View file

@ -131,7 +131,7 @@ static void prepare(void *param)
/* Accumulate window widening */ /* Accumulate window widening */
lll->window_widening_prepare_us += lll->window_widening_periodic_us * lll->window_widening_prepare_us += lll->window_widening_periodic_us *
(p->lazy + 1); (p->lazy + 1U);
if (lll->window_widening_prepare_us > lll->window_widening_max_us) { if (lll->window_widening_prepare_us > lll->window_widening_max_us) {
lll->window_widening_prepare_us = lll->window_widening_max_us; lll->window_widening_prepare_us = lll->window_widening_max_us;
} }
@ -256,12 +256,12 @@ static int create_prepare_cb(struct lll_prepare_param *p)
event_counter = lll->event_counter + lll->skip_event; event_counter = lll->event_counter + lll->skip_event;
/* Reset accumulated latencies */ /* Reset accumulated latencies */
lll->skip_prepare = 0; lll->skip_prepare = 0U;
chan_idx = data_channel_calc(lll); chan_idx = data_channel_calc(lll);
/* Update event counter to next value */ /* Update event counter to next value */
lll->event_counter = (event_counter + 1); lll->event_counter = (event_counter + 1U);
err = prepare_cb_common(p, chan_idx); err = prepare_cb_common(p, chan_idx);
if (err) { if (err) {
@ -320,16 +320,17 @@ static int prepare_cb(struct lll_prepare_param *p)
event_counter = lll->event_counter + lll->skip_event; event_counter = lll->event_counter + lll->skip_event;
/* Reset accumulated latencies */ /* Reset accumulated latencies */
lll->skip_prepare = 0; lll->skip_prepare = 0U;
chan_idx = data_channel_calc(lll); chan_idx = data_channel_calc(lll);
/* Update event counter to next value */ /* Update event counter to next value */
lll->event_counter = (event_counter + 1); lll->event_counter = (event_counter + 1U);
err = prepare_cb_common(p, chan_idx); err = prepare_cb_common(p, chan_idx);
if (err) { if (err) {
DEBUG_RADIO_START_O(1); DEBUG_RADIO_START_O(1);
return 0; return 0;
} }
@ -554,7 +555,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
/* Accumulate the latency as event is aborted while being in pipeline */ /* Accumulate the latency as event is aborted while being in pipeline */
lll = prepare_param->param; lll = prepare_param->param;
lll->skip_prepare += (prepare_param->lazy + 1); lll->skip_prepare += (prepare_param->lazy + 1U);
lll_done(param); lll_done(param);
} }

View file

@ -1574,7 +1574,7 @@ void ull_conn_done(struct node_rx_event_done *done)
if (conn->tx_head || memq_peek(lll->memq_tx.head, if (conn->tx_head || memq_peek(lll->memq_tx.head,
lll->memq_tx.tail, lll->memq_tx.tail,
NULL)) { NULL)) {
lll->latency_event = 0; lll->latency_event = 0U;
} else if (lll->periph.latency_enabled) { } else if (lll->periph.latency_enabled) {
lll->latency_event = lll->latency; lll->latency_event = lll->latency;
} }
@ -1586,7 +1586,7 @@ void ull_conn_done(struct node_rx_event_done *done)
if (ull_tx_q_peek(&conn->tx_q) || if (ull_tx_q_peek(&conn->tx_q) ||
memq_peek(lll->memq_tx.head, memq_peek(lll->memq_tx.head,
lll->memq_tx.tail, NULL)) { lll->memq_tx.tail, NULL)) {
lll->latency_event = 0; lll->latency_event = 0U;
} else if (lll->periph.latency_enabled) { } else if (lll->periph.latency_enabled) {
lll->latency_event = lll->latency; lll->latency_event = lll->latency;
} }
@ -2770,7 +2770,7 @@ static struct node_tx *ctrl_tx_rsp_mem_acquire(struct ll_conn *conn,
rx->hdr.type = NODE_RX_TYPE_RELEASE; rx->hdr.type = NODE_RX_TYPE_RELEASE;
/* Drop request */ /* Drop request */
*err = 0U; *err = 0;
return NULL; return NULL;
} }
@ -3225,7 +3225,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
ctrl_tx_enqueue(conn, tx); ctrl_tx_enqueue(conn, tx);
#endif /* !CONFIG_BT_CTLR_SCHED_ADVANCED */ #endif /* !CONFIG_BT_CTLR_SCHED_ADVANCED */
} else if (instant_latency <= 0x7FFF) { } else if (instant_latency <= 0x7FFF) {
uint32_t ticks_win_offset = 0; uint32_t ticks_win_offset = 0U;
uint32_t ticks_slot_overhead; uint32_t ticks_slot_overhead;
uint16_t conn_interval_old; uint16_t conn_interval_old;
uint16_t conn_interval_new; uint16_t conn_interval_new;
@ -3674,17 +3674,17 @@ static inline void event_enc_prep(struct ll_conn *conn)
sizeof(lll->ccm_tx.iv)); sizeof(lll->ccm_tx.iv));
/* initialise counter */ /* initialise counter */
lll->ccm_rx.counter = 0; lll->ccm_rx.counter = 0U;
lll->ccm_tx.counter = 0; lll->ccm_tx.counter = 0U;
/* set direction: peripheral to central = 0, /* set direction: peripheral to central = 0,
* central to peripheral = 1 * central to peripheral = 1
*/ */
lll->ccm_rx.direction = 0; lll->ccm_rx.direction = 0U;
lll->ccm_tx.direction = 1; lll->ccm_tx.direction = 1U;
/* enable receive encryption */ /* enable receive encryption */
lll->enc_rx = 1; lll->enc_rx = 1U;
/* send enc start resp */ /* send enc start resp */
start_enc_rsp_send(conn, pdu_ctrl_tx); start_enc_rsp_send(conn, pdu_ctrl_tx);
@ -4283,28 +4283,28 @@ static inline void dle_max_time_get(const struct ll_conn *conn,
uint16_t *max_rx_time, uint16_t *max_rx_time,
uint16_t *max_tx_time) uint16_t *max_tx_time)
{ {
uint64_t feature_coded_phy = 0; uint64_t feature_coded_phy = 0U;
uint64_t feature_phy_2m = 0; uint64_t feature_phy_2m = 0U;
uint16_t rx_time = 0; uint16_t rx_time = 0U;
uint16_t tx_time = 0; uint16_t tx_time = 0U;
#if defined(CONFIG_BT_CTLR_PHY) #if defined(CONFIG_BT_CTLR_PHY)
#if defined(CONFIG_BT_CTLR_PHY_CODED) #if defined(CONFIG_BT_CTLR_PHY_CODED)
feature_coded_phy = (conn->llcp_feature.features_conn & feature_coded_phy = (conn->llcp_feature.features_conn &
BIT64(BT_LE_FEAT_BIT_PHY_CODED)); BIT64(BT_LE_FEAT_BIT_PHY_CODED));
#else #else
feature_coded_phy = 0; feature_coded_phy = 0U;
#endif #endif
#if defined(CONFIG_BT_CTLR_PHY_2M) #if defined(CONFIG_BT_CTLR_PHY_2M)
feature_phy_2m = (conn->llcp_feature.features_conn & feature_phy_2m = (conn->llcp_feature.features_conn &
BIT64(BT_LE_FEAT_BIT_PHY_2M)); BIT64(BT_LE_FEAT_BIT_PHY_2M));
#else #else
feature_phy_2m = 0; feature_phy_2m = 0U;
#endif #endif
#else #else
feature_coded_phy = 0; feature_coded_phy = 0U;
feature_phy_2m = 0; feature_phy_2m = 0U;
#endif #endif
if (!conn->common.fex_valid || if (!conn->common.fex_valid ||
@ -4366,8 +4366,8 @@ static inline void event_len_prep(struct ll_conn *conn)
/* /*
* initialize to 0 to eliminate compiler warnings * initialize to 0 to eliminate compiler warnings
*/ */
uint16_t rx_time = 0; uint16_t rx_time = 0U;
uint16_t tx_time = 0; uint16_t tx_time = 0U;
tx = mem_acquire(&mem_conn_tx_ctrl.free); tx = mem_acquire(&mem_conn_tx_ctrl.free);
if (!tx) { if (!tx) {
@ -4450,7 +4450,7 @@ static inline void event_len_prep(struct ll_conn *conn)
/* Initiate cached procedure */ /* Initiate cached procedure */
conn->llcp_length.tx_octets = conn->llcp_length.tx_octets =
conn->llcp_length.cache.tx_octets; conn->llcp_length.cache.tx_octets;
conn->llcp_length.cache.tx_octets = 0; conn->llcp_length.cache.tx_octets = 0U;
#if defined(CONFIG_BT_CTLR_PHY) #if defined(CONFIG_BT_CTLR_PHY)
conn->llcp_length.tx_time = conn->llcp_length.tx_time =
conn->llcp_length.cache.tx_time; conn->llcp_length.cache.tx_time;
@ -4616,7 +4616,9 @@ static inline void event_phy_req_prep(struct ll_conn *conn)
} else { } else {
conn->llcp.phy_upd_ind.rx = 0U; conn->llcp.phy_upd_ind.rx = 0U;
} }
/* conn->llcp.phy_upd_ind.instant = 0; */ /* conn->llcp.phy_upd_ind.instant = 0U; for now, will be filled
* in initiate state.
*/
conn->llcp.phy_upd_ind.initiate = 1U; conn->llcp.phy_upd_ind.initiate = 1U;
conn->llcp.phy_upd_ind.cmd = conn->llcp_phy.cmd; conn->llcp.phy_upd_ind.cmd = conn->llcp_phy.cmd;
@ -5362,10 +5364,10 @@ static int pause_enc_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
} }
/* disable transmit encryption */ /* disable transmit encryption */
conn->lll.enc_tx = 0; conn->lll.enc_tx = 0U;
} else { } else {
/* disable transmit encryption */ /* disable transmit encryption */
conn->lll.enc_tx = 0; conn->lll.enc_tx = 0U;
goto pause_enc_rsp_send_exit; goto pause_enc_rsp_send_exit;
} }
@ -5374,7 +5376,7 @@ static int pause_enc_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
conn->llcp_enc.pause_rx = 1U; conn->llcp_enc.pause_rx = 1U;
/* disable receive encryption */ /* disable receive encryption */
conn->lll.enc_rx = 0; conn->lll.enc_rx = 0U;
/* Enqueue pause enc rsp */ /* Enqueue pause enc rsp */
pdu_ctrl_tx = (void *)tx->pdu; pdu_ctrl_tx = (void *)tx->pdu;
@ -6666,7 +6668,7 @@ static inline void ctrl_tx_ack(struct ll_conn *conn, struct node_tx **tx,
/* Initiate cached procedure */ /* Initiate cached procedure */
conn->llcp_length.tx_octets = conn->llcp_length.tx_octets =
conn->llcp_length.cache.tx_octets; conn->llcp_length.cache.tx_octets;
conn->llcp_length.cache.tx_octets = 0; conn->llcp_length.cache.tx_octets = 0U;
#if defined(CONFIG_BT_CTLR_PHY) #if defined(CONFIG_BT_CTLR_PHY)
conn->llcp_length.tx_time = conn->llcp_length.tx_time =
conn->llcp_length.cache.tx_time; conn->llcp_length.cache.tx_time;
@ -7618,8 +7620,8 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
conn->llcp_phy.rx &= p->tx_phys; conn->llcp_phy.rx &= p->tx_phys;
if (!conn->llcp_phy.tx || !conn->llcp_phy.rx) { if (!conn->llcp_phy.tx || !conn->llcp_phy.rx) {
conn->llcp_phy.tx = 0; conn->llcp_phy.tx = 0U;
conn->llcp_phy.rx = 0; conn->llcp_phy.rx = 0U;
} }
/* pause data packet tx */ /* pause data packet tx */
@ -7652,8 +7654,8 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
conn->llcp_phy.rx &= p->tx_phys; conn->llcp_phy.rx &= p->tx_phys;
if (!conn->llcp_phy.tx || !conn->llcp_phy.rx) { if (!conn->llcp_phy.tx || !conn->llcp_phy.rx) {
conn->llcp_phy.tx = 0; conn->llcp_phy.tx = 0U;
conn->llcp_phy.rx = 0; conn->llcp_phy.rx = 0U;
} }
/* pause data packet tx */ /* pause data packet tx */
@ -7715,7 +7717,9 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
} }
ull_chan_map_get(conn->llcp.chan_map.chm); ull_chan_map_get(conn->llcp.chan_map.chm);
/* conn->llcp.chan_map.instant = 0; */ /* conn->llcp.chan_map.instant = 0U; filled in initiate
* state.
*/
conn->llcp.chan_map.initiate = 1U; conn->llcp.chan_map.initiate = 1U;
conn->llcp_type = LLCP_CHAN_MAP; conn->llcp_type = LLCP_CHAN_MAP;
@ -8059,9 +8063,9 @@ void ull_conn_chan_map_set(struct ll_conn *conn, const uint8_t chm[5])
static inline void dle_max_time_get(struct ll_conn *conn, uint16_t *max_rx_time, static inline void dle_max_time_get(struct ll_conn *conn, uint16_t *max_rx_time,
uint16_t *max_tx_time) uint16_t *max_tx_time)
{ {
uint16_t rx_time = 0;
uint16_t tx_time = 0;
uint8_t phy_select = PHY_1M; uint8_t phy_select = PHY_1M;
uint16_t rx_time = 0U;
uint16_t tx_time = 0U;
#if defined(CONFIG_BT_CTLR_PHY) #if defined(CONFIG_BT_CTLR_PHY)
if (conn->llcp.fex.valid && feature_phy_coded(conn)) { if (conn->llcp.fex.valid && feature_phy_coded(conn)) {
@ -8101,7 +8105,7 @@ void ull_dle_max_time_get(struct ll_conn *conn, uint16_t *max_rx_time,
uint8_t ull_dle_update_eff(struct ll_conn *conn) uint8_t ull_dle_update_eff(struct ll_conn *conn)
{ {
uint8_t dle_changed = 0; uint8_t dle_changed = 0U;
const uint16_t eff_tx_octets = const uint16_t eff_tx_octets =
MAX(MIN(conn->lll.dle.local.max_tx_octets, conn->lll.dle.remote.max_rx_octets), MAX(MIN(conn->lll.dle.local.max_tx_octets, conn->lll.dle.remote.max_rx_octets),

View file

@ -331,7 +331,7 @@ uint8_t ll_sync_create_cancel(void **rx)
sync->is_stop = 1U; sync->is_stop = 1U;
cpu_dmb(); cpu_dmb();
if (sync->timeout_reload != 0) { if (sync->timeout_reload != 0U) {
uint16_t sync_handle = ull_sync_handle_get(sync); uint16_t sync_handle = ull_sync_handle_get(sync);
LL_ASSERT(sync_handle <= UINT8_MAX); LL_ASSERT(sync_handle <= UINT8_MAX);