misra-c: Add 'U' to unsigned variable assignments in subsys/
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
diff --git a/subsys/bluetooth/controller/hal/nrf5/ecb.c b/subsys/bluetooth/controller/hal/nrf5/ecb.c
index 748ca3e..7dc3c46 100644
--- a/subsys/bluetooth/controller/hal/nrf5/ecb.c
+++ b/subsys/bluetooth/controller/hal/nrf5/ecb.c
@@ -159,7 +159,7 @@
struct ecb_ut_context *ecb_ut_context =
(struct ecb_ut_context *)context;
- ecb_ut_context->done = 1;
+ ecb_ut_context->done = 1U;
ecb_ut_context->status = status;
if (!status) {
mem_rcopy(ecb_ut_context->cipher_text, cipher_be,
@@ -175,13 +175,13 @@
0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44,
0x55 };
u8_t cipher_text[16];
- u32_t status = 0;
+ u32_t status = 0U;
struct ecb ecb;
struct ecb_ut_context context;
ecb_encrypt(key, clear_text, cipher_text, NULL);
- context.done = 0;
+ context.done = 0U;
ecb.in_key_le = key;
ecb.in_clear_text_le = clear_text;
ecb.fp_ecb = ecb_cb;
diff --git a/subsys/bluetooth/controller/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/hal/nrf5/radio/radio.c
index 37dfbad..cb919a0 100644
--- a/subsys/bluetooth/controller/hal/nrf5/radio/radio.c
+++ b/subsys/bluetooth/controller/hal/nrf5/radio/radio.c
@@ -149,14 +149,14 @@
#if defined(CONFIG_SOC_SERIES_NRF51X)
ARG_UNUSED(phy);
- extra = 0;
+ extra = 0U;
/* nRF51 supports only 27 byte PDU when using h/w CCM for encryption. */
if (!IS_ENABLED(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR) && dc) {
- bits_len = 5;
+ bits_len = 5U;
}
#elif defined(CONFIG_SOC_COMPATIBLE_NRF52X)
- extra = 0;
+ extra = 0U;
phy = (flags >> 1) & 0x07; /* phy */
switch (phy) {
@@ -585,7 +585,7 @@
{
u8_t index;
- for (index = 0; index < 8; index++) {
+ for (index = 0U; index < 8; index++) {
NRF_RADIO->DAB[index] = ((u32_t)bdaddr[3] << 24) |
((u32_t)bdaddr[2] << 16) |
((u32_t)bdaddr[1] << 8) |
@@ -691,7 +691,7 @@
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
- last_pdu_end_us = 0;
+ last_pdu_end_us = 0U;
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
nrf_timer_task_trigger(SW_SWITCH_TIMER, NRF_TIMER_TASK_CLEAR);
diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c
index 536097b..3aeb2a7 100644
--- a/subsys/bluetooth/controller/hci/hci.c
+++ b/subsys/bluetooth/controller/hci/hci.c
@@ -220,10 +220,10 @@
}
#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL)
hci_hbuf_total = 0;
- hci_hbuf_sent = 0;
- hci_hbuf_acked = 0;
+ hci_hbuf_sent = 0U;
+ hci_hbuf_acked = 0U;
(void)memset(hci_hbuf_pend, 0, sizeof(hci_hbuf_pend));
- conn_count = 0;
+ conn_count = 0U;
if (buf) {
atomic_set_bit(&hci_state_mask, HCI_STATE_BIT_RESET);
k_poll_signal_raise(hbuf_signal, 0x0);
@@ -268,8 +268,8 @@
return;
}
- hci_hbuf_sent = 0;
- hci_hbuf_acked = 0;
+ hci_hbuf_sent = 0U;
+ hci_hbuf_acked = 0U;
(void)memset(hci_hbuf_pend, 0, sizeof(hci_hbuf_pend));
hci_hbuf_total = -hci_hbuf_total;
}
@@ -304,7 +304,7 @@
{
struct bt_hci_cp_host_num_completed_packets *cmd = (void *)buf->data;
struct bt_hci_evt_cc_status *ccst;
- u32_t count = 0;
+ u32_t count = 0U;
int i;
/* special case, no event returned except for error conditions */
@@ -813,7 +813,7 @@
static void le_read_supp_states(struct net_buf *buf, struct net_buf **evt)
{
struct bt_hci_rp_le_read_supp_states *rp;
- u64_t states = 0;
+ u64_t states = 0U;
rp = cmd_complete(evt, sizeof(*rp));
rp->status = 0x00;
@@ -969,7 +969,7 @@
/* initialize duplicate filtering */
if (cmd->enable && cmd->filter_dup) {
dup_count = 0;
- dup_curr = 0;
+ dup_curr = 0U;
} else {
dup_count = -1;
}
@@ -1316,7 +1316,7 @@
phy_opts -= 1;
phy_opts &= 1;
} else {
- phy_opts = 0;
+ phy_opts = 0U;
}
status = ll_phy_req_send(handle, cmd->tx_phys, phy_opts,
@@ -2133,7 +2133,7 @@
}
if (dup_curr == CONFIG_BT_CTLR_DUP_FILTER_LEN) {
- dup_curr = 0;
+ dup_curr = 0U;
}
}
@@ -2509,7 +2509,7 @@
/* Note: This requires linear handle values starting from 0 */
LL_ASSERT(handle < ARRAY_SIZE(hci_hbuf_pend));
hci_hbuf_acked += hci_hbuf_pend[handle];
- hci_hbuf_pend[handle] = 0;
+ hci_hbuf_pend[handle] = 0U;
#endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */
conn_count--;
}
@@ -2982,7 +2982,7 @@
u8_t num_handles;
u8_t len;
- num_handles = 1;
+ num_handles = 1U;
len = (sizeof(*ep) + (sizeof(*hc) * num_handles));
evt_create(buf, BT_HCI_EVT_NUM_COMPLETED_PACKETS, len);
diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c
index 12146f2..adc62bc 100644
--- a/subsys/bluetooth/controller/ll_sw/ctrl.c
+++ b/subsys/bluetooth/controller/ll_sw/ctrl.c
@@ -465,7 +465,7 @@
* TODO: replace this feature with host-to-controller flowcontrol
* implementation/design.
*/
- _radio.fc_ena = 1;
+ _radio.fc_ena = 1U;
/* memory allocations */
common_init();
@@ -495,27 +495,27 @@
role_disable(RADIO_TICKER_ID_SCAN, RADIO_TICKER_ID_SCAN_STOP);
/* disable connection events */
- for (conn_handle = 0; conn_handle < _radio.connection_count;
+ for (conn_handle = 0U; conn_handle < _radio.connection_count;
conn_handle++) {
role_disable(RADIO_TICKER_ID_FIRST_CONNECTION + conn_handle,
TICKER_NULL);
}
/* reset controller context members */
- _radio.advertiser.is_enabled = 0;
+ _radio.advertiser.is_enabled = 0U;
_radio.advertiser.conn = NULL;
- _radio.scanner.is_enabled = 0;
+ _radio.scanner.is_enabled = 0U;
_radio.scanner.conn = NULL;
_radio.packet_rx_data_size = PACKET_RX_DATA_SIZE_MIN;
_radio.packet_rx_data_count = (_radio.packet_rx_data_pool_size /
_radio.packet_rx_data_size);
- _radio.packet_rx_last = 0;
- _radio.packet_rx_acquire = 0;
+ _radio.packet_rx_last = 0U;
+ _radio.packet_rx_acquire = 0U;
_radio.link_rx_data_quota = _radio.packet_rx_count - 1;
- _radio.packet_tx_first = 0;
- _radio.packet_tx_last = 0;
- _radio.packet_release_first = 0;
- _radio.packet_release_last = 0;
+ _radio.packet_tx_first = 0U;
+ _radio.packet_tx_last = 0U;
+ _radio.packet_release_first = 0U;
+ _radio.packet_release_last = 0U;
/* reset FC feature */
/* TODO: remove this feature related all code in the future */
@@ -574,7 +574,7 @@
_radio.data_chan_map[2] = 0xFF;
_radio.data_chan_map[3] = 0xFF;
_radio.data_chan_map[4] = 0x1F;
- _radio.data_chan_count = 37;
+ _radio.data_chan_count = 37U;
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
/* Initialize the DLE defaults */
@@ -1746,7 +1746,7 @@
static inline u32_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx,
struct radio_pdu_node_tx **node_tx)
{
- u32_t ret = 0;
+ u32_t ret = 0U;
switch (pdu_data_tx->llctrl.opcode) {
case PDU_DATA_LLCTRL_TYPE_TERMINATE_IND:
@@ -1775,7 +1775,7 @@
&pdu_data_tx->llctrl.enc_req.ivm[0], 4);
/* pause data packet tx */
- _radio.conn_curr->pause_tx = 1;
+ _radio.conn_curr->pause_tx = 1U;
/* Start Procedure Timeout (this will not replace terminate
* procedure which always gets place before any packets
@@ -1787,7 +1787,7 @@
case PDU_DATA_LLCTRL_TYPE_ENC_RSP:
/* pause data packet tx */
- _radio.conn_curr->pause_tx = 1;
+ _radio.conn_curr->pause_tx = 1U;
break;
case PDU_DATA_LLCTRL_TYPE_START_ENC_REQ:
@@ -1799,10 +1799,10 @@
case PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ:
/* pause data packet tx */
- _radio.conn_curr->pause_tx = 1;
+ _radio.conn_curr->pause_tx = 1U;
/* key refresh */
- _radio.conn_curr->refresh = 1;
+ _radio.conn_curr->refresh = 1U;
/* Start Procedure Timeout (this will not replace terminate
* procedure which always gets place before any packets
@@ -1821,17 +1821,17 @@
*node_tx = NULL;
} else {
/* pause data packet tx */
- _radio.conn_curr->pause_tx = 1;
+ _radio.conn_curr->pause_tx = 1U;
}
break;
case PDU_DATA_LLCTRL_TYPE_REJECT_IND:
/* resume data packet rx and tx */
- _radio.conn_curr->pause_rx = 0;
- _radio.conn_curr->pause_tx = 0;
+ _radio.conn_curr->pause_rx = 0U;
+ _radio.conn_curr->pause_tx = 0U;
/* Procedure complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
break;
#endif /* CONFIG_BT_CTLR_LE_ENC */
@@ -1842,7 +1842,7 @@
(_radio.conn_curr->llcp_length.state ==
LLCP_LENGTH_STATE_ACK_WAIT)){
/* pause data packet tx */
- _radio.conn_curr->llcp_length.pause_tx = 1;
+ _radio.conn_curr->llcp_length.pause_tx = 1U;
/* wait for response */
_radio.conn_curr->llcp_length.state =
@@ -1881,8 +1881,8 @@
{
struct connection *conn = _radio.conn_curr;
- conn->packet_tx_head_len = 0;
- conn->packet_tx_head_offset = 0;
+ conn->packet_tx_head_len = 0U;
+ conn->packet_tx_head_offset = 0U;
/* release */
if (conn->pkt_tx_head == conn->pkt_tx_ctrl) {
@@ -1945,8 +1945,8 @@
conn->llcp_conn_param.state = LLCP_CPR_STATE_UPD;
- conn->llcp.conn_upd.win_size = 1;
- conn->llcp.conn_upd.win_offset_us = 0;
+ conn->llcp.conn_upd.win_size = 1U;
+ conn->llcp.conn_upd.win_offset_us = 0U;
conn->llcp.conn_upd.interval =
conn->llcp_conn_param.interval_max;
conn->llcp.conn_upd.latency = conn->llcp_conn_param.latency;
@@ -1975,7 +1975,7 @@
conn->llcp_conn_param.req;
/* Stop procedure timeout */
- conn->procedure_expire = 0;
+ conn->procedure_expire = 0U;
/* update to next ticks offsets */
if (conn->role) {
@@ -2000,7 +2000,7 @@
cp->timeout = conn->supervision_reload *
conn->conn_interval * 125 / 1000;
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
}
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
@@ -2020,8 +2020,8 @@
/* Procedure complete */
conn->llcp_length.ack = conn->llcp_length.req;
- conn->llcp_length.pause_tx = 0;
- conn->procedure_expire = 0;
+ conn->llcp_length.pause_tx = 0U;
+ conn->procedure_expire = 0U;
/* prepare length rsp structure */
pdu_data_rx->len = offsetof(struct pdu_data_llctrl,
@@ -2041,7 +2041,7 @@
#endif /* CONFIG_BT_CTLR_PHY */
/* enqueue a length rsp */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
}
}
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
@@ -2074,7 +2074,7 @@
_radio.conn_curr->phy_tx;
/* Stop procedure timeout */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
}
/* skip event generation if not cmd initiated */
@@ -2091,7 +2091,7 @@
p->rx = _radio.conn_curr->phy_rx;
/* enqueue the phy update complete */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
}
}
#endif /* CONFIG_BT_CTLR_PHY */
@@ -2129,17 +2129,17 @@
switch (rej_ext_ind->reject_opcode) {
case PDU_DATA_LLCTRL_TYPE_ENC_REQ:
/* resume data packet rx and tx */
- _radio.conn_curr->pause_rx = 0;
- _radio.conn_curr->pause_tx = 0;
+ _radio.conn_curr->pause_rx = 0U;
+ _radio.conn_curr->pause_tx = 0U;
/* Procedure complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
/* enqueue as if it were a reject ind */
pdu_rx->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_IND;
pdu_rx->llctrl.reject_ind.error_code =
rej_ext_ind->error_code;
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
break;
default:
@@ -2161,7 +2161,7 @@
u16_t eff_rx_time;
u16_t eff_tx_time;
#endif /* CONFIG_BT_CTLR_PHY */
- u8_t nack = 0;
+ u8_t nack = 0U;
/* Check for free ctrl tx PDU */
if (pdu_data_rx->llctrl.opcode == PDU_DATA_LLCTRL_TYPE_LENGTH_REQ) {
@@ -2290,14 +2290,14 @@
*/
_radio.state = STATE_CLOSE;
} else {
- nack = 1;
+ nack = 1U;
}
} else {
/* Procedure complete */
_radio.conn_curr->llcp_length.ack =
_radio.conn_curr->llcp_length.req;
- _radio.conn_curr->llcp_length.pause_tx = 0;
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->llcp_length.pause_tx = 0U;
+ _radio.conn_curr->procedure_expire = 0U;
/* No change in effective octets or time */
if (eff_tx_octets == _radio.conn_curr->max_tx_octets &&
@@ -2335,7 +2335,7 @@
/* Enqueue data length change event (with no change in
* rx length happened), safe to enqueue rx.
*/
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
}
} else {
/* Drop response with no Local initiated request. */
@@ -2427,7 +2427,7 @@
isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx, u8_t *rx_enqueue)
{
struct pdu_data *pdu_data_rx;
- u8_t nack = 0;
+ u8_t nack = 0U;
pdu_data_rx = (void *)node_rx->pdu_data;
switch (pdu_data_rx->llctrl.opcode) {
@@ -2446,7 +2446,7 @@
_radio.conn_curr->llcp_terminate.reason_peer = err;
} else {
/* conn param req procedure, if any, is complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
}
}
break;
@@ -2500,7 +2500,7 @@
&pdu_data_rx->llctrl.enc_req.ivm[0], 4);
/* pause rx data packets */
- _radio.conn_curr->pause_rx = 1;
+ _radio.conn_curr->pause_rx = 1U;
/* Start Procedure Timeout (TODO: this shall not replace
* terminate procedure).
@@ -2509,7 +2509,7 @@
_radio.conn_curr->procedure_reload;
/* enqueue the enc req */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
break;
case PDU_DATA_LLCTRL_TYPE_ENC_RSP:
@@ -2526,7 +2526,7 @@
&pdu_data_rx->llctrl.enc_rsp.ivs[0], 4);
/* pause rx data packets */
- _radio.conn_curr->pause_rx = 1;
+ _radio.conn_curr->pause_rx = 1U;
break;
case PDU_DATA_LLCTRL_TYPE_START_ENC_REQ:
@@ -2541,7 +2541,7 @@
}
/* start enc rsp to be scheduled in master prepare */
- _radio.conn_curr->llcp.encryption.initiate = 0;
+ _radio.conn_curr->llcp.encryption.initiate = 0U;
_radio.conn_curr->llcp_type = LLCP_ENCRYPTION;
_radio.conn_curr->llcp_ack--;
break;
@@ -2560,7 +2560,7 @@
LLCP_ENCRYPTION));
/* start enc rsp to be scheduled in slave prepare */
- _radio.conn_curr->llcp.encryption.initiate = 0;
+ _radio.conn_curr->llcp.encryption.initiate = 0U;
_radio.conn_curr->llcp_type = LLCP_ENCRYPTION;
_radio.conn_curr->llcp_ack--;
#else /* CONFIG_BT_CTLR_FAST_ENC */
@@ -2570,27 +2570,27 @@
}
/* resume data packet rx and tx */
- _radio.conn_curr->pause_rx = 0;
- _radio.conn_curr->pause_tx = 0;
+ _radio.conn_curr->pause_rx = 0U;
+ _radio.conn_curr->pause_tx = 0U;
#endif /* CONFIG_BT_CTLR_FAST_ENC */
} else {
/* resume data packet rx and tx */
- _radio.conn_curr->pause_rx = 0;
- _radio.conn_curr->pause_tx = 0;
+ _radio.conn_curr->pause_rx = 0U;
+ _radio.conn_curr->pause_tx = 0U;
}
/* enqueue the start enc resp (encryption change/refresh) */
if (_radio.conn_curr->refresh) {
- _radio.conn_curr->refresh = 0;
+ _radio.conn_curr->refresh = 0U;
/* key refresh event */
node_rx->hdr.type = NODE_RX_TYPE_ENC_REFRESH;
}
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
/* Procedure complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
break;
#endif /* CONFIG_BT_CTLR_LE_ENC */
@@ -2629,13 +2629,13 @@
_radio.conn_curr->llcp_features &= feat_get(&rsp->features[0]);
/* features exchanged */
- _radio.conn_curr->common.fex_valid = 1;
+ _radio.conn_curr->common.fex_valid = 1U;
/* enqueue the feature resp */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
/* Procedure complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
}
break;
@@ -2678,14 +2678,14 @@
}
/* resume data packet rx and tx */
- _radio.conn_curr->pause_rx = 0;
- _radio.conn_curr->pause_tx = 0;
+ _radio.conn_curr->pause_rx = 0U;
+ _radio.conn_curr->pause_tx = 0U;
/* Procedure complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
/* enqueue the reject ind */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
break;
#endif /* CONFIG_BT_CTLR_LE_ENC */
@@ -2804,14 +2804,14 @@
conn->llcp_conn_param.state =
LLCP_CPR_STATE_APP_REQ;
} else {
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
conn->llcp_conn_param.state =
LLCP_CPR_STATE_APP_WAIT;
}
} else {
- conn->llcp_conn_param.status = 0;
- conn->llcp_conn_param.cmd = 0;
+ conn->llcp_conn_param.status = 0U;
+ conn->llcp_conn_param.cmd = 0U;
conn->llcp_conn_param.state =
LLCP_CPR_STATE_RSP;
}
@@ -2877,13 +2877,13 @@
conn->conn_interval *
1250) !=
conn->supervision_reload)) {
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
conn->llcp_conn_param.state =
LLCP_CPR_STATE_APP_WAIT;
} else {
- conn->llcp_conn_param.status = 0;
- conn->llcp_conn_param.cmd = 0;
+ conn->llcp_conn_param.status = 0U;
+ conn->llcp_conn_param.cmd = 0U;
conn->llcp_conn_param.state =
LLCP_CPR_STATE_RSP;
}
@@ -2931,7 +2931,7 @@
}
/* Stop procedure timeout */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
/* save parameters to be used to select offset
*/
@@ -2982,7 +2982,7 @@
}
/* Procedure complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
break;
#endif /* CONFIG_BT_CTLR_LE_PING */
@@ -3000,7 +3000,7 @@
struct radio_le_conn_update_cmplt *cp;
/* Mark CPR as unsupported */
- conn->llcp_conn_param.disabled = 1;
+ conn->llcp_conn_param.disabled = 1U;
/* TODO: check for unsupported remote feature reason */
if (!conn->role) {
@@ -3009,8 +3009,8 @@
conn->llcp_conn_param.state =
LLCP_CPR_STATE_UPD;
- conn->llcp.conn_upd.win_size = 1;
- conn->llcp.conn_upd.win_offset_us = 0;
+ conn->llcp.conn_upd.win_size = 1U;
+ conn->llcp.conn_upd.win_offset_us = 0U;
conn->llcp.conn_upd.interval =
conn->llcp_conn_param.interval_max;
conn->llcp.conn_upd.latency =
@@ -3051,7 +3051,7 @@
cp->timeout = conn->supervision_reload *
conn->conn_interval * 125 / 1000;
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
@@ -3060,12 +3060,12 @@
/* Procedure complete */
_radio.conn_curr->llcp_length.ack =
_radio.conn_curr->llcp_length.req;
- _radio.conn_curr->llcp_length.pause_tx = 0;
+ _radio.conn_curr->llcp_length.pause_tx = 0U;
/* propagate the data length procedure to
* host
*/
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
#if defined(CONFIG_BT_CTLR_PHY)
@@ -3087,12 +3087,12 @@
node_rx->hdr.type = NODE_RX_TYPE_PHY_UPDATE;
p = (void *)pdu_data_rx;
- p->status = 0;
+ p->status = 0U;
p->tx = _radio.conn_curr->phy_tx;
p->rx = _radio.conn_curr->phy_rx;
/* enqueue the phy update complete */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
}
#endif /* CONFIG_BT_CTLR_PHY */
@@ -3112,13 +3112,13 @@
default:
/* enqueue the error and let HCI handle it */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
break;
}
}
/* Procedure complete */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
break;
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
@@ -3195,7 +3195,7 @@
_radio.conn_curr->llcp_phy.req) {
_radio.conn_curr->llcp_phy.ack--;
- _radio.conn_curr->llcp_phy.cmd = 0;
+ _radio.conn_curr->llcp_phy.cmd = 0U;
_radio.conn_curr->llcp_phy.tx =
_radio.conn_curr->phy_pref_tx;
@@ -3232,7 +3232,7 @@
_radio.conn_curr->llcp_phy.rx &= p->tx_phys;
/* Procedure timeout is stopped */
- _radio.conn_curr->procedure_expire = 0;
+ _radio.conn_curr->procedure_expire = 0U;
}
break;
@@ -3283,7 +3283,7 @@
&_radio.data_chan_map[0],
sizeof(conn->llcp.chan_map.chm));
/* conn->llcp.chan_map.instant = 0; */
- conn->llcp.chan_map.initiate = 1;
+ conn->llcp.chan_map.initiate = 1U;
conn->llcp_type = LLCP_CHAN_MAP;
conn->llcp_ack--;
@@ -3343,7 +3343,7 @@
{
struct pdu_data *pdu_data_rx;
struct pdu_data *pdu_data_tx;
- u32_t ret = 0;
+ u32_t ret = 0U;
/* Ack for transmitted data */
pdu_data_rx = (void *)node_rx->pdu_data;
@@ -3356,7 +3356,7 @@
* slave latency.
*/
if (_radio.role == ROLE_SLAVE) {
- _radio.conn_curr->slave.latency_enabled = 1;
+ _radio.conn_curr->slave.latency_enabled = 1U;
}
if (_radio.conn_curr->empty == 0) {
@@ -3387,7 +3387,7 @@
*tx_release = isr_rx_conn_pkt_release(node_tx);
}
} else {
- _radio.conn_curr->empty = 0;
+ _radio.conn_curr->empty = 0U;
}
#if defined(CONFIG_BT_CTLR_TX_RETRY_DISABLE)
} else if (_radio.packet_counter != 1) {
@@ -3420,8 +3420,8 @@
((_radio.fc_req != 0) &&
(_radio.fc_handle[_radio.fc_req - 1] ==
_radio.conn_curr->handle)))))) {
- u8_t ccm_rx_increment = 0;
- u8_t nack = 0;
+ u8_t ccm_rx_increment = 0U;
+ u8_t nack = 0U;
if (pdu_data_rx->len != 0) {
/* If required, wait for CCM to finish
@@ -3432,7 +3432,7 @@
done = radio_ccm_is_done();
LL_ASSERT(done);
- ccm_rx_increment = 1;
+ ccm_rx_increment = 1U;
}
/* MIC Failure Check or data rx during pause */
@@ -3459,15 +3459,15 @@
#if defined(CONFIG_BT_CTLR_LE_PING)
/* stop authenticated payload (pre) timeout */
- _radio.conn_curr->appto_expire = 0;
- _radio.conn_curr->apto_expire = 0;
+ _radio.conn_curr->appto_expire = 0U;
+ _radio.conn_curr->apto_expire = 0U;
#endif /* CONFIG_BT_CTLR_LE_PING */
switch (pdu_data_rx->ll_id) {
case PDU_DATA_LLID_DATA_CONTINUE:
case PDU_DATA_LLID_DATA_START:
/* enqueue data packet */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
break;
case PDU_DATA_LLID_CTRL:
@@ -3494,7 +3494,7 @@
conn->apto_reload;
if (conn->appto_reload != appto_reload_new) {
conn->appto_reload = appto_reload_new;
- conn->apto_expire = 0;
+ conn->apto_expire = 0U;
}
/* start authenticated payload (pre) timeout */
@@ -3526,9 +3526,9 @@
u8_t is_empty_pdu_tx_retry;
struct pdu_data *pdu_data_rx;
struct pdu_data *pdu_data_tx;
- u8_t rx_enqueue = 0;
- u8_t crc_close = 0;
- u32_t rx_ret = 0;
+ u8_t rx_enqueue = 0U;
+ u8_t crc_close = 0U;
+ u32_t rx_ret = 0U;
#if defined(CONFIG_BT_CTLR_PROFILE_ISR)
static u8_t s_lmin = (u8_t) -1;
@@ -3539,9 +3539,9 @@
static u8_t s_prv;
u8_t latency, elapsed, prv;
- u32_t radio_tmr_end = 0;
+ u32_t radio_tmr_end = 0U;
u32_t sample;
- u8_t chg = 0;
+ u8_t chg = 0U;
#endif /* CONFIG_BT_CTLR_PROFILE_ISR */
/* Increment packet counter for this connection event */
@@ -3558,14 +3558,14 @@
}
/* Reset CRC expiry counter */
- _radio.crc_expire = 0;
+ _radio.crc_expire = 0U;
/* Reset supervision counter */
- _radio.conn_curr->supervision_expire = 0;
+ _radio.conn_curr->supervision_expire = 0U;
} else {
/* Start CRC error countdown, if not already started */
if (_radio.crc_expire == 0) {
- _radio.crc_expire = 2;
+ _radio.crc_expire = 2U;
}
/* Check crc error countdown expiry */
@@ -3767,18 +3767,18 @@
/* check changes in min, avg and max of latency */
if (latency > s_lmax) {
s_lmax = latency;
- chg = 1;
+ chg = 1U;
}
if (latency < s_lmin) {
s_lmin = latency;
- chg = 1;
+ chg = 1U;
}
/* check for +/- 1us change */
prv = ((u16_t)s_lprv + latency) >> 1;
if (prv != s_lprv) {
s_lprv = latency;
- chg = 1;
+ chg = 1U;
}
/* calculate the elapsed time in us since ISR entry */
@@ -3787,19 +3787,19 @@
/* check changes in min, avg and max */
if (elapsed > s_max) {
s_max = elapsed;
- chg = 1;
+ chg = 1U;
}
if (elapsed < s_min) {
s_min = elapsed;
- chg = 1;
+ chg = 1U;
}
/* check for +/- 1us change */
prv = ((u16_t)s_prv + elapsed) >> 1;
if (prv != s_prv) {
s_prv = elapsed;
- chg = 1;
+ chg = 1U;
}
/* generate event if any change */
@@ -3846,7 +3846,7 @@
err = isr_rx_adv(devmatch_ok, devmatch_id, irkmatch_ok,
irkmatch_id, rssi_ready);
} else {
- err = 1;
+ err = 1U;
}
if (err) {
_radio.state = STATE_CLOSE;
@@ -3869,13 +3869,13 @@
err = isr_rx_scan(devmatch_ok, devmatch_id, irkmatch_ok,
irkmatch_id, rl_idx, rssi_ready);
} else {
- err = 1;
+ err = 1U;
}
if (err) {
_radio.state = STATE_CLOSE;
radio_disable();
/* switch scanner state to idle */
- _radio.scanner.state = 0;
+ _radio.scanner.state = 0U;
}
break;
@@ -3893,13 +3893,13 @@
static inline u32_t isr_close_adv(void)
{
- u32_t dont_close = 0;
+ u32_t dont_close = 0U;
if ((_radio.state == STATE_CLOSE) &&
(_radio.advertiser.chan_map_current != 0)) {
u32_t start_us;
- dont_close = 1;
+ dont_close = 1U;
adv_setup();
@@ -3974,12 +3974,12 @@
static inline u32_t isr_close_scan(void)
{
- u32_t dont_close = 0;
+ u32_t dont_close = 0U;
if (_radio.state == STATE_CLOSE) {
u32_t start_us;
- dont_close = 1;
+ dont_close = 1U;
radio_tmr_tifs_set(RADIO_TIFS);
radio_switch_complete_and_tx(0, 0, 0, 0);
@@ -4058,8 +4058,8 @@
return;
}
- ticks_drift_plus = 0;
- ticks_drift_minus = 0;
+ ticks_drift_plus = 0U;
+ ticks_drift_minus = 0U;
latency_event = _radio.conn_curr->latency_event;
elapsed_event = latency_event + 1;
@@ -4104,8 +4104,8 @@
}
/* Reset window widening, as anchor point sync-ed */
- _radio.conn_curr->slave.window_widening_event_us = 0;
- _radio.conn_curr->slave.window_size_event_us = 0;
+ _radio.conn_curr->slave.window_widening_event_us = 0U;
+ _radio.conn_curr->slave.window_size_event_us = 0U;
/* apply latency if no more data */
if (_radio.conn_curr->pkt_tx_head) {
@@ -4115,18 +4115,18 @@
_radio.conn_curr->pkt_tx_head->pdu_data;
if (pdu_data_tx->len ||
_radio.conn_curr->packet_tx_head_offset) {
- _radio.conn_curr->latency_event = 0;
+ _radio.conn_curr->latency_event = 0U;
}
} else if (_radio.conn_curr->slave.latency_enabled) {
_radio.conn_curr->latency_event =
_radio.conn_curr->latency;
}
} else if (reason_peer) {
- _radio.conn_curr->master.terminate_ack = 1;
+ _radio.conn_curr->master.terminate_ack = 1U;
}
/* Reset connection failed to establish procedure */
- _radio.conn_curr->connect_expire = 0;
+ _radio.conn_curr->connect_expire = 0U;
}
/* check connection failed to establish */
@@ -4156,26 +4156,26 @@
}
/* check supervision timeout */
- force = 0;
+ force = 0U;
if (_radio.conn_curr->supervision_expire) {
if (_radio.conn_curr->supervision_expire > elapsed_event) {
_radio.conn_curr->supervision_expire -= elapsed_event;
/* break latency */
- _radio.conn_curr->latency_event = 0;
+ _radio.conn_curr->latency_event = 0U;
/* Force both master and slave when close to
* supervision timeout.
*/
if (_radio.conn_curr->supervision_expire <= 6) {
- force = 1;
+ force = 1U;
}
/* use randomness to force slave role when anchor
* points are being missed.
*/
else if (_radio.role == ROLE_SLAVE) {
if (latency_event != 0) {
- force = 1;
+ force = 1U;
} else {
force = _radio.conn_curr->slave.force & 0x01;
@@ -4221,7 +4221,7 @@
} else {
struct radio_pdu_node_rx *node_rx;
- _radio.conn_curr->apto_expire = 0;
+ _radio.conn_curr->apto_expire = 0U;
/* Prepare the rx packet structure */
node_rx = packet_rx_reserve_get(2);
@@ -4240,7 +4240,7 @@
if (_radio.conn_curr->appto_expire > elapsed_event) {
_radio.conn_curr->appto_expire -= elapsed_event;
} else {
- _radio.conn_curr->appto_expire = 0;
+ _radio.conn_curr->appto_expire = 0U;
if ((_radio.conn_curr->procedure_expire == 0) &&
(_radio.conn_curr->llcp_req ==
@@ -4283,11 +4283,11 @@
if ((_radio.conn_curr->llcp_ack != _radio.conn_curr->llcp_req) &&
((_radio.conn_curr->llcp_type == LLCP_CONN_UPD) ||
(_radio.conn_curr->llcp_type == LLCP_CHAN_MAP))) {
- _radio.conn_curr->latency_event = 0;
+ _radio.conn_curr->latency_event = 0U;
}
/* check if latency needs update */
- lazy = 0;
+ lazy = 0U;
if ((force) || (latency_event != _radio.conn_curr->latency_event)) {
lazy = _radio.conn_curr->latency_event + 1;
}
@@ -4319,7 +4319,7 @@
static inline void isr_radio_state_close(void)
{
- u32_t dont_close = 0;
+ u32_t dont_close = 0U;
switch (_radio.role) {
case ROLE_ADV:
@@ -4361,7 +4361,7 @@
_radio.role = ROLE_NONE;
_radio.state = STATE_NONE;
- _radio.ticker_id_event = 0;
+ _radio.ticker_id_event = 0U;
radio_tmr_stop();
@@ -4404,7 +4404,7 @@
irkmatch_id = radio_ar_match_get();
rssi_ready = radio_rssi_is_ready();
} else {
- crc_ok = devmatch_ok = irkmatch_ok = rssi_ready = 0;
+ crc_ok = devmatch_ok = irkmatch_ok = rssi_ready = 0U;
devmatch_id = irkmatch_id = 0xFF;
}
@@ -4495,7 +4495,7 @@
* (to stop Adv role as it is now transitioned
* to Slave role).
*/
- _radio.ticker_id_stop = 0;
+ _radio.ticker_id_stop = 0U;
} else {
LL_ASSERT(0);
}
@@ -4520,7 +4520,7 @@
* (to stop Scan role as it is now transitioned
* to Master role).
*/
- _radio.ticker_id_stop = 0;
+ _radio.ticker_id_stop = 0U;
} else {
LL_ASSERT(0);
}
@@ -4702,7 +4702,7 @@
/* Only user id job will try to retain the XTAL. */
LL_ASSERT(caller_id == RADIO_TICKER_USER_ID_JOB);
- s_xtal_retained = 1;
+ s_xtal_retained = 1U;
retval = mayfly_enqueue(caller_id,
RADIO_TICKER_USER_ID_WORKER, 0,
@@ -4719,7 +4719,7 @@
struct mayfly *p_mfy_xtal_stop = NULL;
u32_t retval;
- s_xtal_retained = 0;
+ s_xtal_retained = 0U;
switch (caller_id) {
case RADIO_TICKER_USER_ID_WORKER:
@@ -4859,7 +4859,7 @@
u32_t ret;
ticker_id_next = 0xff;
- ticks_to_expire = 0;
+ ticks_to_expire = 0U;
do {
ret = ticker_next_slot_get(RADIO_TICKER_INSTANCE_ID_RADIO,
RADIO_TICKER_USER_ID_JOB,
@@ -4919,7 +4919,7 @@
if (ticks_to_expire > ticks_reduced) {
ticks_to_expire -= ticks_reduced;
} else {
- ticks_to_expire = 0;
+ ticks_to_expire = 0U;
}
}
@@ -5021,8 +5021,8 @@
ticks_slot_abs += HAL_TICKER_US_TO_TICKS(RADIO_TICKER_JITTER_US << 3);
ticker_id = ticker_id_prev = 0xff;
- ticks_to_expire = ticks_to_expire_prev = *us_offset = 0;
- ticks_slot_abs_prev = 0;
+ ticks_to_expire = ticks_to_expire_prev = *us_offset = 0U;
+ ticks_slot_abs_prev = 0U;
while (1) {
u32_t volatile ret_cb = TICKER_STATUS_BUSY;
struct connection *conn;
@@ -5170,7 +5170,7 @@
u8_t *offset_max,
u8_t *win_offset)
{
- u32_t ticks_prepare_reduced = 0;
+ u32_t ticks_prepare_reduced = 0U;
u32_t ticks_to_expire_prev;
u32_t ticks_slot_abs_prev;
u32_t ticks_anchor_prev;
@@ -5207,8 +5207,8 @@
ticker_id = ticker_id_prev = ticker_id_other = 0xFF;
ticks_to_expire = ticks_to_expire_prev = ticks_anchor =
- ticks_anchor_prev = offset_index = _win_offset = 0;
- ticks_slot_abs_prev = 0;
+ ticks_anchor_prev = offset_index = _win_offset = 0U;
+ ticks_slot_abs_prev = 0U;
do {
u32_t volatile ret_cb = TICKER_STATUS_BUSY;
struct connection *conn;
@@ -5314,7 +5314,7 @@
ticks_to_expire_prev +
ticks_slot_abs_prev) / 1250;
if (_win_offset >= conn_interval) {
- ticks_to_expire_prev = 0;
+ ticks_to_expire_prev = 0U;
break;
}
@@ -5352,7 +5352,7 @@
ticks_to_expire_prev +
ticks_slot_abs_prev) / 1250;
if (_win_offset >= conn_interval) {
- ticks_to_expire_prev = 0;
+ ticks_to_expire_prev = 0U;
break;
}
@@ -5373,9 +5373,9 @@
static void mayfly_sched_free_win_offset_calc(void *params)
{
struct connection *conn = params;
- u32_t ticks_to_offset_default = 0;
+ u32_t ticks_to_offset_default = 0U;
u32_t *ticks_to_offset_next;
- u8_t offset_max = 6;
+ u8_t offset_max = 6U;
ticks_to_offset_next = &ticks_to_offset_default;
@@ -5400,8 +5400,8 @@
struct connection *conn = params;
u16_t win_offset_m[OFFSET_M_MAX] = {0, };
u8_t offset_m_max = OFFSET_M_MAX;
- u8_t offset_index_s = 0;
- u8_t has_offset_s = 0;
+ u8_t offset_index_s = 0U;
+ u8_t has_offset_s = 0U;
u32_t ticks_to_offset;
u16_t win_offset_s;
@@ -5413,7 +5413,7 @@
&offset_m_max, (u8_t *)&win_offset_m[0]);
while (offset_index_s < OFFSET_S_MAX) {
- u8_t offset_index_m = 0;
+ u8_t offset_index_m = 0U;
memcpy((u8_t *)&win_offset_s,
((u8_t *)&conn->llcp_conn_param.offset0 +
@@ -5426,7 +5426,7 @@
break;
}
- has_offset_s = 1;
+ has_offset_s = 1U;
}
offset_index_m++;
@@ -5689,14 +5689,14 @@
u8_t chan_next;
u8_t byte_count;
- chan_next = 0;
- byte_count = 5;
+ chan_next = 0U;
+ byte_count = 5U;
while (byte_count--) {
u8_t bite;
u8_t bit_count;
bite = *chan_map;
- bit_count = 8;
+ bit_count = 8U;
while (bit_count--) {
if (bite & 0x01) {
if (chan_index == 0) {
@@ -5745,8 +5745,8 @@
u8_t iterate;
u8_t o;
- o = 0;
- for (iterate = 0; iterate < 8; iterate++) {
+ o = 0U;
+ for (iterate = 0U; iterate < 8; iterate++) {
o <<= 1;
o |= (i & 1);
i >>= 1;
@@ -5772,7 +5772,7 @@
prn_e = counter ^ chan_id;
- for (iterate = 0; iterate < 3; iterate++) {
+ for (iterate = 0U; iterate < 3; iterate++) {
prn_e = chan_perm(prn_e);
prn_e = chan_mam(prn_e, chan_id);
}
@@ -5891,19 +5891,19 @@
u8_t bit_idx;
u8_t retry;
- retry = 3;
+ retry = 3U;
again:
LL_ASSERT(retry);
retry--;
bt_rand(&access_addr, sizeof(u32_t));
- bit_idx = 31;
- transitions = 0;
- consecutive_cnt = 1;
+ bit_idx = 31U;
+ transitions = 0U;
+ consecutive_cnt = 1U;
#if defined(CONFIG_BT_CTLR_PHY_CODED)
- ones_count_lsb8 = 0;
- transitions_lsb16 = 0;
+ ones_count_lsb8 = 0U;
+ transitions_lsb16 = 0U;
#endif /* CONFIG_BT_CTLR_PHY_CODED */
consecutive_bit = (access_addr >> bit_idx) & 0x01;
while (bit_idx--) {
@@ -5918,7 +5918,7 @@
if (bit == consecutive_bit) {
consecutive_cnt++;
} else {
- consecutive_cnt = 1;
+ consecutive_cnt = 1U;
consecutive_bit = bit;
transitions++;
@@ -5949,7 +5949,7 @@
(((bit_idx < 29) && (transitions < 1)) ||
((bit_idx < 28) && (transitions < 2))))) {
if (consecutive_bit) {
- consecutive_bit = 0;
+ consecutive_bit = 0U;
access_addr &= ~BIT(bit_idx);
#if defined(CONFIG_BT_CTLR_PHY_CODED)
if (bit_idx < 8) {
@@ -5957,7 +5957,7 @@
}
#endif /* CONFIG_BT_CTLR_PHY_CODED */
} else {
- consecutive_bit = 1;
+ consecutive_bit = 1U;
access_addr |= BIT(bit_idx);
#if defined(CONFIG_BT_CTLR_PHY_CODED)
if (bit_idx < 8) {
@@ -5970,7 +5970,7 @@
consecutive_cnt = consecutive_cnt_prev;
transitions = transitions_prev;
} else {
- consecutive_cnt = 1;
+ consecutive_cnt = 1U;
transitions++;
}
@@ -6069,7 +6069,7 @@
struct pdu_adv *pdu;
u8_t bitmap;
u8_t chan;
- u8_t upd = 0;
+ u8_t upd = 0U;
/* Use latest adv data PDU buffer */
if (_radio.advertiser.adv_data.first !=
@@ -6078,10 +6078,10 @@
first = _radio.advertiser.adv_data.first + 1;
if (first == DOUBLE_BUFFER_SIZE) {
- first = 0;
+ first = 0U;
}
_radio.advertiser.adv_data.first = first;
- upd = 1;
+ upd = 1U;
}
/* Use latest scan data PDU buffer */
@@ -6091,10 +6091,10 @@
first = _radio.advertiser.scan_data.first + 1;
if (first == DOUBLE_BUFFER_SIZE) {
- first = 0;
+ first = 0U;
}
_radio.advertiser.scan_data.first = first;
- upd = 1;
+ upd = 1U;
}
pdu = (void *)_radio.advertiser.adv_data.data
@@ -6129,7 +6129,7 @@
}
bitmap = _radio.advertiser.chan_map_current;
- chan = 0;
+ chan = 0U;
while ((bitmap & 0x01) == 0) {
chan++;
bitmap >>= 1;
@@ -6160,7 +6160,7 @@
*/
_radio.role = ROLE_ADV;
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
_radio.ticker_id_event = RADIO_TICKER_ID_ADV;
_radio.ticks_anchor = ticks_at_expire;
@@ -6292,7 +6292,7 @@
/* Reset the stored ticker id in prepare phase. */
LL_ASSERT(_radio.ticker_id_prepare);
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
/* Step 2.1: Is caller between Primary and Marker0?
* Stop the Marker0 event
@@ -6514,10 +6514,10 @@
*/
_radio.role = ROLE_SCAN;
_radio.state = STATE_RX;
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
_radio.ticker_id_event = RADIO_TICKER_ID_SCAN;
_radio.ticks_anchor = ticks_at_expire;
- _radio.scanner.state = 0;
+ _radio.scanner.state = 0U;
#if defined(CONFIG_BT_CTLR_ADV_EXT)
adv_scan_configure(_radio.scanner.phy, 1); /* if coded then use S8. */
@@ -6527,7 +6527,7 @@
chan_set(37 + _radio.scanner.chan++);
if (_radio.scanner.chan == 3) {
- _radio.scanner.chan = 0;
+ _radio.scanner.chan = 0U;
}
radio_tmr_tifs_set(RADIO_TIFS);
@@ -6772,13 +6772,13 @@
conn->llcp_conn_param.ack = conn->llcp_conn_param.req;
/* Stop procedure timeout */
- conn->procedure_expire = 0;
+ conn->procedure_expire = 0U;
}
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
/* Reset ticker_id_prepare as role is not continued further
* due to conn update at this event.
*/
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
/* reset mutex */
if (_radio.conn_upd == conn) {
@@ -6862,7 +6862,7 @@
(conn_interval_us >> 1) - RADIO_TIFS;
conn->slave.window_size_prepare_us =
conn->llcp.conn_upd.win_size * 1250;
- conn->slave.ticks_to_offset = 0;
+ conn->slave.ticks_to_offset = 0U;
conn->slave.window_widening_prepare_us +=
conn->slave.window_widening_periodic_us *
@@ -6912,7 +6912,7 @@
#endif /* CONFIG_BT_CTLR_LE_PING */
if (!conn->llcp.conn_upd.is_internal) {
- conn->supervision_expire = 0;
+ conn->supervision_expire = 0U;
}
/* disable ticker job, in order to chain stop and start
@@ -6972,7 +6972,7 @@
node_tx->pdu_data;
/* reset initiate flag */
- conn->llcp.chan_map.initiate = 0;
+ conn->llcp.chan_map.initiate = 0U;
/* set instant */
conn->llcp.chan_map.instant =
@@ -7007,7 +7007,7 @@
conn->data_chan_count =
util_ones_count_get(&conn->data_chan_map[0],
sizeof(conn->data_chan_map));
- conn->chm_update = 1;
+ conn->chm_update = 1U;
}
}
@@ -7042,7 +7042,7 @@
pdu->len += offsetof(struct pdu_data_llctrl, reject_ind);
- conn->llcp.encryption.error_code = 0;
+ conn->llcp.encryption.error_code = 0U;
}
static inline void event_enc_prep(struct connection *conn)
@@ -7274,7 +7274,7 @@
conn->llcp_ack = conn->llcp_req;
/* set version ind tx-ed flag */
- conn->llcp_version.tx = 1;
+ conn->llcp_version.tx = 1U;
/* place the version ind packet as next in tx queue */
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
@@ -7363,7 +7363,7 @@
p->interval_max = conn->llcp_conn_param.interval_max;
p->latency = conn->llcp_conn_param.latency;
p->timeout = conn->llcp_conn_param.timeout;
- p->preferred_periodicity = 0;
+ p->preferred_periodicity = 0U;
p->reference_conn_event_count = event_counter;
p->offset0 = 0x0000;
p->offset1 = 0xffff;
@@ -7464,8 +7464,8 @@
conn->llcp_conn_param.state = LLCP_CPR_STATE_UPD;
/* Initiate connection update procedure */
- conn->llcp.conn_upd.win_size = 1;
- conn->llcp.conn_upd.win_offset_us = 0;
+ conn->llcp.conn_upd.win_size = 1U;
+ conn->llcp.conn_upd.win_offset_us = 0U;
if (conn->llcp_conn_param.preferred_periodicity) {
conn->llcp.conn_upd.interval =
((conn->llcp_conn_param.interval_max /
@@ -7719,8 +7719,8 @@
/* Procedure complete */
conn->llcp_length.ack = conn->llcp_length.req;
- conn->llcp_length.pause_tx = 0;
- conn->procedure_expire = 0;
+ conn->llcp_length.pause_tx = 0U;
+ conn->procedure_expire = 0U;
/* Use the new rx octets/time in the connection */
conn->max_rx_octets = conn->llcp_length.rx_octets;
@@ -7907,7 +7907,7 @@
} else if (conn->llcp_phy.tx & BIT(2)) {
conn->llcp_phy.tx = BIT(2);
} else {
- conn->llcp_phy.tx = 0;
+ conn->llcp_phy.tx = 0U;
}
/* select only one rx phy, prefer 2M */
@@ -7918,22 +7918,22 @@
} else if (conn->llcp_phy.rx & BIT(2)) {
conn->llcp_phy.rx = BIT(2);
} else {
- conn->llcp_phy.rx = 0;
+ conn->llcp_phy.rx = 0U;
}
/* Initiate PHY Update Ind */
if (conn->llcp_phy.tx != conn->phy_tx) {
conn->llcp.phy_upd_ind.tx = conn->llcp_phy.tx;
} else {
- conn->llcp.phy_upd_ind.tx = 0;
+ conn->llcp.phy_upd_ind.tx = 0U;
}
if (conn->llcp_phy.rx != conn->phy_rx) {
conn->llcp.phy_upd_ind.rx = conn->llcp_phy.rx;
} else {
- conn->llcp.phy_upd_ind.rx = 0;
+ conn->llcp.phy_upd_ind.rx = 0U;
}
/* conn->llcp.phy_upd_ind.instant = 0; */
- conn->llcp.phy_upd_ind.initiate = 1;
+ conn->llcp.phy_upd_ind.initiate = 1U;
conn->llcp.phy_upd_ind.cmd = conn->llcp_phy.cmd;
conn->llcp_type = LLCP_PHY_UPD;
@@ -7967,7 +7967,7 @@
struct pdu_data_llctrl_phy_upd_ind *ind;
/* reset initiate flag */
- conn->llcp.phy_upd_ind.initiate = 0;
+ conn->llcp.phy_upd_ind.initiate = 0U;
/* Check if both tx and rx PHY unchanged */
if (!((conn->llcp.phy_upd_ind.tx |
@@ -7976,7 +7976,7 @@
conn->llcp_ack = conn->llcp_req;
/* 0 instant */
- conn->llcp.phy_upd_ind.instant = 0;
+ conn->llcp.phy_upd_ind.instant = 0U;
/* generate phy update event */
if (conn->llcp.phy_upd_ind.cmd) {
@@ -7990,7 +7990,7 @@
NODE_RX_TYPE_PHY_UPDATE;
upd = (void *)&node_rx->pdu_data;
- upd->status = 0;
+ upd->status = 0U;
upd->tx = conn->phy_tx;
upd->rx = conn->phy_rx;
@@ -8051,7 +8051,7 @@
node_rx->hdr.type = NODE_RX_TYPE_PHY_UPDATE;
upd = (void *)&node_rx->pdu_data;
- upd->status = 0;
+ upd->status = 0U;
upd->tx = conn->phy_tx;
upd->rx = conn->phy_rx;
@@ -8266,7 +8266,7 @@
void *context)
{
struct connection *conn = context;
- u8_t data_chan_use = 0;
+ u8_t data_chan_use = 0U;
u32_t remainder_us;
u32_t hcto;
@@ -8282,17 +8282,17 @@
_radio.role = ROLE_SLAVE;
_radio.state = STATE_RX;
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
_radio.ticker_id_event =
(RADIO_TICKER_ID_FIRST_CONNECTION + conn->handle);
_radio.ticks_anchor = ticks_at_expire;
- _radio.packet_counter = 0;
- _radio.crc_expire = 0;
+ _radio.packet_counter = 0U;
+ _radio.crc_expire = 0U;
_radio.conn_curr = conn;
conn->latency_event = conn->latency_prepare;
- conn->latency_prepare = 0;
+ conn->latency_prepare = 0U;
connection_configure(conn);
@@ -8330,7 +8330,7 @@
/* current window widening */
conn->slave.window_widening_event_us +=
conn->slave.window_widening_prepare_us;
- conn->slave.window_widening_prepare_us = 0;
+ conn->slave.window_widening_prepare_us = 0U;
if (conn->slave.window_widening_event_us >
conn->slave.window_widening_max_us) {
conn->slave.window_widening_event_us =
@@ -8340,7 +8340,7 @@
/* current window size */
conn->slave.window_size_event_us +=
conn->slave.window_size_prepare_us;
- conn->slave.window_size_prepare_us = 0;
+ conn->slave.window_size_prepare_us = 0U;
remainder_us = radio_tmr_start(0, ticks_at_expire +
HAL_TICKER_US_TO_TICKS(
@@ -8435,7 +8435,7 @@
{
struct connection *conn = context;
struct pdu_data *pdu_data_tx;
- u8_t data_chan_use = 0;
+ u8_t data_chan_use = 0U;
u32_t remainder_us;
ARG_UNUSED(remainder);
@@ -8450,17 +8450,17 @@
_radio.role = ROLE_MASTER;
_radio.state = STATE_TX;
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
_radio.ticker_id_event =
(RADIO_TICKER_ID_FIRST_CONNECTION + conn->handle);
_radio.ticks_anchor = ticks_at_expire;
- _radio.packet_counter = 0;
- _radio.crc_expire = 0;
+ _radio.packet_counter = 0U;
+ _radio.crc_expire = 0U;
_radio.conn_curr = conn;
conn->latency_event = conn->latency_prepare;
- conn->latency_prepare = 0;
+ conn->latency_prepare = 0U;
/* Route the tx packet to respective connections */
packet_tx_enqueue(2);
@@ -8640,7 +8640,7 @@
#if defined(CONFIG_BT_CTLR_PHY)
phy = conn->phy_rx;
#else /* !CONFIG_BT_CTLR_PHY */
- phy = 0;
+ phy = 0U;
#endif /* !CONFIG_BT_CTLR_PHY */
radio_phy_set(phy, 0);
@@ -8672,8 +8672,8 @@
phy = conn->phy_tx;
flags = conn->phy_flags;
#else /* !CONFIG_BT_CTLR_PHY */
- phy = 0;
- flags = 0;
+ phy = 0U;
+ flags = 0U;
#endif /* !CONFIG_BT_CTLR_PHY */
radio_phy_set(phy, flags);
@@ -8722,7 +8722,7 @@
_pdu_data_tx->len = conn->packet_tx_head_len -
conn->packet_tx_head_offset;
- _pdu_data_tx->md = 0;
+ _pdu_data_tx->md = 0U;
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
#if defined(CONFIG_BT_CTLR_PHY)
@@ -8788,11 +8788,11 @@
if (_pdu_data_tx->len > max_tx_octets) {
_pdu_data_tx->len = max_tx_octets;
- _pdu_data_tx->md = 1;
+ _pdu_data_tx->md = 1U;
}
if (conn->pkt_tx_head->next) {
- _pdu_data_tx->md = 1;
+ _pdu_data_tx->md = 1U;
}
if (!conn->pkt_tx_ctrl &&
@@ -8802,10 +8802,10 @@
}
}
- _pdu_data_tx->rfu = 0;
+ _pdu_data_tx->rfu = 0U;
#if !defined(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR)
- _pdu_data_tx->resv = 0;
+ _pdu_data_tx->resv = 0U;
#endif /* !CONFIG_BT_CTLR_DATA_LENGTH_CLEAR */
*pdu_data_tx = _pdu_data_tx;
@@ -8821,7 +8821,7 @@
acquire = _radio.packet_rx_acquire + 1;
if (acquire == _radio.packet_rx_count) {
- acquire = 0;
+ acquire = 0U;
}
while ((max--) && (acquire != _radio.packet_rx_last)) {
@@ -8846,7 +8846,7 @@
acquire = _radio.packet_rx_acquire + 1;
if (acquire == _radio.packet_rx_count) {
- acquire = 0;
+ acquire = 0U;
}
_radio.link_rx_data_quota--;
@@ -8913,7 +8913,7 @@
/* dequeue from acquired rx queue */
last = _radio.packet_rx_last + 1;
if (last == _radio.packet_rx_count) {
- last = 0;
+ last = 0U;
}
_radio.packet_rx_last = last;
@@ -8969,7 +8969,7 @@
first = _radio.packet_tx_first + 1;
if (first == _radio.packet_tx_count) {
- first = 0;
+ first = 0U;
}
_radio.packet_tx_first = first;
}
@@ -8979,15 +8979,15 @@
{
struct pdu_data *pdu_data_tx;
- conn->empty = 1;
+ conn->empty = 1U;
pdu_data_tx = (void *)radio_pkt_empty_get();
pdu_data_tx->ll_id = PDU_DATA_LLID_DATA_CONTINUE;
- pdu_data_tx->len = 0;
+ pdu_data_tx->len = 0U;
if (conn->pkt_tx_head) {
- pdu_data_tx->md = 1;
+ pdu_data_tx->md = 1U;
} else {
- pdu_data_tx->md = 0;
+ pdu_data_tx->md = 0U;
}
return pdu_data_tx;
@@ -9080,7 +9080,7 @@
last = _radio.packet_release_last + 1;
if (last == _radio.packet_tx_count) {
- last = 0;
+ last = 0U;
}
LL_ASSERT(last != _radio.packet_release_first);
@@ -9123,7 +9123,7 @@
/* Reset the stored ticker id in prepare phase that
* initiated the connection event abort (pre-emption).
*/
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
ticker_status =
ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO,
@@ -9262,7 +9262,7 @@
conn->llcp.conn_upd.instant =
pdu_data_rx->llctrl.conn_update_ind.instant;
conn->llcp.conn_upd.state = LLCP_CUI_STATE_INPROG;
- conn->llcp.conn_upd.is_internal = 0;
+ conn->llcp.conn_upd.is_internal = 0U;
conn->llcp_type = LLCP_CONN_UPD;
conn->llcp_ack--;
@@ -9292,8 +9292,8 @@
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
if (!conn->role) {
- conn->llcp.conn_upd.win_size = 1;
- conn->llcp.conn_upd.win_offset_us = 0;
+ conn->llcp.conn_upd.win_size = 1U;
+ conn->llcp.conn_upd.win_offset_us = 0U;
conn->llcp.conn_upd.interval = conn->conn_interval;
conn->llcp.conn_upd.latency = conn->latency;
conn->llcp.conn_upd.timeout = conn->conn_interval *
@@ -9301,7 +9301,7 @@
125 / 1000;
/* conn->llcp.conn_upd.instant = 0; */
conn->llcp.conn_upd.state = LLCP_CUI_STATE_USE;
- conn->llcp.conn_upd.is_internal = 1;
+ conn->llcp.conn_upd.is_internal = 1U;
conn->llcp_type = LLCP_CONN_UPD;
conn->llcp_ack--;
@@ -9314,7 +9314,7 @@
(conn->llcp_features &
BIT(BT_LE_FEAT_BIT_CONN_PARAM_REQ)))) {
/** Perform slave intiated conn param req */
- conn->llcp_conn_param.status = 0;
+ conn->llcp_conn_param.status = 0U;
conn->llcp_conn_param.interval_min = conn->conn_interval;
conn->llcp_conn_param.interval_max = conn->conn_interval;
conn->llcp_conn_param.latency = conn->latency;
@@ -9322,7 +9322,7 @@
conn->supervision_reload *
125 / 1000;
conn->llcp_conn_param.state = LLCP_CPR_STATE_REQ;
- conn->llcp_conn_param.cmd = 0;
+ conn->llcp_conn_param.cmd = 0U;
conn->llcp_conn_param.ack--;
return 0;
@@ -9349,7 +9349,7 @@
sizeof(conn->llcp.chan_map.chm));
conn->llcp.chan_map.instant =
pdu_data_rx->llctrl.chan_map_ind.instant;
- conn->llcp.chan_map.initiate = 0;
+ conn->llcp.chan_map.initiate = 0U;
conn->llcp_type = LLCP_CHAN_MAP;
conn->llcp_ack--;
@@ -9380,7 +9380,7 @@
/* Procedure complete */
conn->llcp_phy.ack = conn->llcp_phy.req;
- conn->procedure_expire = 0;
+ conn->procedure_expire = 0U;
/* Ignore event generation if not local cmd initiated */
if (!conn->llcp_phy.cmd) {
@@ -9391,12 +9391,12 @@
node_rx->hdr.type = NODE_RX_TYPE_PHY_UPDATE;
upd = (void *)pdu_data_rx;
- upd->status = 0;
+ upd->status = 0U;
upd->tx = conn->phy_tx;
upd->rx = conn->phy_rx;
/* enqueue the phy update complete */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
return 0;
}
@@ -9417,13 +9417,13 @@
conn->llcp.phy_upd_ind.cmd = conn->llcp_phy.cmd;
/* Procedure complete, just wait for instant */
- conn->procedure_expire = 0;
+ conn->procedure_expire = 0U;
}
conn->llcp.phy_upd_ind.tx = ind->s_to_m_phy;
conn->llcp.phy_upd_ind.rx = ind->m_to_s_phy;
conn->llcp.phy_upd_ind.instant = ind->instant;
- conn->llcp.phy_upd_ind.initiate = 0;
+ conn->llcp.phy_upd_ind.initiate = 0U;
conn->llcp_type = LLCP_PHY_UPD;
conn->llcp_ack--;
@@ -9530,7 +9530,7 @@
}
/* enable transmit encryption */
- conn->enc_tx = 1;
+ conn->enc_tx = 1U;
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, enc_rsp);
@@ -9556,7 +9556,7 @@
}
/* key refresh */
- conn->refresh = 1;
+ conn->refresh = 1U;
} else if (!conn->role) {
/* acquire tx mem */
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
@@ -9565,19 +9565,19 @@
}
/* disable transmit encryption */
- conn->enc_tx = 0;
+ conn->enc_tx = 0U;
} else {
/* disable transmit encryption */
- conn->enc_tx = 0;
+ conn->enc_tx = 0U;
return 0;
}
/* pause data packet rx */
- conn->pause_rx = 1;
+ conn->pause_rx = 1U;
/* disable receive encryption */
- conn->enc_rx = 0;
+ conn->enc_rx = 0U;
/* Enqueue pause enc rsp */
pdu_ctrl_tx = (void *)node_tx->pdu_data;
@@ -9632,7 +9632,7 @@
_radio.conn_curr->llcp_features &= feat_get(&req->features[0]);
/* features exchanged */
- _radio.conn_curr->common.fex_valid = 1;
+ _radio.conn_curr->common.fex_valid = 1U;
/* Enqueue feature response */
pdu_ctrl_tx = (void *)node_tx->pdu_data;
@@ -9667,7 +9667,7 @@
if (!node_tx) {
return 1;
}
- conn->llcp_version.tx = 1;
+ conn->llcp_version.tx = 1U;
pdu_ctrl_tx = (void *)node_tx->pdu_data;
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
@@ -9687,10 +9687,10 @@
} else if (!conn->llcp_version.rx) {
/* Procedure complete */
- conn->procedure_expire = 0;
+ conn->procedure_expire = 0U;
/* enqueue the version ind */
- *rx_enqueue = 1;
+ *rx_enqueue = 1U;
} else {
/* Tx-ed and Rx-ed before, ignore this invalid Rx. */
return 0;
@@ -9700,7 +9700,7 @@
conn->llcp_version.version_number = v->version_number;
conn->llcp_version.company_id = v->company_id;
conn->llcp_version.sub_version_number = v->sub_version_number;
- conn->llcp_version.rx = 1;
+ conn->llcp_version.rx = 1U;
return 0;
}
@@ -9812,7 +9812,7 @@
conn->llcp_phy.req) {
conn->llcp_phy.ack--;
- conn->llcp_phy.cmd = 0;
+ conn->llcp_phy.cmd = 0U;
conn->llcp_phy.tx =
conn->phy_pref_tx;
@@ -9915,7 +9915,7 @@
/* Reset the stored ticker id in prepare phase. */
LL_ASSERT(_radio.ticker_id_prepare);
- _radio.ticker_id_prepare = 0;
+ _radio.ticker_id_prepare = 0U;
/* Step 2.1: Is caller between Primary and Marker0?
* Stop the Marker0 event
@@ -10033,8 +10033,8 @@
static u32_t role_disable(u8_t ticker_id_primary, u8_t ticker_id_stop)
{
u32_t volatile ret_cb = TICKER_STATUS_BUSY;
- u32_t ticks_active_to_start = 0;
- u32_t ticks_xtal_to_start = 0;
+ u32_t ticks_active_to_start = 0U;
+ u32_t ticks_xtal_to_start = 0U;
u32_t ret;
/* Determine xtal, active and start ticks. Stop directed adv stop
@@ -10131,7 +10131,7 @@
}
role_disable_cleanup:
- _radio.ticker_id_stop = 0;
+ _radio.ticker_id_stop = 0U;
return ret_cb;
}
@@ -10181,11 +10181,11 @@
conn->handle = 0xFFFF;
conn->llcp_features = RADIO_BLE_FEAT;
- conn->data_chan_sel = 0;
- conn->data_chan_use = 0;
- conn->event_counter = 0;
- conn->latency_prepare = 0;
- conn->latency_event = 0;
+ conn->data_chan_sel = 0U;
+ conn->data_chan_use = 0U;
+ conn->event_counter = 0U;
+ conn->latency_prepare = 0U;
+ conn->latency_event = 0U;
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
conn->default_tx_octets = _radio.default_tx_octets;
@@ -10204,75 +10204,75 @@
#if defined(CONFIG_BT_CTLR_PHY)
conn->phy_pref_tx = _radio.default_phy_tx;
conn->phy_tx = BIT(0);
- conn->phy_pref_flags = 0;
- conn->phy_flags = 0;
+ conn->phy_pref_flags = 0U;
+ conn->phy_flags = 0U;
conn->phy_tx_time = BIT(0);
conn->phy_pref_rx = _radio.default_phy_rx;
conn->phy_rx = BIT(0);
#endif /* CONFIG_BT_CTLR_PHY */
- conn->role = 1;
- conn->connect_expire = 6;
- conn->common.fex_valid = 0;
- conn->slave.latency_enabled = 0;
- conn->slave.latency_cancel = 0;
- conn->slave.window_widening_prepare_us = 0;
- conn->slave.window_widening_event_us = 0;
- conn->slave.ticks_to_offset = 0;
- conn->supervision_expire = 0;
- conn->procedure_expire = 0;
+ conn->role = 1U;
+ conn->connect_expire = 6U;
+ conn->common.fex_valid = 0U;
+ conn->slave.latency_enabled = 0U;
+ conn->slave.latency_cancel = 0U;
+ conn->slave.window_widening_prepare_us = 0U;
+ conn->slave.window_widening_event_us = 0U;
+ conn->slave.ticks_to_offset = 0U;
+ conn->supervision_expire = 0U;
+ conn->procedure_expire = 0U;
#if defined(CONFIG_BT_CTLR_LE_PING)
- conn->apto_expire = 0;
- conn->appto_expire = 0;
+ conn->apto_expire = 0U;
+ conn->appto_expire = 0U;
#endif /* CONFIG_BT_CTLR_LE_PING */
- conn->llcp_req = 0;
- conn->llcp_ack = 0;
- conn->llcp_version.tx = 0;
- conn->llcp_version.rx = 0;
- conn->llcp_terminate.req = 0;
- conn->llcp_terminate.ack = 0;
- conn->llcp_terminate.reason_peer = 0;
+ conn->llcp_req = 0U;
+ conn->llcp_ack = 0U;
+ conn->llcp_version.tx = 0U;
+ conn->llcp_version.rx = 0U;
+ conn->llcp_terminate.req = 0U;
+ conn->llcp_terminate.ack = 0U;
+ conn->llcp_terminate.reason_peer = 0U;
conn->llcp_terminate.radio_pdu_node_rx.hdr.onion.link = link;
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
- conn->llcp_conn_param.req = 0;
- conn->llcp_conn_param.ack = 0;
- conn->llcp_conn_param.disabled = 0;
+ conn->llcp_conn_param.req = 0U;
+ conn->llcp_conn_param.ack = 0U;
+ conn->llcp_conn_param.disabled = 0U;
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
- conn->llcp_length.req = 0;
- conn->llcp_length.ack = 0;
- conn->llcp_length.pause_tx = 0;
+ conn->llcp_length.req = 0U;
+ conn->llcp_length.ack = 0U;
+ conn->llcp_length.pause_tx = 0U;
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
#if defined(CONFIG_BT_CTLR_PHY)
- conn->llcp_phy.req = 0;
- conn->llcp_phy.ack = 0;
+ conn->llcp_phy.req = 0U;
+ conn->llcp_phy.ack = 0U;
#endif /* CONFIG_BT_CTLR_PHY */
- conn->sn = 0;
- conn->nesn = 0;
- conn->pause_rx = 0;
- conn->pause_tx = 0;
- conn->enc_rx = 0;
- conn->enc_tx = 0;
- conn->refresh = 0;
- conn->empty = 0;
+ conn->sn = 0U;
+ conn->nesn = 0U;
+ conn->pause_rx = 0U;
+ conn->pause_tx = 0U;
+ conn->enc_rx = 0U;
+ conn->enc_tx = 0U;
+ conn->refresh = 0U;
+ conn->empty = 0U;
conn->pkt_tx_head = NULL;
conn->pkt_tx_ctrl = NULL;
conn->pkt_tx_ctrl_last = NULL;
conn->pkt_tx_data = NULL;
conn->pkt_tx_last = NULL;
- conn->packet_tx_head_len = 0;
- conn->packet_tx_head_offset = 0;
+ conn->packet_tx_head_len = 0U;
+ conn->packet_tx_head_offset = 0U;
#if defined(CONFIG_BT_CTLR_CONN_RSSI)
conn->rssi_latest = 0x7F;
conn->rssi_reported = 0x7F;
- conn->rssi_sample_count = 0;
+ conn->rssi_sample_count = 0U;
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
/* wait for stable 32KHz clock */
@@ -10382,7 +10382,7 @@
}
if (ret_cb == TICKER_STATUS_SUCCESS) {
- _radio.advertiser.is_enabled = 1;
+ _radio.advertiser.is_enabled = 1U;
if (!_radio.scanner.is_enabled) {
ll_adv_scan_state_cb(BIT(0));
@@ -10411,7 +10411,7 @@
if (!status) {
struct connection *conn;
- _radio.advertiser.is_enabled = 0;
+ _radio.advertiser.is_enabled = 0U;
if (!_radio.scanner.is_enabled) {
ll_adv_scan_state_cb(0);
@@ -10507,11 +10507,11 @@
if ((_radio.scanner.conn) ||
!IS_ENABLED(CONFIG_BT_CTLR_SCHED_ADVANCED)) {
- us_offset = 0;
+ us_offset = 0U;
}
#if defined(CONFIG_BT_CTLR_SCHED_ADVANCED)
else {
- u32_t ticks_ref = 0;
+ u32_t ticks_ref = 0U;
sched_after_mstr_free_slot_get(RADIO_TICKER_USER_ID_APP,
(ticks_slot_offset +
@@ -10548,7 +10548,7 @@
return BT_HCI_ERR_CMD_DISALLOWED;
}
- _radio.scanner.is_enabled = 1;
+ _radio.scanner.is_enabled = 1U;
if (!_radio.advertiser.is_enabled) {
ll_adv_scan_state_cb(BIT(1));
@@ -10568,7 +10568,7 @@
status = role_disable(RADIO_TICKER_ID_SCAN,
RADIO_TICKER_ID_SCAN_STOP);
if (!status && !_radio.scanner.conn) {
- _radio.scanner.is_enabled = 0;
+ _radio.scanner.is_enabled = 0U;
if (!_radio.advertiser.is_enabled) {
ll_adv_scan_state_cb(0);
@@ -10642,13 +10642,13 @@
memcpy(&conn->data_chan_map[0], &_radio.data_chan_map[0],
sizeof(conn->data_chan_map));
conn->data_chan_count = _radio.data_chan_count;
- conn->data_chan_sel = 0;
- conn->data_chan_hop = 6;
- conn->data_chan_use = 0;
- conn->event_counter = 0;
+ conn->data_chan_sel = 0U;
+ conn->data_chan_hop = 6U;
+ conn->data_chan_use = 0U;
+ conn->event_counter = 0U;
conn->conn_interval = _radio.scanner.conn_interval;
- conn->latency_prepare = 0;
- conn->latency_event = 0;
+ conn->latency_prepare = 0U;
+ conn->latency_event = 0U;
conn->latency = _radio.scanner.conn_latency;
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
@@ -10666,26 +10666,26 @@
#if defined(CONFIG_BT_CTLR_PHY)
conn->phy_pref_tx = _radio.default_phy_tx;
conn->phy_tx = BIT(0);
- conn->phy_pref_flags = 0;
- conn->phy_flags = 0;
+ conn->phy_pref_flags = 0U;
+ conn->phy_flags = 0U;
conn->phy_tx_time = BIT(0);
conn->phy_pref_rx = _radio.default_phy_rx;
conn->phy_rx = BIT(0);
#endif /* CONFIG_BT_CTLR_PHY */
- conn->role = 0;
- conn->connect_expire = 6;
- conn->common.fex_valid = 0;
- conn->master.terminate_ack = 0;
+ conn->role = 0U;
+ conn->connect_expire = 6U;
+ conn->common.fex_valid = 0U;
+ conn->master.terminate_ack = 0U;
conn_interval_us =
(u32_t)_radio.scanner.conn_interval * 1250;
conn->supervision_reload =
RADIO_CONN_EVENTS((_radio.scanner.conn_timeout * 10 * 1000),
conn_interval_us);
- conn->supervision_expire = 0;
+ conn->supervision_expire = 0U;
conn->procedure_reload =
RADIO_CONN_EVENTS((40 * 1000 * 1000), conn_interval_us);
- conn->procedure_expire = 0;
+ conn->procedure_expire = 0U;
#if defined(CONFIG_BT_CTLR_LE_PING)
/* APTO in no. of connection events */
@@ -10698,56 +10698,56 @@
conn->appto_reload = (conn->apto_reload > (conn->latency + 6)) ?
(conn->apto_reload - (conn->latency + 6)) :
conn->apto_reload;
- conn->apto_expire = 0;
- conn->appto_expire = 0;
+ conn->apto_expire = 0U;
+ conn->appto_expire = 0U;
#endif /* CONFIG_BT_CTLR_LE_PING */
- conn->llcp_req = 0;
- conn->llcp_ack = 0;
- conn->llcp_version.tx = 0;
- conn->llcp_version.rx = 0;
- conn->llcp_terminate.req = 0;
- conn->llcp_terminate.ack = 0;
- conn->llcp_terminate.reason_peer = 0;
+ conn->llcp_req = 0U;
+ conn->llcp_ack = 0U;
+ conn->llcp_version.tx = 0U;
+ conn->llcp_version.rx = 0U;
+ conn->llcp_terminate.req = 0U;
+ conn->llcp_terminate.ack = 0U;
+ conn->llcp_terminate.reason_peer = 0U;
conn->llcp_terminate.radio_pdu_node_rx.hdr.onion.link = link;
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
- conn->llcp_conn_param.req = 0;
- conn->llcp_conn_param.ack = 0;
- conn->llcp_conn_param.disabled = 0;
+ conn->llcp_conn_param.req = 0U;
+ conn->llcp_conn_param.ack = 0U;
+ conn->llcp_conn_param.disabled = 0U;
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
- conn->llcp_length.req = 0;
- conn->llcp_length.ack = 0;
- conn->llcp_length.pause_tx = 0;
+ conn->llcp_length.req = 0U;
+ conn->llcp_length.ack = 0U;
+ conn->llcp_length.pause_tx = 0U;
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
#if defined(CONFIG_BT_CTLR_PHY)
- conn->llcp_phy.req = 0;
- conn->llcp_phy.ack = 0;
+ conn->llcp_phy.req = 0U;
+ conn->llcp_phy.ack = 0U;
#endif /* CONFIG_BT_CTLR_PHY */
- conn->sn = 0;
- conn->nesn = 0;
- conn->pause_rx = 0;
- conn->pause_tx = 0;
- conn->enc_rx = 0;
- conn->enc_tx = 0;
- conn->refresh = 0;
- conn->empty = 0;
+ conn->sn = 0U;
+ conn->nesn = 0U;
+ conn->pause_rx = 0U;
+ conn->pause_tx = 0U;
+ conn->enc_rx = 0U;
+ conn->enc_tx = 0U;
+ conn->refresh = 0U;
+ conn->empty = 0U;
conn->pkt_tx_head = NULL;
conn->pkt_tx_ctrl = NULL;
conn->pkt_tx_ctrl_last = NULL;
conn->pkt_tx_data = NULL;
conn->pkt_tx_last = NULL;
- conn->packet_tx_head_len = 0;
- conn->packet_tx_head_offset = 0;
+ conn->packet_tx_head_len = 0U;
+ conn->packet_tx_head_offset = 0U;
#if defined(CONFIG_BT_CTLR_CONN_RSSI)
conn->rssi_latest = 0x7F;
conn->rssi_reported = 0x7F;
- conn->rssi_sample_count = 0;
+ conn->rssi_sample_count = 0U;
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
/* wait for stable 32KHz clock */
@@ -10817,14 +10817,14 @@
return BT_HCI_ERR_CMD_DISALLOWED;
}
- conn->llcp.conn_upd.win_size = 1;
- conn->llcp.conn_upd.win_offset_us = 0;
+ conn->llcp.conn_upd.win_size = 1U;
+ conn->llcp.conn_upd.win_offset_us = 0U;
conn->llcp.conn_upd.interval = interval_max;
conn->llcp.conn_upd.latency = latency;
conn->llcp.conn_upd.timeout = timeout;
/* conn->llcp.conn_upd.instant = 0; */
conn->llcp.conn_upd.state = LLCP_CUI_STATE_USE;
- conn->llcp.conn_upd.is_internal = 0;
+ conn->llcp.conn_upd.is_internal = 0U;
conn->llcp_type = LLCP_CONN_UPD;
conn->llcp_req++;
@@ -10842,20 +10842,20 @@
conn->llcp_conn_param.status = status;
conn->llcp_conn_param.state = cmd;
- conn->llcp_conn_param.cmd = 1;
+ conn->llcp_conn_param.cmd = 1U;
} else {
if (conn->llcp_conn_param.req !=
conn->llcp_conn_param.ack) {
return BT_HCI_ERR_CMD_DISALLOWED;
}
- conn->llcp_conn_param.status = 0;
+ conn->llcp_conn_param.status = 0U;
conn->llcp_conn_param.interval_min = interval_min;
conn->llcp_conn_param.interval_max = interval_max;
conn->llcp_conn_param.latency = latency;
conn->llcp_conn_param.timeout = timeout;
conn->llcp_conn_param.state = cmd;
- conn->llcp_conn_param.cmd = 1;
+ conn->llcp_conn_param.cmd = 1U;
conn->llcp_conn_param.req++;
}
@@ -10894,7 +10894,7 @@
memcpy(&conn->llcp.chan_map.chm[0], chm,
sizeof(conn->llcp.chan_map.chm));
/* conn->llcp.chan_map.instant = 0; */
- conn->llcp.chan_map.initiate = 1;
+ conn->llcp.chan_map.initiate = 1U;
conn->llcp_type = LLCP_CHAN_MAP;
conn->llcp_req++;
@@ -10916,7 +10916,7 @@
* we were reading it from memory.
*/
do {
- conn->chm_update = 0;
+ conn->chm_update = 0U;
memcpy(chm, conn->data_chan_map, sizeof(conn->data_chan_map));
} while (conn->chm_update);
@@ -10983,7 +10983,7 @@
return 1;
}
- conn->llcp.encryption.initiate = 1;
+ conn->llcp.encryption.initiate = 1U;
conn->llcp_type = LLCP_ENCRYPTION;
conn->llcp_req++;
@@ -11011,7 +11011,7 @@
}
conn->llcp.encryption.error_code = error_code;
- conn->llcp.encryption.initiate = 0;
+ conn->llcp.encryption.initiate = 0U;
conn->llcp_type = LLCP_ENCRYPTION;
conn->llcp_req++;
@@ -11033,8 +11033,8 @@
return 1;
}
- conn->llcp.encryption.error_code = 0;
- conn->llcp.encryption.initiate = 0;
+ conn->llcp.encryption.error_code = 0U;
+ conn->llcp.encryption.initiate = 0U;
conn->llcp_type = LLCP_ENCRYPTION;
conn->llcp_req++;
@@ -11243,7 +11243,7 @@
}
conn->llcp_phy.state = LLCP_PHY_STATE_REQ;
- conn->llcp_phy.cmd = 1;
+ conn->llcp_phy.cmd = 1U;
conn->llcp_phy.tx = tx;
conn->llcp_phy.flags = flags;
conn->llcp_phy.rx = rx;
@@ -11263,7 +11263,7 @@
return 0;
}
- cmplt = 0;
+ cmplt = 0U;
*handle = _radio.pkt_release[_first].handle;
do {
struct radio_pdu_node_tx *node_tx;
@@ -11297,7 +11297,7 @@
_first = _first + 1;
if (_first == _radio.packet_tx_count) {
- _first = 0;
+ _first = 0U;
}
} while (_first != last);
@@ -11311,7 +11311,7 @@
{
u8_t cmplt;
- cmplt = 0;
+ cmplt = 0U;
if (_radio.link_rx_head != _radio.link_rx_tail) {
struct radio_pdu_node_rx *_node_rx;
@@ -11324,7 +11324,7 @@
u16_t h;
first = _radio.packet_release_first;
- cmplt_curr = 0;
+ cmplt_curr = 0U;
do {
cmplt_prev = cmplt_curr;
cmplt_curr = tx_cmplt_get(&h, &first,
@@ -11427,10 +11427,10 @@
}
LL_ASSERT(_radio.advertiser.is_enabled);
- _radio.advertiser.is_enabled = 0;
+ _radio.advertiser.is_enabled = 0U;
} else {
LL_ASSERT(_radio.scanner.is_enabled);
- _radio.scanner.is_enabled = 0;
+ _radio.scanner.is_enabled = 0U;
}
if (conn) {
@@ -11475,7 +11475,7 @@
mem_release(conn, &_radio.conn_free);
- _radio.scanner.is_enabled = 0;
+ _radio.scanner.is_enabled = 0U;
if (!_radio.advertiser.is_enabled) {
ll_adv_scan_state_cb(0);
@@ -11552,7 +11552,7 @@
_radio.fc_handle[_radio.fc_req] = handle;
req = _radio.fc_req + 1;
if (req == TRIPLE_BUFFER_SIZE) {
- req = 0;
+ req = 0U;
}
_radio.fc_req = req;
}
@@ -11644,7 +11644,7 @@
LL_ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
- conn->slave.latency_cancel = 0;
+ conn->slave.latency_cancel = 0U;
}
u32_t ll_tx_mem_enqueue(u16_t handle, void *node_tx)
@@ -11655,7 +11655,7 @@
last = _radio.packet_tx_last + 1;
if (last == _radio.packet_tx_count) {
- last = 0;
+ last = 0U;
}
pdu_data = (void *)((struct radio_pdu_node_tx *)node_tx)->pdu_data;
@@ -11677,7 +11677,7 @@
if (conn->role && conn->latency_event && !conn->slave.latency_cancel) {
u32_t ticker_status;
- conn->slave.latency_cancel = 1;
+ conn->slave.latency_cancel = 1U;
ticker_status = ticker_update(RADIO_TICKER_INSTANCE_ID_RADIO,
RADIO_TICKER_USER_ID_APP,
diff --git a/subsys/bluetooth/controller/ll_sw/ll_adv.c b/subsys/bluetooth/controller/ll_sw/ll_adv.c
index a85ce97..9d39729 100644
--- a/subsys/bluetooth/controller/ll_sw/ll_adv.c
+++ b/subsys/bluetooth/controller/ll_sw/ll_adv.c
@@ -268,7 +268,7 @@
if (radio_adv_data->first == radio_adv_data->last) {
last = radio_adv_data->last + 1;
if (last == DOUBLE_BUFFER_SIZE) {
- last = 0;
+ last = 0U;
}
} else {
last = radio_adv_data->last;
@@ -277,12 +277,12 @@
/* update adv pdu fields. */
pdu = (struct pdu_adv *)&radio_adv_data->data[last][0];
pdu->type = prev->type;
- pdu->rfu = 0;
+ pdu->rfu = 0U;
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
pdu->chan_sel = prev->chan_sel;
} else {
- pdu->chan_sel = 0;
+ pdu->chan_sel = 0U;
}
pdu->tx_addr = prev->tx_addr;
diff --git a/subsys/bluetooth/controller/ll_sw/ll_filter.c b/subsys/bluetooth/controller/ll_sw/ll_filter.c
index d70c7f7..fd729d2 100644
--- a/subsys/bluetooth/controller/ll_sw/ll_filter.c
+++ b/subsys/bluetooth/controller/ll_sw/ll_filter.c
@@ -87,7 +87,7 @@
static void wl_clear(void)
{
for (int i = 0; i < WL_SIZE; i++) {
- wl[i].taken = 0;
+ wl[i].taken = 0U;
}
}
@@ -131,11 +131,11 @@
j = ll_rl_find(id_addr->type, id_addr->a.val, NULL);
if (j < ARRAY_SIZE(rl)) {
wl[i].rl_idx = j;
- rl[j].wl = 1;
+ rl[j].wl = 1U;
} else {
wl[i].rl_idx = FILTER_IDX_NONE;
}
- wl[i].taken = 1;
+ wl[i].taken = 1U;
return 0;
}
@@ -149,9 +149,9 @@
u8_t j = wl[i].rl_idx;
if (j < ARRAY_SIZE(rl)) {
- rl[j].wl = 0;
+ rl[j].wl = 0U;
}
- wl[i].taken = 0;
+ wl[i].taken = 0U;
return 0;
}
@@ -162,8 +162,8 @@
static void filter_clear(struct ll_filter *filter)
{
- filter->enable_bitmask = 0;
- filter->addr_type_bitmask = 0;
+ filter->enable_bitmask = 0U;
+ filter->addr_type_bitmask = 0U;
}
static void filter_insert(struct ll_filter *filter, int index, u8_t addr_type,
@@ -304,7 +304,7 @@
#else
filter_clear(&wl_filter);
#endif /* CONFIG_BT_CTLR_PRIVACY */
- wl_anon = 0;
+ wl_anon = 0U;
return 0;
}
@@ -316,7 +316,7 @@
}
if (addr->type == ADDR_TYPE_ANON) {
- wl_anon = 1;
+ wl_anon = 1U;
return 0;
}
@@ -334,7 +334,7 @@
}
if (addr->type == ADDR_TYPE_ANON) {
- wl_anon = 0;
+ wl_anon = 0U;
return 0;
}
@@ -352,7 +352,7 @@
u8_t i;
/* Populate filter from wl peers */
- for (i = 0; i < WL_SIZE; i++) {
+ for (i = 0U; i < WL_SIZE; i++) {
u8_t j;
if (!wl[i].taken) {
@@ -374,7 +374,7 @@
u8_t i;
/* Populate filter from rl peers */
- for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
+ for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
if (rl[i].taken) {
filter_insert(&rl_filter, i, rl[i].id_addr_type,
rl[i].id_addr.val);
@@ -430,7 +430,7 @@
*free = FILTER_IDX_NONE;
}
- for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
+ for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
if (LIST_MATCH(rl, i, id_addr_type, id_addr)) {
return i;
} else if (free && !rl[i].taken && (*free == FILTER_IDX_NONE)) {
@@ -476,10 +476,10 @@
return true;
}
- for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
+ for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
if (rl[i].taken && (rl[i].id_addr_type == id_addr_type)) {
u8_t *addr = rl[i].id_addr.val;
- for (j = 0; j < BDADDR_SIZE; j++) {
+ for (j = 0U; j < BDADDR_SIZE; j++) {
if (addr[j] != id_addr[j]) {
break;
}
@@ -527,7 +527,7 @@
/* AdvA */
if (idx < ARRAY_SIZE(rl) && rl[idx].lirk) {
LL_ASSERT(rl[idx].rpas_ready);
- pdu->tx_addr = 1;
+ pdu->tx_addr = 1U;
memcpy(adva, rl[idx].local_rpa->val, BDADDR_SIZE);
} else {
pdu->tx_addr = ll_adv->own_addr_type & 0x1;
@@ -537,7 +537,7 @@
/* TargetA */
if (pdu->type == PDU_ADV_TYPE_DIRECT_IND) {
if (idx < ARRAY_SIZE(rl) && rl[idx].pirk) {
- pdu->rx_addr = 1;
+ pdu->rx_addr = 1U;
memcpy(&pdu->direct_ind.tgt_addr[0],
rl[idx].peer_rpa.val, BDADDR_SIZE);
} else {
@@ -570,7 +570,7 @@
if (radio_adv_data->first == radio_adv_data->last) {
last = radio_adv_data->last + 1;
if (last == DOUBLE_BUFFER_SIZE) {
- last = 0;
+ last = 0U;
}
} else {
last = radio_adv_data->last;
@@ -579,12 +579,12 @@
/* update adv pdu fields. */
pdu = (struct pdu_adv *)&radio_adv_data->data[last][0];
pdu->type = prev->type;
- pdu->rfu = 0;
+ pdu->rfu = 0U;
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
pdu->chan_sel = prev->chan_sel;
} else {
- pdu->chan_sel = 0;
+ pdu->chan_sel = 0U;
}
idx = ll_rl_find(ll_adv->id_addr_type, ll_adv->id_addr, NULL);
@@ -603,10 +603,10 @@
static void rl_clear(void)
{
for (u8_t i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
- rl[i].taken = 0;
+ rl[i].taken = 0U;
}
- peer_irk_count = 0;
+ peer_irk_count = 0U;
}
static int rl_access_check(bool check_ar)
@@ -630,7 +630,7 @@
(now - rpa_last_ms >= rpa_timeout_ms);
BT_DBG("");
- for (i = 0; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
+ for (i = 0U; i < CONFIG_BT_CTLR_RL_SIZE; i++) {
if ((rl[i].taken) && (all || !rl[i].rpas_ready)) {
if (rl[i].pirk) {
@@ -657,7 +657,7 @@
rl[i].local_rpa = &local_rpas[i];
}
- rl[i].rpas_ready = 1;
+ rl[i].rpas_ready = 1U;
}
}
@@ -761,18 +761,18 @@
rl[i].local_rpa = NULL;
}
(void)memset(rl[i].curr_rpa.val, 0x00, sizeof(rl[i].curr_rpa));
- rl[i].rpas_ready = 0;
+ rl[i].rpas_ready = 0U;
/* Default to Network Privacy */
- rl[i].dev = 0;
+ rl[i].dev = 0U;
/* Add reference to a whitelist entry */
j = wl_find(id_addr->type, id_addr->a.val, NULL);
if (j < ARRAY_SIZE(wl)) {
wl[j].rl_idx = i;
- rl[i].wl = 1;
+ rl[i].wl = 1U;
} else {
- rl[i].wl = 0;
+ rl[i].wl = 0U;
}
- rl[i].taken = 1;
+ rl[i].taken = 1U;
return 0;
}
@@ -796,7 +796,7 @@
if (pj && pi != pj) {
memcpy(peer_irks[pi], peer_irks[pj], 16);
- for (k = 0;
+ for (k = 0U;
k < CONFIG_BT_CTLR_RL_SIZE;
k++) {
@@ -816,7 +816,7 @@
if (j < ARRAY_SIZE(wl)) {
wl[j].rl_idx = FILTER_IDX_NONE;
}
- rl[i].taken = 0;
+ rl[i].taken = 0U;
return 0;
}
@@ -876,10 +876,10 @@
switch (enable) {
case BT_HCI_ADDR_RES_DISABLE:
- rl_enable = 0;
+ rl_enable = 0U;
break;
case BT_HCI_ADDR_RES_ENABLE:
- rl_enable = 1;
+ rl_enable = 1U;
break;
default:
return BT_HCI_ERR_INVALID_PARAM;
@@ -906,10 +906,10 @@
if (i < ARRAY_SIZE(rl)) {
switch (mode) {
case BT_HCI_LE_PRIVACY_MODE_NETWORK:
- rl[i].dev = 0;
+ rl[i].dev = 0U;
break;
case BT_HCI_LE_PRIVACY_MODE_DEVICE:
- rl[i].dev = 1;
+ rl[i].dev = 1U;
break;
default:
return BT_HCI_ERR_INVALID_PARAM;
@@ -925,12 +925,12 @@
void ll_filter_reset(bool init)
{
- wl_anon = 0;
+ wl_anon = 0U;
#if defined(CONFIG_BT_CTLR_PRIVACY)
wl_clear();
- rl_enable = 0;
+ rl_enable = 0U;
rpa_timeout_ms = DEFAULT_RPA_TIMEOUT_MS;
rpa_last_ms = -1;
rl_clear();
diff --git a/subsys/bluetooth/controller/ll_sw/ll_master.c b/subsys/bluetooth/controller/ll_sw/ll_master.c
index bd32523..34c86c8 100644
--- a/subsys/bluetooth/controller/ll_sw/ll_master.c
+++ b/subsys/bluetooth/controller/ll_sw/ll_master.c
@@ -22,7 +22,7 @@
u16_t timeout)
{
u32_t status;
- u8_t rpa_gen = 0;
+ u8_t rpa_gen = 0U;
u8_t rl_idx = FILTER_IDX_NONE;
if (ll_scan_is_enabled()) {
@@ -50,7 +50,7 @@
/* Generate RPAs if required */
ll_rl_rpa_update(false);
own_addr_type &= 0x1;
- rpa_gen = 1;
+ rpa_gen = 1U;
}
#endif
return radio_scan_enable(0, own_addr_type,
diff --git a/subsys/bluetooth/controller/ll_sw/ll_scan.c b/subsys/bluetooth/controller/ll_sw/ll_scan.c
index dd05d09..34f2190 100644
--- a/subsys/bluetooth/controller/ll_sw/ll_scan.c
+++ b/subsys/bluetooth/controller/ll_sw/ll_scan.c
@@ -59,7 +59,7 @@
u32_t ll_scan_enable(u8_t enable)
{
- u8_t rpa_gen = 0;
+ u8_t rpa_gen = 0U;
u32_t status;
u32_t scan;
@@ -87,7 +87,7 @@
ll_scan.own_addr_type == BT_ADDR_LE_RANDOM_ID)) {
/* Generate RPAs if required */
ll_rl_rpa_update(false);
- rpa_gen = 1;
+ rpa_gen = 1U;
}
#endif
status = radio_scan_enable(ll_scan.type, ll_scan.own_addr_type & 0x1,
diff --git a/subsys/bluetooth/controller/ll_sw/ll_test.c b/subsys/bluetooth/controller/ll_sw/ll_test.c
index f6c9426..584e001 100644
--- a/subsys/bluetooth/controller/ll_sw/ll_test.c
+++ b/subsys/bluetooth/controller/ll_sw/ll_test.c
@@ -127,7 +127,7 @@
static void isr_rx(void)
{
- u8_t crc_ok = 0;
+ u8_t crc_ok = 0U;
u8_t trx_done;
/* Read radio status and events */
@@ -176,10 +176,10 @@
/* Store value needed in Tx/Rx ISR */
if (phy < 0x04) {
test_phy = BIT(phy - 1);
- test_phy_flags = 1;
+ test_phy_flags = 1U;
} else {
test_phy = BIT(2);
- test_phy_flags = 0;
+ test_phy_flags = 0U;
}
/* Setup Radio in Tx/Rx */
@@ -311,7 +311,7 @@
/* Return packets Rx-ed/Completed */
*num_rx = test_num_rx;
- test_num_rx = 0;
+ test_num_rx = 0U;
/* Disable Radio, if in Rx test */
ack = tx_ack;
diff --git a/subsys/bluetooth/controller/ticker/ticker.c b/subsys/bluetooth/controller/ticker/ticker.c
index 3aa666c..a2ef257 100644
--- a/subsys/bluetooth/controller/ticker/ticker.c
+++ b/subsys/bluetooth/controller/ticker/ticker.c
@@ -171,7 +171,7 @@
(*ticks_current != instance->ticks_current)) {
_ticker_id_head = instance->ticker_id_head;
*ticks_current = instance->ticks_current;
- _ticks_to_expire = 0;
+ _ticks_to_expire = 0U;
} else {
ticker = &node[_ticker_id_head];
_ticker_id_head = ticker->next;
@@ -225,7 +225,7 @@
if (ticks_slot_previous > ticks_to_expire_current) {
ticks_slot_previous -= ticks_to_expire_current;
} else {
- ticks_slot_previous = 0;
+ ticks_slot_previous = 0U;
}
}
previous = current;
@@ -274,7 +274,7 @@
node = &instance->node[0];
previous = instance->ticker_id_head;
current = previous;
- total = 0;
+ total = 0U;
ticker_current = 0;
while (current != TICKER_NULL) {
@@ -326,14 +326,14 @@
u8_t ticker_id_head;
/* Defer worker if job running */
- instance->worker_trigger = 1;
+ instance->worker_trigger = 1U;
if (instance->job_guard) {
return;
}
/* If no tickers to expire, do nothing */
if (instance->ticker_id_head == TICKER_NULL) {
- instance->worker_trigger = 0;
+ instance->worker_trigger = 0U;
return;
}
@@ -343,7 +343,7 @@
instance->ticks_current);
/* initialise actual elapsed ticks being consumed */
- ticks_expired = 0;
+ ticks_expired = 0U;
/* auto variable containing the head of tickers expiring */
ticker_id_head = instance->ticker_id_head;
@@ -401,13 +401,13 @@
last = instance->ticks_elapsed_last + 1;
if (last == DOUBLE_BUFFER_SIZE) {
- last = 0;
+ last = 0U;
}
instance->ticks_elapsed_last = last;
}
instance->ticks_elapsed[instance->ticks_elapsed_last] = ticks_expired;
- instance->worker_trigger = 0;
+ instance->worker_trigger = 0U;
instance->sched_cb(TICKER_CALL_ID_WORKER, TICKER_CALL_ID_JOB, 1,
instance);
@@ -433,17 +433,17 @@
} else {
ticks_to_expire_minus +=
(delta_current_start - ticks_to_expire);
- ticks_to_expire = 0;
+ ticks_to_expire = 0U;
}
}
/* Handle any drifts requested */
if (ticks_to_expire > ticks_to_expire_minus) {
ticks_to_expire -= ticks_to_expire_minus;
- ticks_to_expire_minus = 0;
+ ticks_to_expire_minus = 0U;
} else {
ticks_to_expire_minus -= ticks_to_expire;
- ticks_to_expire = 0;
+ ticks_to_expire = 0U;
}
ticker->ticks_to_expire = ticks_to_expire;
@@ -463,7 +463,7 @@
static u8_t ticker_remainder_dec(struct ticker_node *ticker)
{
- u8_t decrement = 0;
+ u8_t decrement = 0U;
if ((ticker->remainder_current >= BIT(31)) ||
(ticker->remainder_current <= (30517578UL / 2))) {
@@ -500,7 +500,7 @@
} else {
ticker->ticks_to_expire_minus += ticks_elapsed -
ticks_to_expire;
- ticks_to_expire = 0;
+ ticks_to_expire = 0U;
}
if ((ticker->ticks_periodic != 0) &&
@@ -534,7 +534,7 @@
if (ticker->ticks_slot > user_op->params.update.ticks_slot_minus) {
ticker->ticks_slot -= user_op->params.update.ticks_slot_minus;
} else {
- ticker->ticks_slot = 0;
+ ticker->ticks_slot = 0U;
}
if (user_op->params.update.force != 0) {
@@ -569,7 +569,7 @@
if (instance->ticker_id_slot_previous == user_op->id) {
instance->ticker_id_slot_previous = TICKER_NULL;
- instance->ticks_slot_previous = 0;
+ instance->ticks_slot_previous = 0U;
}
}
@@ -588,7 +588,7 @@
struct ticker_user *users;
u8_t count_user;
- pending = 0;
+ pending = 0U;
node = &instance->node[0];
users = &instance->user[0];
count_user = instance->count_user;
@@ -611,7 +611,7 @@
prev = user->middle;
middle = user->middle + 1;
if (middle == user->count_user_op) {
- middle = 0;
+ middle = 0U;
}
user->middle = middle;
@@ -662,7 +662,7 @@
*/
user->middle = prev;
- pending = 1;
+ pending = 1U;
break;
}
@@ -681,7 +681,7 @@
u32_t ticks_expired;
node = &instance->node[0];
- ticks_expired = 0;
+ ticks_expired = 0U;
while (instance->ticker_id_head != TICKER_NULL) {
struct ticker_node *ticker;
u32_t ticks_to_expire;
@@ -707,7 +707,7 @@
instance->ticks_slot_previous -= ticks_to_expire;
} else {
instance->ticker_id_slot_previous = TICKER_NULL;
- instance->ticks_slot_previous = 0;
+ instance->ticks_slot_previous = 0U;
}
/* save current ticks_slot_previous */
@@ -717,7 +717,7 @@
}
/* ticker expired, set ticks_to_expire zero */
- ticker->ticks_to_expire = 0;
+ ticker->ticks_to_expire = 0U;
/* remove the expired ticker from head */
instance->ticker_id_head = ticker->next;
@@ -727,7 +727,7 @@
u32_t count;
/* Prepare for next interval */
- ticks_to_expire = 0;
+ ticks_to_expire = 0U;
count = 1 + ticker->lazy_periodic;
while (count--) {
ticks_to_expire += ticker->ticks_periodic;
@@ -737,7 +737,7 @@
ticks_to_expire_prep(ticker, instance->ticks_current,
(ticks_previous + ticks_expired));
ticker->lazy_current = ticker->lazy_periodic;
- ticker->force = 0;
+ ticker->force = 0U;
/* Add to insert list */
ticker->next = *insert_head;
@@ -765,11 +765,11 @@
ticker->timeout_func = start->fp_timeout_func;
ticker->context = start->context;
ticker->ticks_to_expire = start->ticks_first;
- ticker->ticks_to_expire_minus = 0;
+ ticker->ticks_to_expire_minus = 0U;
ticks_to_expire_prep(ticker, ticks_current, start->ticks_at_start);
- ticker->remainder_current = 0;
- ticker->lazy_current = 0;
- ticker->force = 1;
+ ticker->remainder_current = 0U;
+ ticker->lazy_current = 0U;
+ ticker->force = 1U;
}
static inline u32_t ticker_job_insert(struct ticker_instance *instance,
@@ -789,7 +789,7 @@
skip = ticker->lazy_current -
ticker->lazy_periodic;
} else {
- skip = 0;
+ skip = 0U;
}
/* If insert collides, remove colliding or advance to next interval */
@@ -808,7 +808,7 @@
skip_collide = ticker_collide->lazy_current -
ticker_collide->lazy_periodic;
} else {
- skip_collide = 0;
+ skip_collide = 0U;
}
if (ticker_collide->ticks_periodic &&
@@ -844,11 +844,11 @@
ticker->ticks_to_expire_minus) {
ticker->ticks_to_expire -=
ticker->ticks_to_expire_minus;
- ticker->ticks_to_expire_minus = 0;
+ ticker->ticks_to_expire_minus = 0U;
} else {
ticker->ticks_to_expire_minus -=
ticker->ticks_to_expire;
- ticker->ticks_to_expire = 0;
+ ticker->ticks_to_expire = 0U;
}
} else {
return TICKER_STATUS_FAILURE;
@@ -898,7 +898,7 @@
user_op = &user_ops[user_ops_first];
first = user_ops_first + 1;
if (first == user->count_user_op) {
- first = 0;
+ first = 0U;
}
user_ops_first = first;
@@ -977,7 +977,7 @@
first = user->first + 1;
if (first == user->count_user_op) {
- first = 0;
+ first = 0U;
}
user->first = first;
}
@@ -996,7 +996,7 @@
if (instance->ticker_id_head == TICKER_NULL) {
if (cntr_stop() == 0) {
- instance->ticks_slot_previous = 0;
+ instance->ticks_slot_previous = 0U;
}
return;
@@ -1020,7 +1020,7 @@
* the operation is pre-empted and current h/w counter runs
* ahead of compare value to be set.
*/
- i = 10;
+ i = 10U;
do {
u32_t ticks_elapsed;
@@ -1060,7 +1060,7 @@
return;
}
- instance->job_guard = 1;
+ instance->job_guard = 1U;
/* Back up the previous known tick */
ticks_previous = instance->ticks_current;
@@ -1071,7 +1071,7 @@
first = instance->ticks_elapsed_first + 1;
if (first == DOUBLE_BUFFER_SIZE) {
- first = 0;
+ first = 0U;
}
instance->ticks_elapsed_first = first;
@@ -1081,18 +1081,18 @@
instance->ticks_current += ticks_elapsed;
instance->ticks_current &= 0x00FFFFFF;
- flag_elapsed = 1;
+ flag_elapsed = 1U;
} else {
/* No elapsed value in queue */
- flag_elapsed = 0;
- ticks_elapsed = 0;
+ flag_elapsed = 0U;
+ ticks_elapsed = 0U;
}
/* Initialise internal re-insert list */
insert_head = TICKER_NULL;
/* Initialise flag used to update next compare value */
- flag_compare_update = 0;
+ flag_compare_update = 0U;
/* Remember the old head, so as to decide if new compare needs to be
* set.
@@ -1104,7 +1104,7 @@
/* Detect change in head of the list */
if (instance->ticker_id_head != ticker_id_old_head) {
- flag_compare_update = 1;
+ flag_compare_update = 1U;
}
/* Handle expired tickers */
@@ -1114,7 +1114,7 @@
/* detect change in head of the list */
if (instance->ticker_id_head != ticker_id_old_head) {
- flag_compare_update = 1;
+ flag_compare_update = 1U;
}
}
@@ -1123,7 +1123,7 @@
/* detect change in head of the list */
if (instance->ticker_id_head != ticker_id_old_head) {
- flag_compare_update = 1;
+ flag_compare_update = 1U;
}
/* Processing any list inquiries */
@@ -1133,7 +1133,7 @@
}
/* Permit worker job to run */
- instance->job_guard = 0;
+ instance->job_guard = 0U;
/* update compare if head changed */
if (flag_compare_update) {
@@ -1193,10 +1193,10 @@
instance->ticker_id_head = TICKER_NULL;
instance->ticker_id_slot_previous = TICKER_NULL;
- instance->ticks_slot_previous = 0;
- instance->ticks_current = 0;
- instance->ticks_elapsed_first = 0;
- instance->ticks_elapsed_last = 0;
+ instance->ticks_slot_previous = 0U;
+ instance->ticks_current = 0U;
+ instance->ticks_elapsed_first = 0U;
+ instance->ticks_elapsed_last = 0U;
return TICKER_STATUS_SUCCESS;
}
@@ -1236,7 +1236,7 @@
last = user->last + 1;
if (last >= user->count_user_op) {
- last = 0;
+ last = 0U;
}
if (last == user->first) {
@@ -1280,7 +1280,7 @@
last = user->last + 1;
if (last >= user->count_user_op) {
- last = 0;
+ last = 0U;
}
if (last == user->first) {
@@ -1320,7 +1320,7 @@
last = user->last + 1;
if (last >= user->count_user_op) {
- last = 0;
+ last = 0U;
}
if (last == user->first) {
@@ -1355,7 +1355,7 @@
last = user->last + 1;
if (last >= user->count_user_op) {
- last = 0;
+ last = 0U;
}
if (last == user->first) {
@@ -1392,7 +1392,7 @@
last = user->last + 1;
if (last >= user->count_user_op) {
- last = 0;
+ last = 0U;
}
if (last == user->first) {
diff --git a/subsys/bluetooth/controller/util/mayfly.c b/subsys/bluetooth/controller/util/mayfly.c
index 63022d4..558eca9 100644
--- a/subsys/bluetooth/controller/util/mayfly.c
+++ b/subsys/bluetooth/controller/util/mayfly.c
@@ -112,8 +112,8 @@
void mayfly_run(u8_t callee_id)
{
- u8_t disable = 0;
- u8_t enable = 0;
+ u8_t disable = 0U;
+ u8_t enable = 0U;
u8_t caller_id;
/* iterate through each caller queue to this callee_id */
@@ -178,7 +178,7 @@
if (mft[callee_id][caller_id].disable_req !=
mft[callee_id][caller_id].disable_ack) {
- disable = 1;
+ disable = 1U;
mft[callee_id][caller_id].disable_ack =
mft[callee_id][caller_id].disable_req;
@@ -186,7 +186,7 @@
if (mft[callee_id][caller_id].enable_req !=
mft[callee_id][caller_id].enable_ack) {
- enable = 1;
+ enable = 1U;
mft[callee_id][caller_id].enable_ack =
mft[callee_id][caller_id].enable_req;
diff --git a/subsys/bluetooth/controller/util/mem.c b/subsys/bluetooth/controller/util/mem.c
index ae5fe26..01aee14 100644
--- a/subsys/bluetooth/controller/util/mem.c
+++ b/subsys/bluetooth/controller/util/mem.c
@@ -67,7 +67,7 @@
void mem_release(void *mem, void **mem_head)
{
- u16_t free_count = 0;
+ u16_t free_count = 0U;
/* Get the free count from the list and increment it */
if (*mem_head) {
@@ -86,7 +86,7 @@
u16_t mem_free_count_get(void *mem_head)
{
- u16_t free_count = 0;
+ u16_t free_count = 0U;
/* Get the free count from the list */
if (mem_head) {
diff --git a/subsys/bluetooth/controller/util/util.c b/subsys/bluetooth/controller/util/util.c
index b414428..193c258 100644
--- a/subsys/bluetooth/controller/util/util.c
+++ b/subsys/bluetooth/controller/util/util.c
@@ -10,7 +10,7 @@
u8_t util_ones_count_get(u8_t *octets, u8_t octets_len)
{
- u8_t one_count = 0;
+ u8_t one_count = 0U;
while (octets_len--) {
u8_t bite;
diff --git a/subsys/bluetooth/host/at.c b/subsys/bluetooth/host/at.c
index ca83a57..9f6383f 100644
--- a/subsys/bluetooth/host/at.c
+++ b/subsys/bluetooth/host/at.c
@@ -49,7 +49,7 @@
skip_space(at);
- for (i = 0, *val = 0;
+ for (i = 0U, *val = 0U;
isdigit((unsigned char)at->buf[at->pos]);
at->pos++, i++) {
*val = *val * 10 + at->buf[at->pos] - '0';
@@ -105,7 +105,7 @@
} else {
cmd_len++;
at->buf[at->pos] = '\0';
- at->pos = 0;
+ at->pos = 0U;
at->cmd_state = cmd_state;
break;
}
@@ -135,7 +135,7 @@
} else {
cmd_len++;
at->buf[at->pos] = '\0';
- at->pos = 0;
+ at->pos = 0U;
at->state = state;
break;
}
@@ -152,7 +152,7 @@
static void reset_buffer(struct at_client *at)
{
(void)memset(at->buf, 0, at->buf_max_len);
- at->pos = 0;
+ at->pos = 0U;
}
static int at_state_start(struct at_client *at, struct net_buf *buf)
diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c
index afe9bd3..8cb3454 100644
--- a/subsys/bluetooth/host/att.c
+++ b/subsys/bluetooth/host/att.c
@@ -383,7 +383,7 @@
/* Handle 0 is invalid */
if (!start || !end) {
if (err) {
- *err = 0;
+ *err = 0U;
}
return false;
}
@@ -811,7 +811,7 @@
data.att = att;
data.uuid = uuid;
data.rsp = net_buf_add(data.buf, sizeof(*data.rsp));
- data.rsp->len = 0;
+ data.rsp->len = 0U;
/* Pre-set error if no attr will be found in handle */
data.err = BT_ATT_ERR_ATTRIBUTE_NOT_FOUND;
@@ -1115,7 +1115,7 @@
data.att = att;
data.uuid = uuid;
data.rsp = net_buf_add(data.buf, sizeof(*data.rsp));
- data.rsp->len = 0;
+ data.rsp->len = 0U;
data.group = NULL;
bt_gatt_foreach_attr(start_handle, end_handle, read_group_cb, &data);
@@ -1199,7 +1199,7 @@
{
struct write_data *data = user_data;
int write;
- u8_t flags = 0;
+ u8_t flags = 0U;
BT_DBG("handle 0x%04x offset %u", attr->handle, data->offset);
@@ -1222,7 +1222,7 @@
return BT_GATT_ITER_STOP;
}
- data->err = 0;
+ data->err = 0U;
return BT_GATT_ITER_CONTINUE;
}
@@ -1338,7 +1338,7 @@
net_buf_add_mem(data->buf, data->value, data->len);
- data->err = 0;
+ data->err = 0U;
return BT_GATT_ITER_CONTINUE;
}
@@ -1419,7 +1419,7 @@
{
struct bt_conn *conn = att->chan.chan.conn;
struct net_buf *buf;
- u8_t err = 0;
+ u8_t err = 0U;
while ((buf = net_buf_get(&att->prep_queue, K_NO_WAIT))) {
struct bt_attr_data *data = net_buf_user_data(buf);
diff --git a/subsys/bluetooth/host/avdtp.c b/subsys/bluetooth/host/avdtp.c
index 99bd924..83c7a5f 100644
--- a/subsys/bluetooth/host/avdtp.c
+++ b/subsys/bluetooth/host/avdtp.c
@@ -178,7 +178,7 @@
}
}
- for (i = 0; i < ARRAY_SIZE(handler); i++) {
+ for (i = 0U; i < ARRAY_SIZE(handler); i++) {
if (sigid == handler[i].sig_id) {
handler[i].func(session, buf, msgtype);
return 0;
diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c
index 84db14a..7c507d8 100644
--- a/subsys/bluetooth/host/conn.c
+++ b/subsys/bluetooth/host/conn.c
@@ -1057,7 +1057,7 @@
net_buf_unref(conn->rx);
conn->rx = NULL;
- conn->rx_len = 0;
+ conn->rx_len = 0U;
}
void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, u8_t flags)
@@ -1122,7 +1122,7 @@
buf = conn->rx;
conn->rx = NULL;
- conn->rx_len = 0;
+ conn->rx_len = 0U;
break;
default:
diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c
index dd698a4..f5534d4 100644
--- a/subsys/bluetooth/host/gatt.c
+++ b/subsys/bluetooth/host/gatt.c
@@ -189,7 +189,7 @@
u16_t count = svc->attr_count;
if (sys_slist_is_empty(&db)) {
- handle = 0;
+ handle = 0U;
goto populate;
}
@@ -266,8 +266,8 @@
sc_range[1] = sys_cpu_to_le16(sc->end);
atomic_clear_bit(sc->flags, SC_RANGE_CHANGED);
- sc->start = 0;
- sc->end = 0;
+ sc->start = 0U;
+ sc->end = 0U;
sc->params.attr = &gatt_attrs[2];
sc->params.func = sc_indicate_rsp;
@@ -1294,7 +1294,7 @@
const struct bt_att_find_type_rsp *rsp = pdu;
struct bt_gatt_discover_params *params = user_data;
u8_t i;
- u16_t end_handle = 0, start_handle;
+ u16_t end_handle = 0U, start_handle;
BT_DBG("err 0x%02x", err);
@@ -1303,7 +1303,7 @@
}
/* Parse attributes found */
- for (i = 0; length >= sizeof(rsp->list[i]);
+ for (i = 0U; length >= sizeof(rsp->list[i]);
i++, length -= sizeof(rsp->list[i])) {
struct bt_gatt_attr attr = {};
struct bt_gatt_service_val value;
@@ -1458,7 +1458,7 @@
u16_t length)
{
const struct bt_att_read_type_rsp *rsp = pdu;
- u16_t handle = 0;
+ u16_t handle = 0U;
struct bt_gatt_include value;
union {
struct bt_uuid uuid;
@@ -1556,7 +1556,7 @@
u16_t length)
{
const struct bt_att_read_type_rsp *rsp = pdu;
- u16_t handle = 0;
+ u16_t handle = 0U;
union {
struct bt_uuid uuid;
struct bt_uuid_16 u16;
@@ -1684,7 +1684,7 @@
u16_t length)
{
const struct bt_att_read_group_rsp *rsp = pdu;
- u16_t start_handle, end_handle = 0;
+ u16_t start_handle, end_handle = 0U;
union {
struct bt_uuid uuid;
struct bt_uuid_16 u16;
@@ -1816,7 +1816,7 @@
{
const struct bt_att_find_info_rsp *rsp = pdu;
struct bt_gatt_discover_params *params = user_data;
- u16_t handle = 0;
+ u16_t handle = 0U;
u8_t len;
union {
const struct bt_att_info_16 *i16;
@@ -2037,7 +2037,7 @@
return -ENOMEM;
}
- for (i = 0; i < params->handle_count; i++) {
+ for (i = 0U; i < params->handle_count; i++) {
net_buf_add_le16(buf, params->handles[i]);
}
diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c
index 994ba58..d4427d3 100644
--- a/subsys/bluetooth/host/hci_core.c
+++ b/subsys/bluetooth/host/hci_core.c
@@ -623,7 +623,7 @@
STACK_ANALYZE("tx stack", tx_thread_stack);
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
- conn->handle = 0;
+ conn->handle = 0U;
if (conn->type != BT_CONN_TYPE_LE) {
#if defined(CONFIG_BT_BREDR)
@@ -885,7 +885,7 @@
conn->le.latency = sys_le16_to_cpu(evt->latency);
conn->le.timeout = sys_le16_to_cpu(evt->supv_timeout);
conn->role = evt->role;
- conn->err = 0;
+ conn->err = 0U;
/*
* Use connection address (instead of identity address) as initiator
@@ -1619,7 +1619,7 @@
}
conn->handle = handle;
- conn->err = 0;
+ conn->err = 0U;
conn->encrypt = evt->encr_enabled;
update_sec_level_br(conn);
bt_conn_set_state(conn, BT_CONN_CONNECTED);
@@ -1676,7 +1676,7 @@
}
/* clear any old Link Key flags */
- conn->br.link_key->flags = 0;
+ conn->br.link_key->flags = 0U;
switch (evt->key_type) {
case BT_LK_COMBINATION:
@@ -2054,7 +2054,7 @@
continue;
}
- priv->resolving = 1;
+ priv->resolving = 1U;
resolving_names = true;
}
@@ -2214,7 +2214,7 @@
}
priv = (struct discovery_priv *)&result->_priv;
- priv->resolving = 0;
+ priv->resolving = 0U;
if (evt->status) {
goto check_names;
@@ -3594,7 +3594,7 @@
bt_addr_copy(&bt_dev.id_addr[0].a, &rp->bdaddr);
bt_dev.id_addr[0].type = BT_ADDR_LE_PUBLIC;
- bt_dev.id_count = 1;
+ bt_dev.id_count = 1U;
}
static void read_le_features_complete(struct net_buf *buf)
@@ -3777,7 +3777,7 @@
{
struct bt_hci_cp_le_set_event_mask *cp_mask;
struct net_buf *buf;
- u64_t mask = 0;
+ u64_t mask = 0U;
/* Set LE event mask */
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EVENT_MASK, sizeof(*cp_mask));
@@ -4170,7 +4170,7 @@
{
struct bt_hci_cp_set_event_mask *ev;
struct net_buf *buf;
- u64_t mask = 0;
+ u64_t mask = 0U;
buf = bt_hci_cmd_create(BT_HCI_OP_SET_EVENT_MASK, sizeof(*ev));
if (!buf) {
@@ -4864,7 +4864,7 @@
{
u8_t id;
- for (id = 0; id < bt_dev.id_count; id++) {
+ for (id = 0U; id < bt_dev.id_count; id++) {
if (!bt_addr_le_cmp(addr, &bt_dev.id_addr[id])) {
return id;
}
diff --git a/subsys/bluetooth/host/hfp_hf.c b/subsys/bluetooth/host/hfp_hf.c
index 22145d4..d3b9c84 100644
--- a/subsys/bluetooth/host/hfp_hf.c
+++ b/subsys/bluetooth/host/hfp_hf.c
@@ -160,7 +160,7 @@
int cind_handle(struct at_client *hf_at)
{
- u32_t index = 0;
+ u32_t index = 0U;
/* Parsing Example: CIND: ("call",(0,1)) etc.. */
while (at_has_next_list(hf_at)) {
@@ -286,7 +286,7 @@
int cind_status_handle(struct at_client *hf_at)
{
- u32_t index = 0;
+ u32_t index = 0U;
while (at_has_next_list(hf_at)) {
u32_t value;
diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c
index d4d3cad..1b8fdd3 100644
--- a/subsys/bluetooth/host/l2cap.c
+++ b/subsys/bluetooth/host/l2cap.c
@@ -1456,7 +1456,7 @@
struct net_buf *buf)
{
u16_t len;
- u16_t seg = 0;
+ u16_t seg = 0U;
len = net_buf_frags_len(chan->_sdu);
if (len) {
diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c
index 1648969..4264828 100644
--- a/subsys/bluetooth/host/l2cap_br.c
+++ b/subsys/bluetooth/host/l2cap_br.c
@@ -377,14 +377,14 @@
}
done:
atomic_set_bit(l2cap->chan.flags, L2CAP_FLAG_SIG_INFO_DONE);
- l2cap->info_ident = 0;
+ l2cap->info_ident = 0U;
return err;
}
static u8_t get_fixed_channels_mask(void)
{
struct bt_l2cap_fixed_chan *fchan;
- u8_t mask = 0;
+ u8_t mask = 0U;
/* this needs to be enhanced if AMP Test Manager support is added */
SYS_SLIST_FOR_EACH_CONTAINER(&br_fixed_channels, fchan, node) {
diff --git a/subsys/bluetooth/host/mesh/access.c b/subsys/bluetooth/host/mesh/access.c
index f10a1ef..8065d8a 100644
--- a/subsys/bluetooth/host/mesh/access.c
+++ b/subsys/bluetooth/host/mesh/access.c
@@ -431,7 +431,7 @@
{
u8_t i;
- for (i = 0; i < model_count; i++) {
+ for (i = 0U; i < model_count; i++) {
const struct bt_mesh_model_op *op;
*model = &models[i];
@@ -718,7 +718,7 @@
{
u8_t i;
- for (i = 0; i < elem->vnd_model_count; i++) {
+ for (i = 0U; i < elem->vnd_model_count; i++) {
if (elem->vnd_models[i].vnd.company == company &&
elem->vnd_models[i].vnd.id == id) {
return &elem->vnd_models[i];
@@ -733,7 +733,7 @@
{
u8_t i;
- for (i = 0; i < elem->model_count; i++) {
+ for (i = 0U; i < elem->model_count; i++) {
if (elem->models[i].id == id) {
return &elem->models[i];
}
diff --git a/subsys/bluetooth/host/mesh/adv.c b/subsys/bluetooth/host/mesh/adv.c
index f095f26..ef44a4f 100644
--- a/subsys/bluetooth/host/mesh/adv.c
+++ b/subsys/bluetooth/host/mesh/adv.c
@@ -187,7 +187,7 @@
/* busy == 0 means this was canceled */
if (BT_MESH_ADV(buf)->busy) {
- BT_MESH_ADV(buf)->busy = 0;
+ BT_MESH_ADV(buf)->busy = 0U;
adv_send(buf);
}
@@ -245,7 +245,7 @@
BT_MESH_ADV(buf)->cb = cb;
BT_MESH_ADV(buf)->cb_data = cb_data;
- BT_MESH_ADV(buf)->busy = 1;
+ BT_MESH_ADV(buf)->busy = 1U;
net_buf_put(&adv_queue, net_buf_ref(buf));
}
diff --git a/subsys/bluetooth/host/mesh/beacon.c b/subsys/bluetooth/host/mesh/beacon.c
index 511b990..570033b 100644
--- a/subsys/bluetooth/host/mesh/beacon.c
+++ b/subsys/bluetooth/host/mesh/beacon.c
@@ -229,7 +229,7 @@
}
sub->beacons_last = sub->beacons_cur;
- sub->beacons_cur = 0;
+ sub->beacons_cur = 0U;
}
}
@@ -398,8 +398,8 @@
continue;
}
- sub->beacons_last = 0;
- sub->beacons_cur = 0;
+ sub->beacons_last = 0U;
+ sub->beacons_cur = 0U;
bt_mesh_net_beacon_update(sub);
}
diff --git a/subsys/bluetooth/host/mesh/cfg_srv.c b/subsys/bluetooth/host/mesh/cfg_srv.c
index 7a9c5b0..7f7e3e6 100644
--- a/subsys/bluetooth/host/mesh/cfg_srv.c
+++ b/subsys/bluetooth/host/mesh/cfg_srv.c
@@ -51,7 +51,7 @@
{
struct bt_mesh_cfg_srv *cfg = model->user_data;
- u16_t feat = 0;
+ u16_t feat = 0U;
struct __packed {
u8_t init_ttl;
u16_t feat;
@@ -130,7 +130,7 @@
static int comp_get_page_0(struct net_buf_simple *buf)
{
- u16_t feat = 0;
+ u16_t feat = 0U;
const struct bt_mesh_comp *comp;
int i;
@@ -184,7 +184,7 @@
page = net_buf_simple_pull_u8(buf);
if (page != 0) {
BT_WARN("Composition page %u not available", page);
- page = 0;
+ page = 0U;
}
bt_mesh_model_msg_init(&sdu, OP_DEV_COMP_DATA_STATUS);
@@ -643,7 +643,7 @@
}
prev = BT_MESH_KEY_UNUSED;
- for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
+ for (i = 0U; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
if (key->net_idx != get_idx) {
@@ -1049,7 +1049,7 @@
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
- u16_t elem_addr, pub_addr = 0;
+ u16_t elem_addr, pub_addr = 0U;
struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
u8_t *mod_id, status;
@@ -1181,7 +1181,7 @@
return STATUS_UNSPECIFIED;
}
- free_slot->ref = 1;
+ free_slot->ref = 1U;
free_slot->addr = *addr;
memcpy(free_slot->uuid, label_uuid, 16);
@@ -1280,14 +1280,14 @@
if (!elem) {
mod = NULL;
vnd = (buf->len == 4);
- pub_addr = 0;
+ pub_addr = 0U;
status = STATUS_INVALID_ADDRESS;
goto send_status;
}
mod = get_model(elem, buf, &vnd);
if (!mod) {
- pub_addr = 0;
+ pub_addr = 0U;
status = STATUS_INVALID_MODEL;
goto send_status;
}
@@ -1316,7 +1316,7 @@
u8_t *mod_id, status;
struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
- u16_t elem_addr, pub_addr = 0;
+ u16_t elem_addr, pub_addr = 0U;
bool vnd;
elem_addr = net_buf_simple_pull_le16(buf);
@@ -2324,7 +2324,7 @@
bt_mesh_model_msg_init(&msg, OP_NET_KEY_LIST);
prev = BT_MESH_KEY_UNUSED;
- for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) {
+ for (i = 0U; i < ARRAY_SIZE(bt_mesh.sub); i++) {
struct bt_mesh_subnet *sub = &bt_mesh.sub[i];
if (sub->net_idx == BT_MESH_KEY_UNUSED) {
@@ -3062,7 +3062,7 @@
uptime = k_uptime_get();
if (uptime > cfg->hb_sub.expiry) {
- period = 0;
+ period = 0U;
} else {
period = (cfg->hb_sub.expiry - uptime) / 1000;
}
diff --git a/subsys/bluetooth/host/mesh/crypto.c b/subsys/bluetooth/host/mesh/crypto.c
index a159fa8..9968046 100644
--- a/subsys/bluetooth/host/mesh/crypto.c
+++ b/subsys/bluetooth/host/mesh/crypto.c
@@ -284,7 +284,7 @@
last_blk = msg_len % 16;
blk_cnt = (msg_len + 15) / 16;
if (!last_blk) {
- last_blk = 16;
+ last_blk = 16U;
}
for (j = 0; j < blk_cnt; j++) {
@@ -448,7 +448,7 @@
last_blk = msg_len % 16;
blk_cnt = (msg_len + 15) / 16;
if (!last_blk) {
- last_blk = 16;
+ last_blk = 16U;
}
for (j = 0; j < blk_cnt; j++) {
@@ -541,8 +541,8 @@
nonce[6] = pdu[6];
/* Pad */
- nonce[7] = 0;
- nonce[8] = 0;
+ nonce[7] = 0U;
+ nonce[8] = 0U;
/* IV Index */
sys_put_be32(iv_index, &nonce[9]);
@@ -568,8 +568,8 @@
nonce[6] = pdu[6];
/* Pad */
- nonce[7] = 0;
- nonce[8] = 0;
+ nonce[7] = 0U;
+ nonce[8] = 0U;
/* IV Index */
sys_put_be32(iv_index, &nonce[9]);
diff --git a/subsys/bluetooth/host/mesh/friend.c b/subsys/bluetooth/host/mesh/friend.c
index f006084..268a92b 100644
--- a/subsys/bluetooth/host/mesh/friend.c
+++ b/subsys/bluetooth/host/mesh/friend.c
@@ -176,7 +176,7 @@
if (frnd->last) {
/* Cancel the sending if necessary */
if (frnd->pending_buf) {
- BT_MESH_ADV(frnd->last)->busy = 0;
+ BT_MESH_ADV(frnd->last)->busy = 0U;
}
net_buf_unref(frnd->last);
@@ -195,12 +195,12 @@
}
}
- frnd->valid = 0;
- frnd->established = 0;
- frnd->pending_buf = 0;
- frnd->fsn = 0;
- frnd->queue_size = 0;
- frnd->pending_req = 0;
+ frnd->valid = 0U;
+ frnd->established = 0U;
+ frnd->pending_buf = 0U;
+ frnd->fsn = 0U;
+ frnd->queue_size = 0U;
+ frnd->pending_req = 0U;
(void)memset(frnd->sub_list, 0, sizeof(frnd->sub_list));
}
@@ -237,7 +237,7 @@
}
if (net_idx == BT_MESH_KEY_ANY || frnd->net_idx == net_idx) {
- frnd->sec_update = 1;
+ frnd->sec_update = 1U;
}
}
}
@@ -398,8 +398,8 @@
info.src = bt_mesh_primary_addr();
info.dst = frnd->lpn;
- info.ctl = 1;
- info.ttl = 0;
+ info.ctl = 1U;
+ info.ttl = 0U;
seq = bt_mesh_next_seq();
info.seq[0] = seq >> 16;
@@ -456,12 +456,12 @@
}
frnd->last = buf;
- frnd->send_last = 1;
+ frnd->send_last = 1U;
}
static void friend_recv_delay(struct bt_mesh_friend *frnd)
{
- frnd->pending_req = 1;
+ frnd->pending_req = 1U;
k_delayed_work_submit(&frnd->timer, recv_delay(frnd));
BT_DBG("Waiting RecvDelay of %d ms", recv_delay(frnd));
}
@@ -552,7 +552,7 @@
return;
}
- frnd->sec_update = 0;
+ frnd->sec_update = 0U;
enqueue_buf(frnd, buf);
}
@@ -588,12 +588,12 @@
if (!frnd->established) {
BT_DBG("Friendship established with 0x%04x", frnd->lpn);
- frnd->established = 1;
+ frnd->established = 1U;
}
if (msg->fsn == frnd->fsn && frnd->last) {
BT_DBG("Re-sending last PDU");
- frnd->send_last = 1;
+ frnd->send_last = 1U;
} else {
if (frnd->last) {
net_buf_unref(frnd->last);
@@ -687,7 +687,7 @@
BT_DBG("LPN 0x%04x (old) Friend 0x%04x", frnd->lpn, frnd->clear.frnd);
frnd->clear.start = k_uptime_get_32() + (2 * frnd->poll_to);
- frnd->clear.repeat_sec = 1;
+ frnd->clear.repeat_sec = 1U;
send_friend_clear(frnd);
}
@@ -763,7 +763,7 @@
}
frnd->last = buf;
- frnd->send_last = 1;
+ frnd->send_last = 1U;
}
#define RECV_WIN CONFIG_BT_MESH_FRIEND_RECV_WIN
@@ -865,7 +865,7 @@
for (i = 0; i < ARRAY_SIZE(bt_mesh.frnd); i++) {
if (!bt_mesh.frnd[i].valid) {
frnd = &bt_mesh.frnd[i];
- frnd->valid = 1;
+ frnd->valid = 1U;
break;
}
}
@@ -979,7 +979,7 @@
BT_DBG("err %d", err);
- frnd->pending_buf = 0;
+ frnd->pending_buf = 0U;
/* Friend Offer doesn't follow the re-sending semantics */
if (!frnd->established) {
@@ -1025,7 +1025,7 @@
if (frnd->send_last && frnd->last) {
BT_DBG("Sending frnd->last %p", frnd->last);
- frnd->send_last = 0;
+ frnd->send_last = 0U;
goto send_last;
}
@@ -1047,8 +1047,8 @@
frnd->queue_size--;
send_last:
- frnd->pending_req = 0;
- frnd->pending_buf = 1;
+ frnd->pending_req = 0U;
+ frnd->pending_buf = 1U;
bt_mesh_adv_send(frnd->last, &buf_sent_cb, frnd);
}
diff --git a/subsys/bluetooth/host/mesh/health_srv.c b/subsys/bluetooth/host/mesh/health_srv.c
index 7aa75aa..ff31bb4 100644
--- a/subsys/bluetooth/host/mesh/health_srv.c
+++ b/subsys/bluetooth/host/mesh/health_srv.c
@@ -91,7 +91,7 @@
BT_ERR("Failed to get faults (err %d)", err);
sys_put_le16(comp->cid, company_ptr);
*test_id = HEALTH_TEST_STANDARD;
- fault_count = 0;
+ fault_count = 0U;
} else {
sys_put_le16(company_id, company_ptr);
net_buf_simple_add(msg, fault_count);
@@ -100,7 +100,7 @@
BT_WARN("No callback for getting faults");
sys_put_le16(comp->cid, company_ptr);
*test_id = HEALTH_TEST_STANDARD;
- fault_count = 0;
+ fault_count = 0U;
}
return fault_count;
diff --git a/subsys/bluetooth/host/mesh/lpn.c b/subsys/bluetooth/host/mesh/lpn.c
index 4375a53..535f8ec 100644
--- a/subsys/bluetooth/host/mesh/lpn.c
+++ b/subsys/bluetooth/host/mesh/lpn.c
@@ -227,14 +227,14 @@
}
lpn->frnd = BT_MESH_ADDR_UNASSIGNED;
- lpn->fsn = 0;
- lpn->req_attempts = 0;
- lpn->recv_win = 0;
- lpn->queue_size = 0;
- lpn->disable = 0;
- lpn->sent_req = 0;
- lpn->established = 0;
- lpn->clear_success = 0;
+ lpn->fsn = 0U;
+ lpn->req_attempts = 0U;
+ lpn->recv_win = 0U;
+ lpn->queue_size = 0U;
+ lpn->disable = 0U;
+ lpn->sent_req = 0U;
+ lpn->established = 0U;
+ lpn->clear_success = 0U;
group_zero(lpn->added);
group_zero(lpn->pending);
@@ -244,7 +244,7 @@
* Friendship is created, in case lpn->groups doesn't get
* modified meanwhile.
*/
- lpn->groups_changed = 1;
+ lpn->groups_changed = 1U;
if (disable) {
lpn_set_state(BT_MESH_LPN_DISABLED);
@@ -321,7 +321,7 @@
if (err) {
BT_ERR("Sending request failed (err %d)", err);
- lpn->sent_req = 0;
+ lpn->sent_req = 0U;
group_zero(lpn->pending);
return;
}
@@ -370,7 +370,7 @@
if (lpn->sent_req) {
if (lpn->sent_req != TRANS_CTL_OP_FRIEND_POLL) {
- lpn->pending_poll = 1;
+ lpn->pending_poll = 1U;
}
return 0;
@@ -379,7 +379,7 @@
err = bt_mesh_ctl_send(&tx, TRANS_CTL_OP_FRIEND_POLL, &fsn, 1,
NULL, &req_sent_cb, NULL);
if (err == 0) {
- lpn->pending_poll = 0;
+ lpn->pending_poll = 0U;
lpn->sent_req = TRANS_CTL_OP_FRIEND_POLL;
}
@@ -451,8 +451,8 @@
k_delayed_work_cancel(&lpn->timer);
bt_mesh_scan_disable();
lpn_set_state(BT_MESH_LPN_ESTABLISHED);
- lpn->req_attempts = 0;
- lpn->sent_req = 0;
+ lpn->req_attempts = 0U;
+ lpn->sent_req = 0U;
}
void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx)
@@ -527,8 +527,8 @@
if (err) {
friend_cred_clear(cred);
lpn->frnd = BT_MESH_ADDR_UNASSIGNED;
- lpn->recv_win = 0;
- lpn->queue_size = 0;
+ lpn->recv_win = 0U;
+ lpn->queue_size = 0U;
return err;
}
@@ -564,7 +564,7 @@
return 0;
}
- lpn->clear_success = 1;
+ lpn->clear_success = 1U;
clear_friendship(false, lpn->disable);
return 0;
@@ -593,7 +593,7 @@
}
*free_slot = group;
- lpn->groups_changed = 1;
+ lpn->groups_changed = 1U;
}
static void lpn_group_del(u16_t group)
@@ -606,7 +606,7 @@
if (atomic_test_bit(lpn->added, i) ||
atomic_test_bit(lpn->pending, i)) {
atomic_set_bit(lpn->to_remove, i);
- lpn->groups_changed = 1;
+ lpn->groups_changed = 1U;
} else {
lpn->groups[i] = BT_MESH_ADDR_UNASSIGNED;
}
@@ -713,7 +713,7 @@
if (lpn->req_attempts < 6) {
BT_WARN("Retrying first Friend Poll");
- lpn->sent_req = 0;
+ lpn->sent_req = 0U;
if (send_friend_poll() == 0) {
return;
}
@@ -767,7 +767,7 @@
if (lpn->req_attempts < REQ_ATTEMPTS(lpn)) {
u8_t req = lpn->sent_req;
- lpn->sent_req = 0;
+ lpn->sent_req = 0U;
if (!req || req == TRANS_CTL_OP_FRIEND_POLL) {
send_friend_poll();
@@ -780,7 +780,7 @@
BT_ERR("No response from Friend after %u retries",
lpn->req_attempts);
- lpn->req_attempts = 0;
+ lpn->req_attempts = 0U;
clear_friendship(false, false);
break;
case BT_MESH_LPN_RECV_DELAY:
@@ -898,7 +898,7 @@
sub_update(TRANS_CTL_OP_FRIEND_SUB_REM);
if (!lpn->sent_req) {
- lpn->groups_changed = 0;
+ lpn->groups_changed = 0U;
}
}
@@ -952,7 +952,7 @@
return -EINVAL;
}
- lpn->established = 1;
+ lpn->established = 1U;
BT_INFO("Friendship established with 0x%04x", lpn->frnd);
@@ -984,7 +984,7 @@
sub_update(TRANS_CTL_OP_FRIEND_SUB_REM);
if (!lpn->sent_req) {
- lpn->groups_changed = 0;
+ lpn->groups_changed = 0U;
}
}
diff --git a/subsys/bluetooth/host/mesh/main.c b/subsys/bluetooth/host/mesh/main.c
index 23d7a83..38ede54 100644
--- a/subsys/bluetooth/host/mesh/main.c
+++ b/subsys/bluetooth/host/mesh/main.c
@@ -57,7 +57,7 @@
return err;
}
- bt_mesh.seq = 0;
+ bt_mesh.seq = 0U;
bt_mesh_comp_provision(addr);
@@ -81,13 +81,13 @@
return;
}
- bt_mesh.iv_index = 0;
- bt_mesh.seq = 0;
- bt_mesh.iv_update = 0;
- bt_mesh.pending_update = 0;
- bt_mesh.valid = 0;
- bt_mesh.ivu_duration = 0;
- bt_mesh.ivu_initiator = 0;
+ bt_mesh.iv_index = 0U;
+ bt_mesh.seq = 0U;
+ bt_mesh.iv_update = 0U;
+ bt_mesh.pending_update = 0U;
+ bt_mesh.valid = 0U;
+ bt_mesh.ivu_duration = 0U;
+ bt_mesh.ivu_initiator = 0U;
k_delayed_work_cancel(&bt_mesh.ivu_timer);
diff --git a/subsys/bluetooth/host/mesh/net.c b/subsys/bluetooth/host/mesh/net.c
index 90aaf3e..5b94e2c 100644
--- a/subsys/bluetooth/host/mesh/net.c
+++ b/subsys/bluetooth/host/mesh/net.c
@@ -130,7 +130,7 @@
u64_t hash = msg_hash(rx, pdu);
u16_t i;
- for (i = 0; i < ARRAY_SIZE(msg_cache); i++) {
+ for (i = 0U; i < ARRAY_SIZE(msg_cache); i++) {
if (msg_cache[i] == hash) {
return true;
}
@@ -340,8 +340,8 @@
{
cred->net_idx = BT_MESH_KEY_UNUSED;
cred->addr = BT_MESH_ADDR_UNASSIGNED;
- cred->lpn_counter = 0;
- cred->frnd_counter = 0;
+ cred->lpn_counter = 0U;
+ cred->frnd_counter = 0U;
(void)memset(cred->cred, 0, sizeof(cred->cred));
}
@@ -453,7 +453,7 @@
}
(void)memset(msg_cache, 0, sizeof(msg_cache));
- msg_cache_next = 0;
+ msg_cache_next = 0U;
sub = &bt_mesh.sub[0];
@@ -472,7 +472,7 @@
}
}
- bt_mesh.valid = 1;
+ bt_mesh.valid = 1U;
sub->net_idx = idx;
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
@@ -585,7 +585,7 @@
{
bt_mesh.ivu_test = enable;
/* Reset the duration variable - needed for some PTS tests */
- bt_mesh.ivu_duration = 0;
+ bt_mesh.ivu_duration = 0U;
}
bool bt_mesh_iv_update(void)
@@ -657,7 +657,7 @@
BT_WARN("Performing IV Index Recovery");
(void)memset(bt_mesh.rpl, 0, sizeof(bt_mesh.rpl));
bt_mesh.iv_index = iv_index;
- bt_mesh.seq = 0;
+ bt_mesh.seq = 0U;
goto do_update;
}
@@ -683,13 +683,13 @@
/* Defer change to Normal Operation if there are pending acks */
if (!iv_update && bt_mesh_tx_in_progress()) {
BT_WARN("IV Update deferred because of pending transfer");
- bt_mesh.pending_update = 1;
+ bt_mesh.pending_update = 1U;
return false;
}
do_update:
bt_mesh.iv_update = iv_update;
- bt_mesh.ivu_duration = 0;
+ bt_mesh.ivu_duration = 0U;
if (bt_mesh.iv_update) {
bt_mesh.iv_index = iv_index;
@@ -699,7 +699,7 @@
bt_mesh_rpl_reset();
} else {
BT_DBG("Normal mode entered");
- bt_mesh.seq = 0;
+ bt_mesh.seq = 0U;
}
k_delayed_work_submit(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
@@ -835,14 +835,14 @@
&nid, &enc, &priv)) {
BT_WARN("Falling back to master credentials");
- tx->friend_cred = 0;
+ tx->friend_cred = 0U;
nid = tx->sub->keys[tx->sub->kr_flag].nid;
enc = tx->sub->keys[tx->sub->kr_flag].enc;
priv = tx->sub->keys[tx->sub->kr_flag].privacy;
}
} else {
- tx->friend_cred = 0;
+ tx->friend_cred = 0U;
nid = tx->sub->keys[tx->sub->kr_flag].nid;
enc = tx->sub->keys[tx->sub->kr_flag].enc;
priv = tx->sub->keys[tx->sub->kr_flag].privacy;
@@ -1051,7 +1051,7 @@
if (NID(data) == cred->cred[1].nid &&
!net_decrypt(sub, cred->cred[1].enc, cred->cred[1].privacy,
data, data_len, rx, buf)) {
- rx->new_key = 1;
+ rx->new_key = 1U;
return 0;
}
}
@@ -1078,7 +1078,7 @@
#if (defined(CONFIG_BT_MESH_LOW_POWER) || \
defined(CONFIG_BT_MESH_FRIEND))
if (!friend_decrypt(sub, data, data_len, rx, buf)) {
- rx->friend_cred = 1;
+ rx->friend_cred = 1U;
rx->ctx.net_idx = sub->net_idx;
rx->sub = sub;
return true;
@@ -1100,7 +1100,7 @@
if (NID(data) == sub->keys[1].nid &&
!net_decrypt(sub, sub->keys[1].enc, sub->keys[1].privacy,
data, data_len, rx, buf)) {
- rx->new_key = 1;
+ rx->new_key = 1U;
rx->ctx.net_idx = sub->net_idx;
rx->sub = sub;
return true;
diff --git a/subsys/bluetooth/host/mesh/prov.c b/subsys/bluetooth/host/mesh/prov.c
index 44753d2..e0fe710 100644
--- a/subsys/bluetooth/host/mesh/prov.c
+++ b/subsys/bluetooth/host/mesh/prov.c
@@ -216,7 +216,7 @@
link.tx.buf[i] = NULL;
/* Mark as canceled */
- BT_MESH_ADV(buf)->busy = 0;
+ BT_MESH_ADV(buf)->busy = 0U;
net_buf_unref(buf);
}
}
@@ -414,7 +414,7 @@
net_buf_simple_pull(msg, seg_len);
buf = start;
- for (seg_id = 1; msg->len > 0; seg_id++) {
+ for (seg_id = 1U; msg->len > 0; seg_id++) {
if (seg_id >= ARRAY_SIZE(link.tx.buf)) {
BT_ERR("Too big message");
free_segments();
@@ -638,7 +638,7 @@
bt_rand(str, size);
/* Normalize to '0' .. '9' & 'A' .. 'Z' */
- for (i = 0; i < size; i++) {
+ for (i = 0U; i < size; i++) {
str[i] %= 36;
if (str[i] < 10) {
str[i] += '0';
@@ -1065,7 +1065,7 @@
prov_send(&msg);
/* Ignore any further PDUs on this link */
- link.expect = 0;
+ link.expect = 0U;
/* Store info, since bt_mesh_provision() will end up clearing it */
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
@@ -1124,7 +1124,7 @@
prov_send_fail_msg(err);
}
- link.rx.seg = 0;
+ link.rx.seg = 0U;
bearer_ctl_send(LINK_CLOSE, &reason, sizeof(reason));
#endif
@@ -1273,7 +1273,7 @@
gen_prov_ack_send(link.rx.id);
link.rx.prev_id = link.rx.id;
- link.rx.id = 0;
+ link.rx.id = 0U;
if (type != PROV_FAILED && type != link.expect) {
BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect);
diff --git a/subsys/bluetooth/host/mesh/proxy.c b/subsys/bluetooth/host/mesh/proxy.c
index 44502fa..1105e6e 100644
--- a/subsys/bluetooth/host/mesh/proxy.c
+++ b/subsys/bluetooth/host/mesh/proxy.c
@@ -225,7 +225,7 @@
net_buf_simple_add_u8(buf, 0x01);
}
- for (filter_size = 0, i = 0; i < ARRAY_SIZE(client->filter); i++) {
+ for (filter_size = 0U, i = 0; i < ARRAY_SIZE(client->filter); i++) {
if (client->filter[i] != BT_MESH_ADDR_UNASSIGNED) {
filter_size++;
}
@@ -361,7 +361,7 @@
void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub)
{
sub->node_id = BT_MESH_NODE_IDENTITY_STOPPED;
- sub->node_id_start = 0;
+ sub->node_id_start = 0U;
}
int bt_mesh_proxy_identity_enable(void)
diff --git a/subsys/bluetooth/host/mesh/settings.c b/subsys/bluetooth/host/mesh/settings.c
index 4b6d4e6..31f364f 100644
--- a/subsys/bluetooth/host/mesh/settings.c
+++ b/subsys/bluetooth/host/mesh/settings.c
@@ -167,8 +167,8 @@
BT_DBG("val %s", val ? val : "(null)");
if (!val) {
- bt_mesh.iv_index = 0;
- bt_mesh.iv_update = 0;
+ bt_mesh.iv_index = 0U;
+ bt_mesh.iv_update = 0U;
return 0;
}
@@ -202,7 +202,7 @@
BT_DBG("val %s", val ? val : "(null)");
if (!val) {
- bt_mesh.seq = 0;
+ bt_mesh.seq = 0U;
return 0;
}
@@ -824,7 +824,7 @@
cfg->default_ttl = stored_cfg.cfg.default_ttl;
}
- bt_mesh.valid = 1;
+ bt_mesh.valid = 1U;
bt_mesh_net_start();
@@ -1199,7 +1199,7 @@
}
}
- update->valid = 0;
+ update->valid = 0U;
}
}
@@ -1429,7 +1429,7 @@
update = key_update_find(false, sub->net_idx, &free_slot);
if (update) {
- update->clear = 0;
+ update->clear = 0U;
schedule_store(BT_MESH_KEYS_PENDING);
return;
}
@@ -1439,10 +1439,10 @@
return;
}
- free_slot->valid = 1;
+ free_slot->valid = 1U;
free_slot->key_idx = sub->net_idx;
- free_slot->app_key = 0;
- free_slot->clear = 0;
+ free_slot->app_key = 0U;
+ free_slot->clear = 0U;
schedule_store(BT_MESH_KEYS_PENDING);
}
@@ -1455,7 +1455,7 @@
update = key_update_find(true, key->app_idx, &free_slot);
if (update) {
- update->clear = 0;
+ update->clear = 0U;
schedule_store(BT_MESH_KEYS_PENDING);
return;
}
@@ -1465,10 +1465,10 @@
return;
}
- free_slot->valid = 1;
+ free_slot->valid = 1U;
free_slot->key_idx = key->app_idx;
- free_slot->app_key = 1;
- free_slot->clear = 0;
+ free_slot->app_key = 1U;
+ free_slot->clear = 0U;
schedule_store(BT_MESH_KEYS_PENDING);
}
@@ -1498,7 +1498,7 @@
update = key_update_find(false, sub->net_idx, &free_slot);
if (update) {
- update->clear = 1;
+ update->clear = 1U;
schedule_store(BT_MESH_KEYS_PENDING);
return;
}
@@ -1508,10 +1508,10 @@
return;
}
- free_slot->valid = 1;
+ free_slot->valid = 1U;
free_slot->key_idx = sub->net_idx;
- free_slot->app_key = 0;
- free_slot->clear = 1;
+ free_slot->app_key = 0U;
+ free_slot->clear = 1U;
schedule_store(BT_MESH_KEYS_PENDING);
}
@@ -1524,7 +1524,7 @@
update = key_update_find(true, key->app_idx, &free_slot);
if (update) {
- update->clear = 1;
+ update->clear = 1U;
schedule_store(BT_MESH_KEYS_PENDING);
return;
}
@@ -1534,10 +1534,10 @@
return;
}
- free_slot->valid = 1;
+ free_slot->valid = 1U;
free_slot->key_idx = key->app_idx;
- free_slot->app_key = 1;
- free_slot->clear = 1;
+ free_slot->app_key = 1U;
+ free_slot->clear = 1U;
schedule_store(BT_MESH_KEYS_PENDING);
}
diff --git a/subsys/bluetooth/host/mesh/shell.c b/subsys/bluetooth/host/mesh/shell.c
index fca985b..7f2433c 100644
--- a/subsys/bluetooth/host/mesh/shell.c
+++ b/subsys/bluetooth/host/mesh/shell.c
@@ -76,7 +76,7 @@
{
u8_t i, limit = *count;
- for (i = 0, *count = 0; i < faults_size && *count < limit; i++) {
+ for (i = 0U, *count = 0U; i < faults_size && *count < limit; i++) {
if (faults[i]) {
*dst++ = faults[i];
(*count)++;
@@ -893,18 +893,18 @@
if (argc > 2) {
count = strtoul(argv[2], NULL, 0);
} else {
- count = 2;
+ count = 2U;
}
if (argc > 3) {
interval = strtoul(argv[3], NULL, 0);
} else {
- interval = 20;
+ interval = 20U;
}
new_transmit = BT_MESH_TRANSMIT(count, interval);
} else {
- new_transmit = 0;
+ new_transmit = 0U;
}
err = bt_mesh_cfg_relay_set(net.net_idx, net.dst, val,
@@ -1559,7 +1559,7 @@
if (argc > 3) {
iv_index = strtoul(argv[3], NULL, 0);
} else {
- iv_index = 0;
+ iv_index = 0U;
}
err = bt_mesh_provision(default_key, net_idx, 0, iv_index, addr,
@@ -1884,7 +1884,7 @@
return -EINVAL;
}
- for (i = 0; i < sizeof(cur_faults); i++) {
+ for (i = 0U; i < sizeof(cur_faults); i++) {
if (!cur_faults[i]) {
cur_faults[i] = fault_id;
break;
@@ -1897,7 +1897,7 @@
return 0;
}
- for (i = 0; i < sizeof(reg_faults); i++) {
+ for (i = 0U; i < sizeof(reg_faults); i++) {
if (!reg_faults[i]) {
reg_faults[i] = fault_id;
break;
@@ -1931,9 +1931,9 @@
return -EINVAL;
}
- for (i = 0; i < sizeof(cur_faults); i++) {
+ for (i = 0U; i < sizeof(cur_faults); i++) {
if (cur_faults[i] == fault_id) {
- cur_faults[i] = 0;
+ cur_faults[i] = 0U;
shell_print(shell, "Fault cleared");
}
}
diff --git a/subsys/bluetooth/host/mesh/transport.c b/subsys/bluetooth/host/mesh/transport.c
index 019149d..5fa20fe 100644
--- a/subsys/bluetooth/host/mesh/transport.c
+++ b/subsys/bluetooth/host/mesh/transport.c
@@ -175,7 +175,7 @@
tx->cb = NULL;
tx->cb_data = NULL;
- tx->seq_auth = 0;
+ tx->seq_auth = 0U;
tx->sub = NULL;
tx->dst = BT_MESH_ADDR_UNASSIGNED;
@@ -192,11 +192,11 @@
tx->seg[i] = NULL;
}
- tx->nack_count = 0;
+ tx->nack_count = 0U;
if (bt_mesh.pending_update) {
BT_DBG("Proceding with pending IV Update");
- bt_mesh.pending_update = 0;
+ bt_mesh.pending_update = 0U;
/* bt_mesh_net_iv_update() will re-enable the flag if this
* wasn't the only transfer.
*/
@@ -337,7 +337,7 @@
seg_hdr = SEG_HDR(1, net_tx->aid);
}
- seg_o = 0;
+ seg_o = 0U;
tx->dst = net_tx->ctx->addr;
tx->seg_n = (sdu->len - 1) / 12;
tx->nack_count = tx->seg_n + 1;
@@ -357,7 +357,7 @@
BT_DBG("SeqZero 0x%04x", seq_zero);
- for (seg_o = 0; sdu->len; seg_o++) {
+ for (seg_o = 0U; sdu->len; seg_o++) {
struct net_buf *seg;
u16_t len;
int err;
@@ -465,7 +465,7 @@
if (tx->ctx->app_idx == BT_MESH_KEY_DEV) {
key = bt_mesh.dev_key;
- tx->aid = 0;
+ tx->aid = 0U;
} else {
struct bt_mesh_app_key *app_key;
@@ -485,9 +485,9 @@
}
if (!tx->ctx->send_rel || net_buf_simple_tailroom(msg) < 8) {
- tx->aszmic = 0;
+ tx->aszmic = 0U;
} else {
- tx->aszmic = 1;
+ tx->aszmic = 1U;
}
if (BT_MESH_ADDR_IS_VIRTUAL(tx->ctx->addr)) {
@@ -629,7 +629,7 @@
return 0;
}
- for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
+ for (i = 0U; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
struct bt_mesh_app_keys *keys;
@@ -1015,14 +1015,14 @@
&rx->seq_auth);
}
- rx->in_use = 0;
+ rx->in_use = 0U;
/* We don't always reset these values since we need to be able to
* send an ack if we receive a segment after we've already received
* the full SDU.
*/
if (full_reset) {
- rx->seq_auth = 0;
+ rx->seq_auth = 0U;
rx->sub = NULL;
rx->src = BT_MESH_ADDR_UNASSIGNED;
rx->dst = BT_MESH_ADDR_UNASSIGNED;
@@ -1137,7 +1137,7 @@
continue;
}
- rx->in_use = 1;
+ rx->in_use = 1U;
net_buf_simple_reset(&rx->buf);
rx->sub = net_rx->sub;
rx->ctl = net_rx->ctl;
@@ -1147,7 +1147,7 @@
rx->ttl = net_rx->ctx.send_ttl;
rx->src = net_rx->ctx.addr;
rx->dst = net_rx->ctx.recv_dst;
- rx->block = 0;
+ rx->block = 0U;
BT_DBG("New RX context. Block Complete 0x%08x",
BLOCK_COMPLETE(seg_n));
diff --git a/subsys/bluetooth/host/monitor.c b/subsys/bluetooth/host/monitor.c
index 19023d1..17c797c 100644
--- a/subsys/bluetooth/host/monitor.c
+++ b/subsys/bluetooth/host/monitor.c
@@ -102,7 +102,7 @@
struct bt_monitor_ts32 *ts;
hdr->opcode = sys_cpu_to_le16(opcode);
- hdr->flags = 0;
+ hdr->flags = 0U;
ts = (void *)hdr->ext;
ts->type = BT_MONITOR_TS32;
diff --git a/subsys/bluetooth/host/rfcomm.c b/subsys/bluetooth/host/rfcomm.c
index 4690f8b..66549f7 100644
--- a/subsys/bluetooth/host/rfcomm.c
+++ b/subsys/bluetooth/host/rfcomm.c
@@ -917,12 +917,12 @@
/* If PN comes in already opened dlc or cfc not supported
* these should be 0
*/
- pn->credits = 0;
- pn->flow_ctrl = 0;
+ pn->credits = 0U;
+ pn->flow_ctrl = 0U;
}
- pn->max_retrans = 0;
- pn->ack_timer = 0;
- pn->priority = 0;
+ pn->max_retrans = 0U;
+ pn->ack_timer = 0U;
+ pn->priority = 0U;
fcs = rfcomm_calc_fcs(BT_RFCOMM_FCS_LEN_UIH, buf->data);
net_buf_add_u8(buf, fcs);
diff --git a/subsys/bluetooth/host/sdp.c b/subsys/bluetooth/host/sdp.c
index 0180c5f..e099074 100644
--- a/subsys/bluetooth/host/sdp.c
+++ b/subsys/bluetooth/host/sdp.c
@@ -260,7 +260,7 @@
static u16_t parse_data_elem(struct net_buf *buf,
struct bt_sdp_data_elem *data_elem)
{
- u8_t size_field_len = 0; /* Space used to accommodate the size */
+ u8_t size_field_len = 0U; /* Space used to accommodate the size */
if (buf->len < 1) {
BT_WARN("Malformed packet");
@@ -462,7 +462,7 @@
struct bt_sdp_record *record;
u32_t uuid_list_size;
u16_t res;
- u8_t att_idx, rec_idx = 0;
+ u8_t att_idx, rec_idx = 0U;
bool found;
union {
struct bt_uuid uuid;
@@ -528,7 +528,7 @@
/* Go over the list of services, and look for a service which
* doesn't have this UUID
*/
- for (rec_idx = 0; rec_idx < num_services; rec_idx++) {
+ for (rec_idx = 0U; rec_idx < num_services; rec_idx++) {
record = matching_recs[rec_idx];
if (!record) {
@@ -538,7 +538,7 @@
found = false;
/* Search for the UUID in all the attrs of the svc */
- for (att_idx = 0; att_idx < record->attr_count;
+ for (att_idx = 0U; att_idx < record->attr_count;
att_idx++) {
search_uuid(&record->attrs[att_idx].val,
&u.uuid, &found, 1);
@@ -576,8 +576,8 @@
struct net_buf *resp_buf;
struct bt_sdp_record *record;
struct bt_sdp_record *matching_recs[BT_SDP_MAX_SERVICES];
- u16_t max_rec_count, total_recs = 0, current_recs = 0, res;
- u8_t cont_state_size, cont_state = 0, idx = 0, count = 0;
+ u16_t max_rec_count, total_recs = 0U, current_recs = 0U, res;
+ u8_t cont_state_size, cont_state = 0U, idx = 0U, count = 0U;
bool pkt_full = false;
res = find_services(buf, matching_recs);
@@ -595,7 +595,7 @@
cont_state_size = net_buf_pull_u8(buf);
/* Zero out the matching services beyond max_rec_count */
- for (idx = 0; idx < num_services; idx++) {
+ for (idx = 0U; idx < num_services; idx++) {
if (count == max_rec_count) {
matching_recs[idx] = NULL;
continue;
@@ -811,7 +811,7 @@
u32_t attr_size, seq_size;
u8_t idx_filter;
- for (idx_filter = 0; idx_filter < sad->num_filters; idx_filter++) {
+ for (idx_filter = 0U; idx_filter < sad->num_filters; idx_filter++) {
att_id_lower = (sad->filter[idx_filter] >> 16);
att_id_upper = (sad->filter[idx_filter]);
@@ -867,7 +867,7 @@
sad->seq = net_buf_add(sad->rsp_buf,
sizeof(*sad->seq));
sad->seq->type = BT_SDP_SEQ16;
- sad->seq->size = 0;
+ sad->seq->size = 0U;
}
/* Add attribute ID */
@@ -951,7 +951,7 @@
sad.seq = NULL;
sad.filter = filter;
sad.state = state;
- sad.att_list_len = 0;
+ sad.att_list_len = 0U;
sad.new_service = true;
idx_att = bt_sdp_foreach_attr(sad.rec, next_att, select_attrs, &sad);
@@ -984,7 +984,7 @@
u16_t res;
u32_t size;
- *num_filters = 0;
+ *num_filters = 0U;
res = parse_data_elem(buf, &data_elem);
if (res) {
return res;
@@ -1071,7 +1071,7 @@
struct net_buf *rsp_buf;
u32_t svc_rec_hdl;
u16_t max_att_len, res, att_list_len;
- u8_t num_filters, cont_state_size, next_att = 0;
+ u8_t num_filters, cont_state_size, next_att = 0U;
if (buf->len < 6) {
BT_WARN("Malformed packet");
@@ -1141,7 +1141,7 @@
/* For empty responses, add an empty data element sequence */
net_buf_add_u8(rsp_buf, BT_SDP_SEQ8);
net_buf_add_u8(rsp_buf, 0);
- att_list_len = 2;
+ att_list_len = 2U;
}
/* Add continuation state */
@@ -1186,8 +1186,8 @@
struct bt_sdp_record *record;
struct bt_sdp_att_rsp *rsp;
struct bt_sdp_data_elem_seq *seq = NULL;
- u16_t max_att_len, res, att_list_len = 0;
- u8_t num_filters, cont_state_size, next_svc = 0, next_att = 0;
+ u16_t max_att_len, res, att_list_len = 0U;
+ u8_t num_filters, cont_state_size, next_svc = 0U, next_att = 0U;
bool dry_run = false;
res = find_services(buf, matching_recs);
@@ -1248,10 +1248,10 @@
if (!cont_state_size) {
seq = net_buf_add(rsp_buf, sizeof(*seq));
seq->type = BT_SDP_SEQ16;
- seq->size = 0;
+ seq->size = 0U;
/* 3 bytes for Outer Data Element Sequence declaration */
- att_list_len = 3;
+ att_list_len = 3U;
}
rsp_buf_cpy = rsp_buf;
@@ -1289,7 +1289,7 @@
rsp_buf_cpy = NULL;
}
- next_att = 0;
+ next_att = 0U;
}
if (!dry_run) {
@@ -1297,7 +1297,7 @@
/* For empty responses, add an empty data elem seq */
net_buf_add_u8(rsp_buf, BT_SDP_SEQ8);
net_buf_add_u8(rsp_buf, 0);
- att_list_len = 2;
+ att_list_len = 2U;
}
/* Search exhausted */
net_buf_add_u8(rsp_buf, 0);
@@ -1607,7 +1607,7 @@
*/
if (session->cstate.length == 0) {
seq = net_buf_pull_u8(buf);
- pulled = 1;
+ pulled = 1U;
switch (seq) {
case BT_SDP_SEQ8:
*total = net_buf_pull_u8(buf);
@@ -1619,14 +1619,14 @@
break;
default:
BT_WARN("Sequence type 0x%02x not handled", seq);
- *total = 0;
+ *total = 0U;
break;
}
BT_DBG("Total %u octets of all attributes", *total);
} else {
- pulled = 0;
- *total = 0;
+ pulled = 0U;
+ *total = 0U;
}
return pulled;
@@ -1648,7 +1648,7 @@
break;
default:
BT_WARN("Sequence type 0x%02x not handled", seq);
- len = 0;
+ len = 0U;
break;
}
diff --git a/subsys/bluetooth/host/settings.c b/subsys/bluetooth/host/settings.c
index 7671c8f..043dc02 100644
--- a/subsys/bluetooth/host/settings.c
+++ b/subsys/bluetooth/host/settings.c
@@ -121,7 +121,7 @@
BT_ERR("Invalid length ID address in storage");
(void)memset(bt_dev.id_addr, 0,
sizeof(bt_dev.id_addr));
- bt_dev.id_count = 0;
+ bt_dev.id_count = 0U;
} else {
int i;
diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c
index a1e0932..e4da3ee 100644
--- a/subsys/bluetooth/host/smp.c
+++ b/subsys/bluetooth/host/smp.c
@@ -959,7 +959,7 @@
if (atomic_test_bit(smp->flags, SMP_FLAG_BOND)) {
bt_keys_add_type(keys, BT_KEYS_LOCAL_CSRK);
memcpy(keys->local_csrk.val, info->csrk, 16);
- keys->local_csrk.cnt = 0;
+ keys->local_csrk.cnt = 0U;
}
smp_br_send(smp, buf, sign_info_sent);
@@ -1671,7 +1671,7 @@
switch (smp->method) {
case PASSKEY_CONFIRM:
case JUST_WORKS:
- r = 0;
+ r = 0U;
break;
case PASSKEY_DISPLAY:
case PASSKEY_INPUT:
@@ -1843,7 +1843,7 @@
if (atomic_test_bit(smp->flags, SMP_FLAG_BOND)) {
bt_keys_add_type(keys, BT_KEYS_LOCAL_CSRK);
memcpy(keys->local_csrk.val, info->csrk, 16);
- keys->local_csrk.cnt = 0;
+ keys->local_csrk.cnt = 0U;
}
smp_send(smp, buf, sign_info_sent);
@@ -2878,7 +2878,7 @@
switch (smp->method) {
case PASSKEY_CONFIRM:
case JUST_WORKS:
- r = 0;
+ r = 0U;
break;
case PASSKEY_DISPLAY:
case PASSKEY_INPUT:
@@ -3299,7 +3299,7 @@
smp->passkey %= 1000000;
}
- smp->passkey_round = 0;
+ smp->passkey_round = 0U;
if (bt_auth && bt_auth->passkey_display) {
atomic_set_bit(smp->flags, SMP_FLAG_DISPLAY);
diff --git a/subsys/bluetooth/shell/bredr.c b/subsys/bluetooth/shell/bredr.c
index 6576024..49c7952 100644
--- a/subsys/bluetooth/shell/bredr.c
+++ b/subsys/bluetooth/shell/bredr.c
@@ -49,7 +49,7 @@
size_t argc, char *argv[])
{
struct bt_conn *conn;
- u8_t max = 16;
+ u8_t max = 16U;
if (default_conn) {
conn = default_conn;
diff --git a/subsys/bluetooth/shell/gatt.c b/subsys/bluetooth/shell/gatt.c
index 1d1f114..358316c 100644
--- a/subsys/bluetooth/shell/gatt.c
+++ b/subsys/bluetooth/shell/gatt.c
@@ -354,7 +354,7 @@
sign = !strcmp(argv[0], "signed-write");
handle = strtoul(argv[1], NULL, 16);
gatt_write_buf[0] = strtoul(argv[2], NULL, 16);
- len = 1;
+ len = 1U;
if (argc > 3) {
int i;
@@ -366,14 +366,14 @@
}
}
- repeat = 0;
+ repeat = 0U;
if (argc > 4) {
repeat = strtoul(argv[4], NULL, 16);
}
if (!repeat) {
- repeat = 1;
+ repeat = 1U;
}
while (repeat--) {
@@ -691,9 +691,9 @@
* reset the metrics.
*/
if (delta > 1000000000) {
- write_count = 0;
- write_len = 0;
- write_rate = 0;
+ write_count = 0U;
+ write_len = 0U;
+ write_rate = 0U;
cycle_stamp = k_cycle_get_32();
} else {
write_count++;
diff --git a/subsys/bluetooth/shell/l2cap.c b/subsys/bluetooth/shell/l2cap.c
index 16b70a8..a6223e2 100644
--- a/subsys/bluetooth/shell/l2cap.c
+++ b/subsys/bluetooth/shell/l2cap.c
@@ -68,8 +68,8 @@
* reset the metrics.
*/
if (delta > 1000000000) {
- len = 0;
- l2cap_rate = 0;
+ len = 0U;
+ l2cap_rate = 0U;
cycle_stamp = k_cycle_get_32();
} else {
len += buf->len;
diff --git a/subsys/bluetooth/shell/ll.c b/subsys/bluetooth/shell/ll.c
index ee73b25..e168c59 100644
--- a/subsys/bluetooth/shell/ll.c
+++ b/subsys/bluetooth/shell/ll.c
@@ -36,9 +36,9 @@
str_type = argv[1];
if (!strcmp(str_type, "random")) {
- addr_type = 1;
+ addr_type = 1U;
} else if (!strcmp(str_type, "public")) {
- addr_type = 0;
+ addr_type = 0U;
} else {
return -EINVAL;
}
@@ -149,10 +149,10 @@
if (argc > 1) {
if (!strcmp(argv[1], "on")) {
- evt_prop = 0;
- enable = 1;
+ evt_prop = 0U;
+ enable = 1U;
} else if (!strcmp(argv[1], "off")) {
- enable = 0;
+ enable = 0U;
goto disable;
} else {
return -EINVAL;
@@ -216,7 +216,7 @@
int cmd_scanx(const struct shell *shell, size_t argc, char *argv[])
{
- u8_t type = 0;
+ u8_t type = 0U;
u8_t enable;
s32_t err;
@@ -226,13 +226,13 @@
if (argc > 1) {
if (!strcmp(argv[1], "on")) {
- enable = 1;
- type = 1;
+ enable = 1U;
+ type = 1U;
} else if (!strcmp(argv[1], "passive")) {
- enable = 1;
- type = 0;
+ enable = 1U;
+ type = 0U;
} else if (!strcmp(argv[1], "off")) {
- enable = 0;
+ enable = 0U;
goto disable;
} else {
return -EINVAL;
diff --git a/subsys/bluetooth/shell/ticker.c b/subsys/bluetooth/shell/ticker.c
index 55bb988..3178b34 100644
--- a/subsys/bluetooth/shell/ticker.c
+++ b/subsys/bluetooth/shell/ticker.c
@@ -51,10 +51,10 @@
u8_t i;
ticker_id = TICKER_NULL;
- ticks_to_expire = 0;
- ticks_current = 0;
- tickers_count = 0;
- retry = 4;
+ ticks_to_expire = 0U;
+ ticks_current = 0U;
+ tickers_count = 0U;
+ retry = 4U;
do {
u32_t volatile err_cb = TICKER_STATUS_BUSY;
u32_t ticks_previous;
@@ -90,7 +90,7 @@
}
if (tickers_count) {
- tickers_count = 0;
+ tickers_count = 0U;
shell_print(shell, "Query reset, %u retries "
"remaining.", retry);
@@ -115,7 +115,7 @@
shell_print(shell, " id offset offset");
shell_print(shell, " (tick) (us)");
shell_print(shell, "---------------------");
- for (i = 0; i < tickers_count; i++) {
+ for (i = 0U; i < tickers_count; i++) {
shell_print(shell, "%03u %08u %08u", tickers[i].id,
tickers[i].ticks_to_expire,
HAL_TICKER_TICKS_TO_US(tickers[i].ticks_to_expire));
diff --git a/subsys/disk/disk_access_flash.c b/subsys/disk/disk_access_flash.c
index a9bfa24..451eb8c 100644
--- a/subsys/disk/disk_access_flash.c
+++ b/subsys/disk/disk_access_flash.c
@@ -102,7 +102,7 @@
{
off_t fl_addr;
u32_t num_read;
- u32_t offset = 0;
+ u32_t offset = 0U;
/* adjust offset if starting address is not erase-aligned address */
if (start_addr & (CONFIG_DISK_FLASH_ERASE_ALIGNMENT - 1)) {
diff --git a/subsys/disk/disk_access_ram.c b/subsys/disk/disk_access_ram.c
index 9ba4518..2641148 100644
--- a/subsys/disk/disk_access_ram.c
+++ b/subsys/disk/disk_access_ram.c
@@ -73,7 +73,7 @@
*(u32_t *)buff = RAMDISK_SECTOR_SIZE;
break;
case DISK_IOCTL_GET_ERASE_BLOCK_SZ:
- *(u32_t *)buff = 1;
+ *(u32_t *)buff = 1U;
break;
default:
return -EINVAL;
diff --git a/subsys/fb/cfb.c b/subsys/fb/cfb.c
index dc2bc14..d0ef674 100644
--- a/subsys/fb/cfb.c
+++ b/subsys/fb/cfb.c
@@ -120,7 +120,7 @@
if ((fb->screen_info & SCREEN_INFO_MONO_VTILED) && !(y % 8)) {
for (size_t i = 0; i < strlen(str); i++) {
if (x + fptr->width > fb->x_res) {
- x = 0;
+ x = 0U;
y += fptr->height;
}
x += fb->kerning + draw_char_vtmono(fb, str[i], x, y);
@@ -285,16 +285,16 @@
fb->x_res = cfg.x_resolution;
fb->y_res = cfg.y_resolution;
- fb->ppt = 8;
+ fb->ppt = 8U;
fb->pixel_format = cfg.current_pixel_format;
fb->screen_info = cfg.screen_info;
fb->buf = NULL;
- fb->font_idx = 0;
+ fb->font_idx = 0U;
fb->kerning = 0;
fb->inverted = false;
fb->fonts = __font_entry_start;
- fb->font_idx = 0;
+ fb->font_idx = 0U;
fb->size = fb->x_res * fb->y_res / fb->ppt;
fb->buf = k_malloc(fb->size);
diff --git a/subsys/fs/fat_fs.c b/subsys/fs/fat_fs.c
index c60884d..1c53030 100644
--- a/subsys/fs/fat_fs.c
+++ b/subsys/fs/fat_fs.c
@@ -214,7 +214,7 @@
* optimization.
*/
unsigned int bw;
- u8_t c = 0;
+ u8_t c = 0U;
for (int i = cur_length; i < length; i++) {
res = f_write(zfp->filep, &c, 1, &bw);
diff --git a/subsys/fs/fcb/fcb.c b/subsys/fs/fcb/fcb.c
index 2135769..25c76b9 100644
--- a/subsys/fs/fcb/fcb.c
+++ b/subsys/fs/fcb/fcb.c
@@ -292,7 +292,7 @@
/* assure a minimum amount of entries */
if (!entries) {
- entries = 1;
+ entries = 1U;
}
i = 0;
diff --git a/subsys/fs/nvs/nvs.c b/subsys/fs/nvs/nvs.c
index 06a4491..0189190 100644
--- a/subsys/fs/nvs/nvs.c
+++ b/subsys/fs/nvs/nvs.c
@@ -709,7 +709,7 @@
/* find latest entry with same id */
wlk_addr = fs->ate_wra;
rd_addr = wlk_addr;
- freed_space = 0;
+ freed_space = 0U;
while (1) {
rd_addr = wlk_addr;
@@ -811,7 +811,7 @@
return -EINVAL;
}
- cnt_his = 0;
+ cnt_his = 0U;
wlk_addr = fs->ate_wra;
rd_addr = wlk_addr;
diff --git a/subsys/fs/shell.c b/subsys/fs/shell.c
index da8d6bc..13da8c6 100644
--- a/subsys/fs/shell.c
+++ b/subsys/fs/shell.c
@@ -396,7 +396,7 @@
return -ENOEXEC;
}
- buf_len = 0;
+ buf_len = 0U;
while (arg_offset < argc) {
buf[buf_len++] = strtol(argv[arg_offset++], NULL, 16);
@@ -410,7 +410,7 @@
return -ENOEXEC;
}
- buf_len = 0;
+ buf_len = 0U;
}
}
diff --git a/subsys/logging/log_cmds.c b/subsys/logging/log_cmds.c
index 793ecde..fb8c2ad 100644
--- a/subsys/logging/log_cmds.c
+++ b/subsys/logging/log_cmds.c
@@ -109,7 +109,7 @@
shell_fprintf(shell, SHELL_NORMAL,
"----------------------------------------------------------\r\n");
- for (i = 0; i < modules_cnt; i++) {
+ for (i = 0U; i < modules_cnt; i++) {
dynamic_lvl = log_filter_get(backend, CONFIG_LOG_DOMAIN_ID,
i, true);
compiled_lvl = log_filter_get(backend, CONFIG_LOG_DOMAIN_ID,
@@ -148,7 +148,7 @@
const char *tmp_name;
u32_t i;
- for (i = 0; i < modules_cnt; i++) {
+ for (i = 0U; i < modules_cnt; i++) {
tmp_name = log_source_name_get(CONFIG_LOG_DOMAIN_ID, i);
if (strncmp(tmp_name, name, 64) == 0) {
diff --git a/subsys/logging/log_core.c b/subsys/logging/log_core.c
index d039e9d..00d319b 100644
--- a/subsys/logging/log_core.c
+++ b/subsys/logging/log_core.c
@@ -187,7 +187,7 @@
*/
static u32_t count_args(const char *fmt)
{
- u32_t args = 0;
+ u32_t args = 0U;
bool prev = false; /* if previous char was a modificator. */
while (*fmt != '\0') {
@@ -480,7 +480,7 @@
if (backend == NULL) {
struct log_backend const *backend;
- u32_t max = 0;
+ u32_t max = 0U;
u32_t current;
for (int i = 0; i < log_backend_count_get(); i++) {
diff --git a/subsys/logging/log_msg.c b/subsys/logging/log_msg.c
index 3c9ce38..249ebe8 100644
--- a/subsys/logging/log_msg.c
+++ b/subsys/logging/log_msg.c
@@ -190,7 +190,7 @@
args += LOG_MSG_NARGS_HEAD_CHUNK;
} else {
memcpy(msg->payload.single.args, args, nargs * sizeof(u32_t));
- nargs = 0;
+ nargs = 0U;
}
while (nargs) {
@@ -258,7 +258,7 @@
} else {
memcpy(msg->payload.single.bytes, data, length);
msg->hdr.params.generic.ext = 0;
- length = 0;
+ length = 0U;
}
prev_cont = &msg->payload.ext.next;
diff --git a/subsys/logging/log_output.c b/subsys/logging/log_output.c
index bc23933..f72c1e7 100644
--- a/subsys/logging/log_output.c
+++ b/subsys/logging/log_output.c
@@ -398,7 +398,7 @@
const struct log_output *log_output,
int prefix_offset, u32_t flags)
{
- u32_t offset = 0;
+ u32_t offset = 0U;
u32_t length;
print_formatted(log_output, "%s", log_msg_str_get(msg));
@@ -524,7 +524,7 @@
void log_output_timestamp_freq_set(u32_t frequency)
{
- timestamp_div = 1;
+ timestamp_div = 1U;
/* There is no point to have frequency higher than 1MHz (ns are not
* printed) and too high frequency leads to overflows in calculations.
*/
diff --git a/subsys/net/buf.c b/subsys/net/buf.c
index 280d1a6..4081984 100644
--- a/subsys/net/buf.c
+++ b/subsys/net/buf.c
@@ -113,7 +113,7 @@
memcpy(block.data, &block.id, sizeof(block.id));
ref_count = (u8_t *)block.data + sizeof(block.id);
- *ref_count = 1;
+ *ref_count = 1U;
/* Return pointer to the byte following the ref count */
return ref_count + 1;
@@ -171,7 +171,7 @@
return NULL;
}
- *ref_count = 1;
+ *ref_count = 1U;
return ref_count + 1;
}
diff --git a/subsys/net/ip/6lo.c b/subsys/net/ip/6lo.c
index 41f4aa5..9673d2e 100644
--- a/subsys/net/ip/6lo.c
+++ b/subsys/net/ip/6lo.c
@@ -110,7 +110,7 @@
/* If the context information already exists, update or remove
* as per data.
*/
- for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
+ for (i = 0U; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
if (!ctx_6co[i].is_used) {
unused = i;
continue;
@@ -145,7 +145,7 @@
{
u8_t i;
- for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
+ for (i = 0U; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
if (!ctx_6co[i].is_used) {
continue;
}
@@ -164,7 +164,7 @@
{
u8_t i;
- for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
+ for (i = 0U; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
if (!ctx_6co[i].is_used) {
continue;
}
@@ -682,7 +682,7 @@
struct net_6lo_context *dst = NULL;
#endif
struct net_ipv6_hdr *ipv6 = NET_IPV6_HDR(pkt);
- u8_t offset = 0;
+ u8_t offset = 0U;
struct net_buf *frag;
u8_t compressed;
@@ -1217,8 +1217,8 @@
static inline bool uncompress_IPHC_header(struct net_pkt *pkt)
{
struct net_udp_hdr *udp = NULL;
- u8_t offset = 2;
- u8_t chksum = 0;
+ u8_t offset = 2U;
+ u8_t chksum = 0U;
struct net_ipv6_hdr *ipv6;
struct net_buf *frag;
u16_t len;
diff --git a/subsys/net/ip/connection.c b/subsys/net/ip/connection.c
index 1e3b0c0..76f167b 100644
--- a/subsys/net/ip/connection.c
+++ b/subsys/net/ip/connection.c
@@ -152,7 +152,7 @@
u32_t *cache_value)
{
int i, free_pos = -1;
- u32_t value = 0;
+ u32_t value = 0U;
value = ports_to_hash(remote_port, local_port);
@@ -278,7 +278,7 @@
for (i = 0; i < CONFIG_NET_MAX_CONN; i++) {
conn_cache[i].idx = -1;
- conn_cache_neg[i].value = 0;
+ conn_cache_neg[i].value = 0U;
}
}
@@ -559,7 +559,7 @@
struct net_conn_handle **handle)
{
int i;
- u8_t rank = 0;
+ u8_t rank = 0U;
i = find_conn_handler(proto, remote_addr, local_addr, remote_port,
local_port);
@@ -808,7 +808,7 @@
#if defined(CONFIG_NET_CONN_CACHE)
enum net_verdict verdict;
- u32_t cache_value = 0;
+ u32_t cache_value = 0U;
s32_t pos;
verdict = cache_check(proto, pkt, &cache_value, &pos);
diff --git a/subsys/net/ip/icmpv4.c b/subsys/net/ip/icmpv4.c
index 10f564b..94d0382 100644
--- a/subsys/net/ip/icmpv4.c
+++ b/subsys/net/ip/icmpv4.c
@@ -57,7 +57,7 @@
int net_icmpv4_set_chksum(struct net_pkt *pkt)
{
- u16_t chksum = 0;
+ u16_t chksum = 0U;
struct net_buf *frag;
struct net_buf *temp_frag;
u16_t temp_pos;
diff --git a/subsys/net/ip/icmpv6.c b/subsys/net/ip/icmpv6.c
index 0c15bcc..21a756b 100644
--- a/subsys/net/ip/icmpv6.c
+++ b/subsys/net/ip/icmpv6.c
@@ -77,7 +77,7 @@
u8_t icmp_code)
{
struct net_buf *frag = pkt->frags;
- const u32_t unused = 0;
+ const u32_t unused = 0U;
u16_t pos;
NET_IPV6_HDR(pkt)->vtc = 0x60;
@@ -104,7 +104,7 @@
int net_icmpv6_set_chksum(struct net_pkt *pkt)
{
- u16_t chksum = 0;
+ u16_t chksum = 0U;
struct net_buf *frag;
struct net_buf *temp_frag;
u16_t temp_pos;
@@ -200,7 +200,7 @@
struct net_buf *frag;
u16_t pos;
- hdr->reserved = 0;
+ hdr->reserved = 0U;
frag = net_pkt_write(pkt, pkt->frags, net_pkt_ip_hdr_len(pkt) +
net_pkt_ipv6_ext_len(pkt) +
diff --git a/subsys/net/ip/ipv6.c b/subsys/net/ip/ipv6.c
index 936cd0c..f6aea28 100644
--- a/subsys/net/ip/ipv6.c
+++ b/subsys/net/ip/ipv6.c
@@ -226,7 +226,7 @@
enum net_verdict *verdict)
{
u8_t opt_type, opt_len;
- u16_t length = 0, loc;
+ u16_t length = 0U, loc;
#if defined(CONFIG_NET_RPL)
bool result;
#endif
@@ -443,7 +443,7 @@
u8_t first_option;
u16_t offset;
u16_t length;
- u16_t total_len = 0;
+ u16_t total_len = 0U;
u8_t ext_bitmap;
if (real_len < pkt_len) {
@@ -539,9 +539,9 @@
frag = pkt->frags;
next = hdr->nexthdr;
first_option = next;
- length = 0;
- ext_bitmap = 0;
- start_of_ext = 0;
+ length = 0U;
+ ext_bitmap = 0U;
+ start_of_ext = 0U;
offset = sizeof(struct net_ipv6_hdr);
prev_hdr = &NET_IPV6_HDR(pkt)->nexthdr - &NET_IPV6_HDR(pkt)->vtc;
diff --git a/subsys/net/ip/ipv6_fragment.c b/subsys/net/ip/ipv6_fragment.c
index 49cb4f7..08ad7d2 100644
--- a/subsys/net/ip/ipv6_fragment.c
+++ b/subsys/net/ip/ipv6_fragment.c
@@ -66,7 +66,7 @@
next = NET_IPV6_HDR(pkt)->nexthdr;
/* Initial value if no extension fragments are found */
- *next_hdr_idx = 6;
+ *next_hdr_idx = 6U;
*last_hdr_idx = sizeof(struct net_ipv6_hdr);
/* First check the simplest case where there is no extension headers
@@ -100,7 +100,7 @@
case NET_IPV6_NEXTHDR_HBHO:
case NET_IPV6_NEXTHDR_DESTO:
- length = 0;
+ length = 0U;
frag = net_frag_read_u8(frag, offset, &offset,
(u8_t *)&length);
if (!frag) {
@@ -143,7 +143,7 @@
/* Current next_hdr_idx offset is based on respective fragment, but we
* need to calculate next_hdr_idx offset based on whole packet.
*/
- pkt_offset = 0;
+ pkt_offset = 0U;
frag = pkt->frags;
while (frag) {
if (next_hdr_frag == frag) {
@@ -158,7 +158,7 @@
/* Current last_hdr_idx offset is based on respective fragment, but we
* need to calculate last_hdr_idx offset based on whole packet.
*/
- pkt_offset = 0;
+ pkt_offset = 0U;
frag = pkt->frags;
while (frag) {
if (last_hdr_frag == frag) {
@@ -238,7 +238,7 @@
NET_DBG("IPv6 reassembly id 0x%x remaining %d ms",
reassembly[i].id, remaining);
- reassembly[i].id = 0;
+ reassembly[i].id = 0U;
for (j = 0; j < NET_IPV6_FRAGMENTS_MAX_PKT; j++) {
if (!reassembly[i].pkt[j]) {
@@ -808,8 +808,8 @@
goto fail;
}
- frag_count = 0;
- frag_offset = 0;
+ frag_count = 0U;
+ frag_offset = 0U;
/* The Maximum payload can fit into each packet after IPv6 header,
* Extenstion headers and Fragmentation header.
diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c
index 0d4cb7e..bb5f5dd 100644
--- a/subsys/net/ip/ipv6_nbr.c
+++ b/subsys/net/ip/ipv6_nbr.c
@@ -695,10 +695,10 @@
orig_frag = pkt->frags;
copy_len = orig_frag->len;
- pos = 0;
+ pos = 0U;
pkt->frags = NULL;
- room_len = 0;
+ room_len = 0U;
frag = NULL;
while (orig_frag) {
@@ -720,14 +720,14 @@
orig_frag->data + pos, copy_len);
room_len -= copy_len;
- copy_len = 0;
+ copy_len = 0U;
} else {
memcpy(net_buf_add(frag, room_len),
orig_frag->data + pos, room_len);
copy_len -= room_len;
pos += room_len;
- room_len = 0;
+ room_len = 0U;
}
if (!copy_len) {
@@ -743,7 +743,7 @@
}
copy_len = orig_frag->len;
- pos = 0;
+ pos = 0U;
}
}
@@ -1226,8 +1226,8 @@
static enum net_verdict handle_ns_input(struct net_pkt *pkt)
{
u16_t total_len = net_pkt_get_len(pkt);
- u8_t prev_opt_len = 0;
- u8_t flags = 0;
+ u8_t prev_opt_len = 0U;
+ u8_t flags = 0U;
bool routing = false;
struct net_icmpv6_nd_opt_hdr nd_opt_hdr;
struct net_icmpv6_ns_hdr ns_hdr;
@@ -1578,7 +1578,7 @@
case NET_IPV6_NBR_STATE_DELAY:
data->state = NET_IPV6_NBR_STATE_PROBE;
- data->ns_count = 0;
+ data->ns_count = 0U;
NET_DBG("nbr %p moving %s state to PROBE (%d)",
nbr,
@@ -1744,7 +1744,7 @@
if (net_is_solicited(pkt)) {
ipv6_nbr_set_state(nbr, NET_IPV6_NBR_STATE_REACHABLE);
- net_ipv6_nbr_data(nbr)->ns_count = 0;
+ net_ipv6_nbr_data(nbr)->ns_count = 0U;
/* We might have active timer from PROBE */
net_ipv6_nbr_data(nbr)->reachable = 0;
@@ -1836,8 +1836,8 @@
static enum net_verdict handle_na_input(struct net_pkt *pkt)
{
u16_t total_len = net_pkt_get_len(pkt);
- u16_t tllao_offset = 0;
- u8_t prev_opt_len = 0;
+ u16_t tllao_offset = 0U;
+ u8_t prev_opt_len = 0U;
struct net_icmpv6_nd_opt_hdr nd_opt_hdr;
struct net_icmpv6_na_hdr na_hdr;
struct net_if_addr *ifaddr;
@@ -2112,7 +2112,7 @@
struct net_pkt *pkt;
struct net_buf *frag;
bool unspec_src;
- u8_t llao_len = 0;
+ u8_t llao_len = 0U;
int ret;
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, NULL),
diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c
index 41ea17b..0b3cbc7 100644
--- a/subsys/net/ip/net_context.c
+++ b/subsys/net/ip/net_context.c
@@ -1180,7 +1180,7 @@
.sa_family = net_context_get_family(context),
};
struct sockaddr *laddr = NULL;
- u16_t lport = 0;
+ u16_t lport = 0U;
int ret;
ARG_UNUSED(timeout);
diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c
index 5573be9..fe01c57 100644
--- a/subsys/net/ip/net_if.c
+++ b/subsys/net/ip/net_if.c
@@ -400,14 +400,14 @@
static u8_t get_ipaddr_diff(const u8_t *src, const u8_t *dst, int addr_len)
{
u8_t j, k, xor;
- u8_t len = 0;
+ u8_t len = 0U;
- for (j = 0; j < addr_len; j++) {
+ for (j = 0U; j < addr_len; j++) {
if (src[j] == dst[j]) {
len += 8;
} else {
xor = src[j] ^ dst[j];
- for (k = 0; k < 8; k++) {
+ for (k = 0U; k < 8; k++) {
if (!(xor & 0x80)) {
len++;
xor <<= 1;
@@ -1996,7 +1996,7 @@
{
#if defined(CONFIG_NET_IPV6)
struct in6_addr *src = NULL;
- u8_t best_match = 0;
+ u8_t best_match = 0U;
struct net_if *iface;
if (!net_ipv6_is_ll_addr(dst) && !net_ipv6_is_addr_mcast(dst)) {
@@ -2383,7 +2383,7 @@
{
#if defined(CONFIG_NET_IPV4)
struct in_addr *src = NULL;
- u8_t best_match = 0;
+ u8_t best_match = 0U;
struct net_if *iface;
if (!net_ipv4_is_ll_addr(dst) && !net_ipv4_is_addr_mcast(dst)) {
diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c
index 012c8ee..b3a17b5 100644
--- a/subsys/net/ip/net_mgmt.c
+++ b/subsys/net/ip/net_mgmt.c
@@ -85,7 +85,7 @@
u16_t o_idx = out_event + 1;
if (o_idx == CONFIG_NET_MGMT_EVENT_QUEUE_SIZE) {
- o_idx = 0;
+ o_idx = 0U;
}
if (events[o_idx].event) {
@@ -123,7 +123,7 @@
static inline void mgmt_clean_event(struct mgmt_event_entry *mgmt_event)
{
- mgmt_event->event = 0;
+ mgmt_event->event = 0U;
mgmt_event->iface = NULL;
}
@@ -136,7 +136,7 @@
{
struct net_mgmt_event_callback *cb, *tmp;
- global_event_mask = 0;
+ global_event_mask = 0U;
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&event_callbacks, cb, tmp, node) {
mgmt_add_event_mask(cb->event_mask);
@@ -369,7 +369,7 @@
void net_mgmt_event_init(void)
{
sys_slist_init(&event_callbacks);
- global_event_mask = 0;
+ global_event_mask = 0U;
in_event = -1;
out_event = -1;
diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c
index 302f3ca..95ee17b 100644
--- a/subsys/net/ip/net_pkt.c
+++ b/subsys/net/ip/net_pkt.c
@@ -566,7 +566,7 @@
#endif /* CONFIG_NET_CONTEXT_PRIORITY */
if (slab != &rx_pkts) {
- uint16_t iface_len, data_len = 0;
+ uint16_t iface_len, data_len = 0U;
enum net_ip_protocol proto;
iface_len = net_if_get_mtu(iface);
@@ -1087,7 +1087,7 @@
}
/* traverse the fragment chain until len bytes are copied */
- copied = 0;
+ copied = 0U;
while (src && len > 0) {
to_copy = min(len, src->len - offset);
memcpy(dst->data + copied, src->data + offset, to_copy);
@@ -1097,7 +1097,7 @@
len -= to_copy;
src = src->frags;
/* after the first iteration, this value will be 0 */
- offset = 0;
+ offset = 0U;
}
if (len > 0) {
@@ -1239,7 +1239,7 @@
{
struct net_buf *frag;
struct net_context *ctx = NULL;
- u16_t max_len, appended = 0;
+ u16_t max_len, appended = 0U;
if (!pkt || !len) {
return 0;
@@ -1321,7 +1321,7 @@
*pos = offset + 1;
if (*pos >= frag->len) {
- *pos = 0;
+ *pos = 0U;
return frag->frags;
}
@@ -1356,7 +1356,7 @@
struct net_buf *net_frag_read(struct net_buf *frag, u16_t offset,
u16_t *pos, u16_t len, u8_t *data)
{
- u16_t copy = 0;
+ u16_t copy = 0U;
frag = adjust_offset(frag, offset, pos);
if (!frag) {
@@ -1466,7 +1466,7 @@
return frag;
}
- *pos = 0;
+ *pos = 0U;
return check_and_create_data(pkt, frag->frags,
timeout);
@@ -1495,7 +1495,7 @@
/* Create empty space */
net_buf_add(frag, tailroom);
- *pos = 0;
+ *pos = 0U;
return check_and_create_data(pkt,
frag->frags,
@@ -1557,7 +1557,7 @@
}
data += count;
- offset = 0;
+ offset = 0U;
frag = frag->frags;
if (!frag) {
@@ -1618,7 +1618,7 @@
data += count;
}
- offset = 0;
+ offset = 0U;
insert = net_pkt_get_frag(pkt, timeout);
if (!insert) {
@@ -1644,7 +1644,7 @@
while (frag) {
if (offset == frag->len) {
- *pos = 0;
+ *pos = 0U;
return frag->frags;
}
@@ -1903,7 +1903,7 @@
temp = frag;
frag = frag->frags;
temp->frags = NULL;
- offset = 0;
+ offset = 0U;
net_buf_unref(temp);
@@ -1916,7 +1916,7 @@
memmove(frag->data, frag->data + len,
frag->len - len);
frag->len -= len;
- len = 0;
+ len = 0U;
if (!frag->len) {
temp = frag;
@@ -1941,13 +1941,13 @@
len -= avail;
prev = frag;
frag = frag->frags;
- offset = 0;
+ offset = 0U;
} else {
memmove(frag->data + offset,
frag->data + offset + len,
avail - len);
frag->len -= len;
- len = 0;
+ len = 0U;
}
}
}
@@ -2096,7 +2096,7 @@
enum net_ip_protocol proto)
{
size_t total_len = net_pkt_get_len(pkt);
- u16_t proto_len = 0;
+ u16_t proto_len = 0U;
struct net_buf *frag;
u16_t offset;
diff --git a/subsys/net/ip/net_shell.c b/subsys/net/ip/net_shell.c
index 6ef9b1a..d0c51c1 100644
--- a/subsys/net/ip/net_shell.c
+++ b/subsys/net/ip/net_shell.c
@@ -2694,7 +2694,7 @@
if (prefix) {
prefix_len = prefix->len;
} else {
- prefix_len = 128;
+ prefix_len = 128U;
}
if (ipv6->unicast[i].is_infinite) {
diff --git a/subsys/net/ip/route.c b/subsys/net/ip/route.c
index c6b05c1..bb41598 100644
--- a/subsys/net/ip/route.c
+++ b/subsys/net/ip/route.c
@@ -256,7 +256,7 @@
struct in6_addr *dst)
{
struct net_route_entry *route, *found = NULL;
- u8_t longest_match = 0;
+ u8_t longest_match = 0U;
int i;
for (i = 0; i < CONFIG_NET_MAX_ROUTES && longest_match < 128; i++) {
diff --git a/subsys/net/ip/rpl-mrhof.c b/subsys/net/ip/rpl-mrhof.c
index df4e1d2..33eb52c 100644
--- a/subsys/net/ip/rpl-mrhof.c
+++ b/subsys/net/ip/rpl-mrhof.c
@@ -100,7 +100,7 @@
int status, int numtx)
{
u16_t packet_etx = numtx * NET_RPL_MC_ETX_DIVISOR;
- u16_t recorded_etx = 0;
+ u16_t recorded_etx = 0U;
struct net_ipv6_nbr_data *data;
u16_t new_etx;
@@ -261,7 +261,7 @@
u16_t base_rank)
{
u16_t new_rank;
- u16_t rank_increase = 0;
+ u16_t rank_increase = 0U;
struct net_ipv6_nbr_data *data;
if (!parent) {
@@ -320,7 +320,7 @@
instance->mc.flags = NET_RPL_MC_FLAG_P;
instance->mc.aggregated = NET_RPL_MC_A_ADDITIVE;
- instance->mc.precedence = 0;
+ instance->mc.precedence = 0U;
dag = instance->current_dag;
@@ -330,7 +330,7 @@
}
if (dag->rank == NET_RPL_ROOT_RANK(instance)) {
- path_metric = 0;
+ path_metric = 0U;
} else {
path_metric = calculate_path_metric(dag->preferred_parent);
}
diff --git a/subsys/net/ip/rpl.c b/subsys/net/ip/rpl.c
index c79fe7c..db33496 100644
--- a/subsys/net/ip/rpl.c
+++ b/subsys/net/ip/rpl.c
@@ -717,7 +717,7 @@
"ROOT" : "");
#endif /* CONFIG_NET_STATISTICS_RPL */
- instance->dio_counter = 0;
+ instance->dio_counter = 0U;
instance->dio_send = true;
k_delayed_work_submit(&instance->dio_timer, time);
@@ -727,7 +727,7 @@
{
if (instance->dio_interval_current > instance->dio_interval_min) {
instance->dio_interval_current = instance->dio_interval_min;
- instance->dio_counter = 0;
+ instance->dio_counter = 0U;
new_dio_interval(instance);
}
@@ -1022,7 +1022,7 @@
#endif
#if defined(CONFIG_NET_RPL_DAO_ACK)
- instance->dao_transmissions = 1;
+ instance->dao_transmissions = 1U;
k_delayed_work_submit(&instance->dao_retransmit_timer,
NET_RPL_DAO_RETRANSMIT_TIMEOUT);
#endif
@@ -1317,7 +1317,7 @@
* unless forced to do so.
*/
if (instance->dio_interval_current > instance->dio_interval_min) {
- instance->dio_counter = 0;
+ instance->dio_counter = 0U;
instance->dio_interval_current = instance->dio_interval_min;
new_dio_interval(instance);
}
@@ -2210,7 +2210,7 @@
u8_t i;
/* Send a DAO for own multicast addresses */
- for (i = 0; i < NET_IF_MAX_IPV6_MADDR; i++) {
+ for (i = 0U; i < NET_IF_MAX_IPV6_MADDR; i++) {
addr =
&instance->iface->config.ip.ipv6->mcast[i].address.in6_addr;
@@ -2875,7 +2875,7 @@
/* Handle any DIO suboptions */
while (frag) {
- len = 0;
+ len = 0U;
frag = net_frag_read_u8(frag, pos, &pos, &subopt_type);
if (!frag && pos == 0) {
/* We are at the end of the message */
@@ -3050,7 +3050,7 @@
struct in6_addr *prefix,
u8_t lifetime)
{
- u16_t value = 0;
+ u16_t value = 0U;
struct net_rpl_instance *instance;
const struct in6_addr *src;
struct net_rpl_dag *dag;
@@ -3437,11 +3437,11 @@
}
}
- target_len = 0;
+ target_len = 0U;
/* Handle any DAO suboptions */
while (frag) {
- len = 0;
+ len = 0U;
frag = net_frag_read_u8(frag, pos, &pos, &subopt_type);
if (!frag && pos == 0) {
/* We are at the end of the message */
@@ -3771,7 +3771,7 @@
int net_rpl_update_header(struct net_pkt *pkt, struct in6_addr *addr)
{
- u16_t pos = 0;
+ u16_t pos = 0U;
struct net_rpl_parent *parent;
struct net_buf *frag;
u16_t sender_rank;
@@ -4032,7 +4032,7 @@
struct net_rpl_parent *parent;
struct net_route_entry *route;
u8_t next_hdr, len, length;
- u8_t opt_type = 0, opt_len;
+ u8_t opt_type = 0U, opt_len;
u8_t instance_id, flags;
u16_t pos;
int ret;
@@ -4058,7 +4058,7 @@
return 0;
}
- length = 0;
+ length = 0U;
if (len != NET_RPL_HOP_BY_HOP_LEN - 8) {
NET_DBG("Hop-by-hop ext header is wrong size "
diff --git a/subsys/net/ip/rpl.h b/subsys/net/ip/rpl.h
index f8a2566..e085145 100644
--- a/subsys/net/ip/rpl.h
+++ b/subsys/net/ip/rpl.h
@@ -711,7 +711,7 @@
{
NET_ASSERT(dag);
- dag->is_used = 0;
+ dag->is_used = 0U;
}
/**
@@ -723,7 +723,7 @@
{
NET_ASSERT(dag);
- dag->is_used = 1;
+ dag->is_used = 1U;
}
/**
@@ -777,7 +777,7 @@
{
NET_ASSERT(dag);
- dag->is_joined = 1;
+ dag->is_joined = 1U;
}
/**
@@ -789,7 +789,7 @@
{
NET_ASSERT(dag);
- dag->is_joined = 0;
+ dag->is_joined = 0U;
}
/**
diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c
index f1d5ea1..3d3ece0 100644
--- a/subsys/net/ip/tcp.c
+++ b/subsys/net/ip/tcp.c
@@ -128,7 +128,7 @@
ack = sys_get_be32(tcp_hdr->ack);
if (!tcp->sent_ack) {
- rel_ack = 0;
+ rel_ack = 0U;
} else {
rel_ack = ack ? ack - tcp->sent_ack : 0;
}
@@ -392,7 +392,7 @@
struct net_pkt *alloc_pkt;
u16_t dst_port, src_port;
bool pkt_allocated;
- u8_t optlen = 0;
+ u8_t optlen = 0U;
int status;
NET_ASSERT(context);
@@ -668,13 +668,13 @@
{
u32_t recv_mss;
- *optionlen = 0;
+ *optionlen = 0U;
if (!(tcp->flags & NET_TCP_RECV_MSS_SET)) {
recv_mss = net_tcp_get_recv_mss(tcp);
tcp->flags |= NET_TCP_RECV_MSS_SET;
} else {
- recv_mss = 0;
+ recv_mss = 0U;
}
recv_mss |= (NET_TCP_MSS_OPT << 24) | (NET_TCP_MSS_SIZE << 16);
@@ -764,9 +764,9 @@
}
segment.dst_addr = remote;
- segment.wnd = 0;
+ segment.wnd = 0U;
segment.options = NULL;
- segment.optlen = 0;
+ segment.optlen = 0U;
status = prepare_segment(tcp, &segment, NULL, pkt);
}
@@ -960,7 +960,7 @@
{
if (!sys_slist_is_empty(&tcp->sent_list)) {
tcp->flags |= NET_TCP_RETRYING;
- tcp->retry_timeout_shift = 0;
+ tcp->retry_timeout_shift = 0U;
k_delayed_work_submit(&tcp->retry_timer, retry_timeout(tcp));
} else if (CONFIG_NET_TCP_TIME_WAIT_DELAY != 0 &&
(tcp->fin_sent && tcp->fin_rcvd)) {
@@ -1354,7 +1354,7 @@
struct net_buf *net_tcp_set_chksum(struct net_pkt *pkt, struct net_buf *frag)
{
struct net_tcp_hdr *hdr;
- u16_t chksum = 0;
+ u16_t chksum = 0U;
u16_t pos;
hdr = net_pkt_tcp_data(pkt);
@@ -1417,7 +1417,7 @@
}
if (!opt_totlen) {
- optlen = 0;
+ optlen = 0U;
goto error;
}
@@ -1877,7 +1877,7 @@
struct net_pkt *pkt = NULL;
int ret;
u8_t options[NET_TCP_MAX_OPT_SIZE];
- u8_t optionlen = 0;
+ u8_t optionlen = 0U;
if (flags == NET_TCP_SYN) {
net_tcp_set_syn_opt(context->tcp, options, &optionlen);
@@ -2541,7 +2541,7 @@
{
struct sockaddr local_addr;
struct sockaddr *laddr = NULL;
- u16_t lport = 0;
+ u16_t lport = 0U;
int ret;
NET_ASSERT(context->tcp);
diff --git a/subsys/net/ip/trickle.c b/subsys/net/ip/trickle.c
index f217306..2a27408 100644
--- a/subsys/net/ip/trickle.c
+++ b/subsys/net/ip/trickle.c
@@ -93,7 +93,7 @@
/* Did the clock wrap */
if ((s32_t)diff < 0) {
- diff = 0;
+ diff = 0U;
NET_DBG("Clock wrap");
}
diff --git a/subsys/net/ip/udp.c b/subsys/net/ip/udp.c
index 1eae112..e813936 100644
--- a/subsys/net/ip/udp.c
+++ b/subsys/net/ip/udp.c
@@ -96,7 +96,7 @@
struct net_buf *net_udp_set_chksum(struct net_pkt *pkt, struct net_buf *frag)
{
struct net_udp_hdr *hdr;
- u16_t chksum = 0;
+ u16_t chksum = 0U;
u16_t pos;
hdr = net_pkt_udp_data(pkt);
diff --git a/subsys/net/ip/utils.c b/subsys/net/ip/utils.c
index 524ec2c..6c0bd3f 100644
--- a/subsys/net/ip/utils.c
+++ b/subsys/net/ip/utils.c
@@ -78,17 +78,17 @@
switch (ll_len) {
case 8:
- len = 8;
+ len = 8U;
break;
case 6:
- len = 6;
+ len = 6U;
break;
default:
- len = 6;
+ len = 6U;
break;
}
- for (i = 0, blen = buflen; i < len && blen > 0; i++) {
+ for (i = 0U, blen = buflen; i < len && blen > 0; i++) {
ptr = net_byte_to_hex(ptr, (char)ll[i], 'A', true);
*ptr++ = ':';
blen -= 3;
@@ -109,7 +109,7 @@
int temp;
char *start = buf;
- divisor = 1000000000;
+ divisor = 1000000000U;
if (precision < 0)
precision = 1;
for (i = 9; i >= 0; i--, divisor /= 10) {
@@ -131,7 +131,7 @@
struct in_addr *addr;
struct in6_addr *addr6;
u16_t *w;
- u8_t i, bl, bh, longest = 1;
+ u8_t i, bl, bh, longest = 1U;
s8_t pos = -1;
char delim = ':';
unsigned char zeros[8] = { 0 };
@@ -145,7 +145,7 @@
w = (u16_t *)addr6->s6_addr16;
len = 8;
- for (i = 0; i < 8; i++) {
+ for (i = 0U; i < 8; i++) {
u8_t j;
for (j = i; j < 8; j++) {
@@ -157,7 +157,7 @@
}
}
- for (i = 0; i < 8; i++) {
+ for (i = 0U; i < 8; i++) {
if (zeros[i] > longest) {
longest = zeros[i];
pos = i;
@@ -176,7 +176,7 @@
return NULL;
}
- for (i = 0; i < len; i++) {
+ for (i = 0U; i < len; i++) {
/* IPv4 address a.b.c.d */
if (len == 4) {
u8_t l;
@@ -470,7 +470,7 @@
u16_t net_calc_chksum(struct net_pkt *pkt, u8_t proto)
{
u16_t upper_layer_len;
- u16_t sum = 0;
+ u16_t sum = 0U;
switch (net_pkt_family(pkt)) {
#if defined(CONFIG_NET_IPV4)
@@ -752,7 +752,7 @@
unsigned int i;
char *endptr;
- for (i = 0; i < strlen(src); i++) {
+ for (i = 0U; i < strlen(src); i++) {
if (!(src[i] >= '0' && src[i] <= '9') &&
!(src[i] >= 'A' && src[i] <= 'F') &&
!(src[i] >= 'a' && src[i] <= 'f') &&
@@ -763,7 +763,7 @@
(void)memset(buf, 0, buf_len);
- for (i = 0; i < buf_len; i++) {
+ for (i = 0U; i < buf_len; i++) {
buf[i] = strtol(src, &endptr, 16);
src = ++endptr;
}
diff --git a/subsys/net/l2/ethernet/ethernet.c b/subsys/net/l2/ethernet/ethernet.c
index 873b209..f2f5fcf 100644
--- a/subsys/net/l2/ethernet/ethernet.c
+++ b/subsys/net/l2/ethernet/ethernet.c
@@ -109,7 +109,7 @@
len -= frag->len;
} else {
frag->len = len;
- len = 0;
+ len = 0U;
}
}
}
diff --git a/subsys/net/l2/ethernet/gptp/gptp.c b/subsys/net/l2/ethernet/gptp/gptp.c
index 65fde06..e457b07 100644
--- a/subsys/net/l2/ethernet/gptp/gptp.c
+++ b/subsys/net/l2/ethernet/gptp/gptp.c
@@ -387,7 +387,7 @@
default_ds->priority2 = GPTP_PRIORITY2_DEFAULT;
- default_ds->cur_utc_offset = 37; /* Current leap seconds TAI - UTC */
+ default_ds->cur_utc_offset = 37U; /* Current leap seconds TAI - UTC */
default_ds->flags.all = 0;
default_ds->flags.octets[1] = GPTP_FLAG_TIME_TRACEABLE;
default_ds->time_source = GPTP_TS_INTERNAL_OSCILLATOR;
@@ -418,7 +418,7 @@
/* Initialize properties data set. */
/* TODO: Get accurate values for below. From the GM. */
- prop_ds->cur_utc_offset = 37; /* Current leap seconds TAI - UTC */
+ prop_ds->cur_utc_offset = 37U; /* Current leap seconds TAI - UTC */
prop_ds->cur_utc_offset_valid = false;
prop_ds->leap59 = false;
prop_ds->leap61 = false;
@@ -468,7 +468,7 @@
port_ds->ini_log_half_sync_itv = CONFIG_NET_GPTP_INIT_LOG_SYNC_ITV - 1;
port_ds->cur_log_half_sync_itv = port_ds->ini_log_half_sync_itv;
port_ds->sync_receipt_timeout = CONFIG_NET_GPTP_SYNC_RECEIPT_TIMEOUT;
- port_ds->sync_receipt_timeout_time_itv = 10000000; /* 10ms */
+ port_ds->sync_receipt_timeout_time_itv = 10000000U; /* 10ms */
port_ds->ini_log_pdelay_req_itv =
CONFIG_NET_GPTP_INIT_LOG_PDELAY_REQ_ITV;
@@ -1009,7 +1009,7 @@
void net_gptp_init(void)
{
- gptp_domain.default_ds.nb_ports = 0;
+ gptp_domain.default_ds.nb_ports = 0U;
#if defined(CONFIG_NET_GPTP_VLAN)
/* If user has enabled gPTP over VLAN support, then we start gPTP
diff --git a/subsys/net/l2/ethernet/gptp/gptp_md.c b/subsys/net/l2/ethernet/gptp/gptp_md.c
index ca9d930..b9b7adb 100644
--- a/subsys/net/l2/ethernet/gptp/gptp_md.c
+++ b/subsys/net/l2/ethernet/gptp/gptp_md.c
@@ -72,8 +72,8 @@
fup->tlv.org_id[0] = GPTP_FUP_TLV_ORG_ID_BYTE_0;
fup->tlv.org_id[1] = GPTP_FUP_TLV_ORG_ID_BYTE_1;
fup->tlv.org_id[2] = GPTP_FUP_TLV_ORG_ID_BYTE_2;
- fup->tlv.org_sub_type[0] = 0;
- fup->tlv.org_sub_type[1] = 0;
+ fup->tlv.org_sub_type[0] = 0U;
+ fup->tlv.org_sub_type[1] = 0U;
fup->tlv.org_sub_type[2] = GPTP_FUP_TLV_ORG_SUB_TYPE;
fup->tlv.cumulative_scaled_rate_offset =
@@ -211,8 +211,8 @@
static void gptp_md_compute_pdelay_rate_ratio(int port)
{
- u64_t ingress_tstamp = 0;
- u64_t resp_evt_tstamp = 0;
+ u64_t ingress_tstamp = 0U;
+ u64_t resp_evt_tstamp = 0U;
struct gptp_pdelay_resp_follow_up *fup;
struct gptp_pdelay_req_state *state;
struct gptp_port_ds *port_ds;
@@ -271,7 +271,7 @@
static void gptp_md_compute_prop_time(int port)
{
- u64_t t1_ns = 0, t2_ns = 0, t3_ns = 0, t4_ns = 0;
+ u64_t t1_ns = 0U, t2_ns = 0U, t3_ns = 0U, t4_ns = 0U;
struct gptp_pdelay_resp_follow_up *fup;
struct gptp_pdelay_req_state *state;
struct gptp_pdelay_resp *resp;
diff --git a/subsys/net/l2/ethernet/gptp/gptp_messages.c b/subsys/net/l2/ethernet/gptp/gptp_messages.c
index 1ca31ca..8fad1b6 100644
--- a/subsys/net/l2/ethernet/gptp/gptp_messages.c
+++ b/subsys/net/l2/ethernet/gptp/gptp_messages.c
@@ -369,9 +369,9 @@
GPTP_CLOCK_ID_LEN);
/* PTP configuration. */
- pdelay_resp->req_receipt_ts_secs_high = 0;
- pdelay_resp->req_receipt_ts_secs_low = 0;
- pdelay_resp->req_receipt_ts_nsecs = 0;
+ pdelay_resp->req_receipt_ts_secs_high = 0U;
+ pdelay_resp->req_receipt_ts_secs_low = 0U;
+ pdelay_resp->req_receipt_ts_nsecs = 0U;
memcpy(&pdelay_resp->requesting_port_id,
&query->port_id, sizeof(struct gptp_port_identity));
@@ -432,9 +432,9 @@
GPTP_CLOCK_ID_LEN);
/* PTP configuration. */
- follow_up->resp_orig_ts_secs_high = 0;
- follow_up->resp_orig_ts_secs_low = 0;
- follow_up->resp_orig_ts_nsecs = 0;
+ follow_up->resp_orig_ts_secs_high = 0U;
+ follow_up->resp_orig_ts_secs_low = 0U;
+ follow_up->resp_orig_ts_nsecs = 0U;
memcpy(&follow_up->requesting_port_id,
&pdelay_resp->requesting_port_id,
@@ -533,7 +533,7 @@
/* Clear reserved fields. */
(void)memset(ann->reserved1, 0, sizeof(ann->reserved1));
- ann->reserved2 = 0;
+ ann->reserved2 = 0U;
hdr->message_length = htons(sizeof(struct gptp_hdr) +
sizeof(struct gptp_announce) - 8 +
diff --git a/subsys/net/l2/ethernet/gptp/gptp_mi.c b/subsys/net/l2/ethernet/gptp/gptp_mi.c
index c3bcb13..f56135e 100644
--- a/subsys/net/l2/ethernet/gptp/gptp_mi.c
+++ b/subsys/net/l2/ethernet/gptp/gptp_mi.c
@@ -1738,7 +1738,7 @@
global_ds->current_utc_offset =
global_ds->sys_current_utc_offset;
global_ds->time_source = global_ds->sys_time_source;
- global_ds->master_steps_removed = 0;
+ global_ds->master_steps_removed = 0U;
} else {
bmca_data = GPTP_PORT_BMCA_DATA(best_port);
diff --git a/subsys/net/l2/ieee802154/ieee802154_fragment.c b/subsys/net/l2/ieee802154/ieee802154_fragment.c
index 87b9d63..344a345 100644
--- a/subsys/net/l2/ieee802154/ieee802154_fragment.c
+++ b/subsys/net/l2/ieee802154/ieee802154_fragment.c
@@ -116,7 +116,7 @@
static inline void set_up_frag_hdr(struct net_buf *frag, u16_t size,
u8_t offset)
{
- u8_t pos = 0;
+ u8_t pos = 0U;
if (offset) {
frag->data[pos] = NET_6LO_DISPATCH_FRAGN;
@@ -246,9 +246,9 @@
/* Datagram_size: total length before compression */
size = net_pkt_get_len(pkt) + hdr_diff;
- room = 0;
- offset = 0;
- processed = 0;
+ room = 0U;
+ offset = 0U;
+ processed = 0U;
first = true;
datagram_tag++;
@@ -337,7 +337,7 @@
{
u8_t i;
- for (i = 0; i < REASS_CACHE_SIZE; i++) {
+ for (i = 0U; i < REASS_CACHE_SIZE; i++) {
if (!(cache[i].size == size && cache[i].tag == tag)) {
continue;
}
@@ -347,8 +347,8 @@
}
cache[i].pkt = NULL;
- cache[i].size = 0;
- cache[i].tag = 0;
+ cache[i].size = 0U;
+ cache[i].tag = 0U;
cache[i].used = false;
k_delayed_work_cancel(&cache[i].timer);
}
@@ -367,8 +367,8 @@
}
cache->pkt = NULL;
- cache->size = 0;
- cache->tag = 0;
+ cache->size = 0U;
+ cache->tag = 0U;
cache->used = false;
}
@@ -408,7 +408,7 @@
{
u8_t i;
- for (i = 0; i < REASS_CACHE_SIZE; i++) {
+ for (i = 0U; i < REASS_CACHE_SIZE; i++) {
if (cache[i].used) {
if (cache[i].size == size &&
cache[i].tag == tag) {
@@ -467,8 +467,8 @@
struct net_buf *frag;
u16_t size;
u16_t tag;
- u16_t offset = 0;
- u8_t pos = 0;
+ u16_t offset = 0U;
+ u8_t pos = 0U;
/* Parse total size of packet */
size = get_datagram_size(pkt->frags->data);
diff --git a/subsys/net/l2/ieee802154/ieee802154_frame.c b/subsys/net/l2/ieee802154/ieee802154_frame.c
index e4575f5..8972101 100644
--- a/subsys/net/l2/ieee802154/ieee802154_frame.c
+++ b/subsys/net/l2/ieee802154/ieee802154_frame.c
@@ -246,8 +246,8 @@
struct ieee802154_command *c = (struct ieee802154_command *)buf;
bool src_pan_brdcst_chk = false;
bool dst_brdcst_chk = false;
- u8_t comp = 0;
- u8_t ar = 0;
+ u8_t comp = 0U;
+ u8_t ar = 0U;
u8_t src, dst;
switch (c->cfi) {
@@ -262,14 +262,14 @@
case IEEE802154_CFI_ASSOCIATION_RESPONSE:
case IEEE802154_CFI_DISASSOCIATION_NOTIFICATION:
case IEEE802154_CFI_PAN_ID_CONLICT_NOTIFICATION:
- ar = 1;
- comp = 1;
+ ar = 1U;
+ comp = 1U;
src = IEEE802154_EXT_ADDR_LENGTH;
dst = IEEE802154_EXT_ADDR_LENGTH;
break;
case IEEE802154_CFI_DATA_REQUEST:
- ar = 1;
+ ar = 1U;
src = IEEE802154_ADDR_MODE_SHORT |
IEEE802154_ADDR_MODE_EXTENDED;
@@ -277,14 +277,14 @@
IEEE802154_ADDR_MODE_NONE) {
dst = IEEE802154_ADDR_MODE_NONE;
} else {
- comp = 1;
+ comp = 1U;
dst = IEEE802154_ADDR_MODE_SHORT |
IEEE802154_ADDR_MODE_EXTENDED;
}
break;
case IEEE802154_CFI_ORPHAN_NOTIFICATION:
- comp = 1;
+ comp = 1U;
src = IEEE802154_EXT_ADDR_LENGTH;
dst = IEEE802154_ADDR_MODE_SHORT;
@@ -308,7 +308,7 @@
break;
case IEEE802154_CFI_GTS_REQUEST:
- ar = 1;
+ ar = 1U;
src = IEEE802154_ADDR_MODE_SHORT;
dst = IEEE802154_ADDR_MODE_NONE;
@@ -502,14 +502,14 @@
fs = (struct ieee802154_fcf_seq *) *p_buf;
- fs->fc.security_enabled = 0;
- fs->fc.frame_pending = 0;
+ fs->fc.security_enabled = 0U;
+ fs->fc.frame_pending = 0U;
fs->fc.ar = ack;
- fs->fc.pan_id_comp = 0;
- fs->fc.reserved = 0;
+ fs->fc.pan_id_comp = 0U;
+ fs->fc.reserved = 0U;
/** We support version 2006 only for now */
- fs->fc.seq_num_suppr = 0;
- fs->fc.ie_list = 0;
+ fs->fc.seq_num_suppr = 0U;
+ fs->fc.ie_list = 0U;
fs->fc.frame_version = IEEE802154_VERSION_802154_2006;
*p_buf += sizeof(struct ieee802154_fcf_seq);
@@ -550,12 +550,12 @@
fs->fc.dst_addr_mode = get_dst_addr_mode(dst, &broadcast);
if (fs->fc.dst_addr_mode != IEEE802154_ADDR_MODE_NONE) {
- fs->fc.pan_id_comp = 1;
+ fs->fc.pan_id_comp = 1U;
if (broadcast) {
params->dst.short_addr = IEEE802154_BROADCAST_ADDRESS;
params->dst.len = IEEE802154_SHORT_ADDR_LENGTH;
- fs->fc.ar = 0;
+ fs->fc.ar = 0U;
} else {
params->dst.ext_addr = dst->addr;
params->dst.len = dst->len;
@@ -644,7 +644,7 @@
aux_sec->control.security_level = sec_ctx->level;
aux_sec->control.key_id_mode = sec_ctx->key_mode;
- aux_sec->control.reserved = 0;
+ aux_sec->control.reserved = 0U;
aux_sec->frame_counter = sys_cpu_to_le32(sec_ctx->frame_counter);
@@ -683,7 +683,7 @@
goto no_security_hdr;
}
- fs->fc.security_enabled = 1;
+ fs->fc.security_enabled = 1U;
p_buf = generate_aux_security_hdr(&ctx->sec_ctx, p_buf);
@@ -732,8 +732,8 @@
{
switch (cfi) {
case IEEE802154_CFI_DISASSOCIATION_NOTIFICATION:
- fs->fc.ar = 1;
- fs->fc.pan_id_comp = 1;
+ fs->fc.ar = 1U;
+ fs->fc.pan_id_comp = 1U;
/* Fall through for common src/dst addr mode handling */
case IEEE802154_CFI_ASSOCIATION_REQUEST:
@@ -748,19 +748,19 @@
break;
case IEEE802154_CFI_ASSOCIATION_RESPONSE:
case IEEE802154_CFI_PAN_ID_CONLICT_NOTIFICATION:
- fs->fc.ar = 1;
- fs->fc.pan_id_comp = 1;
+ fs->fc.ar = 1U;
+ fs->fc.pan_id_comp = 1U;
fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED;
fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_EXTENDED;
break;
case IEEE802154_CFI_DATA_REQUEST:
- fs->fc.ar = 1;
+ fs->fc.ar = 1U;
/* ToDo: src/dst addr mode: see 5.3.4 */
break;
case IEEE802154_CFI_ORPHAN_NOTIFICATION:
- fs->fc.pan_id_comp = 1;
+ fs->fc.pan_id_comp = 1U;
fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_EXTENDED;
fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_SHORT;
@@ -775,7 +775,7 @@
break;
case IEEE802154_CFI_GTS_REQUEST:
- fs->fc.ar = 1;
+ fs->fc.ar = 1U;
fs->fc.src_addr_mode = IEEE802154_ADDR_MODE_SHORT;
fs->fc.dst_addr_mode = IEEE802154_ADDR_MODE_NONE;
@@ -789,7 +789,7 @@
static inline u8_t mac_command_length(enum ieee802154_cfi cfi)
{
- u8_t reserve = 1; /* cfi is at least present */
+ u8_t reserve = 1U; /* cfi is at least present */
switch (cfi) {
case IEEE802154_CFI_ASSOCIATION_REQUEST:
@@ -886,8 +886,8 @@
fs = generate_fcf_grounds(&p_buf, false);
- fs->fc.dst_addr_mode = 0;
- fs->fc.src_addr_mode = 0;
+ fs->fc.dst_addr_mode = 0U;
+ fs->fc.src_addr_mode = 0U;
fs->fc.frame_type = IEEE802154_FRAME_TYPE_ACK;
fs->sequence = seq;
diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c
index c116d5f..5bda96e 100644
--- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c
+++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c
@@ -125,7 +125,7 @@
/* ToDo: For now, we assume we are on 2.4Ghz
* (device will have to export capabilities) */
- for (channel = 11; channel <= 26; channel++) {
+ for (channel = 11U; channel <= 26; channel++) {
if (IEEE802154_IS_CHAN_UNSCANNED(scan->channel_set, channel)) {
continue;
}
@@ -254,11 +254,11 @@
}
cmd = ieee802154_get_mac_command(pkt);
- cmd->assoc_req.ci.dev_type = 0; /* RFD */
- cmd->assoc_req.ci.power_src = 0; /* ToDo: set right power source */
- cmd->assoc_req.ci.rx_on = 1; /* ToDo: that will depends on PM */
- cmd->assoc_req.ci.sec_capability = 0; /* ToDo: security support */
- cmd->assoc_req.ci.alloc_addr = 0; /* ToDo: handle short addr */
+ cmd->assoc_req.ci.dev_type = 0U; /* RFD */
+ cmd->assoc_req.ci.power_src = 0U; /* ToDo: set right power source */
+ cmd->assoc_req.ci.rx_on = 1U; /* ToDo: that will depends on PM */
+ cmd->assoc_req.ci.sec_capability = 0U; /* ToDo: security support */
+ cmd->assoc_req.ci.alloc_addr = 0U; /* ToDo: handle short addr */
ctx->associated = false;
diff --git a/subsys/net/l2/ieee802154/ieee802154_radio_csma_ca.c b/subsys/net/l2/ieee802154/ieee802154_radio_csma_ca.c
index 27eda12..0d03bc0 100644
--- a/subsys/net/l2/ieee802154/ieee802154_radio_csma_ca.c
+++ b/subsys/net/l2/ieee802154/ieee802154_radio_csma_ca.c
@@ -29,7 +29,7 @@
struct ieee802154_context *ctx = net_if_l2_data(iface);
bool ack_required = prepare_for_ack(ctx, pkt, frag);
u8_t be = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MIN_BE;
- u8_t nb = 0;
+ u8_t nb = 0U;
int ret = -EIO;
NET_DBG("frag %p", frag);
diff --git a/subsys/net/l2/ieee802154/ieee802154_shell.c b/subsys/net/l2/ieee802154/ieee802154_shell.c
index 9b4f44d..542a13c 100644
--- a/subsys/net/l2/ieee802154/ieee802154_shell.c
+++ b/subsys/net/l2/ieee802154/ieee802154_shell.c
@@ -155,7 +155,7 @@
static inline u32_t parse_channel_set(char *str_set)
{
- u32_t channel_set = 0;
+ u32_t channel_set = 0U;
char *p, *n;
p = str_set;
diff --git a/subsys/net/l2/openthread/openthread.c b/subsys/net/l2/openthread/openthread.c
index e5fa528..3ee722d 100644
--- a/subsys/net/l2/openthread/openthread.c
+++ b/subsys/net/l2/openthread/openthread.c
@@ -99,7 +99,7 @@
{
struct openthread_context *ot_context = context;
- u16_t offset = 0;
+ u16_t offset = 0U;
u16_t read_len;
struct net_pkt *pkt;
struct net_buf *prev_buf = NULL;
diff --git a/subsys/net/l2/openthread/openthread_utils.c b/subsys/net/l2/openthread/openthread_utils.c
index a84897e..9de137c 100644
--- a/subsys/net/l2/openthread/openthread_utils.c
+++ b/subsys/net/l2/openthread/openthread_utils.c
@@ -25,7 +25,7 @@
i_idx++;
if (i_idx == CONFIG_OPENTHREAD_PKT_LIST_SIZE) {
- i_idx = 0;
+ i_idx = 0U;
}
if (i_idx == context->pkt_list_out_idx) {
diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c
index 4e5ebbc..22c2562 100644
--- a/subsys/net/l2/wifi/wifi_shell.c
+++ b/subsys/net/l2/wifi/wifi_shell.c
@@ -87,7 +87,7 @@
print(context.shell, SHELL_NORMAL, "Scan request done\n");
}
- scan_result = 0;
+ scan_result = 0U;
}
static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb)
@@ -281,8 +281,8 @@
ARG_UNUSED(unused);
context.shell = NULL;
- context.all = 0;
- scan_result = 0;
+ context.all = 0U;
+ scan_result = 0U;
net_mgmt_init_event_callback(&wifi_shell_mgmt_cb,
wifi_mgmt_event_handler,
diff --git a/subsys/net/lib/app/client.c b/subsys/net/lib/app/client.c
index dcc11a9..d0dea31 100644
--- a/subsys/net/lib/app/client.c
+++ b/subsys/net/lib/app/client.c
@@ -196,7 +196,7 @@
char *buf,
size_t buf_len)
{
- u16_t port = 0;
+ u16_t port = 0U;
char *ptr;
int count, i;
@@ -378,7 +378,7 @@
}
if (client_addr) {
- u16_t local_port = 0;
+ u16_t local_port = 0U;
bool empty_addr = false;
addr.sa_family = remote_addr.sa_family;
diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c
index bf70dab..c2f398d 100644
--- a/subsys/net/lib/coap/coap.c
+++ b/subsys/net/lib/coap/coap.c
@@ -104,7 +104,7 @@
if (opt == COAP_OPTION_EXT_13) {
u8_t val;
- *hdr_len = 1;
+ *hdr_len = 1U;
context->frag = net_frag_read_u8(context->frag,
context->offset,
&context->offset,
@@ -119,7 +119,7 @@
} else if (opt == COAP_OPTION_EXT_14) {
u16_t val;
- *hdr_len = 2;
+ *hdr_len = 2U;
context->frag = net_frag_read_be16(context->frag,
context->offset,
&context->offset,
@@ -268,8 +268,8 @@
return r;
}
- num = 0;
- opt_len = 0;
+ num = 0U;
+ opt_len = 0U;
while (true) {
struct coap_option *option;
@@ -603,9 +603,9 @@
u8_t opt_num)
{
u8_t i;
- u8_t j = 0;
+ u8_t j = 0U;
- for (i = 0; i < opt_num && path[j]; i++) {
+ for (i = 0U; i < opt_num && path[j]; i++) {
if (options[i].delta != COAP_OPTION_URI_PATH) {
continue;
}
@@ -715,7 +715,7 @@
static int get_observe_option(const struct coap_packet *cpkt)
{
struct coap_option option = {};
- u16_t count = 1;
+ u16_t count = 1U;
int r;
r = coap_find_options(cpkt, COAP_OPTION_OBSERVE, &option, count);
@@ -939,7 +939,7 @@
{
if (num < COAP_OPTION_EXT_13) {
*opt = num;
- *ext = 0;
+ *ext = 0U;
return 0;
} else if (num < COAP_OPTION_EXT_269) {
@@ -1049,21 +1049,21 @@
u8_t data[4], len;
if (val == 0) {
- data[0] = 0;
- len = 0;
+ data[0] = 0U;
+ len = 0U;
} else if (val < 0xFF) {
data[0] = (u8_t) val;
- len = 1;
+ len = 1U;
} else if (val < 0xFFFF) {
sys_put_be16(val, data);
- len = 2;
+ len = 2U;
} else if (val < 0xFFFFFF) {
sys_put_be16(val, &data[1]);
data[0] = val >> 16;
- len = 3;
+ len = 3U;
} else {
sys_put_be32(val, data);
- len = 4;
+ len = 4U;
}
return coap_packet_append_option(cpkt, code, data, len);
@@ -1093,7 +1093,7 @@
return r;
}
- opt_len = 0;
+ opt_len = 0U;
count = 0;
while (context.delta <= code && count < veclen) {
@@ -1251,7 +1251,7 @@
}
*offset = 0xffff;
- *len = 0;
+ *len = 0U;
coap_pkt_len = get_coap_packet_len(cpkt->pkt);
@@ -1286,7 +1286,7 @@
struct coap_block_context *ctx)
{
u16_t bytes = coap_block_size_to_bytes(ctx->block_size);
- unsigned int val = 0;
+ unsigned int val = 0U;
int r;
if (is_request(cpkt)) {
diff --git a/subsys/net/lib/coap/coap_link_format.c b/subsys/net/lib/coap/coap_link_format.c
index 014f9c8..3b81581 100644
--- a/subsys/net/lib/coap/coap_link_format.c
+++ b/subsys/net/lib/coap/coap_link_format.c
@@ -174,7 +174,7 @@
static bool append_to_net_pkt(struct net_pkt *pkt, const char *str, u16_t len,
u16_t *remaining, size_t *offset, size_t current)
{
- u16_t pos = 0;
+ u16_t pos = 0U;
bool res;
if (!*remaining) {
@@ -374,7 +374,7 @@
return -EINVAL;
}
- delta = 0;
+ delta = 0U;
/* Note: coap_well_known_core_get() added Option (delta and len) witho
* out any extended options so parsing will not consider at the moment.
*/
@@ -463,7 +463,7 @@
goto end;
}
- format = 40; /* application/link-format */
+ format = 40U; /* application/link-format */
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
&format, sizeof(format));
@@ -652,7 +652,7 @@
return r;
}
- format = 40; /* application/link-format */
+ format = 40U; /* application/link-format */
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
&format, sizeof(format));
if (r < 0) {
diff --git a/subsys/net/lib/coap/coap_link_format_sock.c b/subsys/net/lib/coap/coap_link_format_sock.c
index 738d726..67dfd55 100644
--- a/subsys/net/lib/coap/coap_link_format_sock.c
+++ b/subsys/net/lib/coap/coap_link_format_sock.c
@@ -221,7 +221,7 @@
u16_t *remaining, size_t *offset,
size_t current)
{
- u16_t pos = 0;
+ u16_t pos = 0U;
bool res;
if (!*remaining) {
@@ -422,7 +422,7 @@
u8_t len;
offset = cpkt->hdr_len;
- delta = 0;
+ delta = 0U;
while (1) {
opt = cpkt->data[offset++];
@@ -504,7 +504,7 @@
goto end;
}
- format = 40; /* application/link-format */
+ format = 40U; /* application/link-format */
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
&format, sizeof(format));
@@ -688,7 +688,7 @@
return r;
}
- format = 40; /* application/link-format */
+ format = 40U; /* application/link-format */
r = coap_packet_append_option(response, COAP_OPTION_CONTENT_FORMAT,
&format, sizeof(format));
if (r < 0) {
diff --git a/subsys/net/lib/coap/coap_sock.c b/subsys/net/lib/coap/coap_sock.c
index 4bbd4a5..59b464d 100644
--- a/subsys/net/lib/coap/coap_sock.c
+++ b/subsys/net/lib/coap/coap_sock.c
@@ -161,7 +161,7 @@
{
if (num < COAP_OPTION_EXT_13) {
*opt = num;
- *ext = 0;
+ *ext = 0U;
return 0;
} else if (num < COAP_OPTION_EXT_269) {
@@ -277,21 +277,21 @@
u8_t data[4], len;
if (val == 0) {
- data[0] = 0;
- len = 0;
+ data[0] = 0U;
+ len = 0U;
} else if (val < 0xFF) {
data[0] = (u8_t) val;
- len = 1;
+ len = 1U;
} else if (val < 0xFFFF) {
sys_put_be16(val, data);
- len = 2;
+ len = 2U;
} else if (val < 0xFFFFFF) {
sys_put_be16(val, &data[1]);
data[0] = val >> 16;
- len = 3;
+ len = 3U;
} else {
sys_put_be32(val, data);
- len = 4;
+ len = 4U;
}
return coap_packet_append_option(cpkt, code, data, len);
@@ -399,7 +399,7 @@
if (opt == COAP_OPTION_EXT_13) {
u8_t val;
- *hdr_len = 1;
+ *hdr_len = 1U;
ret = read_u8(data, offset, pos, max_len, &val);
if (ret < 0) {
@@ -410,7 +410,7 @@
} else if (opt == COAP_OPTION_EXT_14) {
u16_t val;
- *hdr_len = 2;
+ *hdr_len = 2U;
ret = read_be16(data, offset, pos, max_len, &val);
if (ret < 0) {
@@ -572,9 +572,9 @@
}
offset = cpkt->offset;
- opt_len = 0;
- delta = 0;
- num = 0;
+ opt_len = 0U;
+ delta = 0U;
+ num = 0U;
while (1) {
struct coap_option *option;
@@ -606,9 +606,9 @@
int r;
offset = cpkt->hdr_len;
- opt_len = 0;
- delta = 0;
- num = 0;
+ opt_len = 0U;
+ delta = 0U;
+ num = 0U;
while (delta <= code && num < veclen) {
r = parse_option(cpkt->data, offset, &offset,
@@ -737,7 +737,7 @@
if (payload_len > 0) {
*len = payload_len;
} else {
- *len = 0;
+ *len = 0U;
}
return !(*len) ? NULL :
@@ -750,9 +750,9 @@
u8_t opt_num)
{
u8_t i;
- u8_t j = 0;
+ u8_t j = 0U;
- for (i = 0; i < opt_num && path[j]; i++) {
+ for (i = 0U; i < opt_num && path[j]; i++) {
if (options[i].delta != COAP_OPTION_URI_PATH) {
continue;
}
@@ -862,7 +862,7 @@
struct coap_block_context *ctx)
{
u16_t bytes = coap_block_size_to_bytes(ctx->block_size);
- unsigned int val = 0;
+ unsigned int val = 0U;
int r;
if (is_request(cpkt)) {
@@ -1209,7 +1209,7 @@
static int get_observe_option(const struct coap_packet *cpkt)
{
struct coap_option option = {};
- u16_t count = 1;
+ u16_t count = 1U;
int r;
r = coap_find_options(cpkt, COAP_OPTION_OBSERVE, &option, count);
diff --git a/subsys/net/lib/config/init.c b/subsys/net/lib/config/init.c
index 7250ee8..e15d0e5 100644
--- a/subsys/net/lib/config/init.c
+++ b/subsys/net/lib/config/init.c
@@ -343,7 +343,7 @@
#if defined(CONFIG_NET_CONFIG_AUTO_INIT)
static int init_net_app(struct device *device)
{
- u32_t flags = 0;
+ u32_t flags = 0U;
int ret;
ARG_UNUSED(device);
diff --git a/subsys/net/lib/dns/dns_pack.c b/subsys/net/lib/dns/dns_pack.c
index aec55b1d..6859923 100644
--- a/subsys/net/lib/dns/dns_pack.c
+++ b/subsys/net/lib/dns/dns_pack.c
@@ -55,9 +55,9 @@
u16_t lb_size;
u16_t i;
- lb_start = 0;
- lb_index = 1;
- lb_size = 0;
+ lb_start = 0U;
+ lb_index = 1U;
+ lb_size = 0U;
dn_size = dns_strlen(domain_name);
if (dn_size == 0) {
@@ -65,7 +65,7 @@
}
/* traverse the domain name str, including the null-terminator :) */
- for (i = 0; i < dn_size + 1; i++) {
+ for (i = 0U; i < dn_size + 1; i++) {
if (lb_index >= size) {
return -ENOMEM;
}
@@ -77,12 +77,12 @@
break;
case '.':
buf[lb_start] = lb_size;
- lb_size = 0;
+ lb_size = 0U;
lb_start = lb_index;
break;
case '\0':
buf[lb_start] = lb_size;
- buf[lb_index] = 0;
+ buf[lb_index] = 0U;
break;
}
lb_index += 1;
@@ -354,7 +354,7 @@
int rc = -EINVAL;
int i = 0;
- *len = 0;
+ *len = 0U;
/* Iterate ANCOUNT + 1 to allow the Query's QNAME to be parsed.
* This is required to avoid 'alias loops'
diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c
index 0b0d2e6e..b905516 100644
--- a/subsys/net/lib/dns/llmnr_responder.c
+++ b/subsys/net/lib/dns/llmnr_responder.c
@@ -467,7 +467,7 @@
int hostname_len = strlen(hostname);
struct net_buf *result;
struct dns_msg_t dns_msg;
- u16_t dns_id = 0;
+ u16_t dns_id = 0U;
int data_len;
int queries;
int offset;
diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c
index 2b4f2df..a73c246 100644
--- a/subsys/net/lib/dns/resolve.c
+++ b/subsys/net/lib/dns/resolve.c
@@ -518,7 +518,7 @@
struct dns_resolve_context *ctx = user_data;
struct net_buf *dns_cname = NULL;
struct net_buf *dns_data = NULL;
- u16_t dns_id = 0;
+ u16_t dns_id = 0U;
int ret, i;
ARG_UNUSED(net_ctx);
@@ -853,7 +853,7 @@
}
for (j = 0; j < SERVER_COUNT; j++) {
- hop_limit = 0;
+ hop_limit = 0U;
if (!ctx->servers[j].net_ctx) {
continue;
@@ -875,7 +875,7 @@
continue;
}
- hop_limit = 1;
+ hop_limit = 1U;
}
ret = dns_write(ctx, j, i, dns_data, dns_qname, hop_limit);
@@ -914,7 +914,7 @@
}
if (dns_id) {
- *dns_id = 0;
+ *dns_id = 0U;
}
}
diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c
index 8f4d0e3..61850e4 100644
--- a/subsys/net/lib/http/http_client.c
+++ b/subsys/net/lib/http/http_client.c
@@ -492,7 +492,7 @@
{
struct http_ctx *ctx = user_data;
size_t start = ctx->http.rsp.data_len;
- u16_t len = 0;
+ u16_t len = 0U;
struct net_buf *frag, *prev_frag = NULL;
size_t recv_len;
size_t pkt_len;
@@ -544,7 +544,7 @@
len);
ctx->http.rsp.data_len = 0;
- len = 0;
+ len = 0U;
start = 0;
}
diff --git a/subsys/net/lib/http/http_server.c b/subsys/net/lib/http/http_server.c
index 5586086..480b8ef 100644
--- a/subsys/net/lib/http/http_server.c
+++ b/subsys/net/lib/http/http_server.c
@@ -461,7 +461,7 @@
u8_t i;
int ret;
- for (i = 0; i < CONFIG_HTTP_SERVER_NUM_URLS; i++) {
+ for (i = 0U; i < CONFIG_HTTP_SERVER_NUM_URLS; i++) {
if (!ctx->http.urls) {
continue;
}
@@ -560,7 +560,7 @@
{
struct http_ctx *ctx = user_data;
size_t start = ctx->http.data_len;
- u16_t len = 0;
+ u16_t len = 0U;
const struct sockaddr *dst = NULL;
struct net_buf *frag;
int parsed_len;
@@ -636,7 +636,7 @@
}
ctx->http.data_len = 0;
- len = 0;
+ len = 0U;
start = 0;
}
@@ -684,7 +684,7 @@
ws_only:
if (ctx->cb.recv) {
#if defined(CONFIG_WEBSOCKET)
- u32_t msg_len, header_len = 0;
+ u32_t msg_len, header_len = 0U;
bool masked = true;
int ret;
diff --git a/subsys/net/lib/lwm2m/ipso_light_control.c b/subsys/net/lib/lwm2m/ipso_light_control.c
index b0856a8..eba1372 100644
--- a/subsys/net/lib/lwm2m/ipso_light_control.c
+++ b/subsys/net/lib/lwm2m/ipso_light_control.c
@@ -139,9 +139,9 @@
/* Set default values */
on_off_value[avail] = false;
- dimmer_value[avail] = 0;
+ dimmer_value[avail] = 0U;
on_time_value[avail] = 0;
- on_time_offset[avail] = 0;
+ on_time_offset[avail] = 0U;
cumulative_active_value[avail].val1 = 0;
cumulative_active_value[avail].val2 = 0;
power_factor_value[avail].val1 = 0;
diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c
index 93246d8..3f48858 100644
--- a/subsys/net/lib/lwm2m/lwm2m_engine.c
+++ b/subsys/net/lib/lwm2m/lwm2m_engine.c
@@ -322,7 +322,7 @@
return;
}
- ctx->tkl = 0;
+ ctx->tkl = 0U;
}
/* observer functions */
@@ -547,7 +547,7 @@
observe_node_data[i].min_period_sec = attrs.pmin;
observe_node_data[i].max_period_sec = max(attrs.pmax, attrs.pmin);
observe_node_data[i].format = format;
- observe_node_data[i].counter = 1;
+ observe_node_data[i].counter = 1U;
sys_slist_append(&engine_observer_list,
&observe_node_data[i].node);
@@ -806,7 +806,7 @@
static int get_option_int(const struct coap_packet *cpkt, u8_t opt)
{
struct coap_option option = {};
- u16_t count = 1;
+ u16_t count = 1U;
int r;
r = coap_find_options(cpkt, opt, &option, count);
@@ -833,13 +833,13 @@
(void)memset(context->path, 0, sizeof(struct lwm2m_obj_path));
}
- context->operation = 0;
+ context->operation = 0U;
}
static u16_t atou16(u8_t *buf, u16_t buflen, u16_t *len)
{
- u16_t val = 0;
- u16_t pos = 0;
+ u16_t val = 0U;
+ u16_t pos = 0U;
/* we should get a value first - consume all numbers */
while (pos < buflen && isdigit(buf[pos])) {
@@ -982,7 +982,7 @@
struct net_pkt *pkt;
struct net_app_ctx *app_ctx;
struct net_buf *frag;
- u8_t tokenlen = 0;
+ u8_t tokenlen = 0U;
u8_t *token = NULL;
int r = 0;
@@ -1010,7 +1010,7 @@
* msg->tkl == LWM2M_MSG_TOKEN_LEN_SKIP means dont set
*/
if (msg->tkl == 0) {
- tokenlen = 0;
+ tokenlen = 0U;
token = coap_next_token();
} else if (msg->token && msg->tkl != LWM2M_MSG_TOKEN_LEN_SKIP) {
tokenlen = msg->tkl;
@@ -1123,7 +1123,7 @@
struct lwm2m_engine_obj *obj;
struct lwm2m_engine_obj_inst *obj_inst;
u8_t temp[32];
- u16_t pos = 0;
+ u16_t pos = 0U;
int len;
/* Add resource-type/content-type to the registration message */
@@ -1975,7 +1975,7 @@
struct lwm2m_output_context *out;
struct lwm2m_obj_path *path;
int i, loop_max = 1;
- u16_t res_inst_id_tmp = 0;
+ u16_t res_inst_id_tmp = 0U;
void *data_ptr = NULL;
size_t data_len = 0;
@@ -2177,7 +2177,7 @@
size_t len = 0;
size_t total_size = 0;
int ret = 0;
- u8_t tkl = 0;
+ u8_t tkl = 0U;
u8_t token[8];
bool last_block = true;
struct block_context *block_ctx = NULL;
@@ -2339,7 +2339,7 @@
struct lwm2m_attr *attr;
struct notification_attrs nattrs = { 0 };
struct observe_node *obs;
- u8_t type = 0;
+ u8_t type = 0U;
void *nattr_ptrs[NR_LWM2M_ATTR] = {
&nattrs.pmin, &nattrs.pmax, &nattrs.gt, &nattrs.lt, &nattrs.st
};
@@ -2397,7 +2397,7 @@
for (i = 0; i < nr_opt; i++) {
int limit = min(options[i].len, 5), plen = 0, vlen;
float32_value_t val = { 0 };
- type = 0;
+ type = 0U;
/* search for '=' */
while (plen < limit && options[i].value[plen] != '=') {
@@ -2410,7 +2410,7 @@
}
/* matching attribute name */
- for (type = 0; type < NR_LWM2M_ATTR; type++) {
+ for (type = 0U; type < NR_LWM2M_ATTR; type++) {
if (LWM2M_ATTR_LEN[type] == plen &&
!memcmp(options[i].value, LWM2M_ATTR_STR[type],
LWM2M_ATTR_LEN[type])) {
@@ -2547,7 +2547,7 @@
}
/* add attribute to obj/obj_inst/res */
- for (type = 0; nattrs.flags && type < NR_LWM2M_ATTR; type++) {
+ for (type = 0U; nattrs.flags && type < NR_LWM2M_ATTR; type++) {
if (!(BIT(type) & nattrs.flags)) {
continue;
}
@@ -2739,7 +2739,7 @@
struct lwm2m_engine_obj_field *obj_field;
int ret = 0, index;
u16_t temp_len;
- u8_t num_read = 0;
+ u8_t num_read = 0U;
if (path->level >= 2) {
obj_inst = get_engine_obj_inst(path->obj_id, path->obj_inst_id);
@@ -3076,7 +3076,7 @@
int ret = 0;
if (created) {
- *created = 0;
+ *created = 0U;
}
*obj_inst = get_engine_obj_inst(path->obj_id, path->obj_inst_id);
@@ -3089,7 +3089,7 @@
/* set created flag to one */
if (created) {
- *created = 1;
+ *created = 1U;
}
}
@@ -3132,7 +3132,7 @@
struct coap_option options[4];
struct lwm2m_engine_obj *obj = NULL;
u8_t token[8];
- u8_t tkl = 0;
+ u8_t tkl = 0U;
u16_t format = LWM2M_FORMAT_NONE, accept;
struct lwm2m_input_context in;
struct lwm2m_output_context out;
@@ -3752,7 +3752,7 @@
msg->type = COAP_TYPE_CON;
msg->code = COAP_RESPONSE_CODE_CONTENT;
- msg->mid = 0;
+ msg->mid = 0U;
msg->token = obs->token;
msg->tkl = obs->tkl;
msg->reply_cb = notify_message_reply_cb;
@@ -3842,7 +3842,7 @@
service_node_data[i].service_fn = service;
service_node_data[i].min_call_period = period_ms;
- service_node_data[i].last_timestamp = 0;
+ service_node_data[i].last_timestamp = 0U;
sys_slist_append(&engine_service_list,
&service_node_data[i].node);
diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c
index 38d3ffe..4737b96 100644
--- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c
+++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c
@@ -132,7 +132,7 @@
static int reset_error_list_cb(u16_t obj_inst_id)
{
- error_code_count = 0;
+ error_code_count = 0U;
return 0;
}
@@ -327,11 +327,11 @@
int ret = 0, i;
/* Set default values */
- time_offset = 0;
+ time_offset = 0U;
mem_total_kb = 0;
mem_free_kb = -1;
- pwrsrc_count = 0;
- error_code_count = 0;
+ pwrsrc_count = 0U;
+ error_code_count = 0U;
/* currently only support UDP binding mode (no SMS or Queue mode) */
strcpy(binding_mode, "U");
@@ -343,7 +343,7 @@
device.obj_id = LWM2M_OBJECT_DEVICE_ID;
device.fields = fields;
device.field_count = ARRAY_SIZE(fields);
- device.max_instance_count = 1;
+ device.max_instance_count = 1U;
device.create_cb = device_create;
lwm2m_register_obj(&device);
diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_firmware.c b/subsys/net/lib/lwm2m/lwm2m_obj_firmware.c
index b212e39..cd04cca 100644
--- a/subsys/net/lib/lwm2m/lwm2m_obj_firmware.c
+++ b/subsys/net/lib/lwm2m/lwm2m_obj_firmware.c
@@ -343,7 +343,7 @@
firmware.obj_id = LWM2M_OBJECT_FIRMWARE_ID;
firmware.fields = fields;
firmware.field_count = ARRAY_SIZE(fields);
- firmware.max_instance_count = 1;
+ firmware.max_instance_count = 1U;
firmware.create_cb = firmware_create;
lwm2m_register_obj(&firmware);
diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_firmware_pull.c b/subsys/net/lib/lwm2m/lwm2m_obj_firmware_pull.c
index d733106..f8d0306 100644
--- a/subsys/net/lib/lwm2m/lwm2m_obj_firmware_pull.c
+++ b/subsys/net/lib/lwm2m/lwm2m_obj_firmware_pull.c
@@ -96,7 +96,7 @@
msg->type = COAP_TYPE_CON;
msg->code = COAP_METHOD_GET;
- msg->mid = 0;
+ msg->mid = 0U;
msg->token = token;
msg->tkl = tkl;
msg->reply_cb = reply_cb;
diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_security.c b/subsys/net/lib/lwm2m/lwm2m_obj_security.c
index 3f2fe63..2c78e6a 100644
--- a/subsys/net/lib/lwm2m/lwm2m_obj_security.c
+++ b/subsys/net/lib/lwm2m/lwm2m_obj_security.c
@@ -91,8 +91,8 @@
/* default values */
security_uri[index][0] = '\0';
bootstrap_flag[index] = 0;
- security_mode[index] = 0;
- short_server_id[index] = 0;
+ security_mode[index] = 0U;
+ short_server_id[index] = 0U;
/* initialize instance resource data */
INIT_OBJ_RES_DATA(res[index], i, SECURITY_SERVER_URI_ID,
diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_server.c b/subsys/net/lib/lwm2m/lwm2m_obj_server.c
index d12c8bc..8e7075f 100644
--- a/subsys/net/lib/lwm2m/lwm2m_obj_server.c
+++ b/subsys/net/lib/lwm2m/lwm2m_obj_server.c
@@ -75,7 +75,7 @@
LOG_DBG("DISABLE %d", obj_inst_id);
for (i = 0; i < MAX_INSTANCE_COUNT; i++) {
if (inst[i].obj && inst[i].obj_inst_id == obj_inst_id) {
- server_flag_disabled[i] = 1;
+ server_flag_disabled[i] = 1U;
return 0;
}
}
@@ -119,13 +119,13 @@
}
/* Set default values */
- server_flag_disabled[index] = 0;
- server_flag_store_notify[index] = 0;
+ server_flag_disabled[index] = 0U;
+ server_flag_store_notify[index] = 0U;
server_id[index] = index + 1;
lifetime[index] = CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME;
- default_min_period[index] = 0;
- default_max_period[index] = 0;
- disabled_timeout[index] = 86400;
+ default_min_period[index] = 0U;
+ default_max_period[index] = 0U;
+ disabled_timeout[index] = 86400U;
strcpy(transport_binding[index], "U");
/* initialize instance resource data */
diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c
index b129470..5234f1b 100644
--- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c
+++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c
@@ -181,7 +181,7 @@
void engine_trigger_update(void)
{
/* TODO: add locking? */
- client.trigger_update = 1;
+ client.trigger_update = 1U;
}
/* state machine reply callbacks */
@@ -372,13 +372,13 @@
client.ep_name,
client.lifetime);
/* Zephyr has joined network already */
- client.has_registration_info = 1;
- client.bootstrapped = 0;
- client.trigger_update = 0;
+ client.has_registration_info = 1U;
+ client.bootstrapped = 0U;
+ client.trigger_update = 0U;
#if defined(CONFIG_LWM2M_BOOTSTRAP_SERVER)
- client.use_bootstrap = 1;
+ client.use_bootstrap = 1U;
#else
- client.use_registration = 1;
+ client.use_registration = 1U;
#endif
if (client.lifetime == 0) {
client.lifetime = CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME;
@@ -412,7 +412,7 @@
msg->type = COAP_TYPE_CON;
msg->code = COAP_METHOD_POST;
- msg->mid = 0;
+ msg->mid = 0U;
msg->reply_cb = do_bootstrap_reply_cb;
msg->message_timeout_cb = do_bootstrap_timeout_cb;
@@ -483,7 +483,7 @@
#endif
LOG_ERR("Failed to parse URI!");
} else {
- client.has_registration_info = 1;
+ client.has_registration_info = 1U;
client.bootstrapped++;
}
} else {
@@ -527,7 +527,7 @@
msg->type = COAP_TYPE_CON;
msg->code = COAP_METHOD_POST;
- msg->mid = 0;
+ msg->mid = 0U;
msg->reply_cb = reply_cb;
msg->message_timeout_cb = timeout_cb;
@@ -649,7 +649,7 @@
((client.lifetime - SECONDS_TO_UPDATE_EARLY) <=
(k_uptime_get() - client.last_update) / 1000))) {
forced_update = client.trigger_update;
- client.trigger_update = 0;
+ client.trigger_update = 0U;
ret = sm_send_registration(forced_update,
do_update_reply_cb,
do_update_timeout_cb);
@@ -678,7 +678,7 @@
msg->type = COAP_TYPE_CON;
msg->code = COAP_METHOD_DELETE;
- msg->mid = 0;
+ msg->mid = 0U;
msg->reply_cb = do_deregister_reply_cb;
msg->message_timeout_cb = do_deregister_timeout_cb;
diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_json.c b/subsys/net/lib/lwm2m/lwm2m_rw_json.c
index 972d157..cae65ca 100644
--- a/subsys/net/lib/lwm2m/lwm2m_rw_json.c
+++ b/subsys/net/lib/lwm2m/lwm2m_rw_json.c
@@ -127,7 +127,7 @@
bool escape = false;
(void)memset(json, 0, sizeof(struct json_data));
- cont = 1;
+ cont = 1U;
/* We will be either at start, or at a specific position */
while (in->frag && in->offset != 0xffff && cont) {
@@ -160,7 +160,7 @@
json_type == T_STRING) {
json->value[json->value_len] = '\0';
json_type = T_NONE;
- cont = 0;
+ cont = 0U;
}
} else {
json_add_char(json, c, json_type);
@@ -174,7 +174,7 @@
json_type = T_STRING;
} else if (!escape) {
json_type = T_STRING_B;
- json->name_len = 0;
+ json->name_len = 0U;
} else {
json_add_char(json, c, json_type);
}
@@ -545,10 +545,10 @@
int ret = 0;
int pos = 0;
u16_t val;
- u8_t c = 0;
+ u8_t c = 0U;
do {
- val = 0;
+ val = 0U;
c = buf[pos];
/* we should get a value first - consume all numbers */
while (pos < buflen && isdigit(c)) {
@@ -591,7 +591,7 @@
struct lwm2m_engine_obj_inst *obj_inst = NULL;
struct lwm2m_engine_res_inst *res = NULL;
struct json_data json;
- u8_t olv = 0;
+ u8_t olv = 0U;
u8_t created;
int i, r;
u8_t mode = MODE_NONE;
@@ -600,7 +600,7 @@
while (json_next_token(in, &json)) {
i = 0;
- created = 0;
+ created = 0U;
if (json.name[0] == 'n') {
path->level = parse_path(json.value, json.value_len,
path);
diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_oma_tlv.c b/subsys/net/lib/lwm2m/lwm2m_rw_oma_tlv.c
index 72dd525..e0b6c40 100644
--- a/subsys/net/lib/lwm2m/lwm2m_rw_oma_tlv.c
+++ b/subsys/net/lib/lwm2m/lwm2m_rw_oma_tlv.c
@@ -228,7 +228,7 @@
{
struct net_buf *tmp_frag;
u8_t len_type;
- u8_t len_pos = 1;
+ u8_t len_pos = 1U;
size_t tlv_len;
u16_t tmp_offset;
u8_t buf[2];
@@ -325,7 +325,7 @@
struct oma_tlv tlv;
struct net_buf *tmp_frag;
u16_t tmp_pos;
- u32_t len = 0;
+ u32_t len = 0U;
*writer_flags &= ~writer_flag;
@@ -846,7 +846,7 @@
struct lwm2m_engine_obj_inst *obj_inst = NULL;
struct lwm2m_engine_res_inst *res = NULL;
struct lwm2m_engine_obj_field *obj_field = NULL;
- u8_t created = 0;
+ u8_t created = 0U;
int ret, i;
ret = lwm2m_get_or_create_engine_obj(context, &obj_inst, &created);
diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_plain_text.c b/subsys/net/lib/lwm2m/lwm2m_rw_plain_text.c
index b972ddb..b035c55 100644
--- a/subsys/net/lib/lwm2m/lwm2m_rw_plain_text.c
+++ b/subsys/net/lib/lwm2m/lwm2m_rw_plain_text.c
@@ -353,7 +353,7 @@
struct lwm2m_engine_obj_field *obj_field;
struct lwm2m_engine_res_inst *res = NULL;
int ret, i;
- u8_t created = 0;
+ u8_t created = 0U;
ret = lwm2m_get_or_create_engine_obj(context, &obj_inst, &created);
if (ret < 0) {
@@ -384,6 +384,6 @@
return -ENOENT;
}
- context->path->level = 3;
+ context->path->level = 3U;
return lwm2m_write_handler(obj_inst, res, obj_field, context);
}
diff --git a/subsys/net/lib/mqtt/mqtt_pkt.c b/subsys/net/lib/mqtt/mqtt_pkt.c
index 3a0cd11..47ac640 100644
--- a/subsys/net/lib/mqtt/mqtt_pkt.c
+++ b/subsys/net/lib/mqtt/mqtt_pkt.c
@@ -90,13 +90,13 @@
int compute_rlen_size(u16_t *size, u32_t len)
{
if (len <= 127) {
- *size = 1;
+ *size = 1U;
} else if (len >= 128 && len <= 16383) {
- *size = 2;
+ *size = 2U;
} else if (len >= 16384 && len <= 2097151) {
- *size = 3;
+ *size = 3U;
} else if (len >= 2097152 && len <= 268435455) {
- *size = 4;
+ *size = 4U;
} else {
return -EINVAL;
}
@@ -117,7 +117,7 @@
u8_t encoded;
u8_t i;
- i = 0;
+ i = 0U;
do {
encoded = len % 128;
len = len / 128;
@@ -147,9 +147,9 @@
static int rlen_decode(u32_t *rlen, u16_t *rlen_size,
u8_t *buf, u16_t size)
{
- u32_t value = 0;
- u32_t mult = 1;
- u16_t i = 0;
+ u32_t value = 0U;
+ u32_t mult = 1U;
+ u16_t i = 0U;
u8_t encoded;
do {
@@ -279,7 +279,7 @@
UNALIGNED_PUT(htons(pkt_id), (u16_t *)(buf + offset));
offset += PACKET_ID_SIZE;
- for (i = 0; i < elements; i++) {
+ for (i = 0U; i < elements; i++) {
buf[offset + i] = granted_qos[i];
}
@@ -592,7 +592,7 @@
*payload_size = PACKET_ID_SIZE;
- for (i = 0; i < items; i++) {
+ for (i = 0U; i < items; i++) {
/* topic length (as string) +1 byte for its QoS */
*payload_size += mqtt_strlen(topics[i]) +
(with_qos ? QoS_SIZE : 0);
@@ -669,7 +669,7 @@
UNALIGNED_PUT(htons(pkt_id), (u16_t *)(buf + offset));
offset += PACKET_ID_SIZE;
- for (i = 0; i < items; i++) {
+ for (i = 0U; i < items; i++) {
u16_t topic_len = mqtt_strlen(topics[i]);
UNALIGNED_PUT(htons(topic_len), (u16_t *)(buf + offset));
@@ -746,8 +746,8 @@
*pkt_id = ntohs(val_u16);
offset += PACKET_ID_SIZE;
- *items = 0;
- for (i = 0; i < elements; i++) {
+ *items = 0U;
+ for (i = 0U; i < elements; i++) {
if ((offset + TOPIC_MIN_SIZE) > length) {
return -EINVAL;
}
@@ -787,8 +787,8 @@
u8_t i;
int rc;
- *pkt_id = 0;
- *items = 0;
+ *pkt_id = 0U;
+ *items = 0U;
if (elements <= 0) {
return -EINVAL;
@@ -822,7 +822,7 @@
return -EINVAL;
}
- for (i = 0; i < *items; i++) {
+ for (i = 0U; i < *items; i++) {
qos = *(buf + offset);
if (qos < MQTT_QoS0 || qos > MQTT_QoS2) {
return -EINVAL;
diff --git a/subsys/net/lib/mqtt_sock/mqtt_decoder.c b/subsys/net/lib/mqtt_sock/mqtt_decoder.c
index d46a104..7df7dbc 100644
--- a/subsys/net/lib/mqtt_sock/mqtt_decoder.c
+++ b/subsys/net/lib/mqtt_sock/mqtt_decoder.c
@@ -160,10 +160,10 @@
*/
int packet_length_decode(struct buf_ctx *buf, u32_t *length)
{
- u8_t shift = 0;
- u8_t bytes = 0;
+ u8_t shift = 0U;
+ u8_t bytes = 0U;
- *length = 0;
+ *length = 0U;
do {
if (bytes > MQTT_MAX_LENGTH_BYTES) {
return -EINVAL;
diff --git a/subsys/net/lib/mqtt_sock/mqtt_encoder.c b/subsys/net/lib/mqtt_sock/mqtt_encoder.c
index 0f9c441..a9a3b3c 100644
--- a/subsys/net/lib/mqtt_sock/mqtt_encoder.c
+++ b/subsys/net/lib/mqtt_sock/mqtt_encoder.c
@@ -151,7 +151,7 @@
*/
static u8_t packet_length_encode(u32_t length, struct buf_ctx *buf)
{
- u8_t encoded_bytes = 0;
+ u8_t encoded_bytes = 0U;
MQTT_TRC(">> length:0x%08x cur:%p, end:%p", length,
(buf == NULL) ? 0 : buf->cur, (buf == NULL) ? 0 : buf->end);
diff --git a/subsys/net/lib/mqtt_sock/mqtt_rx.c b/subsys/net/lib/mqtt_sock/mqtt_rx.c
index b87c97e..9d610fa 100644
--- a/subsys/net/lib/mqtt_sock/mqtt_rx.c
+++ b/subsys/net/lib/mqtt_sock/mqtt_rx.c
@@ -232,7 +232,7 @@
/* Reset to pointer to the beginning of the frame. */
buf->cur = client->rx_buf;
- chunk_size = 1;
+ chunk_size = 1U;
err_code = fixed_header_decode(buf, type_and_flags, var_length);
} while (err_code == -EAGAIN);
diff --git a/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tcp.c b/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tcp.c
index c51fd8b..cb0f39f 100644
--- a/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tcp.c
+++ b/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tcp.c
@@ -65,7 +65,7 @@
int mqtt_client_tcp_write(struct mqtt_client *client, const u8_t *data,
u32_t datalen)
{
- u32_t offset = 0;
+ u32_t offset = 0U;
int ret;
while (offset < datalen) {
diff --git a/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tls.c
index 862495e..625c2ef 100644
--- a/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tls.c
+++ b/subsys/net/lib/mqtt_sock/mqtt_transport_socket_tls.c
@@ -104,7 +104,7 @@
int mqtt_client_tls_write(struct mqtt_client *client, const u8_t *data,
u32_t datalen)
{
- u32_t offset = 0;
+ u32_t offset = 0U;
int ret;
while (offset < datalen) {
diff --git a/subsys/net/lib/openthread/platform/flash.c b/subsys/net/lib/openthread/platform/flash.c
index 7aa73ab..b2776f3 100644
--- a/subsys/net/lib/openthread/platform/flash.c
+++ b/subsys/net/lib/openthread/platform/flash.c
@@ -84,7 +84,7 @@
u32_t utilsFlashWrite(u32_t aAddress, uint8_t *aData, u32_t aSize)
{
- u32_t index = 0;
+ u32_t index = 0U;
flash_write_protection_set(flash_dev, false);
if (!flash_write(flash_dev, mapAddress(aAddress), aData, aSize)) {
@@ -97,7 +97,7 @@
u32_t utilsFlashRead(u32_t aAddress, uint8_t *aData, u32_t aSize)
{
- u32_t index = 0;
+ u32_t index = 0U;
if (!flash_read(flash_dev, mapAddress(aAddress), aData, aSize)) {
index = aSize;
diff --git a/subsys/net/lib/openthread/platform/logging.c b/subsys/net/lib/openthread/platform/logging.c
index c0ebe64..247074e 100644
--- a/subsys/net/lib/openthread/platform/logging.c
+++ b/subsys/net/lib/openthread/platform/logging.c
@@ -25,7 +25,7 @@
ARG_UNUSED(aLogRegion);
char logString[LOG_PARSE_BUFFER_SIZE + 1];
- u16_t length = 0;
+ u16_t length = 0U;
/* Parse user string. */
va_list paramList;
diff --git a/subsys/net/lib/sntp/sntp.c b/subsys/net/lib/sntp/sntp.c
index 1828249..21afa89 100644
--- a/subsys/net/lib/sntp/sntp.c
+++ b/subsys/net/lib/sntp/sntp.c
@@ -110,9 +110,9 @@
{
struct sntp_ctx *sntp = (struct sntp_ctx *)user_data;
struct sntp_pkt buf = { 0 };
- u64_t epoch_time = 0;
- u64_t tmp = 0;
- u16_t offset = 0;
+ u64_t epoch_time = 0U;
+ u64_t tmp = 0U;
+ u16_t offset = 0U;
if (status < 0) {
goto error_exit;
diff --git a/subsys/net/lib/sockets/getaddrinfo.c b/subsys/net/lib/sockets/getaddrinfo.c
index 5f01df5..676f67a 100644
--- a/subsys/net/lib/sockets/getaddrinfo.c
+++ b/subsys/net/lib/sockets/getaddrinfo.c
@@ -103,7 +103,7 @@
}
ai_state.hints = hints;
- ai_state.idx = 0;
+ ai_state.idx = 0U;
ai_state.port = htons(port);
ai_state.ai_arr = res;
k_sem_init(&ai_state.sem, 0, UINT_MAX);
diff --git a/subsys/net/lib/websocket/websocket.c b/subsys/net/lib/websocket/websocket.c
index edc5911..52ad0e2 100644
--- a/subsys/net/lib/websocket/websocket.c
+++ b/subsys/net/lib/websocket/websocket.c
@@ -58,7 +58,7 @@
masking_value >> (8 * (3 - (*data_read) % 4));
}
- pos = 0;
+ pos = 0U;
frag = frag->frags;
}
}
@@ -68,7 +68,7 @@
const struct sockaddr *dst,
void *user_send_data)
{
- u8_t header[14], hdr_len = 2;
+ u8_t header[14], hdr_len = 2U;
int ret;
if (ctx->state != HTTP_STATE_OPEN) {
@@ -101,10 +101,10 @@
hdr_len += 2;
} else {
header[1] |= 127;
- header[2] = 0;
- header[3] = 0;
- header[4] = 0;
- header[5] = 0;
+ header[2] = 0U;
+ header[3] = 0U;
+ header[4] = 0U;
+ header[5] = 0U;
header[6] = payload_len >> 24;
header[7] = payload_len >> 16;
header[8] = payload_len >> 8;
@@ -186,12 +186,12 @@
len = value & 0x007f;
if (len < 126) {
- len_len = 0;
+ len_len = 0U;
*message_length = len;
} else if (len == 126) {
u16_t msg_len;
- len_len = 2;
+ len_len = 2U;
frag = net_frag_read_be16(frag, pos, &pos, &msg_len);
if (!frag && pos == 0xffff) {
@@ -200,7 +200,7 @@
*message_length = msg_len;
} else {
- len_len = 4;
+ len_len = 4U;
frag = net_frag_read_be32(frag, pos, &pos, message_length);
if (!frag && pos == 0xffff) {
@@ -210,7 +210,7 @@
if (value & 0x0080) {
*masked = true;
- appdata_pos = 0;
+ appdata_pos = 0U;
frag = net_frag_read_be32(frag, pos, &pos, mask_value);
if (!frag && pos == 0xffff) {
diff --git a/subsys/settings/src/settings.c b/subsys/settings/src/settings.c
index 51a1e1a..d6c4911 100644
--- a/subsys/settings/src/settings.c
+++ b/subsys/settings/src/settings.c
@@ -34,7 +34,7 @@
sys_slist_init(&settings_handlers);
settings_store_init();
- settings_cmd_inited = 1;
+ settings_cmd_inited = 1U;
}
}
@@ -211,7 +211,7 @@
static void u64_to_dec(char *ptr, int buf_len, u64_t value, int base)
{
- u64_t t = 0, res = 0;
+ u64_t t = 0U, res = 0U;
u64_t tmp = value;
int count = 0;
@@ -265,7 +265,7 @@
static s64_t dec_to_s64(char *p_str, char **e_ptr)
{
- u64_t val = 0, prev_val = 0;
+ u64_t val = 0U, prev_val = 0U;
bool neg = false;
int digit;
diff --git a/subsys/shell/modules/kernel_service.c b/subsys/shell/modules/kernel_service.c
index affcd8e..6d3635e 100644
--- a/subsys/shell/modules/kernel_service.c
+++ b/subsys/shell/modules/kernel_service.c
@@ -55,7 +55,7 @@
&& defined(CONFIG_THREAD_STACK_INFO)
static void shell_tdata_dump(const struct k_thread *thread, void *user_data)
{
- unsigned int pcnt, unused = 0;
+ unsigned int pcnt, unused = 0U;
unsigned int size = thread->stack_info.size;
const char *tname;
@@ -95,7 +95,7 @@
static void shell_stack_dump(const struct k_thread *thread, void *user_data)
{
- unsigned int pcnt, unused = 0;
+ unsigned int pcnt, unused = 0U;
unsigned int size = thread->stack_info.size;
const char *tname;
diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c
index ce9cc09..8e56d16 100644
--- a/subsys/shell/shell.c
+++ b/subsys/shell/shell.c
@@ -495,7 +495,7 @@
bool found = false;
size_t idx = 0;
- *longest = 0;
+ *longest = 0U;
*cnt = 0;
while (true) {
@@ -1719,7 +1719,7 @@
{
const struct shell_static_entry *entry = NULL;
struct shell_static_entry static_entry;
- u16_t longest_syntax = 0;
+ u16_t longest_syntax = 0U;
size_t cmd_idx = 0;
/* Checking if there are any subcommands available. */
diff --git a/subsys/shell/shell_cmds.c b/subsys/shell/shell_cmds.c
index 9c5403c..8eceeb8 100644
--- a/subsys/shell/shell_cmds.c
+++ b/subsys/shell/shell_cmds.c
@@ -52,12 +52,12 @@
/* Function reads cursor position from terminal. */
static int cursor_position_get(const struct shell *shell, u16_t *x, u16_t *y)
{
- u16_t buff_idx = 0;
+ u16_t buff_idx = 0U;
size_t cnt;
char c = 0;
- *x = 0;
- *y = 0;
+ *x = 0U;
+ *y = 0U;
memset(shell->ctx->temp_buff, 0, sizeof(shell->ctx->temp_buff));
@@ -96,7 +96,7 @@
/* Index start position in the buffer where 'y'
* is stored.
*/
- buff_idx = 2;
+ buff_idx = 2U;
while (shell->ctx->temp_buff[buff_idx] != ';') {
*y = *y * 10 +
diff --git a/subsys/shell/shell_ops.c b/subsys/shell/shell_ops.c
index 12f80d2..0cfb892 100644
--- a/subsys/shell/shell_ops.c
+++ b/subsys/shell/shell_ops.c
@@ -110,7 +110,7 @@
}
/* Start at the current position. */
- chars_to_delete = 0;
+ chars_to_delete = 0U;
/* Look back for all spaces then for non-spaces. */
while ((str >= str_start) && (*str == ' ')) {
diff --git a/subsys/shell/shell_utils.c b/subsys/shell/shell_utils.c
index 45e2b50..db55dde 100644
--- a/subsys/shell/shell_utils.c
+++ b/subsys/shell/shell_utils.c
@@ -100,9 +100,9 @@
if (t == '0') {
u8_t i;
- u8_t v = 0;
+ u8_t v = 0U;
- for (i = 2; i < (2 + 3); i++) {
+ for (i = 2U; i < (2 + 3); i++) {
t = *(cmd + i);
if (t >= '0' && t <= '7') {
@@ -122,9 +122,9 @@
if (t == 'x') {
u8_t i;
- u8_t v = 0;
+ u8_t v = 0U;
- for (i = 2; i < (2 + 2); i++) {
+ for (i = 2U; i < (2 + 2); i++) {
t = *(cmd + i);
if (t >= '0' && t <= '9') {
@@ -242,7 +242,7 @@
void shell_spaces_trim(char *str)
{
u16_t len = shell_strlen(str);
- u16_t shift = 0;
+ u16_t shift = 0U;
if (!str) {
return;
@@ -262,7 +262,7 @@
&str[j],
len - shift + 1);
len -= shift;
- shift = 0;
+ shift = 0U;
}
break;
@@ -273,7 +273,7 @@
void shell_buffer_trim(char *buff, u16_t *buff_len)
{
- u16_t i = 0;
+ u16_t i = 0U;
/* no command in the buffer */
if (buff[0] == '\0') {
diff --git a/subsys/storage/flash_map/flash_map.c b/subsys/storage/flash_map/flash_map.c
index 5a7606d..1f6db7f 100644
--- a/subsys/storage/flash_map/flash_map.c
+++ b/subsys/storage/flash_map/flash_map.c
@@ -152,7 +152,7 @@
cb_data->area_len = fa->fa_size;
cb_data->ret = ret;
- cb_data->ret_idx = 0;
+ cb_data->ret_idx = 0U;
cb_data->ret_len = *cnt;
cb_data->status = 0;
@@ -277,7 +277,7 @@
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(flash_dev); i++) {
+ for (i = 0U; i < ARRAY_SIZE(flash_dev); i++) {
flash_dev[i] = device_get_binding(flash_drivers_map[i].name);
}
diff --git a/subsys/usb/class/cdc_acm.c b/subsys/usb/class/cdc_acm.c
index 83f620a..6aa121c 100644
--- a/subsys/usb/class/cdc_acm.c
+++ b/subsys/usb/class/cdc_acm.c
@@ -305,7 +305,7 @@
ARG_UNUSED(ep_status);
ARG_UNUSED(ep);
- dev_data->tx_ready = 1;
+ dev_data->tx_ready = 1U;
k_sem_give(&poll_wait_sem);
/* Call callback only if tx irq ena */
if (dev_data->cb && dev_data->tx_irq_ena) {
@@ -339,10 +339,10 @@
* Quark SE USB controller is always storing data
* in the FIFOs per 32-bit words.
*/
- for (i = 0; i < bytes_to_read; i += 4) {
+ for (i = 0U; i < bytes_to_read; i += 4) {
usb_read(ep, tmp_buf, 4, NULL);
- for (j = 0; j < 4; j++) {
+ for (j = 0U; j < 4; j++) {
if (i + j == bytes_to_read) {
/* We read all the data */
break;
@@ -360,7 +360,7 @@
}
dev_data->rx_buf_head = buf_head;
- dev_data->rx_ready = 1;
+ dev_data->rx_ready = 1U;
/* Call callback only if rx irq ena */
if (dev_data->cb && dev_data->rx_irq_ena) {
dev_data->cb(dev_data->cb_data);
@@ -381,7 +381,7 @@
ARG_UNUSED(ep_status);
- dev_data->notification_sent = 1;
+ dev_data->notification_sent = 1U;
LOG_DBG("CDC_IntIN EP[%x]\r", ep);
}
@@ -545,14 +545,14 @@
const u8_t *tx_data, int len)
{
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
- u32_t wrote = 0;
+ u32_t wrote = 0U;
int err;
if (dev_data->usb_status != USB_DC_CONFIGURED) {
return 0;
}
- dev_data->tx_ready = 0;
+ dev_data->tx_ready = 0U;
/* FIXME: On Quark SE Family processor, restrict writing more than
* 4 bytes into TX USB Endpoint. When more than 4 bytes are written,
@@ -596,7 +596,7 @@
bytes_read = avail_data;
}
- for (i = 0; i < bytes_read; i++) {
+ for (i = 0U; i < bytes_read; i++) {
rx_data[i] = dev_data->rx_buf[(dev_data->rx_buf_tail + i) %
CDC_ACM_BUFFER_SIZE];
}
@@ -606,7 +606,7 @@
if (dev_data->rx_buf_tail == dev_data->rx_buf_head) {
/* Buffer empty */
- dev_data->rx_ready = 0;
+ dev_data->rx_ready = 0U;
}
return bytes_read;
@@ -623,7 +623,7 @@
{
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
- dev_data->tx_irq_ena = 1;
+ dev_data->tx_irq_ena = 1U;
}
/**
@@ -637,7 +637,7 @@
{
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
- dev_data->tx_irq_ena = 0;
+ dev_data->tx_irq_ena = 0U;
}
/**
@@ -652,7 +652,7 @@
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
if (dev_data->tx_ready) {
- dev_data->tx_ready = 0;
+ dev_data->tx_ready = 0U;
return 1;
}
@@ -670,7 +670,7 @@
{
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
- dev_data->rx_irq_ena = 1;
+ dev_data->rx_irq_ena = 1U;
}
/**
@@ -684,7 +684,7 @@
{
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
- dev_data->rx_irq_ena = 0;
+ dev_data->rx_irq_ena = 0U;
}
/**
@@ -699,7 +699,7 @@
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
if (dev_data->rx_ready) {
- dev_data->rx_ready = 0;
+ dev_data->rx_ready = 0U;
return 1;
}
@@ -775,7 +775,7 @@
{
struct cdc_acm_dev_data_t * const dev_data = DEV_DATA(dev);
struct cdc_acm_notification notification;
- u32_t cnt = 0;
+ u32_t cnt = 0U;
notification.bmRequestType = 0xA1;
notification.bNotificationType = 0x20;
@@ -784,7 +784,7 @@
notification.wLength = sys_cpu_to_le16(sizeof(serial_state));
notification.data = sys_cpu_to_le16(serial_state);
- dev_data->notification_sent = 0;
+ dev_data->notification_sent = 0U;
usb_write(cdc_acm_ep_data[ACM_INT_EP_IDX].ep_addr,
(const u8_t *)¬ification, sizeof(notification), NULL);
diff --git a/subsys/usb/class/mass_storage.c b/subsys/usb/class/mass_storage.c
index e774546..eec2129 100644
--- a/subsys/usb/class/mass_storage.c
+++ b/subsys/usb/class/mass_storage.c
@@ -182,8 +182,8 @@
(void)memset((void *)&cbw, 0, sizeof(struct CBW));
(void)memset((void *)&csw, 0, sizeof(struct CSW));
(void)memset(page, 0, sizeof(page));
- addr = 0;
- length = 0;
+ addr = 0U;
+ length = 0U;
}
static void sendCSW(void)
@@ -255,7 +255,7 @@
return -EINVAL;
}
- max_lun_count = 0;
+ max_lun_count = 0U;
*data = (u8_t *)(&max_lun_count);
*len = 1;
break;
@@ -611,7 +611,7 @@
}
/* info are in RAM -> no need to re-read memory */
- for (n = 0; n < size; n++) {
+ for (n = 0U; n < size; n++) {
if (page[addr%BLOCK_SIZE + n] != buf[n]) {
LOG_DBG("Mismatch sector %d offset %d",
addr/BLOCK_SIZE, n);
@@ -671,7 +671,7 @@
static void mass_storage_bulk_out(u8_t ep,
enum usb_dc_ep_cb_status_code ep_status)
{
- u32_t bytes_read = 0;
+ u32_t bytes_read = 0U;
u8_t bo_buf[CONFIG_MASS_STORAGE_BULK_EP_MPS];
ARG_UNUSED(ep_status);
@@ -911,7 +911,7 @@
*/
static int mass_storage_init(struct device *dev)
{
- u32_t block_size = 0;
+ u32_t block_size = 0U;
ARG_UNUSED(dev);
diff --git a/subsys/usb/class/netusb/function_rndis.c b/subsys/usb/class/netusb/function_rndis.c
index 002c758..fde86c4 100644
--- a/subsys/usb/class/netusb/function_rndis.c
+++ b/subsys/usb/class/netusb/function_rndis.c
@@ -223,7 +223,7 @@
};
static u8_t manufacturer[] = CONFIG_USB_DEVICE_MANUFACTURER;
-static u32_t drv_version = 1;
+static u32_t drv_version = 1U;
static u32_t object_id_supported[] = {
RNDIS_OBJECT_ID_GEN_SUPP_LIST,
@@ -336,7 +336,7 @@
static void rndis_bulk_out(u8_t ep, enum usb_dc_ep_cb_status_code ep_status)
{
u8_t buffer[CONFIG_RNDIS_BULK_EP_MPS];
- u32_t hdr_offset = 0;
+ u32_t hdr_offset = 0U;
u32_t len, read;
int ret;
@@ -619,7 +619,7 @@
struct rndis_query_cmd *cmd = (void *)data;
struct rndis_query_cmd_complete *rsp;
struct net_buf *buf;
- u32_t object_id, buf_len = 0;
+ u32_t object_id, buf_len = 0U;
buf = net_buf_alloc(&rndis_tx_pool, K_NO_WAIT);
if (!buf) {
@@ -963,8 +963,8 @@
ind->status = sys_cpu_to_le32(RNDIS_STATUS_DISCONNECT_MEDIA);
}
- ind->buf_len = 0;
- ind->buf_offset = 0;
+ ind->buf_len = 0U;
+ ind->buf_offset = 0U;
rndis_queue_rsp(buf);
@@ -984,7 +984,7 @@
buf = net_buf_get(&rndis_tx_queue, K_NO_WAIT);
if (!buf) {
LOG_ERR("Error getting response buffer");
- *len = 0;
+ *len = 0U;
return -ENODATA;
}
diff --git a/subsys/usb/class/netusb/netusb.c b/subsys/usb/class/netusb/netusb.c
index f8f4614..6cedec5 100644
--- a/subsys/usb/class/netusb/netusb.c
+++ b/subsys/usb/class/netusb/netusb.c
@@ -130,7 +130,7 @@
int try_write(u8_t ep, u8_t *data, u16_t len)
{
- u8_t tries = 10;
+ u8_t tries = 10U;
int ret = 0;
net_hexdump("USB <", data, len);
diff --git a/subsys/usb/class/usb_dfu.c b/subsys/usb/class/usb_dfu.c
index e572db0..4baaff5 100644
--- a/subsys/usb/class/usb_dfu.c
+++ b/subsys/usb/class/usb_dfu.c
@@ -314,8 +314,8 @@
*/
static void dfu_reset_counters(void)
{
- dfu_data.bytes_sent = 0;
- dfu_data.block_nr = 0;
+ dfu_data.bytes_sent = 0U;
+ dfu_data.block_nr = 0U;
flash_img_init(&dfu_data.ctx, dfu_data.flash_dev);
}
@@ -373,11 +373,11 @@
}
(*data)[0] = dfu_data.status;
- (*data)[1] = 0;
- (*data)[2] = 1;
- (*data)[3] = 0;
+ (*data)[1] = 0U;
+ (*data)[2] = 1U;
+ (*data)[3] = 0U;
(*data)[4] = dfu_data.state;
- (*data)[5] = 0;
+ (*data)[5] = 0U;
*data_len = 6;
break;
diff --git a/subsys/usb/usb_descriptor.c b/subsys/usb/usb_descriptor.c
index 355436b..ab78666 100644
--- a/subsys/usb/usb_descriptor.c
+++ b/subsys/usb/usb_descriptor.c
@@ -175,7 +175,7 @@
__ASSERT(buf[ascii_idx_max] > 0x1F && buf[ascii_idx_max] < 0x7F,
"Only printable ascii-7 characters are allowed in USB "
"string descriptors");
- buf[i] = 0;
+ buf[i] = 0U;
buf[i - 1] = buf[ascii_idx_max--];
}
}
@@ -337,8 +337,8 @@
struct usb_if_descriptor *if_descr = NULL;
struct usb_cfg_data *cfg_data = NULL;
struct usb_ep_descriptor *ep_descr = NULL;
- u8_t numof_ifaces = 0;
- u8_t str_descr_idx = 0;
+ u8_t numof_ifaces = 0U;
+ u8_t str_descr_idx = 0U;
u32_t requested_ep = BIT(16) | BIT(0);
while (head->bLength != 0) {
diff --git a/subsys/usb/usb_device.c b/subsys/usb/usb_device.c
index 87ea962..ee63118 100644
--- a/subsys/usb/usb_device.c
+++ b/subsys/usb/usb_device.c
@@ -252,8 +252,8 @@
static void usb_handle_control_transfer(u8_t ep,
enum usb_dc_ep_cb_status_code ep_status)
{
- u32_t chunk = 0;
- u32_t type = 0;
+ u32_t chunk = 0U;
+ u32_t type = 0U;
struct usb_setup_packet *setup = &usb_dev.setup;
LOG_DBG("ep %x, status %x", ep, ep_status);
@@ -401,8 +401,8 @@
static bool usb_get_descriptor(u16_t type_index, u16_t lang_id,
s32_t *len, u8_t **data)
{
- u8_t type = 0;
- u8_t index = 0;
+ u8_t type = 0U;
+ u8_t index = 0U;
u8_t *p = NULL;
s32_t cur_index = 0;
bool found = false;
@@ -474,8 +474,8 @@
static bool usb_set_configuration(u8_t config_index, u8_t alt_setting)
{
u8_t *p = NULL;
- u8_t cur_config = 0;
- u8_t cur_alt_setting = 0;
+ u8_t cur_config = 0U;
+ u8_t cur_alt_setting = 0U;
if (config_index == 0) {
/* unconfigure device */
@@ -616,8 +616,8 @@
LOG_DBG("REQ_GET_STATUS");
/* bit 0: self-powered */
/* bit 1: remote wakeup = not supported */
- data[0] = 0;
- data[1] = 0;
+ data[0] = 0U;
+ data[1] = 0U;
*len = 2;
break;
@@ -699,8 +699,8 @@
switch (setup->bRequest) {
case REQ_GET_STATUS:
/* no bits specified */
- data[0] = 0;
- data[1] = 0;
+ data[0] = 0U;
+ data[1] = 0U;
*len = 2;
break;
@@ -711,7 +711,7 @@
case REQ_GET_INTERFACE:
/* there is only one interface, return n-1 (= 0) */
- data[0] = 0;
+ data[0] = 0U;
*len = 1;
break;
@@ -749,7 +749,7 @@
case REQ_GET_STATUS:
/* bit 0 = endpointed halted or not */
usb_dc_ep_is_stalled(ep, &data[0]);
- data[1] = 0;
+ data[1] = 0U;
*len = 2;
break;
@@ -1043,7 +1043,7 @@
return ret;
/*register endpoint handlers*/
- for (i = 0; i < config->num_endpoints; i++) {
+ for (i = 0U; i < config->num_endpoints; i++) {
ret = usb_dc_ep_set_callback(config->endpoint[i].ep_addr,
config->endpoint[i].ep_cb);
if (ret < 0)
@@ -1051,7 +1051,7 @@
}
/* init transfer slots */
- for (i = 0; i < MAX_NUM_TRANSFERS; i++) {
+ for (i = 0U; i < MAX_NUM_TRANSFERS; i++) {
k_work_init(&usb_dev.transfer[i].work, usb_transfer_work);
k_sem_init(&usb_dev.transfer[i].sem, 1, 1);
}