drivers: Add 'U' to unsigned variable assignments

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>
This commit is contained in:
Patrik Flykt 2018-11-29 11:12:22 -08:00 committed by Anas Nashif
commit 8ff96b5a57
172 changed files with 693 additions and 693 deletions

View file

@ -185,7 +185,7 @@ static inline void adc_context_start_read(struct adc_context *ctx,
ctx->status = 0; ctx->status = 0;
if (ctx->sequence->options) { if (ctx->sequence->options) {
ctx->sampling_index = 0; ctx->sampling_index = 0U;
if (ctx->sequence->options->interval_us != 0) { if (ctx->sequence->options->interval_us != 0) {
atomic_set(&ctx->sampling_requested, 0); atomic_set(&ctx->sampling_requested, 0);

View file

@ -294,7 +294,7 @@ static int adc_dw_read_request(struct device *dev,
if (seq_tbl->options) { if (seq_tbl->options) {
info->seq_size = seq_tbl->options->extra_samplings + 1; info->seq_size = seq_tbl->options->extra_samplings + 1;
} else { } else {
info->seq_size = 1; info->seq_size = 1U;
} }
info->state = ADC_STATE_SAMPLING; info->state = ADC_STATE_SAMPLING;
@ -342,7 +342,7 @@ static void adc_dw_start_conversion(struct device *dev)
const struct adc_config *config = info->dev->config->config_info; const struct adc_config *config = info->dev->config->config_info;
const struct adc_sequence *entry = info->ctx.sequence; const struct adc_sequence *entry = info->ctx.sequence;
u32_t adc_base = config->reg_base; u32_t adc_base = config->reg_base;
u32_t ctrl, tmp_val, interval_us = 0; u32_t ctrl, tmp_val, interval_us = 0U;
info->channel_id = find_lsb_set(info->channels) - 1; info->channel_id = find_lsb_set(info->channels) - 1;

View file

@ -267,7 +267,7 @@ static int adc_quark_d2000_read_request(struct device *dev,
if (seq_tbl->options) { if (seq_tbl->options) {
info->seq_size = seq_tbl->options->extra_samplings + 1; info->seq_size = seq_tbl->options->extra_samplings + 1;
} else { } else {
info->seq_size = 1; info->seq_size = 1U;
} }
if (info->seq_size > ADC_FIFO_LEN) { if (info->seq_size > ADC_FIFO_LEN) {
@ -276,7 +276,7 @@ static int adc_quark_d2000_read_request(struct device *dev,
/* check if buffer has enough size */ /* check if buffer has enough size */
utmp = info->channels; utmp = info->channels;
num_channels = 0; num_channels = 0U;
while (utmp) { while (utmp) {
if (utmp & BIT(0)) { if (utmp & BIT(0)) {
num_channels++; num_channels++;
@ -325,8 +325,8 @@ static void adc_quark_d2000_start_conversion(struct device *dev)
info->dev->config->config_info; info->dev->config->config_info;
const struct adc_sequence *entry = info->ctx.sequence; const struct adc_sequence *entry = info->ctx.sequence;
volatile adc_reg_t *adc_regs = config->reg_base; volatile adc_reg_t *adc_regs = config->reg_base;
u32_t i, val, interval_us = 0; u32_t i, val, interval_us = 0U;
u32_t idx = 0, offset = 0; u32_t idx = 0U, offset = 0U;
info->channel_id = find_lsb_set(info->channels) - 1; info->channel_id = find_lsb_set(info->channels) - 1;
@ -338,7 +338,7 @@ static void adc_quark_d2000_start_conversion(struct device *dev)
adc_regs->sample = ADC_FIFO_CLEAR; adc_regs->sample = ADC_FIFO_CLEAR;
/* setup the sequence table */ /* setup the sequence table */
for (i = 0; i < info->seq_size; i++) { for (i = 0U; i < info->seq_size; i++) {
idx = i / 4; idx = i / 4;
offset = (i % 4) * 8; offset = (i % 4) * 8;

View file

@ -133,7 +133,7 @@ static void mcux_adc16_start_channel(struct device *dev)
struct mcux_adc16_data *data = dev->driver_data; struct mcux_adc16_data *data = dev->driver_data;
adc16_channel_config_t channel_config; adc16_channel_config_t channel_config;
u32_t channel_group = 0; u32_t channel_group = 0U;
data->channel_id = find_lsb_set(data->channels) - 1; data->channel_id = find_lsb_set(data->channels) - 1;
@ -174,7 +174,7 @@ static void mcux_adc16_isr(void *arg)
const struct mcux_adc16_config *config = dev->config->config_info; const struct mcux_adc16_config *config = dev->config->config_info;
struct mcux_adc16_data *data = dev->driver_data; struct mcux_adc16_data *data = dev->driver_data;
ADC_Type *base = config->base; ADC_Type *base = config->base;
u32_t channel_group = 0; u32_t channel_group = 0U;
u16_t result; u16_t result;
result = ADC16_GetChannelConversionValue(base, channel_group); result = ADC16_GetChannelConversionValue(base, channel_group);

View file

@ -173,12 +173,12 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence)
return -EINVAL; return -EINVAL;
} }
active_channels = 0; active_channels = 0U;
nrfx_adc_all_channels_disable(); nrfx_adc_all_channels_disable();
/* Enable the channels selected for the pointed sequence. /* Enable the channels selected for the pointed sequence.
*/ */
channel_id = 0; channel_id = 0U;
while (selected_channels) { while (selected_channels) {
if (selected_channels & BIT(0)) { if (selected_channels & BIT(0)) {
/* The nrfx driver requires setting the resolution /* The nrfx driver requires setting the resolution

View file

@ -261,12 +261,12 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence)
return -EINVAL; return -EINVAL;
} }
active_channels = 0; active_channels = 0U;
/* Enable only the channels selected for the pointed sequence. /* Enable only the channels selected for the pointed sequence.
* Disable all the rest. * Disable all the rest.
*/ */
channel_id = 0; channel_id = 0U;
do { do {
if (selected_channels & BIT(channel_id)) { if (selected_channels & BIT(channel_id)) {
/* Signal an error if a selected channel has not been /* Signal an error if a selected channel has not been

View file

@ -187,7 +187,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence)
int error = 0; int error = 0;
u32_t channels = sequence->channels; u32_t channels = sequence->channels;
data->channels = 0; data->channels = 0U;
/* Signal an error if the channel selection is invalid (no channels or /* Signal an error if the channel selection is invalid (no channels or
* a non-existing one is selected). * a non-existing one is selected).
@ -212,8 +212,8 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence)
return -EINVAL; return -EINVAL;
} }
u8_t num_active_channels = 0; u8_t num_active_channels = 0U;
u8_t channel = 0; u8_t channel = 0U;
while (channels > 0) { while (channels > 0) {
if (channels & 1) { if (channels & 1) {

View file

@ -142,7 +142,7 @@ static int aio_qmsi_cmp_init(struct device *dev)
config.cmp_en = QM_SCSS_CMP->cmp_en; config.cmp_en = QM_SCSS_CMP->cmp_en;
/* Clear callback pointers */ /* Clear callback pointers */
for (i = 0; i < dev_data->num_cmp; i++) { for (i = 0U; i < dev_data->num_cmp; i++) {
dev_data->cb[i].cb = NULL; dev_data->cb[i].cb = NULL;
dev_data->cb[i].param = NULL; dev_data->cb[i].param = NULL;
} }
@ -161,7 +161,7 @@ static void aio_qmsi_cmp_isr(void *data)
u32_t int_status = QM_SCSS_CMP->cmp_stat_clr; u32_t int_status = QM_SCSS_CMP->cmp_stat_clr;
for (i = 0; i < dev_data->num_cmp; i++) { for (i = 0U; i < dev_data->num_cmp; i++) {
if (int_status & (1 << i)) { if (int_status & (1 << i)) {
if (dev_data->cb[i].cb != NULL) { if (dev_data->cb[i].cb != NULL) {
dev_data->cb[i].cb(dev_data->cb[i].param); dev_data->cb[i].cb(dev_data->cb[i].param);

View file

@ -652,14 +652,14 @@ static int source_ipm_helper(struct pdm_chan_cfg *config, u32_t *source_mask,
u8_t pdm_ix; u8_t pdm_ix;
u8_t chan_ix; u8_t chan_ix;
enum pdm_lr lr; enum pdm_lr lr;
u16_t pdm_lr_mask = 0; u16_t pdm_lr_mask = 0U;
int ipm = 0; int ipm = 0;
/* clear outputs */ /* clear outputs */
*source_mask = 0; *source_mask = 0U;
*stereo_mask = 0; *stereo_mask = 0U;
*swap_mask = 0; *swap_mask = 0U;
*controller_mask = 0; *controller_mask = 0U;
/* Loop number of PDM controllers in the configuration. If mic A /* Loop number of PDM controllers in the configuration. If mic A
* or B is enabled then a pdm controller is marked as active. Also it * or B is enabled then a pdm controller is marked as active. Also it
@ -668,7 +668,7 @@ static int source_ipm_helper(struct pdm_chan_cfg *config, u32_t *source_mask,
* swapped mono left. The function returns also in array source[] the * swapped mono left. The function returns also in array source[] the
* indice of enabled pdm controllers to be used for IPM configuration. * indice of enabled pdm controllers to be used for IPM configuration.
*/ */
for (chan_ix = 0; chan_ix < config->req_num_chan; chan_ix++) { for (chan_ix = 0U; chan_ix < config->req_num_chan; chan_ix++) {
dmic_parse_channel_map(config->req_chan_map_lo, dmic_parse_channel_map(config->req_chan_map_lo,
config->req_chan_map_hi, config->req_chan_map_hi,

View file

@ -155,9 +155,9 @@ static inline void copy_hdr(struct net_buf *buf)
static void reset_rx(void) static void reset_rx(void)
{ {
rx.type = H4_NONE; rx.type = H4_NONE;
rx.remaining = 0; rx.remaining = 0U;
rx.have_hdr = false; rx.have_hdr = false;
rx.hdr_len = 0; rx.hdr_len = 0U;
rx.discardable = false; rx.discardable = false;
} }

View file

@ -711,7 +711,7 @@ static void h5_init(void)
h5.link_state = UNINIT; h5.link_state = UNINIT;
h5.rx_state = START; h5.rx_state = START;
h5.tx_win = 4; h5.tx_win = 4U;
/* TX thread */ /* TX thread */
k_fifo_init(&h5.tx_queue); k_fifo_init(&h5.tx_queue);

View file

@ -83,7 +83,7 @@ static inline void spi_dump_message(const u8_t *pre, u8_t *buf,
u8_t i, c; u8_t i, c;
printk("%s (%d): ", pre, size); printk("%s (%d): ", pre, size);
for (i = 0; i < size; i++) { for (i = 0U; i < size; i++) {
c = buf[i]; c = buf[i];
printk("%x ", c); printk("%x ", c);
if (c >= 31 && c <= 126) { if (c >= 31 && c <= 126) {
@ -283,7 +283,7 @@ static void bt_spi_rx_thread(void)
u8_t header_master[5] = { SPI_READ, 0x00, 0x00, 0x00, 0x00 }; u8_t header_master[5] = { SPI_READ, 0x00, 0x00, 0x00, 0x00 };
u8_t header_slave[5]; u8_t header_slave[5];
struct bt_hci_acl_hdr acl_hdr; struct bt_hci_acl_hdr acl_hdr;
u8_t size = 0; u8_t size = 0U;
int ret; int ret;
(void)memset(&txmsg, 0xFF, SPI_MAX_MSG_LEN); (void)memset(&txmsg, 0xFF, SPI_MAX_MSG_LEN);

View file

@ -288,7 +288,7 @@ static int can_stm32_init(struct device *dev)
data->filter_usage = (1ULL << CAN_MAX_NUMBER_OF_FILTES) - 1ULL; data->filter_usage = (1ULL << CAN_MAX_NUMBER_OF_FILTES) - 1ULL;
(void)memset(data->rx_response, 0, (void)memset(data->rx_response, 0,
sizeof(void *) * CONFIG_CAN_MAX_FILTER); sizeof(void *) * CONFIG_CAN_MAX_FILTER);
data->response_type = 0; data->response_type = 0U;
clock = device_get_binding(STM32_CLOCK_CONTROL_NAME); clock = device_get_binding(STM32_CLOCK_CONTROL_NAME);
__ASSERT_NO_MSG(clock); __ASSERT_NO_MSG(clock);
@ -595,8 +595,8 @@ static inline int can_stm32_set_filter(const struct can_filter *filter,
CAN_TypeDef *can, CAN_TypeDef *can,
int *filter_index) int *filter_index)
{ {
u32_t mask = 0; u32_t mask = 0U;
u32_t id = 0; u32_t id = 0U;
int filter_nr = 0; int filter_nr = 0;
int filter_index_tmp = CAN_NO_FREE_FILTER; int filter_index_tmp = CAN_NO_FREE_FILTER;
int bank_nr; int bank_nr;

View file

@ -84,7 +84,7 @@ static inline int beetle_clock_control_on(struct device *dev,
struct arm_clock_control_t *beetle_cc = struct arm_clock_control_t *beetle_cc =
(struct arm_clock_control_t *)(sub_system); (struct arm_clock_control_t *)(sub_system);
u8_t bit = 0; u8_t bit = 0U;
switch (beetle_cc->bus) { switch (beetle_cc->bus) {
case CMSDK_AHB: case CMSDK_AHB:
@ -108,7 +108,7 @@ static inline int beetle_clock_control_off(struct device *dev,
struct arm_clock_control_t *beetle_cc = struct arm_clock_control_t *beetle_cc =
(struct arm_clock_control_t *)(sub_system); (struct arm_clock_control_t *)(sub_system);
u8_t bit = 0; u8_t bit = 0U;
switch (beetle_cc->bus) { switch (beetle_cc->bus) {
case CMSDK_AHB: case CMSDK_AHB:
@ -154,7 +154,7 @@ static const struct clock_control_driver_api beetle_clock_control_api = {
#ifdef CONFIG_CLOCK_CONTROL_BEETLE_ENABLE_PLL #ifdef CONFIG_CLOCK_CONTROL_BEETLE_ENABLE_PLL
static u32_t beetle_round_freq(u32_t mainclk) static u32_t beetle_round_freq(u32_t mainclk)
{ {
u32_t nc_mainclk = 0; u32_t nc_mainclk = 0U;
/* /*
* Verify that the frequency is in the supported range otherwise * Verify that the frequency is in the supported range otherwise
@ -175,7 +175,7 @@ static u32_t beetle_round_freq(u32_t mainclk)
static u32_t beetle_get_prescaler(u32_t mainclk) static u32_t beetle_get_prescaler(u32_t mainclk)
{ {
u32_t pre_mainclk = 0; u32_t pre_mainclk = 0U;
/* /*
* Verify that the frequency is in the supported range otherwise * Verify that the frequency is in the supported range otherwise

View file

@ -47,7 +47,7 @@ static int _m16src_start(struct device *dev, clock_control_subsys_t sub_system)
return -EAGAIN; return -EAGAIN;
} }
m16src_grd = 1; m16src_grd = 1U;
irq_unlock(imask); irq_unlock(imask);
@ -87,7 +87,7 @@ static int _m16src_start(struct device *dev, clock_control_subsys_t sub_system)
} }
/* release resource guard */ /* release resource guard */
m16src_grd = 0; m16src_grd = 0U;
hf_already_started: hf_already_started:
/* rollover should not happen as start and stop shall be /* rollover should not happen as start and stop shall be
@ -130,7 +130,7 @@ static int _m16src_stop(struct device *dev, clock_control_subsys_t sub_system)
return -EAGAIN; return -EAGAIN;
} }
m16src_grd = 1; m16src_grd = 1U;
irq_unlock(imask); irq_unlock(imask);
@ -139,7 +139,7 @@ static int _m16src_stop(struct device *dev, clock_control_subsys_t sub_system)
nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP); nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP);
/* release resource guard */ /* release resource guard */
m16src_grd = 0; m16src_grd = 0U;
return 0; return 0;
} }
@ -172,7 +172,7 @@ static int _k32src_start(struct device *dev, clock_control_subsys_t sub_system)
goto lf_already_started; goto lf_already_started;
} }
k32src_initialized = 1; k32src_initialized = 1U;
irq_unlock(imask); irq_unlock(imask);
@ -348,7 +348,7 @@ static void _power_clock_isr(void *arg)
/* Start HF Clock if LF RC is used. */ /* Start HF Clock if LF RC is used. */
if ((NRF_CLOCK->LFCLKSRCCOPY & CLOCK_LFCLKSRCCOPY_SRC_Msk) == if ((NRF_CLOCK->LFCLKSRCCOPY & CLOCK_LFCLKSRCCOPY_SRC_Msk) ==
CLOCK_LFCLKSRCCOPY_SRC_RC) { CLOCK_LFCLKSRCCOPY_SRC_RC) {
ctto = 1; ctto = 1U;
} }
} }
} }

View file

@ -30,7 +30,7 @@ static void ipm_console_thread(void *arg1, void *arg2, void *arg3)
driver_data = d->driver_data; driver_data = d->driver_data;
config_info = d->config->config_info; config_info = d->config->config_info;
ARG_UNUSED(arg2); ARG_UNUSED(arg2);
size32 = 0; size32 = 0U;
pos = 0; pos = 0;
while (1) { while (1) {
@ -42,7 +42,7 @@ static void ipm_console_thread(void *arg1, void *arg2, void *arg3)
if (ret) { if (ret) {
/* Shouldn't ever happen... */ /* Shouldn't ever happen... */
printk("ipm console ring buffer error: %d\n", ret); printk("ipm console ring buffer error: %d\n", ret);
size32 = 0; size32 = 0U;
continue; continue;
} }

View file

@ -100,11 +100,11 @@ static void telnet_rb_init(void)
{ {
int i; int i;
telnet_rb.line_in = 0; telnet_rb.line_in = 0U;
telnet_rb.line_out = 0; telnet_rb.line_out = 0U;
for (i = 0; i < TELNET_LINES; i++) { for (i = 0; i < TELNET_LINES; i++) {
telnet_rb.l_bufs[i].len = 0; telnet_rb.l_bufs[i].len = 0U;
} }
} }
@ -141,10 +141,10 @@ static void telnet_rb_switch(void)
telnet_rb.line_in++; telnet_rb.line_in++;
if (telnet_rb.line_in == TELNET_LINES) { if (telnet_rb.line_in == TELNET_LINES) {
telnet_rb.line_in = 0; telnet_rb.line_in = 0U;
} }
telnet_rb.l_bufs[telnet_rb.line_in].len = 0; telnet_rb.l_bufs[telnet_rb.line_in].len = 0U;
/* Unfortunately, we don't have enough line buffer, /* Unfortunately, we don't have enough line buffer,
* so we eat the next to be sent. * so we eat the next to be sent.
@ -152,7 +152,7 @@ static void telnet_rb_switch(void)
if (telnet_rb.line_in == telnet_rb.line_out) { if (telnet_rb.line_in == telnet_rb.line_out) {
telnet_rb.line_out++; telnet_rb.line_out++;
if (telnet_rb.line_out == TELNET_LINES) { if (telnet_rb.line_out == TELNET_LINES) {
telnet_rb.line_out = 0; telnet_rb.line_out = 0U;
} }
} }
@ -166,7 +166,7 @@ static inline struct line_buf *telnet_rb_get_line_out(void)
telnet_rb.line_out++; telnet_rb.line_out++;
if (telnet_rb.line_out == TELNET_LINES) { if (telnet_rb.line_out == TELNET_LINES) {
telnet_rb.line_out = 0; telnet_rb.line_out = 0U;
} }
if (!telnet_rb.l_bufs[out].len) { if (!telnet_rb.l_bufs[out].len) {
@ -240,7 +240,7 @@ static inline bool telnet_send(void)
K_FOREVER); K_FOREVER);
/* We reinitialize the line buffer */ /* We reinitialize the line buffer */
lb->len = 0; lb->len = 0U;
if (net_context_send(out_pkt, telnet_sent_cb, if (net_context_send(out_pkt, telnet_sent_cb,
K_NO_WAIT, NULL, NULL) || K_NO_WAIT, NULL, NULL) ||

View file

@ -258,13 +258,13 @@ static void handle_ansi(u8_t byte, char *line)
{ {
if (atomic_test_and_clear_bit(&esc_state, ESC_ANSI_FIRST)) { if (atomic_test_and_clear_bit(&esc_state, ESC_ANSI_FIRST)) {
if (!isdigit(byte)) { if (!isdigit(byte)) {
ansi_val = 1; ansi_val = 1U;
goto ansi_cmd; goto ansi_cmd;
} }
atomic_set_bit(&esc_state, ESC_ANSI_VAL); atomic_set_bit(&esc_state, ESC_ANSI_VAL);
ansi_val = byte - '0'; ansi_val = byte - '0';
ansi_val_2 = 0; ansi_val_2 = 0U;
return; return;
} }
@ -317,7 +317,7 @@ ansi_cmd:
cursor_backward(cur); cursor_backward(cur);
end += cur; end += cur;
cur = 0; cur = 0U;
break; break;
case ANSI_END: case ANSI_END:
if (!end) { if (!end) {
@ -326,7 +326,7 @@ ansi_cmd:
cursor_forward(end); cursor_forward(end);
cur += end; cur += end;
end = 0; end = 0U;
break; break;
case ANSI_DEL: case ANSI_DEL:
if (!end) { if (!end) {
@ -441,8 +441,8 @@ static bool handle_mcumgr(struct console_input *cmd, uint8_t byte)
clear_mcumgr(); clear_mcumgr();
cmd = NULL; cmd = NULL;
cur = 0; cur = 0U;
end = 0; end = 0U;
} }
return true; return true;
@ -529,8 +529,8 @@ void uart_console_isr(struct device *unused)
cmd->line[cur + end] = '\0'; cmd->line[cur + end] = '\0';
uart_poll_out(uart_console_dev, '\r'); uart_poll_out(uart_console_dev, '\r');
uart_poll_out(uart_console_dev, '\n'); uart_poll_out(uart_console_dev, '\n');
cur = 0; cur = 0U;
end = 0; end = 0U;
k_fifo_put(lines_queue, cmd); k_fifo_put(lines_queue, cmd);
cmd = NULL; cmd = NULL;
break; break;
@ -617,7 +617,7 @@ static int uart_console_init(struct device *arg)
#if defined(CONFIG_USB_UART_CONSOLE) && defined(CONFIG_USB_UART_DTR_WAIT) #if defined(CONFIG_USB_UART_CONSOLE) && defined(CONFIG_USB_UART_DTR_WAIT)
while (1) { while (1) {
u32_t dtr = 0; u32_t dtr = 0U;
uart_line_ctrl_get(uart_console_dev, LINE_CTRL_DTR, &dtr); uart_line_ctrl_get(uart_console_dev, LINE_CTRL_DTR, &dtr);
if (dtr) { if (dtr) {

View file

@ -101,11 +101,11 @@ static void ws_rb_init(void)
{ {
int i; int i;
ws_rb.line_in = 0; ws_rb.line_in = 0U;
ws_rb.line_out = 0; ws_rb.line_out = 0U;
for (i = 0; i < WS_CONSOLE_LINES; i++) { for (i = 0; i < WS_CONSOLE_LINES; i++) {
ws_rb.l_bufs[i].len = 0; ws_rb.l_bufs[i].len = 0U;
} }
} }
@ -127,10 +127,10 @@ static void ws_rb_switch(void)
ws_rb.line_in++; ws_rb.line_in++;
if (ws_rb.line_in == WS_CONSOLE_LINES) { if (ws_rb.line_in == WS_CONSOLE_LINES) {
ws_rb.line_in = 0; ws_rb.line_in = 0U;
} }
ws_rb.l_bufs[ws_rb.line_in].len = 0; ws_rb.l_bufs[ws_rb.line_in].len = 0U;
/* Unfortunately, we don't have enough line buffer, /* Unfortunately, we don't have enough line buffer,
* so we eat the next to be sent. * so we eat the next to be sent.
@ -138,7 +138,7 @@ static void ws_rb_switch(void)
if (ws_rb.line_in == ws_rb.line_out) { if (ws_rb.line_in == ws_rb.line_out) {
ws_rb.line_out++; ws_rb.line_out++;
if (ws_rb.line_out == WS_CONSOLE_LINES) { if (ws_rb.line_out == WS_CONSOLE_LINES) {
ws_rb.line_out = 0; ws_rb.line_out = 0U;
} }
} }
@ -152,7 +152,7 @@ static inline struct line_buf *ws_rb_get_line_out(void)
ws_rb.line_out++; ws_rb.line_out++;
if (ws_rb.line_out == WS_CONSOLE_LINES) { if (ws_rb.line_out == WS_CONSOLE_LINES) {
ws_rb.line_out = 0; ws_rb.line_out = 0U;
} }
if (!ws_rb.l_bufs[out].len) { if (!ws_rb.l_bufs[out].len) {
@ -274,7 +274,7 @@ static bool ws_console_send(struct http_ctx *console)
NULL, NULL); NULL, NULL);
/* We reinitialize the line buffer */ /* We reinitialize the line buffer */
lb->len = 0; lb->len = 0U;
} }
return true; return true;

View file

@ -56,7 +56,7 @@ static u32_t counter_dtmr_cmsdk_apb_read(struct device *dev)
dev->config->config_info; dev->config->config_info;
/* Return Counter Value */ /* Return Counter Value */
u32_t value = 0; u32_t value = 0U;
value = DUALTIMER_MAX_RELOAD - cfg->dtimer->timer1value; value = DUALTIMER_MAX_RELOAD - cfg->dtimer->timer1value;

View file

@ -56,7 +56,7 @@ static u32_t counter_tmr_cmsdk_apb_read(struct device *dev)
dev->config->config_info; dev->config->config_info;
/* Return Counter Value */ /* Return Counter Value */
u32_t value = 0; u32_t value = 0U;
value = TIMER_MAX_RELOAD - cfg->timer->value; value = TIMER_MAX_RELOAD - cfg->timer->value;

View file

@ -80,7 +80,7 @@ static u32_t timer_dtmr_cmsdk_apb_read(struct device *dev)
struct timer_dtmr_cmsdk_apb_dev_data *data = dev->driver_data; struct timer_dtmr_cmsdk_apb_dev_data *data = dev->driver_data;
/* Return Timer Value */ /* Return Timer Value */
u32_t value = 0; u32_t value = 0U;
value = data->load - cfg->dtimer->timer1value; value = data->load - cfg->dtimer->timer1value;

View file

@ -80,7 +80,7 @@ static u32_t timer_tmr_cmsdk_apb_read(struct device *dev)
struct timer_tmr_cmsdk_apb_dev_data *data = dev->driver_data; struct timer_tmr_cmsdk_apb_dev_data *data = dev->driver_data;
/* Return Counter Value */ /* Return Counter Value */
u32_t value = 0; u32_t value = 0U;
value = data->load - cfg->timer->value; value = data->load - cfg->timer->value;

View file

@ -119,7 +119,7 @@ void ataes132a_atmel_crc(u8_t *input, u8_t length,
u16_t double_carry; u16_t double_carry;
u8_t higher_crc_bit; u8_t higher_crc_bit;
for (i = 0, crc = 0; i < length; i++) { for (i = 0, crc = 0U; i < length; i++) {
for (j = 7; j >= 0; j--) { for (j = 7; j >= 0; j--) {
bit = !!(input[i] & BIT(j)); bit = !!(input[i] & BIT(j));
higher_crc_bit = crc >> 15; higher_crc_bit = crc >> 15;

View file

@ -134,11 +134,11 @@ static int ili9340_write(const struct device *dev, const u16_t x,
ili9340_set_mem_area(data, x, y, desc->width, desc->height); ili9340_set_mem_area(data, x, y, desc->width, desc->height);
if (desc->pitch > desc->width) { if (desc->pitch > desc->width) {
write_h = 1; write_h = 1U;
nbr_of_writes = desc->height; nbr_of_writes = desc->height;
} else { } else {
write_h = desc->height; write_h = desc->height;
nbr_of_writes = 1; nbr_of_writes = 1U;
} }
ili9340_transmit(data, ILI9340_CMD_MEM_WRITE, ili9340_transmit(data, ILI9340_CMD_MEM_WRITE,
@ -148,7 +148,7 @@ static int ili9340_write(const struct device *dev, const u16_t x,
tx_bufs.count = 1; tx_bufs.count = 1;
write_data_start += (3 * desc->pitch); write_data_start += (3 * desc->pitch);
for (write_cnt = 1; write_cnt < nbr_of_writes; ++write_cnt) { for (write_cnt = 1U; write_cnt < nbr_of_writes; ++write_cnt) {
tx_buf.buf = (void *)write_data_start; tx_buf.buf = (void *)write_data_start;
tx_buf.len = 3 * desc->width * write_h; tx_buf.len = 3 * desc->width * write_h;
spi_write(data->spi_dev, &data->spi_config, &tx_bufs); spi_write(data->spi_dev, &data->spi_config, &tx_bufs);

View file

@ -252,9 +252,9 @@ int glcd_initialize(struct device *port)
LOG_DBG("initialize called"); LOG_DBG("initialize called");
dev->input_set = 0; dev->input_set = 0U;
dev->display_switch = 0; dev->display_switch = 0U;
dev->function = 0; dev->function = 0U;
/* /*
* First set up the device driver... * First set up the device driver...

View file

@ -146,7 +146,7 @@ static void start_image(struct mb_display *disp, const struct mb_image *img)
int row, col; int row, col;
for (row = 0; row < DISPLAY_ROWS; row++) { for (row = 0; row < DISPLAY_ROWS; row++) {
disp->row[row] = 0; disp->row[row] = 0U;
for (col = 0; col < DISPLAY_COLS; col++) { for (col = 0; col < DISPLAY_COLS; col++) {
if (GET_PIXEL(img, map[row][col].x, map[row][col].y)) { if (GET_PIXEL(img, map[row][col].x, map[row][col].y)) {
@ -158,7 +158,7 @@ static void start_image(struct mb_display *disp, const struct mb_image *img)
disp->row[row] |= BIT(LED_ROW1_GPIO_PIN + row); disp->row[row] |= BIT(LED_ROW1_GPIO_PIN + row);
} }
disp->cur = 0; disp->cur = 0U;
if (disp->duration == K_FOREVER) { if (disp->duration == K_FOREVER) {
disp->expiry = K_FOREVER; disp->expiry = K_FOREVER;
@ -196,9 +196,9 @@ static void reset_display(struct mb_display *disp)
k_timer_stop(&disp->timer); k_timer_stop(&disp->timer);
disp->str = NULL; disp->str = NULL;
disp->cur_img = 0; disp->cur_img = 0U;
disp->img = NULL; disp->img = NULL;
disp->img_count = 0; disp->img_count = 0U;
disp->scroll = SCROLL_OFF; disp->scroll = SCROLL_OFF;
} }
@ -269,7 +269,7 @@ static void update_scroll(struct mb_display *disp)
start_image(disp, &img); start_image(disp, &img);
} else { } else {
if (disp->first) { if (disp->first) {
disp->first = 0; disp->first = 0U;
} else { } else {
disp->cur_img++; disp->cur_img++;
} }
@ -280,8 +280,8 @@ static void update_scroll(struct mb_display *disp)
return; return;
} }
disp->cur_img = 0; disp->cur_img = 0U;
disp->first = 1; disp->first = 1U;
} }
disp->scroll = SCROLL_START; disp->scroll = SCROLL_START;
@ -299,7 +299,7 @@ static void update_image(struct mb_display *disp)
return; return;
} }
disp->cur_img = 0; disp->cur_img = 0U;
} }
start_image(disp, current_img(disp)); start_image(disp, current_img(disp));
@ -343,8 +343,8 @@ static void start_scroll(struct mb_display *disp, s32_t duration)
} }
disp->scroll = SCROLL_START; disp->scroll = SCROLL_START;
disp->first = 1; disp->first = 1U;
disp->cur_img = 0; disp->cur_img = 0U;
start_image(disp, get_font(' ')); start_image(disp, get_font(' '));
} }
@ -366,11 +366,11 @@ void mb_display_image(struct mb_display *disp, u32_t mode, s32_t duration,
__ASSERT(img && img_count > 0, "Invalid parameters"); __ASSERT(img && img_count > 0, "Invalid parameters");
disp->text = 0; disp->text = 0U;
disp->img_count = img_count; disp->img_count = img_count;
disp->img = img; disp->img = img;
disp->img_sep = 0; disp->img_sep = 0U;
disp->cur_img = 0; disp->cur_img = 0U;
disp->loop = !!(mode & MB_DISPLAY_FLAG_LOOP); disp->loop = !!(mode & MB_DISPLAY_FLAG_LOOP);
switch (mode & MODE_MASK) { switch (mode & MODE_MASK) {
@ -407,9 +407,9 @@ void mb_display_print(struct mb_display *disp, u32_t mode,
} }
disp->str = disp->str_buf; disp->str = disp->str_buf;
disp->text = 1; disp->text = 1U;
disp->img_sep = 1; disp->img_sep = 1U;
disp->cur_img = 0; disp->cur_img = 0U;
disp->loop = !!(mode & MB_DISPLAY_FLAG_LOOP); disp->loop = !!(mode & MB_DISPLAY_FLAG_LOOP);
switch (mode & MODE_MASK) { switch (mode & MODE_MASK) {

View file

@ -88,7 +88,7 @@ static inline int ssd1673_write_cmd(struct ssd1673_data *driver,
static inline void ssd1673_busy_wait(struct ssd1673_data *driver) static inline void ssd1673_busy_wait(struct ssd1673_data *driver)
{ {
u32_t val = 0; u32_t val = 0U;
gpio_pin_read(driver->busy, DT_SSD1673_BUSY_PIN, &val); gpio_pin_read(driver->busy, DT_SSD1673_BUSY_PIN, &val);
while (val) { while (val) {
@ -181,7 +181,7 @@ static int ssd1673_update_display(const struct device *dev, bool initial)
} }
if (initial) { if (initial) {
driver->numof_part_cycles = 0; driver->numof_part_cycles = 0U;
driver->last_lut = SSD1673_LAST_LUT_INITIAL; driver->last_lut = SSD1673_LAST_LUT_INITIAL;
if (ssd1673_write_cmd(driver, SSD1673_CMD_UPDATE_LUT, if (ssd1673_write_cmd(driver, SSD1673_CMD_UPDATE_LUT,
ssd1673_lut_initial, ssd1673_lut_initial,
@ -409,7 +409,7 @@ static int ssd1673_controller_init(struct device *dev)
ssd1673_busy_wait(driver); ssd1673_busy_wait(driver);
tmp[0] = (SSD1673_RAM_YRES - 1); tmp[0] = (SSD1673_RAM_YRES - 1);
tmp[1] = 0; tmp[1] = 0U;
if (ssd1673_write_cmd(driver, SSD1673_CMD_GDO_CTRL, tmp, 2)) { if (ssd1673_write_cmd(driver, SSD1673_CMD_GDO_CTRL, tmp, 2)) {
return -1; return -1;
} }
@ -441,9 +441,9 @@ static int ssd1673_controller_init(struct device *dev)
} }
ssd1673_set_orientation(driver); ssd1673_set_orientation(driver);
driver->numof_part_cycles = 0; driver->numof_part_cycles = 0U;
driver->last_lut = SSD1673_LAST_LUT_INITIAL; driver->last_lut = SSD1673_LAST_LUT_INITIAL;
driver->contrast = 0; driver->contrast = 0U;
return 0; return 0;
} }

View file

@ -58,9 +58,9 @@ static void dw_dma_isr(void *arg)
struct dw_dma_dev_data *const dev_data = DEV_DATA(dev); struct dw_dma_dev_data *const dev_data = DEV_DATA(dev);
struct dma_chan_data *chan_data; struct dma_chan_data *chan_data;
u32_t status_tfr = 0; u32_t status_tfr = 0U;
u32_t status_block = 0; u32_t status_block = 0U;
u32_t status_err = 0; u32_t status_err = 0U;
u32_t status_intr; u32_t status_intr;
u32_t channel; u32_t channel;

View file

@ -133,7 +133,7 @@ static int dma_qmsi_chan_config(struct device *dev, u32_t channel,
struct dma_qmsi_driver_data *data = dev->driver_data; struct dma_qmsi_driver_data *data = dev->driver_data;
qm_dma_transfer_t qmsi_transfer_cfg = { 0 }; qm_dma_transfer_t qmsi_transfer_cfg = { 0 };
qm_dma_channel_config_t qmsi_cfg = { 0 }; qm_dma_channel_config_t qmsi_cfg = { 0 };
u32_t temp = 0; u32_t temp = 0U;
int ret = 0; int ret = 0;
if (config->block_count != 1) { if (config->block_count != 1) {

View file

@ -243,9 +243,9 @@ static int sam_xdmac_config(struct device *dev, u32_t channel,
| XDMAC_CC_SIF_AHB_IF1 | XDMAC_CC_SIF_AHB_IF1
| XDMAC_CC_DIF_AHB_IF1 | XDMAC_CC_DIF_AHB_IF1
| XDMAC_CC_PERID(cfg->dma_slot); | XDMAC_CC_PERID(cfg->dma_slot);
channel_cfg.ds_msp = 0; channel_cfg.ds_msp = 0U;
channel_cfg.sus = 0; channel_cfg.sus = 0U;
channel_cfg.dus = 0; channel_cfg.dus = 0U;
channel_cfg.cie = channel_cfg.cie =
(cfg->complete_callback_en ? XDMAC_CIE_BIE : XDMAC_CIE_LIE) (cfg->complete_callback_en ? XDMAC_CIE_BIE : XDMAC_CIE_LIE)
| (cfg->error_callback_en ? XDMAC_INT_ERR : 0); | (cfg->error_callback_en ? XDMAC_INT_ERR : 0);

View file

@ -14,7 +14,7 @@
static u8_t entropy_mcux_rnga_get_uint8(void) static u8_t entropy_mcux_rnga_get_uint8(void)
{ {
u32_t random; u32_t random;
u8_t output = 0; u8_t output = 0U;
int i; int i;
RNGA_SetMode(RNG, kRNGA_ModeNormal); RNGA_SetMode(RNG, kRNGA_ModeNormal);

View file

@ -192,9 +192,9 @@ static int rng_pool_put(struct rng_pool *rngp, u8_t byte)
static void rng_pool_init(struct rng_pool *rngp, u16_t size, u8_t threshold) static void rng_pool_init(struct rng_pool *rngp, u16_t size, u8_t threshold)
{ {
rngp->first_alloc = 0; rngp->first_alloc = 0U;
rngp->first_read = 0; rngp->first_read = 0U;
rngp->last = 0; rngp->last = 0U;
rngp->mask = size - 1; rngp->mask = size - 1;
rngp->threshold = threshold; rngp->threshold = threshold;
} }

View file

@ -106,7 +106,7 @@ static void eth_rx(struct device *dev)
release_desc: release_desc:
/* Return ownership of the RX descriptor to the device. */ /* Return ownership of the RX descriptor to the device. */
context->rx_desc.own = 1; context->rx_desc.own = 1U;
/* Request that the device check for an available RX descriptor, since /* Request that the device check for an available RX descriptor, since
* ownership of the descriptor was just transferred to the device. * ownership of the descriptor was just transferred to the device.
@ -146,7 +146,7 @@ static void eth_tx_data(struct eth_runtime *context, u8_t *data, u16_t len)
eth_write(context->base_addr, REG_ADDR_TX_DESC_LIST, eth_write(context->base_addr, REG_ADDR_TX_DESC_LIST,
(u32_t)&context->tx_desc); (u32_t)&context->tx_desc);
context->tx_desc.own = 1; context->tx_desc.own = 1U;
/* Request that the device check for an available TX descriptor, since /* Request that the device check for an available TX descriptor, since
* ownership of the descriptor was just transferred to the device. * ownership of the descriptor was just transferred to the device.
@ -257,27 +257,27 @@ static int eth_initialize_internal(struct net_if *iface)
/* Initialize receive descriptor. */ /* Initialize receive descriptor. */
context->rx_desc.rdes0 = 0; context->rx_desc.rdes0 = 0U;
context->rx_desc.rdes1 = 0; context->rx_desc.rdes1 = 0U;
context->rx_desc.buf1_ptr = (u8_t *)context->rx_buf; context->rx_desc.buf1_ptr = (u8_t *)context->rx_buf;
context->rx_desc.first_desc = 1; context->rx_desc.first_desc = 1U;
context->rx_desc.last_desc = 1; context->rx_desc.last_desc = 1U;
context->rx_desc.own = 1; context->rx_desc.own = 1U;
context->rx_desc.rx_buf1_sz = sizeof(context->rx_buf); context->rx_desc.rx_buf1_sz = sizeof(context->rx_buf);
context->rx_desc.rx_end_of_ring = 1; context->rx_desc.rx_end_of_ring = 1U;
/* Install receive descriptor. */ /* Install receive descriptor. */
eth_write(base_addr, REG_ADDR_RX_DESC_LIST, (u32_t)&context->rx_desc); eth_write(base_addr, REG_ADDR_RX_DESC_LIST, (u32_t)&context->rx_desc);
/* Initialize transmit descriptor. */ /* Initialize transmit descriptor. */
context->tx_desc.tdes0 = 0; context->tx_desc.tdes0 = 0U;
context->tx_desc.tdes1 = 0; context->tx_desc.tdes1 = 0U;
context->tx_desc.buf1_ptr = NULL; context->tx_desc.buf1_ptr = NULL;
context->tx_desc.tx_buf1_sz = 0; context->tx_desc.tx_buf1_sz = 0U;
context->tx_desc.first_seg_in_frm = 1; context->tx_desc.first_seg_in_frm = 1U;
context->tx_desc.last_seg_in_frm = 1; context->tx_desc.last_seg_in_frm = 1U;
context->tx_desc.tx_end_of_ring = 1; context->tx_desc.tx_end_of_ring = 1U;
/* Install transmit descriptor. */ /* Install transmit descriptor. */
eth_write(context->base_addr, REG_ADDR_TX_DESC_LIST, eth_write(context->base_addr, REG_ADDR_TX_DESC_LIST,

View file

@ -115,10 +115,10 @@ static void eth_enc28j60_read_reg(struct device *dev, u16_t reg_addr,
.buffers = &rx_buf, .buffers = &rx_buf,
.count = 1 .count = 1
}; };
u8_t rx_size = 2; u8_t rx_size = 2U;
if (reg_addr & 0xF000) { if (reg_addr & 0xF000) {
rx_size = 3; rx_size = 3U;
} }
rx_buf.len = rx_size; rx_buf.len = rx_size;
@ -130,7 +130,7 @@ static void eth_enc28j60_read_reg(struct device *dev, u16_t reg_addr,
*value = buf[rx_size - 1]; *value = buf[rx_size - 1];
} else { } else {
LOG_DBG("Failure while reading register 0x%04x", reg_addr); LOG_DBG("Failure while reading register 0x%04x", reg_addr);
*value = 0; *value = 0U;
} }
} }
@ -513,12 +513,12 @@ static int eth_enc28j60_rx(struct device *dev)
do { do {
struct net_buf *pkt_buf = NULL; struct net_buf *pkt_buf = NULL;
struct net_buf *last_buf = NULL; struct net_buf *last_buf = NULL;
u16_t frm_len = 0; u16_t frm_len = 0U;
u8_t info[RSV_SIZE]; u8_t info[RSV_SIZE];
struct net_pkt *pkt; struct net_pkt *pkt;
u16_t next_packet; u16_t next_packet;
u8_t rdptl = 0; u8_t rdptl = 0U;
u8_t rdpth = 0; u8_t rdpth = 0U;
/* remove read fifo address to packet header address */ /* remove read fifo address to packet header address */
eth_enc28j60_set_bank(dev, ENC28J60_REG_ERXRDPTL); eth_enc28j60_set_bank(dev, ENC28J60_REG_ERXRDPTL);

View file

@ -182,7 +182,7 @@ static inline struct net_if *get_iface(struct eth_context *ctx, u16_t vlan_tag)
static void eth_mcux_phy_enter_reset(struct eth_context *context) static void eth_mcux_phy_enter_reset(struct eth_context *context)
{ {
const u32_t phy_addr = 0; const u32_t phy_addr = 0U;
/* Reset the PHY. */ /* Reset the PHY. */
ENET_StartSMIWrite(ENET, phy_addr, PHY_BASICCONTROL_REG, ENET_StartSMIWrite(ENET, phy_addr, PHY_BASICCONTROL_REG,
@ -193,7 +193,7 @@ static void eth_mcux_phy_enter_reset(struct eth_context *context)
static void eth_mcux_phy_start(struct eth_context *context) static void eth_mcux_phy_start(struct eth_context *context)
{ {
const u32_t phy_addr = 0; const u32_t phy_addr = 0U;
#ifdef CONFIG_ETH_MCUX_PHY_EXTRA_DEBUG #ifdef CONFIG_ETH_MCUX_PHY_EXTRA_DEBUG
LOG_DBG("phy_state=%s", phy_state_name(context->phy_state)); LOG_DBG("phy_state=%s", phy_state_name(context->phy_state));
#endif #endif
@ -259,7 +259,7 @@ static void eth_mcux_phy_event(struct eth_context *context)
bool link_up; bool link_up;
phy_duplex_t phy_duplex = kPHY_FullDuplex; phy_duplex_t phy_duplex = kPHY_FullDuplex;
phy_speed_t phy_speed = kPHY_Speed100M; phy_speed_t phy_speed = kPHY_Speed100M;
const u32_t phy_addr = 0; const u32_t phy_addr = 0U;
#ifdef CONFIG_ETH_MCUX_PHY_EXTRA_DEBUG #ifdef CONFIG_ETH_MCUX_PHY_EXTRA_DEBUG
LOG_DBG("phy_state=%s", phy_state_name(context->phy_state)); LOG_DBG("phy_state=%s", phy_state_name(context->phy_state));
@ -532,7 +532,7 @@ static void eth_rx(struct device *iface)
struct net_buf *prev_buf; struct net_buf *prev_buf;
struct net_pkt *pkt; struct net_pkt *pkt;
const u8_t *src; const u8_t *src;
u32_t frame_length = 0; u32_t frame_length = 0U;
status_t status; status_t status;
unsigned int imask; unsigned int imask;
u16_t vlan_tag = NET_VLAN_TAG_UNSPEC; u16_t vlan_tag = NET_VLAN_TAG_UNSPEC;

View file

@ -195,8 +195,8 @@ static inline void gmac_desc_append_w1(struct gmac_desc *desc, u32_t value)
*/ */
static void ring_buf_reset(struct ring_buf *rb) static void ring_buf_reset(struct ring_buf *rb)
{ {
rb->head = 0; rb->head = 0U;
rb->tail = 0; rb->tail = 0U;
} }
/* /*
@ -270,8 +270,8 @@ static int rx_descriptors_init(Gmac *gmac, struct gmac_queue *queue)
__ASSERT_NO_MSG(rx_frag_list->buf); __ASSERT_NO_MSG(rx_frag_list->buf);
rx_desc_list->tail = 0; rx_desc_list->tail = 0U;
rx_frag_list->tail = 0; rx_frag_list->tail = 0U;
for (int i = 0; i < rx_desc_list->len; i++) { for (int i = 0; i < rx_desc_list->len; i++) {
rx_buf = net_pkt_get_reserve_rx_data(0, K_NO_WAIT); rx_buf = net_pkt_get_reserve_rx_data(0, K_NO_WAIT);
@ -308,8 +308,8 @@ static void tx_descriptors_init(Gmac *gmac, struct gmac_queue *queue)
{ {
struct gmac_desc_list *tx_desc_list = &queue->tx_desc_list; struct gmac_desc_list *tx_desc_list = &queue->tx_desc_list;
tx_desc_list->head = 0; tx_desc_list->head = 0U;
tx_desc_list->tail = 0; tx_desc_list->tail = 0U;
for (int i = 0; i < tx_desc_list->len; i++) { for (int i = 0; i < tx_desc_list->len; i++) {
gmac_desc_set_w0(&tx_desc_list->buf[i], 0); gmac_desc_set_w0(&tx_desc_list->buf[i], 0);
@ -602,8 +602,8 @@ static void rx_error_handler(Gmac *gmac, struct gmac_queue *queue)
/* Stop reception */ /* Stop reception */
gmac->GMAC_NCR &= ~GMAC_NCR_RXEN; gmac->GMAC_NCR &= ~GMAC_NCR_RXEN;
queue->rx_desc_list.tail = 0; queue->rx_desc_list.tail = 0U;
queue->rx_frag_list.tail = 0; queue->rx_frag_list.tail = 0U;
for (int i = 0; i < queue->rx_desc_list.len; i++) { for (int i = 0; i < queue->rx_desc_list.len; i++) {
gmac_desc_set_w1(&queue->rx_desc_list.buf[i], 0); gmac_desc_set_w1(&queue->rx_desc_list.buf[i], 0);
@ -829,8 +829,8 @@ static void gmac_setup_ptp_clock_divisors(Gmac *gmac)
} }
nit = min_cycles - 1; nit = min_cycles - 1;
cns = 0; cns = 0U;
acns = 0; acns = 0U;
while ((cns + 2) * nit < min_period) { while ((cns + 2) * nit < min_period) {
cns++; cns++;
@ -985,9 +985,9 @@ static int nonpriority_queue_init(Gmac *gmac, struct gmac_queue *queue)
/* Setup RX/TX completion and error interrupts */ /* Setup RX/TX completion and error interrupts */
gmac->GMAC_IER = GMAC_INT_EN_FLAGS; gmac->GMAC_IER = GMAC_INT_EN_FLAGS;
queue->err_rx_frames_dropped = 0; queue->err_rx_frames_dropped = 0U;
queue->err_rx_flushed_count = 0; queue->err_rx_flushed_count = 0U;
queue->err_tx_flushed_count = 0; queue->err_tx_flushed_count = 0U;
LOG_INF("Queue %d activated", queue->que_idx); LOG_INF("Queue %d activated", queue->que_idx);
@ -1035,9 +1035,9 @@ static int priority_queue_init(Gmac *gmac, struct gmac_queue *queue)
/* Enable RX/TX completion and error interrupts */ /* Enable RX/TX completion and error interrupts */
gmac->GMAC_IERPQ[queue_index] = GMAC_INTPQ_EN_FLAGS; gmac->GMAC_IERPQ[queue_index] = GMAC_INTPQ_EN_FLAGS;
queue->err_rx_frames_dropped = 0; queue->err_rx_frames_dropped = 0U;
queue->err_rx_flushed_count = 0; queue->err_rx_flushed_count = 0U;
queue->err_tx_flushed_count = 0; queue->err_tx_flushed_count = 0U;
return 0; return 0;
} }
@ -1096,7 +1096,7 @@ static struct net_pkt *frame_get(struct gmac_queue *queue)
struct net_buf *last_frag = NULL; struct net_buf *last_frag = NULL;
u8_t *frag_data; u8_t *frag_data;
u32_t frag_len; u32_t frag_len;
u32_t frame_len = 0; u32_t frame_len = 0U;
u16_t tail; u16_t tail;
u8_t wrap; u8_t wrap;

View file

@ -39,7 +39,7 @@ static void mdio_bus_disable(Gmac *gmac)
/* Wait PHY operation complete. */ /* Wait PHY operation complete. */
static int mdio_bus_wait(Gmac *gmac) static int mdio_bus_wait(Gmac *gmac)
{ {
u32_t retries = 100; /* will wait up to 1 s */ u32_t retries = 100U; /* will wait up to 1 s */
while (!(gmac->GMAC_NSR & GMAC_NSR_IDLE)) { while (!(gmac->GMAC_NSR & GMAC_NSR_IDLE)) {
if (retries-- == 0) { if (retries-- == 0) {
@ -109,7 +109,7 @@ static int phy_write(const struct phy_sam_gmac_dev *phy, u8_t reg_addr,
static int phy_soft_reset(const struct phy_sam_gmac_dev *phy) static int phy_soft_reset(const struct phy_sam_gmac_dev *phy)
{ {
u32_t phy_reg; u32_t phy_reg;
u32_t retries = 12; u32_t retries = 12U;
int retval; int retval;
/* Issue a soft reset */ /* Issue a soft reset */

View file

@ -145,7 +145,7 @@ static int flash_sam0_write_page(struct device *dev, off_t offset,
static int flash_sam0_erase_row(struct device *dev, off_t offset) static int flash_sam0_erase_row(struct device *dev, off_t offset)
{ {
*FLASH_MEM(offset) = 0; *FLASH_MEM(offset) = 0U;
NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMD_ER | NVMCTRL_CTRLA_CMDEX_KEY; NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMD_ER | NVMCTRL_CTRLA_CMDEX_KEY;
return flash_sam0_check_status(offset); return flash_sam0_check_status(offset);
@ -318,7 +318,7 @@ static int flash_sam0_write_protection(struct device *dev, bool enable)
for (offset = 0; offset < CONFIG_FLASH_SIZE * 1024; for (offset = 0; offset < CONFIG_FLASH_SIZE * 1024;
offset += LOCK_REGION_SIZE) { offset += LOCK_REGION_SIZE) {
*FLASH_MEM(offset) = 0; *FLASH_MEM(offset) = 0U;
if (enable) { if (enable) {
NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMD_LR | NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMD_LR |

View file

@ -12,10 +12,10 @@
static int flash_stm32_erase(struct device *dev, off_t offset, size_t size) static int flash_stm32_erase(struct device *dev, off_t offset, size_t size)
{ {
u32_t first_page_addr = 0; u32_t first_page_addr = 0U;
u32_t last_page_addr = 0; u32_t last_page_addr = 0U;
u16_t no_of_pages = size / CONFIG_FLASH_PAGE_SIZE; u16_t no_of_pages = size / CONFIG_FLASH_PAGE_SIZE;
u16_t page_index = 0; u16_t page_index = 0U;
/* Check offset and size alignment. */ /* Check offset and size alignment. */
if (((offset % CONFIG_FLASH_PAGE_SIZE) != 0) || if (((offset % CONFIG_FLASH_PAGE_SIZE) != 0) ||
@ -67,15 +67,15 @@ static int flash_stm32_read(struct device *dev, off_t offset,
static int flash_stm32_write(struct device *dev, off_t offset, static int flash_stm32_write(struct device *dev, off_t offset,
const void *data, size_t len) const void *data, size_t len)
{ {
u16_t halfword = 0; u16_t halfword = 0U;
u32_t address = u32_t address =
CONFIG_FLASH_BASE_ADDRESS + offset; CONFIG_FLASH_BASE_ADDRESS + offset;
u8_t remainder = 0; u8_t remainder = 0U;
if ((len % 2) != 0) { if ((len % 2) != 0) {
remainder = 1; remainder = 1U;
} }
len = len / 2; len = len / 2;

View file

@ -92,9 +92,9 @@ static int flash_nios2_qspi_erase(struct device *dev, off_t offset, size_t len)
break; break;
} }
block_offset = 0; /* block offset in byte addressing */ block_offset = 0U; /* block offset in byte addressing */
offset_in_block = 0; /* offset into current sector to erase */ offset_in_block = 0U; /* offset into current sector to erase */
length_to_erase = 0; /* length to erase in current sector */ length_to_erase = 0U; /* length to erase in current sector */
/* calculate current sector/block offset in byte addressing */ /* calculate current sector/block offset in byte addressing */
block_offset = erase_offset & ~(qspi_dev->sector_size - 1); block_offset = erase_offset & ~(qspi_dev->sector_size - 1);
@ -161,7 +161,7 @@ static int flash_nios2_qspi_write_block(struct device *dev, int block_offset,
{ {
struct flash_nios2_qspi_config *flash_cfg = dev->driver_data; struct flash_nios2_qspi_config *flash_cfg = dev->driver_data;
alt_qspi_controller2_dev *qspi_dev = &flash_cfg->qspi_dev; alt_qspi_controller2_dev *qspi_dev = &flash_cfg->qspi_dev;
u32_t buffer_offset = 0; /* offset into data buffer to get write data */ u32_t buffer_offset = 0U; /* offset into data buffer to get write data */
u32_t remaining_length = len; /* length left to write */ u32_t remaining_length = len; /* length left to write */
u32_t write_offset = mem_offset; /* offset into flash to write too */ u32_t write_offset = mem_offset; /* offset into flash to write too */
u32_t word_to_write, padding, bytes_to_copy; u32_t word_to_write, padding, bytes_to_copy;
@ -173,7 +173,7 @@ static int flash_nios2_qspi_write_block(struct device *dev, int block_offset,
word_to_write = NIOS2_QSPI_BLANK_WORD; word_to_write = NIOS2_QSPI_BLANK_WORD;
/* bytes to pad the next word that is written */ /* bytes to pad the next word that is written */
padding = 0; padding = 0U;
/* number of bytes from source to copy */ /* number of bytes from source to copy */
bytes_to_copy = NIOS2_WRITE_BLOCK_SIZE; bytes_to_copy = NIOS2_WRITE_BLOCK_SIZE;
@ -260,7 +260,7 @@ static int flash_nios2_qspi_write(struct device *dev, off_t offset,
alt_qspi_controller2_dev *qspi_dev = &flash_cfg->qspi_dev; alt_qspi_controller2_dev *qspi_dev = &flash_cfg->qspi_dev;
u32_t block_offset, offset_in_block, length_to_write; u32_t block_offset, offset_in_block, length_to_write;
u32_t write_offset = offset; /* address of next byte to write */ u32_t write_offset = offset; /* address of next byte to write */
u32_t buffer_offset = 0; /* offset into source buffer */ u32_t buffer_offset = 0U; /* offset into source buffer */
u32_t remaining_length = len; /* length of data left to be written */ u32_t remaining_length = len; /* length of data left to be written */
s32_t rc = 0, i; s32_t rc = 0, i;
@ -284,9 +284,9 @@ static int flash_nios2_qspi_write(struct device *dev, off_t offset,
break; break;
} }
block_offset = 0; /* block offset in byte addressing */ block_offset = 0U; /* block offset in byte addressing */
offset_in_block = 0; /* offset into current sector to write */ offset_in_block = 0U; /* offset into current sector to write */
length_to_write = 0; /* length to write to current sector */ length_to_write = 0U; /* length to write to current sector */
/* calculate current sector/block offset in byte addressing */ /* calculate current sector/block offset in byte addressing */
block_offset = write_offset & ~(qspi_dev->sector_size - 1); block_offset = write_offset & ~(qspi_dev->sector_size - 1);
@ -324,7 +324,7 @@ static int flash_nios2_qspi_read(struct device *dev, off_t offset,
{ {
struct flash_nios2_qspi_config *flash_cfg = dev->driver_data; struct flash_nios2_qspi_config *flash_cfg = dev->driver_data;
alt_qspi_controller2_dev *qspi_dev = &flash_cfg->qspi_dev; alt_qspi_controller2_dev *qspi_dev = &flash_cfg->qspi_dev;
u32_t buffer_offset = 0; /* offset into data buffer to get read data */ u32_t buffer_offset = 0U; /* offset into data buffer to get read data */
u32_t remaining_length = len; /* length left to read */ u32_t remaining_length = len; /* length left to read */
u32_t read_offset = offset; /* offset into flash to read from */ u32_t read_offset = offset; /* offset into flash to read from */
u32_t word_to_read, bytes_to_copy; u32_t word_to_read, bytes_to_copy;

View file

@ -407,9 +407,9 @@ static int erase_op(void *context)
struct flash_context *e_ctx = context; struct flash_context *e_ctx = context;
#if defined(CONFIG_SOC_FLASH_NRF_RADIO_SYNC) #if defined(CONFIG_SOC_FLASH_NRF_RADIO_SYNC)
u32_t ticks_begin = 0; u32_t ticks_begin = 0U;
u32_t ticks_diff; u32_t ticks_diff;
u32_t i = 0; u32_t i = 0U;
if (e_ctx->enable_time_limit) { if (e_ctx->enable_time_limit) {
ticks_begin = ticker_ticks_now_get(); ticks_begin = ticker_ticks_now_get();
@ -464,9 +464,9 @@ static int write_op(void *context)
u32_t count; u32_t count;
#if defined(CONFIG_SOC_FLASH_NRF_RADIO_SYNC) #if defined(CONFIG_SOC_FLASH_NRF_RADIO_SYNC)
u32_t ticks_begin = 0; u32_t ticks_begin = 0U;
u32_t ticks_diff; u32_t ticks_diff;
u32_t i = 1; u32_t i = 1U;
if (w_ctx->enable_time_limit) { if (w_ctx->enable_time_limit) {
ticks_begin = ticker_ticks_now_get(); ticks_begin = ticker_ticks_now_get();

View file

@ -115,7 +115,7 @@ static int flash_qmsi_write(struct device *dev, off_t addr,
{ {
qm_flash_t flash = QM_FLASH_0; qm_flash_t flash = QM_FLASH_0;
qm_flash_region_t reg; qm_flash_region_t reg;
u32_t data_word = 0, offset = 0, f_addr = 0; u32_t data_word = 0U, offset = 0U, f_addr = 0U;
if ((!is_aligned_32(len)) || (!is_aligned_32(addr))) { if ((!is_aligned_32(len)) || (!is_aligned_32(addr))) {
return -EINVAL; return -EINVAL;
@ -173,7 +173,7 @@ static int flash_qmsi_erase(struct device *dev, off_t addr, size_t size)
{ {
qm_flash_t flash = QM_FLASH_0; qm_flash_t flash = QM_FLASH_0;
qm_flash_region_t reg; qm_flash_region_t reg;
u32_t page = 0; u32_t page = 0U;
/* starting address needs to be a 2KB aligned address */ /* starting address needs to be a 2KB aligned address */
if (addr & QM_FLASH_ADDRESS_MASK) { if (addr & QM_FLASH_ADDRESS_MASK) {

View file

@ -184,7 +184,7 @@ static int spi_flash_wb_write(struct device *dev, off_t offset,
static int spi_flash_wb_write_protection_set(struct device *dev, bool enable) static int spi_flash_wb_write_protection_set(struct device *dev, bool enable)
{ {
struct spi_flash_data *const driver_data = dev->driver_data; struct spi_flash_data *const driver_data = dev->driver_data;
u8_t reg = 0; u8_t reg = 0U;
int ret; int ret;
SYNC_LOCK(); SYNC_LOCK();

View file

@ -227,7 +227,7 @@ static int gpio_cc2650_config(struct device *port, int access_op,
return gpio_cc2650_config_pin(pin, flags); return gpio_cc2650_config_pin(pin, flags);
} }
const u32_t nb_pins = 32; const u32_t nb_pins = 32U;
for (u8_t i = 0; i < nb_pins; ++i) { for (u8_t i = 0; i < nb_pins; ++i) {
if (pin & 0x1 && if (pin & 0x1 &&
@ -257,7 +257,7 @@ static int gpio_cc2650_write(struct device *port, int access_op,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
gpio_cc2650_write_pin(pin, value); gpio_cc2650_write_pin(pin, value);
} else { } else {
const u32_t nb_pins = 32; const u32_t nb_pins = 32U;
for (u32_t i = 0; i < nb_pins; ++i) { for (u32_t i = 0; i < nb_pins; ++i) {
if (pin & 0x1) { if (pin & 0x1) {
@ -279,7 +279,7 @@ static int gpio_cc2650_read(struct device *port, int access_op,
gpio_cc2650_read_pin(pin, value); gpio_cc2650_read_pin(pin, value);
*value >>= pin; *value >>= pin;
} else { } else {
const u32_t nb_pins = 32; const u32_t nb_pins = 32U;
for (u32_t i = 0; i < nb_pins; ++i) { for (u32_t i = 0; i < nb_pins; ++i) {
if (pin & 0x1) { if (pin & 0x1) {

View file

@ -158,7 +158,7 @@ static int gpio_cc32xx_disable_callback(struct device *dev,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
data->pin_callback_enables &= ~(1 << pin); data->pin_callback_enables &= ~(1 << pin);
} else { } else {
data->pin_callback_enables = 0; data->pin_callback_enables = 0U;
} }
return 0; return 0;

View file

@ -74,7 +74,7 @@ static int gpio_gecko_configure(struct device *dev,
GPIO_P_TypeDef *gpio_base = config->gpio_base; GPIO_P_TypeDef *gpio_base = config->gpio_base;
GPIO_Port_TypeDef gpio_index = config->gpio_index; GPIO_Port_TypeDef gpio_index = config->gpio_index;
GPIO_Mode_TypeDef mode; GPIO_Mode_TypeDef mode;
unsigned int out = 0; unsigned int out = 0U;
/* Check for an invalid pin configuration */ /* Check for an invalid pin configuration */
if ((flags & GPIO_INT) && (flags & GPIO_DIR_OUT)) { if ((flags & GPIO_INT) && (flags & GPIO_DIR_OUT)) {
@ -94,7 +94,7 @@ static int gpio_gecko_configure(struct device *dev,
if ((flags & GPIO_DIR_MASK) == GPIO_DIR_IN) { if ((flags & GPIO_DIR_MASK) == GPIO_DIR_IN) {
if ((flags & GPIO_PUD_MASK) == GPIO_PUD_PULL_UP) { if ((flags & GPIO_PUD_MASK) == GPIO_PUD_PULL_UP) {
mode = gpioModeInputPull; mode = gpioModeInputPull;
out = 1; /* pull-up*/ out = 1U; /* pull-up*/
} else if ((flags & GPIO_PUD_MASK) == GPIO_PUD_PULL_DOWN) { } else if ((flags & GPIO_PUD_MASK) == GPIO_PUD_PULL_DOWN) {
mode = gpioModeInputPull; mode = gpioModeInputPull;
/* out = 0 means pull-down*/ /* out = 0 means pull-down*/

View file

@ -65,7 +65,7 @@ static int imx_gpio_configure(struct device *dev,
GPIO_Init(config->base, &pin_config); GPIO_Init(config->base, &pin_config);
GPIO_SetIntEdgeSelect(config->base, pin, double_edge); GPIO_SetIntEdgeSelect(config->base, pin, double_edge);
} else { /* GPIO_ACCESS_BY_PORT */ } else { /* GPIO_ACCESS_BY_PORT */
for (i = 0; i < 32; i++) { for (i = 0U; i < 32; i++) {
pin_config.pin = i; pin_config.pin = i;
GPIO_Init(config->base, &pin_config); GPIO_Init(config->base, &pin_config);
GPIO_SetIntEdgeSelect(config->base, i, double_edge); GPIO_SetIntEdgeSelect(config->base, i, double_edge);
@ -126,7 +126,7 @@ static int imx_gpio_enable_callback(struct device *dev,
GPIO_SetPinIntMode(config->base, pin, true); GPIO_SetPinIntMode(config->base, pin, true);
} else { } else {
data->pin_callback_enables = 0xFFFFFFFF; data->pin_callback_enables = 0xFFFFFFFF;
for (i = 0; i < 32; i++) { for (i = 0U; i < 32; i++) {
GPIO_SetPinIntMode(config->base, i, true); GPIO_SetPinIntMode(config->base, i, true);
} }
} }
@ -145,10 +145,10 @@ static int imx_gpio_disable_callback(struct device *dev,
GPIO_SetPinIntMode(config->base, pin, false); GPIO_SetPinIntMode(config->base, pin, false);
data->pin_callback_enables &= ~BIT(pin); data->pin_callback_enables &= ~BIT(pin);
} else { } else {
for (i = 0; i < 32; i++) { for (i = 0U; i < 32; i++) {
GPIO_SetPinIntMode(config->base, i, false); GPIO_SetPinIntMode(config->base, i, false);
} }
data->pin_callback_enables = 0; data->pin_callback_enables = 0U;
} }
return 0; return 0;

View file

@ -34,8 +34,8 @@ static int gpio_mcux_configure(struct device *dev,
GPIO_Type *gpio_base = config->gpio_base; GPIO_Type *gpio_base = config->gpio_base;
PORT_Type *port_base = config->port_base; PORT_Type *port_base = config->port_base;
port_interrupt_t port_interrupt = 0; port_interrupt_t port_interrupt = 0;
u32_t mask = 0; u32_t mask = 0U;
u32_t pcr = 0; u32_t pcr = 0U;
u8_t i; u8_t i;
/* Check for an invalid pin configuration */ /* Check for an invalid pin configuration */
@ -116,7 +116,7 @@ static int gpio_mcux_configure(struct device *dev,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
port_base->PCR[pin] = (port_base->PCR[pin] & ~mask) | pcr; port_base->PCR[pin] = (port_base->PCR[pin] & ~mask) | pcr;
} else { /* GPIO_ACCESS_BY_PORT */ } else { /* GPIO_ACCESS_BY_PORT */
for (i = 0; i < ARRAY_SIZE(port_base->PCR); i++) { for (i = 0U; i < ARRAY_SIZE(port_base->PCR); i++) {
port_base->PCR[i] = (port_base->PCR[pin] & ~mask) | pcr; port_base->PCR[i] = (port_base->PCR[pin] & ~mask) | pcr;
} }
} }
@ -201,7 +201,7 @@ static int gpio_mcux_disable_callback(struct device *dev,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
data->pin_callback_enables &= ~BIT(pin); data->pin_callback_enables &= ~BIT(pin);
} else { } else {
data->pin_callback_enables = 0; data->pin_callback_enables = 0U;
} }
return 0; return 0;

View file

@ -66,7 +66,7 @@ static int mcux_igpio_configure(struct device *dev,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
GPIO_PinInit(config->base, pin, &pin_config); GPIO_PinInit(config->base, pin, &pin_config);
} else { /* GPIO_ACCESS_BY_PORT */ } else { /* GPIO_ACCESS_BY_PORT */
for (i = 0; i < 32; i++) { for (i = 0U; i < 32; i++) {
GPIO_PinInit(config->base, i, &pin_config); GPIO_PinInit(config->base, i, &pin_config);
} }
} }
@ -140,7 +140,7 @@ static int mcux_igpio_disable_callback(struct device *dev,
data->pin_callback_enables &= ~BIT(pin); data->pin_callback_enables &= ~BIT(pin);
} else { } else {
GPIO_PortDisableInterrupts(config->base, 0); GPIO_PortDisableInterrupts(config->base, 0);
data->pin_callback_enables = 0; data->pin_callback_enables = 0U;
} }
return 0; return 0;

View file

@ -181,8 +181,8 @@ static int gpio_nrfx_config(struct device *port, int access_op,
: NRF_GPIO_PIN_INPUT_DISCONNECT; : NRF_GPIO_PIN_INPUT_DISCONNECT;
if (access_op == GPIO_ACCESS_BY_PORT) { if (access_op == GPIO_ACCESS_BY_PORT) {
from_pin = 0; from_pin = 0U;
to_pin = 31; to_pin = 31U;
} else { } else {
from_pin = pin; from_pin = pin;
to_pin = pin; to_pin = pin;
@ -270,8 +270,8 @@ static int gpio_nrfx_pin_manage_callback(struct device *port,
u8_t to_pin; u8_t to_pin;
if (access_op == GPIO_ACCESS_BY_PORT) { if (access_op == GPIO_ACCESS_BY_PORT) {
from_pin = 0; from_pin = 0U;
to_pin = 31; to_pin = 31U;
} else { } else {
from_pin = pin; from_pin = pin;
to_pin = pin; to_pin = pin;

View file

@ -154,7 +154,7 @@ static int _setup_pin_dir(struct device *dev, int access_op,
(struct gpio_pcal9535a_drv_data * const)dev->driver_data; (struct gpio_pcal9535a_drv_data * const)dev->driver_data;
union gpio_pcal9535a_port_data *port = &drv_data->reg_cache.dir; union gpio_pcal9535a_port_data *port = &drv_data->reg_cache.dir;
u16_t bit_mask; u16_t bit_mask;
u16_t new_value = 0; u16_t new_value = 0U;
int ret; int ret;
switch (access_op) { switch (access_op) {
@ -206,7 +206,7 @@ static int _setup_pin_pullupdown(struct device *dev, int access_op,
(struct gpio_pcal9535a_drv_data * const)dev->driver_data; (struct gpio_pcal9535a_drv_data * const)dev->driver_data;
union gpio_pcal9535a_port_data *port; union gpio_pcal9535a_port_data *port;
u16_t bit_mask; u16_t bit_mask;
u16_t new_value = 0; u16_t new_value = 0U;
int ret; int ret;
/* If disabling pull up/down, there is no need to set the selection /* If disabling pull up/down, there is no need to set the selection
@ -299,7 +299,7 @@ static int _setup_pin_polarity(struct device *dev, int access_op,
(struct gpio_pcal9535a_drv_data * const)dev->driver_data; (struct gpio_pcal9535a_drv_data * const)dev->driver_data;
union gpio_pcal9535a_port_data *port = &drv_data->reg_cache.pol_inv; union gpio_pcal9535a_port_data *port = &drv_data->reg_cache.pol_inv;
u16_t bit_mask; u16_t bit_mask;
u16_t new_value = 0; u16_t new_value = 0U;
int ret; int ret;
switch (access_op) { switch (access_op) {

View file

@ -336,7 +336,7 @@ static inline int gpio_qmsi_disable_callback(struct device *port,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
context->pin_callbacks &= ~BIT(pin); context->pin_callbacks &= ~BIT(pin);
} else { } else {
context->pin_callbacks = 0; context->pin_callbacks = 0U;
} }
if (IS_ENABLED(CONFIG_GPIO_QMSI_API_REENTRANCY)) { if (IS_ENABLED(CONFIG_GPIO_QMSI_API_REENTRANCY)) {

View file

@ -329,7 +329,7 @@ static inline int ss_gpio_qmsi_disable_callback(struct device *port,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
context->pin_callbacks &= ~BIT(pin); context->pin_callbacks &= ~BIT(pin);
} else { } else {
context->pin_callbacks = 0; context->pin_callbacks = 0U;
} }
if (IS_ENABLED(CONFIG_GPIO_QMSI_API_REENTRANCY)) { if (IS_ENABLED(CONFIG_GPIO_QMSI_API_REENTRANCY)) {

View file

@ -89,17 +89,17 @@ static void _gpio_pin_config(struct device *dev, u32_t pin, int flags)
{ {
const struct gpio_sch_config *info = dev->config->config_info; const struct gpio_sch_config *info = dev->config->config_info;
struct gpio_sch_data *gpio = dev->driver_data; struct gpio_sch_data *gpio = dev->driver_data;
u8_t active_high = 0; u8_t active_high = 0U;
u8_t active_low = 0; u8_t active_low = 0U;
_set_bit_gen(info->regs, pin, 1); _set_bit_gen(info->regs, pin, 1);
_set_bit_gio(info->regs, pin, !(flags & GPIO_DIR_MASK)); _set_bit_gio(info->regs, pin, !(flags & GPIO_DIR_MASK));
if (flags & GPIO_INT) { if (flags & GPIO_INT) {
if (flags & GPIO_INT_ACTIVE_HIGH) { if (flags & GPIO_INT_ACTIVE_HIGH) {
active_high = 1; active_high = 1U;
} else { } else {
active_low = 1; active_low = 1U;
} }
LOG_DBG("Setting up pin %d to active_high %d and " LOG_DBG("Setting up pin %d to active_high %d and "
@ -217,7 +217,7 @@ static void _gpio_sch_manage_callback(struct device *dev)
if (!sys_slist_is_empty(&gpio->callbacks) && gpio->cb_enabled) { if (!sys_slist_is_empty(&gpio->callbacks) && gpio->cb_enabled) {
if (!gpio->poll) { if (!gpio->poll) {
LOG_DBG("Starting SCH GPIO polling thread"); LOG_DBG("Starting SCH GPIO polling thread");
gpio->poll = 1; gpio->poll = 1U;
k_thread_create(&gpio->polling_thread, k_thread_create(&gpio->polling_thread,
gpio->polling_stack, gpio->polling_stack,
GPIO_SCH_POLLING_STACK_SIZE, GPIO_SCH_POLLING_STACK_SIZE,
@ -226,7 +226,7 @@ static void _gpio_sch_manage_callback(struct device *dev)
K_PRIO_COOP(1), 0, 0); K_PRIO_COOP(1), 0, 0);
} }
} else { } else {
gpio->poll = 0; gpio->poll = 0U;
} }
} }
@ -290,7 +290,7 @@ static int gpio_sch_disable_callback(struct device *dev,
_write_gtpe(0, info->regs); _write_gtpe(0, info->regs);
_write_gtne(0, info->regs); _write_gtne(0, info->regs);
gpio->cb_enabled = 0; gpio->cb_enabled = 0U;
} }
_gpio_sch_manage_callback(dev); _gpio_sch_manage_callback(dev);

View file

@ -48,7 +48,7 @@ static const struct args_number args_no = {
static int cmd_gpio_conf(const struct shell *shell, size_t argc, char **argv) static int cmd_gpio_conf(const struct shell *shell, size_t argc, char **argv)
{ {
u8_t index = 0; u8_t index = 0U;
int type = GPIO_DIR_OUT; int type = GPIO_DIR_OUT;
struct device *dev; struct device *dev;
@ -85,8 +85,8 @@ static int cmd_gpio_get(const struct shell *shell,
size_t argc, char **argv) size_t argc, char **argv)
{ {
struct device *dev; struct device *dev;
u8_t index = 0; u8_t index = 0U;
u32_t value = 0; u32_t value = 0U;
int rc; int rc;
if (argc == args_no.get && isdigit((unsigned char)argv[args_indx.index][0])) { if (argc == args_no.get && isdigit((unsigned char)argv[args_indx.index][0])) {
@ -120,8 +120,8 @@ static int cmd_gpio_set(const struct shell *shell,
size_t argc, char **argv) size_t argc, char **argv)
{ {
struct device *dev; struct device *dev;
u8_t index = 0; u8_t index = 0U;
u8_t value = 0; u8_t value = 0U;
if (argc == args_no.set && if (argc == args_no.set &&
isdigit((unsigned char)argv[args_indx.index][0]) && isdigit((unsigned char)argv[args_indx.index][0]) &&

View file

@ -339,14 +339,14 @@ static int gpio_sifive_init(struct device *dev)
const struct gpio_sifive_config *cfg = DEV_GPIO_CFG(dev); const struct gpio_sifive_config *cfg = DEV_GPIO_CFG(dev);
/* Ensure that all gpio registers are reset to 0 initially */ /* Ensure that all gpio registers are reset to 0 initially */
gpio->in_en = 0; gpio->in_en = 0U;
gpio->out_en = 0; gpio->out_en = 0U;
gpio->pue = 0; gpio->pue = 0U;
gpio->rise_ie = 0; gpio->rise_ie = 0U;
gpio->fall_ie = 0; gpio->fall_ie = 0U;
gpio->high_ie = 0; gpio->high_ie = 0U;
gpio->low_ie = 0; gpio->low_ie = 0U;
gpio->invert = 0; gpio->invert = 0U;
/* Setup IRQ handler for each gpio pin */ /* Setup IRQ handler for each gpio pin */
cfg->gpio_cfg_func(); cfg->gpio_cfg_func();

View file

@ -131,13 +131,13 @@ static u32_t clk_div_calc(struct device *dev)
switch (I2C_SPEED_GET(dev_data->dev_config)) { switch (I2C_SPEED_GET(dev_data->dev_config)) {
case I2C_SPEED_STANDARD: case I2C_SPEED_STANDARD:
i2c_clk = 100000 * 2; i2c_clk = 100000 * 2;
i2c_h_min_time = 4000; i2c_h_min_time = 4000U;
i2c_l_min_time = 4700; i2c_l_min_time = 4700U;
break; break;
case I2C_SPEED_FAST: case I2C_SPEED_FAST:
i2c_clk = 400000 * 2; i2c_clk = 400000 * 2;
i2c_h_min_time = 600; i2c_h_min_time = 600U;
i2c_l_min_time = 1300; i2c_l_min_time = 1300U;
break; break;
default: default:
/* Return 0 as error */ /* Return 0 as error */
@ -159,7 +159,7 @@ static u32_t clk_div_calc(struct device *dev)
cldiv_min = (i2c_l_min_time * mck / 1000) - 4 + 1; cldiv_min = (i2c_l_min_time * mck / 1000) - 4 + 1;
chdiv_min = (i2c_h_min_time * mck / 1000) - 4 + 1; chdiv_min = (i2c_h_min_time * mck / 1000) - 4 + 1;
ckdiv = 0; ckdiv = 0U;
while (cldiv > 255) { while (cldiv > 255) {
ckdiv++; ckdiv++;
@ -195,7 +195,7 @@ static int i2c_sam3_runtime_configure(struct device *dev, u32_t config)
u32_t clk; u32_t clk;
dev_data->dev_config = config; dev_data->dev_config = config;
reg = 0; reg = 0U;
/* Calculate clock dividers */ /* Calculate clock dividers */
clk = clk_div_calc(dev); clk = clk_div_calc(dev);
@ -288,7 +288,7 @@ static inline void transfer_setup(struct device *dev, u16_t slave_address)
/* 7-bit slave addressing */ /* 7-bit slave addressing */
mmr = TWI_MMR_DADR(slave_address); mmr = TWI_MMR_DADR(slave_address);
iadr = 0; iadr = 0U;
} }
cfg->regs->TWI_MMR = mmr; cfg->regs->TWI_MMR = mmr;
@ -361,7 +361,7 @@ static inline int msg_read(struct device *dev)
* reading from slave. If the previous message is also read, * reading from slave. If the previous message is also read,
* there is no need to set the START bit again. * there is no need to set the START bit again.
*/ */
ctrl_reg = 0; ctrl_reg = 0U;
if (dev_data->xfr_flags & I2C_MSG_RESTART) { if (dev_data->xfr_flags & I2C_MSG_RESTART) {
ctrl_reg = TWI_CR_START; ctrl_reg = TWI_CR_START;
} }
@ -390,7 +390,7 @@ static inline int msg_read(struct device *dev)
if (dev_data->xfr_len > 1) { if (dev_data->xfr_len > 1) {
last_len = dev_data->xfr_len - 1; last_len = dev_data->xfr_len - 1;
} else { } else {
last_len = 1; last_len = 1U;
/* Set STOP bit for last byte. /* Set STOP bit for last byte.
* The extra check here is to prevent setting * The extra check here is to prevent setting
@ -453,7 +453,7 @@ static int i2c_sam3_transfer(struct device *dev,
struct i2c_sam3_dev_data * const dev_data = dev->driver_data; struct i2c_sam3_dev_data * const dev_data = dev->driver_data;
struct i2c_msg *cur_msg = msgs; struct i2c_msg *cur_msg = msgs;
u8_t msg_left = num_msgs; u8_t msg_left = num_msgs;
u32_t pflags = 0; u32_t pflags = 0U;
int ret = 0; int ret = 0;
int xfr_ret; int xfr_ret;

View file

@ -172,7 +172,7 @@ static bool i2c_write_byte(struct i2c_bitbang *context, u8_t byte)
static u8_t i2c_read_byte(struct i2c_bitbang *context) static u8_t i2c_read_byte(struct i2c_bitbang *context)
{ {
unsigned int byte = 1; unsigned int byte = 1U;
do { do {
byte <<= 1; byte <<= 1;

View file

@ -94,10 +94,10 @@ static int i2c_cc32xx_configure(struct device *dev, u32_t dev_config_raw)
switch (I2C_SPEED_GET(dev_config_raw)) { switch (I2C_SPEED_GET(dev_config_raw)) {
case I2C_SPEED_STANDARD: case I2C_SPEED_STANDARD:
bitrate_id = 0; bitrate_id = 0U;
break; break;
case I2C_SPEED_FAST: case I2C_SPEED_FAST:
bitrate_id = 1; bitrate_id = 1U;
break; break;
default: default:
return -EINVAL; return -EINVAL;

View file

@ -51,7 +51,7 @@ static inline void _i2c_dw_data_ask(struct device *dev)
/* No more bytes to request, so command queue is no longer needed */ /* No more bytes to request, so command queue is no longer needed */
if (dw->request_bytes == 0) { if (dw->request_bytes == 0) {
regs->ic_intr_mask.bits.tx_empty = 0; regs->ic_intr_mask.bits.tx_empty = 0U;
return; return;
} }
@ -126,14 +126,14 @@ static void _i2c_dw_data_read(struct device *dev)
static int _i2c_dw_data_send(struct device *dev) static int _i2c_dw_data_send(struct device *dev)
{ {
struct i2c_dw_dev_config * const dw = dev->driver_data; struct i2c_dw_dev_config * const dw = dev->driver_data;
u32_t data = 0; u32_t data = 0U;
volatile struct i2c_dw_registers * const regs = volatile struct i2c_dw_registers * const regs =
(struct i2c_dw_registers *)dw->base_address; (struct i2c_dw_registers *)dw->base_address;
/* Nothing to send anymore, mask the interrupt */ /* Nothing to send anymore, mask the interrupt */
if (dw->xfr_len == 0) { if (dw->xfr_len == 0) {
regs->ic_intr_mask.bits.tx_empty = 0; regs->ic_intr_mask.bits.tx_empty = 0U;
dw->state &= ~I2C_DW_CMD_SEND; dw->state &= ~I2C_DW_CMD_SEND;
@ -282,13 +282,13 @@ static int _i2c_dw_setup(struct device *dev, u16_t slave_address)
volatile struct i2c_dw_registers * const regs = volatile struct i2c_dw_registers * const regs =
(struct i2c_dw_registers *)dw->base_address; (struct i2c_dw_registers *)dw->base_address;
ic_con.raw = 0; ic_con.raw = 0U;
/* Disable the device controller to be able set TAR */ /* Disable the device controller to be able set TAR */
regs->ic_enable.bits.enable = 0; regs->ic_enable.bits.enable = 0U;
/* Disable interrupts */ /* Disable interrupts */
regs->ic_intr_mask.raw = 0; regs->ic_intr_mask.raw = 0U;
/* Clear interrupts */ /* Clear interrupts */
value = regs->ic_clr_intr; value = regs->ic_clr_intr;
@ -300,19 +300,19 @@ static int _i2c_dw_setup(struct device *dev, u16_t slave_address)
* to both 0 or both 1 * to both 0 or both 1
*/ */
LOG_DBG("I2C: host configured as Master Device"); LOG_DBG("I2C: host configured as Master Device");
ic_con.bits.master_mode = 1; ic_con.bits.master_mode = 1U;
ic_con.bits.slave_disable = 1; ic_con.bits.slave_disable = 1U;
} else { } else {
return -EINVAL; return -EINVAL;
} }
ic_con.bits.restart_en = 1; ic_con.bits.restart_en = 1U;
/* Set addressing mode - (initialization = 7 bit) */ /* Set addressing mode - (initialization = 7 bit) */
if (I2C_ADDR_10_BITS & dw->app_config) { if (I2C_ADDR_10_BITS & dw->app_config) {
LOG_DBG("I2C: using 10-bit address"); LOG_DBG("I2C: using 10-bit address");
ic_con.bits.addr_master_10bit = 1; ic_con.bits.addr_master_10bit = 1U;
ic_con.bits.addr_slave_10bit = 1; ic_con.bits.addr_slave_10bit = 1U;
} }
/* Setup the clock frequency and speed mode */ /* Setup the clock frequency and speed mode */
@ -361,7 +361,7 @@ static int _i2c_dw_setup(struct device *dev, u16_t slave_address)
* *
* TODO: extend the threshold for multi-byte RX. * TODO: extend the threshold for multi-byte RX.
*/ */
regs->ic_rx_tl = 0; regs->ic_rx_tl = 0U;
/* Set TX fifo threshold level. /* Set TX fifo threshold level.
* TX_EMPTY interrupt is triggered only when the * TX_EMPTY interrupt is triggered only when the
@ -371,7 +371,7 @@ static int _i2c_dw_setup(struct device *dev, u16_t slave_address)
* cause some pauses during transfers, but this keeps * cause some pauses during transfers, but this keeps
* the device from interrupting often. * the device from interrupting often.
*/ */
regs->ic_tx_tl = 0; regs->ic_tx_tl = 0U;
if (regs->ic_con.bits.master_mode) { if (regs->ic_con.bits.master_mode) {
/* Set address of target slave */ /* Set address of target slave */
@ -388,9 +388,9 @@ static int _i2c_dw_setup(struct device *dev, u16_t slave_address)
*/ */
if (I2C_MODE_MASTER & dw->app_config) { if (I2C_MODE_MASTER & dw->app_config) {
if (I2C_ADDR_10_BITS & dw->app_config) { if (I2C_ADDR_10_BITS & dw->app_config) {
regs->ic_tar.bits.ic_10bitaddr_master = 1; regs->ic_tar.bits.ic_10bitaddr_master = 1U;
} else { } else {
regs->ic_tar.bits.ic_10bitaddr_master = 0; regs->ic_tar.bits.ic_10bitaddr_master = 0U;
} }
} }
@ -429,7 +429,7 @@ static int i2c_dw_transfer(struct device *dev,
} }
/* Enable controller */ /* Enable controller */
regs->ic_enable.bits.enable = 1; regs->ic_enable.bits.enable = 1U;
/* /*
* While waiting at device_sync_sem, kernel can switch to idle * While waiting at device_sync_sem, kernel can switch to idle
@ -452,7 +452,7 @@ static int i2c_dw_transfer(struct device *dev,
dw->xfr_buf = cur_msg->buf; dw->xfr_buf = cur_msg->buf;
dw->xfr_len = cur_msg->len; dw->xfr_len = cur_msg->len;
dw->xfr_flags = cur_msg->flags; dw->xfr_flags = cur_msg->flags;
dw->rx_pending = 0; dw->rx_pending = 0U;
/* Need to RESTART if changing transfer direction */ /* Need to RESTART if changing transfer direction */
if ((pflags & I2C_MSG_RW_MASK) if ((pflags & I2C_MSG_RW_MASK)
@ -469,7 +469,7 @@ static int i2c_dw_transfer(struct device *dev,
if ((dw->xfr_flags & I2C_MSG_RW_MASK) == I2C_MSG_WRITE) { if ((dw->xfr_flags & I2C_MSG_RW_MASK) == I2C_MSG_WRITE) {
dw->state |= I2C_DW_CMD_SEND; dw->state |= I2C_DW_CMD_SEND;
dw->request_bytes = 0; dw->request_bytes = 0U;
} else { } else {
dw->state |= I2C_DW_CMD_RECV; dw->state |= I2C_DW_CMD_RECV;
dw->request_bytes = dw->xfr_len; dw->request_bytes = dw->xfr_len;
@ -513,8 +513,8 @@ static int i2c_dw_transfer(struct device *dev,
static int i2c_dw_runtime_configure(struct device *dev, u32_t config) static int i2c_dw_runtime_configure(struct device *dev, u32_t config)
{ {
struct i2c_dw_dev_config * const dw = dev->driver_data; struct i2c_dw_dev_config * const dw = dev->driver_data;
u32_t value = 0; u32_t value = 0U;
u32_t rc = 0; u32_t rc = 0U;
volatile struct i2c_dw_registers * const regs = volatile struct i2c_dw_registers * const regs =
(struct i2c_dw_registers *)dw->base_address; (struct i2c_dw_registers *)dw->base_address;

View file

@ -170,7 +170,7 @@ static int i2c_esp32_configure(struct device *dev, u32_t dev_config)
const struct i2c_esp32_config *config = dev->config->config_info; const struct i2c_esp32_config *config = dev->config->config_info;
struct i2c_esp32_data *data = dev->driver_data; struct i2c_esp32_data *data = dev->driver_data;
unsigned int key = irq_lock(); unsigned int key = irq_lock();
u32_t v = 0; u32_t v = 0U;
int ret; int ret;
ret = i2c_esp32_configure_pins(config->pins.scl, ret = i2c_esp32_configure_pins(config->pins.scl,
@ -344,7 +344,7 @@ i2c_esp32_write_addr(struct device *dev,
{ {
const struct i2c_esp32_config *config = dev->config->config_info; const struct i2c_esp32_config *config = dev->config->config_info;
struct i2c_esp32_data *data = dev->driver_data; struct i2c_esp32_data *data = dev->driver_data;
u32_t addr_len = 1; u32_t addr_len = 1U;
i2c_esp32_reset_fifo(config); i2c_esp32_reset_fifo(config);
@ -437,7 +437,7 @@ static int i2c_esp32_read_msg(struct device *dev, u16_t addr,
return ret; return ret;
} }
for (i = 0; i < to_read; i++) { for (i = 0U; i < to_read; i++) {
u32_t v = sys_read32(I2C_DATA_APB_REG(config->index)); u32_t v = sys_read32(I2C_DATA_APB_REG(config->index));
*msg.buf++ = v & I2C_FIFO_RDATA; *msg.buf++ = v & I2C_FIFO_RDATA;
@ -469,7 +469,7 @@ static int i2c_esp32_write_msg(struct device *dev, u16_t addr,
int ret; int ret;
/* Copy data to TX fifo */ /* Copy data to TX fifo */
for (i = 0; i < to_send; i++) { for (i = 0U; i < to_send; i++) {
sys_write32(*msg.buf++, sys_write32(*msg.buf++,
I2C_DATA_APB_REG(config->index)); I2C_DATA_APB_REG(config->index));
} }
@ -514,7 +514,7 @@ static int i2c_esp32_transfer(struct device *dev, struct i2c_msg *msgs,
addr &= BIT_MASK(data->dev_config & I2C_ADDR_10_BITS ? 10 : 7); addr &= BIT_MASK(data->dev_config & I2C_ADDR_10_BITS ? 10 : 7);
addr <<= 1; addr <<= 1;
for (i = 0; i < num_msgs; i++) { for (i = 0U; i < num_msgs; i++) {
if ((msgs[i].flags & I2C_MSG_RW_MASK) == I2C_MSG_WRITE) { if ((msgs[i].flags & I2C_MSG_RW_MASK) == I2C_MSG_WRITE) {
ret = i2c_esp32_write_msg(dev, addr, msgs[i]); ret = i2c_esp32_write_msg(dev, addr, msgs[i]);
} else { } else {

View file

@ -95,7 +95,7 @@ static int i2c_gecko_transfer(struct device *dev, struct i2c_msg *msgs,
struct i2c_gecko_data *data = DEV_DATA(dev); struct i2c_gecko_data *data = DEV_DATA(dev);
I2C_TransferSeq_TypeDef seq; I2C_TransferSeq_TypeDef seq;
I2C_TransferReturn_TypeDef ret = -EIO; I2C_TransferReturn_TypeDef ret = -EIO;
u32_t timeout = 300000; u32_t timeout = 300000U;
if (!num_msgs) { if (!num_msgs) {
return 0; return 0;

View file

@ -58,7 +58,7 @@ static void i2c_gpio_set_sda(void *io_context, int state)
static int i2c_gpio_get_sda(void *io_context) static int i2c_gpio_get_sda(void *io_context)
{ {
struct i2c_gpio_context *context = io_context; struct i2c_gpio_context *context = io_context;
u32_t state = 1; /* Default high as that would be a NACK */ u32_t state = 1U; /* Default high as that would be a NACK */
gpio_pin_read(context->gpio, context->sda_pin, &state); gpio_pin_read(context->gpio, context->sda_pin, &state);
return state; return state;

View file

@ -29,7 +29,7 @@ static u32_t copy_msgs_and_transfer(struct device *dev,
/* Validate the buffers in each message struct. Read options require /* Validate the buffers in each message struct. Read options require
* that the target buffer be writable * that the target buffer be writable
*/ */
for (i = 0; i < num_msgs; i++) { for (i = 0U; i < num_msgs; i++) {
Z_OOPS(Z_SYSCALL_MEMORY(copy[i].buf, copy[i].len, Z_OOPS(Z_SYSCALL_MEMORY(copy[i].buf, copy[i].len,
copy[i].flags & I2C_MSG_READ)); copy[i].flags & I2C_MSG_READ));
} }

View file

@ -135,9 +135,9 @@ static int i2c_imx_configure(struct device *dev, u32_t dev_config_raw)
/* Initialize I2C state structure content. */ /* Initialize I2C state structure content. */
transfer->txBuff = 0; transfer->txBuff = 0;
transfer->rxBuff = 0; transfer->rxBuff = 0;
transfer->cmdSize = 0; transfer->cmdSize = 0U;
transfer->txSize = 0; transfer->txSize = 0U;
transfer->rxSize = 0; transfer->rxSize = 0U;
transfer->isBusy = false; transfer->isBusy = false;
transfer->currentDir = i2cDirectionReceive; transfer->currentDir = i2cDirectionReceive;
transfer->currentMode = i2cModeSlave; transfer->currentMode = i2cModeSlave;

View file

@ -25,7 +25,7 @@ int i2c_stm32_runtime_configure(struct device *dev, u32_t config)
const struct i2c_stm32_config *cfg = DEV_CFG(dev); const struct i2c_stm32_config *cfg = DEV_CFG(dev);
struct i2c_stm32_data *data = DEV_DATA(dev); struct i2c_stm32_data *data = DEV_DATA(dev);
I2C_TypeDef *i2c = cfg->i2c; I2C_TypeDef *i2c = cfg->i2c;
u32_t clock = 0; u32_t clock = 0U;
#if defined(CONFIG_SOC_SERIES_STM32F3X) || defined(CONFIG_SOC_SERIES_STM32F0X) #if defined(CONFIG_SOC_SERIES_STM32F3X) || defined(CONFIG_SOC_SERIES_STM32F0X)
LL_RCC_ClocksTypeDef rcc_clocks; LL_RCC_ClocksTypeDef rcc_clocks;

View file

@ -36,10 +36,10 @@ static inline void handle_sb(I2C_TypeDef *i2c, struct i2c_stm32_data *data)
u8_t header = slave | HEADER; u8_t header = slave | HEADER;
if (data->current.is_restart == 0) { if (data->current.is_restart == 0) {
data->current.is_restart = 1; data->current.is_restart = 1U;
} else { } else {
header |= I2C_REQUEST_READ; header |= I2C_REQUEST_READ;
data->current.is_restart = 0; data->current.is_restart = 0U;
} }
LL_I2C_TransmitData8(i2c, header); LL_I2C_TransmitData8(i2c, header);
@ -57,7 +57,7 @@ static inline void handle_addr(I2C_TypeDef *i2c, struct i2c_stm32_data *data)
{ {
if (I2C_ADDR_10_BITS & data->dev_config) { if (I2C_ADDR_10_BITS & data->dev_config) {
if (!data->current.is_write && data->current.is_restart) { if (!data->current.is_write && data->current.is_restart) {
data->current.is_restart = 0; data->current.is_restart = 0U;
LL_I2C_ClearFlag_ADDR(i2c); LL_I2C_ClearFlag_ADDR(i2c);
LL_I2C_GenerateStartCondition(i2c); LL_I2C_GenerateStartCondition(i2c);
@ -139,7 +139,7 @@ static inline void handle_btf(I2C_TypeDef *i2c, struct i2c_stm32_data *data)
if (data->current.is_write) { if (data->current.is_write) {
handle_txe(i2c, data); handle_txe(i2c, data);
} else { } else {
u32_t counter = 0; u32_t counter = 0U;
switch (data->current.len) { switch (data->current.len) {
case 2: case 2:
@ -151,7 +151,7 @@ static inline void handle_btf(I2C_TypeDef *i2c, struct i2c_stm32_data *data)
LL_I2C_GenerateStopCondition(i2c); LL_I2C_GenerateStopCondition(i2c);
} }
for (counter = 2; counter > 0; counter--) { for (counter = 2U; counter > 0; counter--) {
data->current.len--; data->current.len--;
*data->current.buf = LL_I2C_ReceiveData8(i2c); *data->current.buf = LL_I2C_ReceiveData8(i2c);
data->current.buf++; data->current.buf++;
@ -201,12 +201,12 @@ void stm32_i2c_error_isr(void *arg)
if (LL_I2C_IsActiveFlag_AF(i2c)) { if (LL_I2C_IsActiveFlag_AF(i2c)) {
LL_I2C_ClearFlag_AF(i2c); LL_I2C_ClearFlag_AF(i2c);
LL_I2C_GenerateStopCondition(i2c); LL_I2C_GenerateStopCondition(i2c);
data->current.is_nack = 1; data->current.is_nack = 1U;
k_sem_give(&data->device_sync_sem); k_sem_give(&data->device_sync_sem);
return; return;
} }
data->current.is_err = 1; data->current.is_err = 1U;
k_sem_give(&data->device_sync_sem); k_sem_give(&data->device_sync_sem);
} }
@ -223,10 +223,10 @@ s32_t stm32_i2c_msg_write(struct device *dev, struct i2c_msg *msg,
data->current.len = msg->len; data->current.len = msg->len;
data->current.buf = msg->buf; data->current.buf = msg->buf;
data->current.flags = msg->flags; data->current.flags = msg->flags;
data->current.is_restart = 0; data->current.is_restart = 0U;
data->current.is_write = 1; data->current.is_write = 1U;
data->current.is_nack = 0; data->current.is_nack = 0U;
data->current.is_err = 0; data->current.is_err = 0U;
data->slave_address = saddr; data->slave_address = saddr;
LL_I2C_EnableIT_EVT(i2c); LL_I2C_EnableIT_EVT(i2c);
@ -249,8 +249,8 @@ s32_t stm32_i2c_msg_write(struct device *dev, struct i2c_msg *msg,
LOG_DBG("%s: ERR %d", __func__, LOG_DBG("%s: ERR %d", __func__,
data->current.is_err); data->current.is_err);
data->current.is_nack = 0; data->current.is_nack = 0U;
data->current.is_err = 0; data->current.is_err = 0U;
ret = -EIO; ret = -EIO;
} }
@ -273,9 +273,9 @@ s32_t stm32_i2c_msg_read(struct device *dev, struct i2c_msg *msg,
data->current.len = msg->len; data->current.len = msg->len;
data->current.buf = msg->buf; data->current.buf = msg->buf;
data->current.flags = msg->flags; data->current.flags = msg->flags;
data->current.is_restart = 0; data->current.is_restart = 0U;
data->current.is_write = 0; data->current.is_write = 0U;
data->current.is_err = 0; data->current.is_err = 0U;
data->slave_address = saddr; data->slave_address = saddr;
LL_I2C_EnableIT_EVT(i2c); LL_I2C_EnableIT_EVT(i2c);
@ -289,7 +289,7 @@ s32_t stm32_i2c_msg_read(struct device *dev, struct i2c_msg *msg,
LL_I2C_DisableIT_BUF(i2c); LL_I2C_DisableIT_BUF(i2c);
if (data->current.is_err) { if (data->current.is_err) {
LOG_DBG("%s: ERR %d", __func__, data->current.is_err); LOG_DBG("%s: ERR %d", __func__, data->current.is_err);
data->current.is_err = 0; data->current.is_err = 0U;
ret = -EIO; ret = -EIO;
} }

View file

@ -283,7 +283,7 @@ static void stm32_i2c_event(struct device *dev)
/* NACK received */ /* NACK received */
if (LL_I2C_IsActiveFlag_NACK(i2c)) { if (LL_I2C_IsActiveFlag_NACK(i2c)) {
LL_I2C_ClearFlag_NACK(i2c); LL_I2C_ClearFlag_NACK(i2c);
data->current.is_nack = 1; data->current.is_nack = 1U;
goto end; goto end;
} }
@ -326,13 +326,13 @@ static int stm32_i2c_error(struct device *dev)
if (LL_I2C_IsActiveFlag_ARLO(i2c)) { if (LL_I2C_IsActiveFlag_ARLO(i2c)) {
LL_I2C_ClearFlag_ARLO(i2c); LL_I2C_ClearFlag_ARLO(i2c);
data->current.is_arlo = 1; data->current.is_arlo = 1U;
goto end; goto end;
} }
if (LL_I2C_IsActiveFlag_BERR(i2c)) { if (LL_I2C_IsActiveFlag_BERR(i2c)) {
LL_I2C_ClearFlag_BERR(i2c); LL_I2C_ClearFlag_BERR(i2c);
data->current.is_err = 1; data->current.is_err = 1U;
goto end; goto end;
} }
@ -378,9 +378,9 @@ int stm32_i2c_msg_write(struct device *dev, struct i2c_msg *msg,
data->current.len = msg->len; data->current.len = msg->len;
data->current.buf = msg->buf; data->current.buf = msg->buf;
data->current.is_write = 1; data->current.is_write = 1U;
data->current.is_nack = 0; data->current.is_nack = 0U;
data->current.is_err = 0; data->current.is_err = 0U;
data->current.msg = msg; data->current.msg = msg;
msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_WRITE); msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_WRITE);
@ -400,18 +400,18 @@ error:
if (data->current.is_arlo) { if (data->current.is_arlo) {
LOG_DBG("%s: ARLO %d", __func__, LOG_DBG("%s: ARLO %d", __func__,
data->current.is_arlo); data->current.is_arlo);
data->current.is_arlo = 0; data->current.is_arlo = 0U;
} }
if (data->current.is_nack) { if (data->current.is_nack) {
LOG_DBG("%s: NACK", __func__); LOG_DBG("%s: NACK", __func__);
data->current.is_nack = 0; data->current.is_nack = 0U;
} }
if (data->current.is_err) { if (data->current.is_err) {
LOG_DBG("%s: ERR %d", __func__, LOG_DBG("%s: ERR %d", __func__,
data->current.is_err); data->current.is_err);
data->current.is_err = 0; data->current.is_err = 0U;
} }
return -EIO; return -EIO;
@ -426,10 +426,10 @@ int stm32_i2c_msg_read(struct device *dev, struct i2c_msg *msg,
data->current.len = msg->len; data->current.len = msg->len;
data->current.buf = msg->buf; data->current.buf = msg->buf;
data->current.is_write = 0; data->current.is_write = 0U;
data->current.is_arlo = 0; data->current.is_arlo = 0U;
data->current.is_err = 0; data->current.is_err = 0U;
data->current.is_nack = 0; data->current.is_nack = 0U;
data->current.msg = msg; data->current.msg = msg;
msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_READ); msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_READ);
@ -449,18 +449,18 @@ error:
if (data->current.is_arlo) { if (data->current.is_arlo) {
LOG_DBG("%s: ARLO %d", __func__, LOG_DBG("%s: ARLO %d", __func__,
data->current.is_arlo); data->current.is_arlo);
data->current.is_arlo = 0; data->current.is_arlo = 0U;
} }
if (data->current.is_nack) { if (data->current.is_nack) {
LOG_DBG("%s: NACK", __func__); LOG_DBG("%s: NACK", __func__);
data->current.is_nack = 0; data->current.is_nack = 0U;
} }
if (data->current.is_err) { if (data->current.is_err) {
LOG_DBG("%s: ERR %d", __func__, LOG_DBG("%s: ERR %d", __func__,
data->current.is_err); data->current.is_err);
data->current.is_err = 0; data->current.is_err = 0U;
} }
return -EIO; return -EIO;
@ -492,7 +492,7 @@ int stm32_i2c_msg_write(struct device *dev, struct i2c_msg *msg,
{ {
const struct i2c_stm32_config *cfg = DEV_CFG(dev); const struct i2c_stm32_config *cfg = DEV_CFG(dev);
I2C_TypeDef *i2c = cfg->i2c; I2C_TypeDef *i2c = cfg->i2c;
unsigned int len = 0; unsigned int len = 0U;
u8_t *buf = msg->buf; u8_t *buf = msg->buf;
msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_WRITE); msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_WRITE);
@ -529,7 +529,7 @@ int stm32_i2c_msg_read(struct device *dev, struct i2c_msg *msg,
{ {
const struct i2c_stm32_config *cfg = DEV_CFG(dev); const struct i2c_stm32_config *cfg = DEV_CFG(dev);
I2C_TypeDef *i2c = cfg->i2c; I2C_TypeDef *i2c = cfg->i2c;
unsigned int len = 0; unsigned int len = 0U;
u8_t *buf = msg->buf; u8_t *buf = msg->buf;
msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_READ); msg_init(dev, msg, next_msg_flags, slave, LL_I2C_REQUEST_READ);
@ -558,21 +558,21 @@ int stm32_i2c_configure_timing(struct device *dev, u32_t clock)
I2C_TypeDef *i2c = cfg->i2c; I2C_TypeDef *i2c = cfg->i2c;
u32_t i2c_hold_time_min, i2c_setup_time_min; u32_t i2c_hold_time_min, i2c_setup_time_min;
u32_t i2c_h_min_time, i2c_l_min_time; u32_t i2c_h_min_time, i2c_l_min_time;
u32_t presc = 1; u32_t presc = 1U;
u32_t timing = 0; u32_t timing = 0U;
switch (I2C_SPEED_GET(data->dev_config)) { switch (I2C_SPEED_GET(data->dev_config)) {
case I2C_SPEED_STANDARD: case I2C_SPEED_STANDARD:
i2c_h_min_time = 4000; i2c_h_min_time = 4000U;
i2c_l_min_time = 4700; i2c_l_min_time = 4700U;
i2c_hold_time_min = 500; i2c_hold_time_min = 500U;
i2c_setup_time_min = 1250; i2c_setup_time_min = 1250U;
break; break;
case I2C_SPEED_FAST: case I2C_SPEED_FAST:
i2c_h_min_time = 600; i2c_h_min_time = 600U;
i2c_l_min_time = 1300; i2c_l_min_time = 1300U;
i2c_hold_time_min = 375; i2c_hold_time_min = 375U;
i2c_setup_time_min = 500; i2c_setup_time_min = 500U;
break; break;
default: default:
return -EINVAL; return -EINVAL;

View file

@ -83,7 +83,7 @@ static void i2c_mcux_master_transfer_callback(I2C_Type *base,
static u32_t i2c_mcux_convert_flags(int msg_flags) static u32_t i2c_mcux_convert_flags(int msg_flags)
{ {
u32_t flags = 0; u32_t flags = 0U;
if (!(msg_flags & I2C_MSG_STOP)) { if (!(msg_flags & I2C_MSG_STOP)) {
flags |= kI2C_TransferNoStopFlag; flags |= kI2C_TransferNoStopFlag;

View file

@ -127,7 +127,7 @@ DEVICE_DEFINE(i2c_ss_0, DT_I2C_SS_0_NAME, i2c_qmsi_ss_init,
static void i2c_qmsi_ss_config_irq_0(void) static void i2c_qmsi_ss_config_irq_0(void)
{ {
u32_t mask = 0; u32_t mask = 0U;
/* Need to unmask the interrupts in System Control Subsystem (SCSS) /* Need to unmask the interrupts in System Control Subsystem (SCSS)
* so the interrupt controller can route these interrupts to * so the interrupt controller can route these interrupts to
@ -184,7 +184,7 @@ DEVICE_DEFINE(i2c_ss_1, DT_I2C_SS_1_NAME, i2c_qmsi_ss_init,
static void i2c_qmsi_ss_config_irq_1(void) static void i2c_qmsi_ss_config_irq_1(void)
{ {
u32_t mask = 0; u32_t mask = 0U;
/* Need to unmask the interrupts in System Control Subsystem (SCSS) /* Need to unmask the interrupts in System Control Subsystem (SCSS)
* so the interrupt controller can route these interrupts to * so the interrupt controller can route these interrupts to

View file

@ -72,7 +72,7 @@ struct i2c_sam_twi_dev_data {
static int i2c_clk_set(Twi *const twi, u32_t speed) static int i2c_clk_set(Twi *const twi, u32_t speed)
{ {
u32_t ck_div = 0; u32_t ck_div = 0U;
u32_t cl_div; u32_t cl_div;
bool div_completed = false; bool div_completed = false;
@ -197,8 +197,8 @@ static int i2c_sam_twi_transfer(struct device *dev, struct i2c_msg *msgs,
for (; num_msgs > 0; num_msgs--, msgs++) { for (; num_msgs > 0; num_msgs--, msgs++) {
dev_data->msg.buf = msgs->buf; dev_data->msg.buf = msgs->buf;
dev_data->msg.len = msgs->len; dev_data->msg.len = msgs->len;
dev_data->msg.idx = 0; dev_data->msg.idx = 0U;
dev_data->msg.twi_sr = 0; dev_data->msg.twi_sr = 0U;
dev_data->msg.flags = msgs->flags; dev_data->msg.flags = msgs->flags;
/* /*

View file

@ -72,7 +72,7 @@ struct i2c_sam_twihs_dev_data {
static int i2c_clk_set(Twihs *const twihs, u32_t speed) static int i2c_clk_set(Twihs *const twihs, u32_t speed)
{ {
u32_t ck_div = 0; u32_t ck_div = 0U;
u32_t cl_div; u32_t cl_div;
bool div_completed = false; bool div_completed = false;
@ -199,8 +199,8 @@ static int i2c_sam_twihs_transfer(struct device *dev, struct i2c_msg *msgs,
for (int i = 0; i < num_msgs; i++) { for (int i = 0; i < num_msgs; i++) {
dev_data->msg.buf = msgs[i].buf; dev_data->msg.buf = msgs[i].buf;
dev_data->msg.len = msgs[i].len; dev_data->msg.len = msgs[i].len;
dev_data->msg.idx = 0; dev_data->msg.idx = 0U;
dev_data->msg.twihs_sr = 0; dev_data->msg.twihs_sr = 0U;
dev_data->msg.flags = msgs[i].flags; dev_data->msg.flags = msgs[i].flags;
if ((msgs[i].flags & I2C_MSG_RW_MASK) == I2C_MSG_READ) { if ((msgs[i].flags & I2C_MSG_RW_MASK) == I2C_MSG_READ) {
read_msg_start(twihs, &dev_data->msg, addr); read_msg_start(twihs, &dev_data->msg, addr);

View file

@ -259,11 +259,11 @@ static int i2s_cavs_configure(struct device *dev, enum i2s_dir dir,
u32_t sstsa; u32_t sstsa;
u32_t ssrsa; u32_t ssrsa;
u32_t ssto; u32_t ssto;
u32_t ssioc = 0; u32_t ssioc = 0U;
u32_t mdiv; u32_t mdiv;
u32_t i2s_m = 0; u32_t i2s_m = 0U;
u32_t i2s_n = 0; u32_t i2s_n = 0U;
u32_t frame_len = 0; u32_t frame_len = 0U;
bool inverted_frame = false; bool inverted_frame = false;
if ((dev_data->tx.state != I2S_STATE_NOT_READY) && if ((dev_data->tx.state != I2S_STATE_NOT_READY) &&
@ -308,14 +308,14 @@ static int i2s_cavs_configure(struct device *dev, enum i2s_dir dir,
ssc1 = SSCR1_TTE | SSCR1_TTELP | SSCR1_TRAIL | SSCR1_TSRE | SSCR1_RSRE; ssc1 = SSCR1_TTE | SSCR1_TTELP | SSCR1_TRAIL | SSCR1_TSRE | SSCR1_RSRE;
/* sscr2 dynamic setting is LJDFD */ /* sscr2 dynamic setting is LJDFD */
ssc2 = 0; ssc2 = 0U;
/* sscr3 dynamic settings are TFT, RFT */ /* sscr3 dynamic settings are TFT, RFT */
ssc3 = SSCR3_TX(CAVS_I2S_DMA_BURST_SIZE) | ssc3 = SSCR3_TX(CAVS_I2S_DMA_BURST_SIZE) |
SSCR3_RX(CAVS_I2S_DMA_BURST_SIZE); SSCR3_RX(CAVS_I2S_DMA_BURST_SIZE);
/* sspsp dynamic settings are SCMODE, SFRMP, DMYSTRT, SFRMWDTH */ /* sspsp dynamic settings are SCMODE, SFRMP, DMYSTRT, SFRMWDTH */
sspsp = 0; sspsp = 0U;
/* sspsp2 no dynamic setting */ /* sspsp2 no dynamic setting */
sspsp2 = 0x0; sspsp2 = 0x0;
@ -384,7 +384,7 @@ static int i2s_cavs_configure(struct device *dev, enum i2s_dir dir,
i2s_n = mclk / 100; i2s_n = mclk / 100;
/* set divider value of 1 which divides the clock by 2 */ /* set divider value of 1 which divides the clock by 2 */
mdiv = 1; mdiv = 1U;
/* Select M/N divider as the clock source */ /* Select M/N divider as the clock source */
ssc0 |= SSCR0_ECS; ssc0 |= SSCR0_ECS;

View file

@ -775,7 +775,7 @@ static void tx_queue_drop(struct stream *stream)
{ {
size_t size; size_t size;
void *mem_block; void *mem_block;
unsigned int n = 0; unsigned int n = 0U;
while (queue_get(&stream->mem_block_queue, &mem_block, &size) == 0) { while (queue_get(&stream->mem_block_queue, &mem_block, &size) == 0) {
k_mem_slab_free(stream->cfg.mem_slab, &mem_block); k_mem_slab_free(stream->cfg.mem_slab, &mem_block);

View file

@ -310,15 +310,15 @@ static int set_rx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
const bool pin_rf_en = IS_ENABLED(CONFIG_I2S_SAM_SSC_0_PIN_RF_EN); const bool pin_rf_en = IS_ENABLED(CONFIG_I2S_SAM_SSC_0_PIN_RF_EN);
u8_t word_size_bits = i2s_cfg->word_size; u8_t word_size_bits = i2s_cfg->word_size;
u8_t num_words = i2s_cfg->channels; u8_t num_words = i2s_cfg->channels;
u8_t fslen = 0; u8_t fslen = 0U;
u32_t ssc_rcmr = 0; u32_t ssc_rcmr = 0U;
u32_t ssc_rfmr = 0; u32_t ssc_rfmr = 0U;
bool frame_clk_master = !(i2s_cfg->options & I2S_OPT_FRAME_CLK_SLAVE); bool frame_clk_master = !(i2s_cfg->options & I2S_OPT_FRAME_CLK_SLAVE);
switch (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) { switch (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) {
case I2S_FMT_DATA_FORMAT_I2S: case I2S_FMT_DATA_FORMAT_I2S:
num_words = 2; num_words = 2U;
fslen = word_size_bits - 1; fslen = word_size_bits - 1;
ssc_rcmr = SSC_RCMR_CKI ssc_rcmr = SSC_RCMR_CKI
@ -401,14 +401,14 @@ static int set_tx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
Ssc *const ssc = dev_cfg->regs; Ssc *const ssc = dev_cfg->regs;
u8_t word_size_bits = i2s_cfg->word_size; u8_t word_size_bits = i2s_cfg->word_size;
u8_t num_words = i2s_cfg->channels; u8_t num_words = i2s_cfg->channels;
u8_t fslen = 0; u8_t fslen = 0U;
u32_t ssc_tcmr = 0; u32_t ssc_tcmr = 0U;
u32_t ssc_tfmr = 0; u32_t ssc_tfmr = 0U;
switch (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) { switch (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) {
case I2S_FMT_DATA_FORMAT_I2S: case I2S_FMT_DATA_FORMAT_I2S:
num_words = 2; num_words = 2U;
fslen = word_size_bits - 1; fslen = word_size_bits - 1;
ssc_tcmr = SSC_TCMR_START_TF_FALLING ssc_tcmr = SSC_TCMR_START_TF_FALLING
@ -729,7 +729,7 @@ static void tx_queue_drop(struct stream *stream)
{ {
size_t size; size_t size;
void *mem_block; void *mem_block;
unsigned int n = 0; unsigned int n = 0U;
while (queue_get(&stream->mem_block_queue, &mem_block, &size) == 0) { while (queue_get(&stream->mem_block_queue, &mem_block, &size) == 0) {
k_mem_slab_free(stream->cfg.mem_slab, &mem_block); k_mem_slab_free(stream->cfg.mem_slab, &mem_block);

View file

@ -99,7 +99,7 @@ bool _cc1200_access_reg(struct cc1200_context *ctx, bool read, u8_t addr,
burst ? "burst" : "single"); burst ? "burst" : "single");
*/ */
cmd_buf[0] = 0; cmd_buf[0] = 0U;
if (burst) { if (burst) {
cmd_buf[0] |= CC1200_ACCESS_BURST; cmd_buf[0] |= CC1200_ACCESS_BURST;
@ -276,9 +276,9 @@ static bool write_reg_freq(struct cc1200_context *ctx, u32_t freq)
static u32_t rf_evaluate_freq_setting(struct cc1200_context *ctx, u32_t chan) static u32_t rf_evaluate_freq_setting(struct cc1200_context *ctx, u32_t chan)
{ {
u32_t xtal = CONFIG_IEEE802154_CC1200_XOSC; u32_t xtal = CONFIG_IEEE802154_CC1200_XOSC;
u32_t mult_10 = 100000; u32_t mult_10 = 100000U;
u32_t factor = 1; u32_t factor = 1U;
u32_t freq = 0; u32_t freq = 0U;
u32_t rf, lo_div; u32_t rf, lo_div;
rf = ctx->rf_settings->chan_center_freq0 + rf = ctx->rf_settings->chan_center_freq0 +

View file

@ -261,7 +261,7 @@ static inline u8_t _cc2520_status(struct cc2520_context *ctx)
static bool verify_osc_stabilization(struct cc2520_context *cc2520) static bool verify_osc_stabilization(struct cc2520_context *cc2520)
{ {
u8_t timeout = 100; u8_t timeout = 100U;
u8_t status; u8_t status;
do { do {
@ -499,7 +499,7 @@ static inline bool verify_txfifo_status(struct cc2520_context *cc2520,
static inline bool verify_tx_done(struct cc2520_context *cc2520) static inline bool verify_tx_done(struct cc2520_context *cc2520)
{ {
u8_t timeout = 10; u8_t timeout = 10U;
u8_t status; u8_t status;
do { do {
@ -575,9 +575,9 @@ static inline void insert_radio_noise_details(struct net_pkt *pkt, u8_t *buf)
*/ */
lqi = buf[1] & CC2520_FCS_CORRELATION; lqi = buf[1] & CC2520_FCS_CORRELATION;
if (lqi <= 50) { if (lqi <= 50) {
lqi = 0; lqi = 0U;
} else if (lqi >= 110) { } else if (lqi >= 110) {
lqi = 255; lqi = 255U;
} else { } else {
lqi = (lqi - 50) << 2; lqi = (lqi - 50) << 2;
} }
@ -816,7 +816,7 @@ static int cc2520_tx(struct device *dev,
u8_t *frame = frag->data - net_pkt_ll_reserve(pkt); u8_t *frame = frag->data - net_pkt_ll_reserve(pkt);
u8_t len = net_pkt_ll_reserve(pkt) + frag->len; u8_t len = net_pkt_ll_reserve(pkt) + frag->len;
struct cc2520_context *cc2520 = dev->driver_data; struct cc2520_context *cc2520 = dev->driver_data;
u8_t retry = 2; u8_t retry = 2U;
bool status; bool status;
LOG_DBG("%p (%u)", frag, len); LOG_DBG("%p (%u)", frag, len);
@ -1195,7 +1195,7 @@ static int insert_crypto_parameters(struct cipher_ctx *ctx,
u8_t data[128]; u8_t data[128];
u8_t *in_buf; u8_t *in_buf;
u8_t in_len; u8_t in_len;
u8_t m = 0; u8_t m = 0U;
if (!apkt->pkt->out_buf || !apkt->pkt->out_buf_max) { if (!apkt->pkt->out_buf || !apkt->pkt->out_buf_max) {
LOG_ERR("Out buffer needs to be set"); LOG_ERR("Out buffer needs to be set");
@ -1231,7 +1231,7 @@ static int insert_crypto_parameters(struct cipher_ctx *ctx,
in_buf = apkt->ad; in_buf = apkt->ad;
in_len = apkt->ad_len; in_len = apkt->ad_len;
*auth_crypt = 0; *auth_crypt = 0U;
} else { } else {
in_buf = data; in_buf = data;
@ -1246,7 +1246,7 @@ static int insert_crypto_parameters(struct cipher_ctx *ctx,
if (ctx->mode_params.ccm_info.tag_len) { if (ctx->mode_params.ccm_info.tag_len) {
if ((ctx->mode_params.ccm_info.tag_len >> 2) > 3) { if ((ctx->mode_params.ccm_info.tag_len >> 2) > 3) {
m = 3; m = 3U;
} else { } else {
m = ctx->mode_params.ccm_info.tag_len >> 2; m = ctx->mode_params.ccm_info.tag_len >> 2;
} }

View file

@ -647,7 +647,7 @@ static void kw41z_isr(int unused)
{ {
u32_t irqsts = ZLL->IRQSTS; u32_t irqsts = ZLL->IRQSTS;
u8_t state = kw41z_get_seq_state(); u8_t state = kw41z_get_seq_state();
u8_t restart_rx = 1; u8_t restart_rx = 1U;
u32_t rx_len; u32_t rx_len;
/* /*
@ -676,7 +676,7 @@ static void kw41z_isr(int unused)
(unsigned int)ZLL->PHY_CTRL, (unsigned int)ZLL->PHY_CTRL,
(unsigned int)seq_state, state); (unsigned int)seq_state, state);
restart_rx = 0; restart_rx = 0U;
} else if ((!(ZLL->PHY_CTRL & ZLL_PHY_CTRL_RX_WMRK_MSK_MASK)) && } else if ((!(ZLL->PHY_CTRL & ZLL_PHY_CTRL_RX_WMRK_MSK_MASK)) &&
(irqsts & ZLL_IRQSTS_RXWTRMRKIRQ_MASK)) { (irqsts & ZLL_IRQSTS_RXWTRMRKIRQ_MASK)) {
@ -713,7 +713,7 @@ static void kw41z_isr(int unused)
rx_len = rx_len * 2 + 12 + 22 + 2; rx_len = rx_len * 2 + 12 + 22 + 2;
kw41z_tmr3_set_timeout(rx_len); kw41z_tmr3_set_timeout(rx_len);
} }
restart_rx = 0; restart_rx = 0U;
} }
/* Sequence done IRQ */ /* Sequence done IRQ */
@ -725,7 +725,7 @@ static void kw41z_isr(int unused)
if (irqsts & ZLL_IRQSTS_PLL_UNLOCK_IRQ_MASK) { if (irqsts & ZLL_IRQSTS_PLL_UNLOCK_IRQ_MASK) {
LOG_ERR("PLL unlock error"); LOG_ERR("PLL unlock error");
kw41z_isr_seq_cleanup(); kw41z_isr_seq_cleanup();
restart_rx = 1; restart_rx = 1U;
} }
/* /*
* TMR3 timeout, the autosequence has been aborted due to * TMR3 timeout, the autosequence has been aborted due to
@ -745,7 +745,7 @@ static void kw41z_isr(int unused)
(unsigned int)ZLL->PHY_CTRL, seq_state); (unsigned int)ZLL->PHY_CTRL, seq_state);
kw41z_isr_timeout_cleanup(); kw41z_isr_timeout_cleanup();
restart_rx = 1; restart_rx = 1U;
if (state == KW41Z_STATE_TXRX) { if (state == KW41Z_STATE_TXRX) {
/* TODO: What is the right error for no ACK? */ /* TODO: What is the right error for no ACK? */
@ -776,7 +776,7 @@ static void kw41z_isr(int unused)
rx_len); rx_len);
} }
} }
restart_rx = 1; restart_rx = 1U;
break; break;
case KW41Z_STATE_TXRX: case KW41Z_STATE_TXRX:
LOG_DBG("TXRX seq done"); LOG_DBG("TXRX seq done");
@ -796,7 +796,7 @@ static void kw41z_isr(int unused)
} }
k_sem_give(&kw41z_context_data.seq_sync); k_sem_give(&kw41z_context_data.seq_sync);
restart_rx = 1; restart_rx = 1U;
break; break;
case KW41Z_STATE_CCA: case KW41Z_STATE_CCA:
@ -807,19 +807,19 @@ static void kw41z_isr(int unused)
atomic_set( atomic_set(
&kw41z_context_data.seq_retval, &kw41z_context_data.seq_retval,
-EBUSY); -EBUSY);
restart_rx = 1; restart_rx = 1U;
} else { } else {
atomic_set( atomic_set(
&kw41z_context_data.seq_retval, &kw41z_context_data.seq_retval,
0); 0);
restart_rx = 0; restart_rx = 0U;
} }
k_sem_give(&kw41z_context_data.seq_sync); k_sem_give(&kw41z_context_data.seq_sync);
break; break;
default: default:
LOG_DBG("Unhandled state: %d", state); LOG_DBG("Unhandled state: %d", state);
restart_rx = 1; restart_rx = 1U;
break; break;
} }
} }
@ -833,10 +833,10 @@ static void kw41z_isr(int unused)
irqsts, seq_state, state); irqsts, seq_state, state);
kw41z_tmr3_disable(); kw41z_tmr3_disable();
restart_rx = 0; restart_rx = 0U;
if (state != KW41Z_STATE_IDLE) { if (state != KW41Z_STATE_IDLE) {
kw41z_isr_timeout_cleanup(); kw41z_isr_timeout_cleanup();
restart_rx = 1; restart_rx = 1U;
/* If we are not running an automated /* If we are not running an automated
* sequence then handle event. TMR3 can expire * sequence then handle event. TMR3 can expire
* during Recv/Ack sequence where the transmit * during Recv/Ack sequence where the transmit

View file

@ -278,7 +278,7 @@ static int mcr20a_timer_set(struct mcr20a_context *mcr20a,
u8_t cmp_reg, u8_t cmp_reg,
u32_t timeout) u32_t timeout)
{ {
u32_t now = 0; u32_t now = 0U;
u32_t next; u32_t next;
bool retval; bool retval;
@ -455,7 +455,7 @@ static inline int mcr20a_abort_sequence(struct mcr20a_context *mcr20a,
static inline int mcr20a_set_sequence(struct mcr20a_context *mcr20a, static inline int mcr20a_set_sequence(struct mcr20a_context *mcr20a,
u8_t seq) u8_t seq)
{ {
u8_t ctrl1 = 0; u8_t ctrl1 = 0U;
seq = set_bits_phy_ctrl1_xcvseq(seq); seq = set_bits_phy_ctrl1_xcvseq(seq);
ctrl1 = read_reg_phy_ctrl1(mcr20a); ctrl1 = read_reg_phy_ctrl1(mcr20a);
@ -720,7 +720,7 @@ static void mcr20a_thread_main(void *arg)
struct mcr20a_context *mcr20a = dev->driver_data; struct mcr20a_context *mcr20a = dev->driver_data;
u8_t dregs[MCR20A_PHY_CTRL4 + 1]; u8_t dregs[MCR20A_PHY_CTRL4 + 1];
bool set_new_seq; bool set_new_seq;
u8_t ctrl1 = 0; u8_t ctrl1 = 0U;
while (true) { while (true) {
k_sem_take(&mcr20a->isr_sem, K_FOREVER); k_sem_take(&mcr20a->isr_sem, K_FOREVER);
@ -1153,7 +1153,7 @@ error:
static int mcr20a_start(struct device *dev) static int mcr20a_start(struct device *dev)
{ {
struct mcr20a_context *mcr20a = dev->driver_data; struct mcr20a_context *mcr20a = dev->driver_data;
u8_t timeout = 6; u8_t timeout = 6U;
u8_t status; u8_t status;
k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER); k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER);
@ -1275,9 +1275,9 @@ error:
static int power_on_and_setup(struct device *dev) static int power_on_and_setup(struct device *dev)
{ {
struct mcr20a_context *mcr20a = dev->driver_data; struct mcr20a_context *mcr20a = dev->driver_data;
u8_t timeout = 6; u8_t timeout = 6U;
u32_t status; u32_t status;
u8_t tmp = 0; u8_t tmp = 0U;
if (!PART_OF_KW2XD_SIP) { if (!PART_OF_KW2XD_SIP) {
set_reset(dev, 0); set_reset(dev, 0);

View file

@ -165,8 +165,8 @@ out:
net_pkt_unref(pkt); net_pkt_unref(pkt);
flush: flush:
upipe->rx = false; upipe->rx = false;
upipe->rx_len = 0; upipe->rx_len = 0U;
upipe->rx_off = 0; upipe->rx_off = 0U;
} }
done: done:
*off = 0; *off = 0;
@ -284,7 +284,7 @@ static int upipe_tx(struct device *dev,
data = len; data = len;
uart_pipe_send(&data, 1); uart_pipe_send(&data, 1);
for (i = 0; i < len; i++) { for (i = 0U; i < len; i++) {
uart_pipe_send(pkt_buf+i, 1); uart_pipe_send(pkt_buf+i, 1);
} }

View file

@ -117,7 +117,7 @@ static int _arc_v2_irq_unit_suspend(struct device *dev)
* by IRQ auxiliary registers. For that reason we skip those * by IRQ auxiliary registers. For that reason we skip those
* values in this loop. * values in this loop.
*/ */
for (irq = 16; irq < CONFIG_NUM_IRQS; irq++) { for (irq = 16U; irq < CONFIG_NUM_IRQS; irq++) {
_arc_v2_aux_reg_write(_ARC_V2_IRQ_SELECT, irq); _arc_v2_aux_reg_write(_ARC_V2_IRQ_SELECT, irq);
ctx.irq_config[irq - 16] = ctx.irq_config[irq - 16] =
_arc_v2_aux_reg_read(_ARC_V2_IRQ_PRIORITY) << 2; _arc_v2_aux_reg_read(_ARC_V2_IRQ_PRIORITY) << 2;
@ -146,7 +146,7 @@ static int _arc_v2_irq_unit_resume(struct device *dev)
* by IRQ auxiliary registers. For that reason we skip those * by IRQ auxiliary registers. For that reason we skip those
* values in this loop. * values in this loop.
*/ */
for (irq = 16; irq < CONFIG_NUM_IRQS; irq++) { for (irq = 16U; irq < CONFIG_NUM_IRQS; irq++) {
_arc_v2_aux_reg_write(_ARC_V2_IRQ_SELECT, irq); _arc_v2_aux_reg_write(_ARC_V2_IRQ_SELECT, irq);
#ifdef CONFIG_ARC_HAS_SECURE #ifdef CONFIG_ARC_HAS_SECURE
_arc_v2_aux_reg_write(_ARC_V2_IRQ_PRIORITY, _arc_v2_aux_reg_write(_ARC_V2_IRQ_PRIORITY,

View file

@ -39,8 +39,8 @@ static int dw_ictl_initialize(struct device *port)
(struct dw_ictl_registers *)dw->base_addr; (struct dw_ictl_registers *)dw->base_addr;
/* disable all interrupts */ /* disable all interrupts */
regs->irq_inten_l = 0; regs->irq_inten_l = 0U;
regs->irq_inten_h = 0; regs->irq_inten_h = 0U;
return 0; return 0;
} }

View file

@ -176,7 +176,7 @@ void store_flags(unsigned int irq, u32_t flags)
u32_t restore_flags(unsigned int irq) u32_t restore_flags(unsigned int irq)
{ {
u32_t flags = 0; u32_t flags = 0U;
if (sys_bitfield_test_bit((mem_addr_t) ioapic_suspend_buf, if (sys_bitfield_test_bit((mem_addr_t) ioapic_suspend_buf,
BIT_POS_FOR_IRQ_OPTION(irq, IOAPIC_BITFIELD_HI_LO))) { BIT_POS_FOR_IRQ_OPTION(irq, IOAPIC_BITFIELD_HI_LO))) {

View file

@ -195,18 +195,18 @@ static int plic_init(struct device *dev)
/* Ensure that all interrupts are disabled initially */ /* Ensure that all interrupts are disabled initially */
for (i = 0; i < PLIC_EN_SIZE; i++) { for (i = 0; i < PLIC_EN_SIZE; i++) {
*en = 0; *en = 0U;
en++; en++;
} }
/* Set priority of each interrupt line to 0 initially */ /* Set priority of each interrupt line to 0 initially */
for (i = 0; i < PLIC_IRQS; i++) { for (i = 0; i < PLIC_IRQS; i++) {
*prio = 0; *prio = 0U;
prio++; prio++;
} }
/* Set threshold priority to 0 */ /* Set threshold priority to 0 */
regs->threshold_prio = 0; regs->threshold_prio = 0U;
/* Setup IRQ handler for PLIC driver */ /* Setup IRQ handler for PLIC driver */
IRQ_CONNECT(RISCV_MACHINE_EXT_IRQ, IRQ_CONNECT(RISCV_MACHINE_EXT_IRQ,

View file

@ -29,7 +29,7 @@ static int isr_register(struct device *dev, isr_t isr_func,
const struct shared_irq_config *config = dev->config->config_info; const struct shared_irq_config *config = dev->config->config_info;
u32_t i; u32_t i;
for (i = 0; i < config->client_count; i++) { for (i = 0U; i < config->client_count; i++) {
if (!clients->client[i].isr_dev) { if (!clients->client[i].isr_dev) {
clients->client[i].isr_dev = isr_dev; clients->client[i].isr_dev = isr_dev;
clients->client[i].isr_func = isr_func; clients->client[i].isr_func = isr_func;
@ -50,7 +50,7 @@ static inline int enable(struct device *dev, struct device *isr_dev)
const struct shared_irq_config *config = dev->config->config_info; const struct shared_irq_config *config = dev->config->config_info;
u32_t i; u32_t i;
for (i = 0; i < config->client_count; i++) { for (i = 0U; i < config->client_count; i++) {
if (clients->client[i].isr_dev == isr_dev) { if (clients->client[i].isr_dev == isr_dev) {
clients->client[i].enabled = 1; clients->client[i].enabled = 1;
irq_enable(config->irq_num); irq_enable(config->irq_num);
@ -64,7 +64,7 @@ static int last_enabled_isr(struct shared_irq_runtime *clients, int count)
{ {
u32_t i; u32_t i;
for (i = 0; i < count; i++) { for (i = 0U; i < count; i++) {
if (clients->client[i].enabled) { if (clients->client[i].enabled) {
return 0; return 0;
} }
@ -82,7 +82,7 @@ static inline int disable(struct device *dev, struct device *isr_dev)
const struct shared_irq_config *config = dev->config->config_info; const struct shared_irq_config *config = dev->config->config_info;
u32_t i; u32_t i;
for (i = 0; i < config->client_count; i++) { for (i = 0U; i < config->client_count; i++) {
if (clients->client[i].isr_dev == isr_dev) { if (clients->client[i].isr_dev == isr_dev) {
clients->client[i].enabled = 0; clients->client[i].enabled = 0;
if (last_enabled_isr(clients, config->client_count)) { if (last_enabled_isr(clients, config->client_count)) {
@ -100,7 +100,7 @@ void shared_irq_isr(struct device *dev)
const struct shared_irq_config *config = dev->config->config_info; const struct shared_irq_config *config = dev->config->config_info;
u32_t i; u32_t i;
for (i = 0; i < config->client_count; i++) { for (i = 0U; i < config->client_count; i++) {
if (clients->client[i].isr_dev) { if (clients->client[i].isr_dev) {
clients->client[i].isr_func(clients->client[i].isr_dev); clients->client[i].isr_func(clients->client[i].isr_dev);
} }

View file

@ -203,7 +203,7 @@ int quark_se_ipm_controller_initialize(struct device *d)
for (i = 0; i < QUARK_SE_IPM_CHANNELS; ++i) { for (i = 0; i < QUARK_SE_IPM_CHANNELS; ++i) {
volatile struct quark_se_ipm *ipm = QUARK_SE_IPM(i); volatile struct quark_se_ipm *ipm = QUARK_SE_IPM(i);
ipm->sts = 0; ipm->sts = 0U;
} }
#endif #endif

View file

@ -241,10 +241,10 @@ static int lp3943_led_init(struct device *dev)
} }
/* Hardware specific limits */ /* Hardware specific limits */
dev_data->min_period = 0; dev_data->min_period = 0U;
dev_data->max_period = 1600; dev_data->max_period = 1600U;
dev_data->min_brightness = 0; dev_data->min_brightness = 0U;
dev_data->max_brightness = 100; dev_data->max_brightness = 100U;
return 0; return 0;
} }

View file

@ -239,13 +239,13 @@ static int lp5562_get_engine_reg_shift(enum lp5562_led_sources engine,
{ {
switch (engine) { switch (engine) {
case LP5562_SOURCE_ENGINE_1: case LP5562_SOURCE_ENGINE_1:
*shift = 4; *shift = 4U;
break; break;
case LP5562_SOURCE_ENGINE_2: case LP5562_SOURCE_ENGINE_2:
*shift = 2; *shift = 2U;
break; break;
case LP5562_SOURCE_ENGINE_3: case LP5562_SOURCE_ENGINE_3:
*shift = 0; *shift = 0U;
break; break;
default: default:
return -EINVAL; return -EINVAL;
@ -275,7 +275,7 @@ static void lp5562_ms_to_prescale_and_step(struct led_data *data, u32_t ms,
* the step_time value never goes above the allowed 63. * the step_time value never goes above the allowed 63.
*/ */
if (ms < 31) { if (ms < 31) {
*prescale = 0; *prescale = 0U;
*step_time = ms << 1; *step_time = ms << 1;
return; return;
@ -285,7 +285,7 @@ static void lp5562_ms_to_prescale_and_step(struct led_data *data, u32_t ms,
* With a prescaler value set to 1 one step takes 15.6ms. So by dividing * With a prescaler value set to 1 one step takes 15.6ms. So by dividing
* through 16 we get a decent enough result with low effort. * through 16 we get a decent enough result with low effort.
*/ */
*prescale = 1; *prescale = 1U;
*step_time = ms >> 4; *step_time = ms >> 4;
return; return;
@ -750,7 +750,7 @@ static int lp5562_led_blink(struct device *dev, u32_t led,
struct led_data *dev_data = &data->dev_data; struct led_data *dev_data = &data->dev_data;
int ret; int ret;
enum lp5562_led_sources engine; enum lp5562_led_sources engine;
u8_t command_index = 0; u8_t command_index = 0U;
ret = lp5562_get_available_engine(dev, &engine); ret = lp5562_get_available_engine(dev, &engine);
if (ret) { if (ret) {

View file

@ -184,10 +184,10 @@ static int pca9633_led_init(struct device *dev)
} }
/* Hardware specific limits */ /* Hardware specific limits */
dev_data->min_period = 41; dev_data->min_period = 41U;
dev_data->max_period = 10667; dev_data->max_period = 10667U;
dev_data->min_brightness = 0; dev_data->min_brightness = 0U;
dev_data->max_brightness = 100; dev_data->max_brightness = 100U;
return 0; return 0;
} }

View file

@ -30,7 +30,7 @@ static int send_buf(u8_t *buf, size_t len)
/* Initilization of i is strictly not needed, but it avoids an /* Initilization of i is strictly not needed, but it avoids an
* uninitialized warning with the inline assembly. * uninitialized warning with the inline assembly.
*/ */
u32_t i = 0; u32_t i = 0U;
clock = device_get_binding(CONFIG_CLOCK_CONTROL_NRF5_M16SRC_DRV_NAME); clock = device_get_binding(CONFIG_CLOCK_CONTROL_NRF5_M16SRC_DRV_NAME);
if (!clock) { if (!clock) {

View file

@ -424,13 +424,13 @@ static void net_buf_skipcrlf(struct net_buf **buf)
static u16_t net_buf_findcrlf(struct net_buf *buf, struct net_buf **frag, static u16_t net_buf_findcrlf(struct net_buf *buf, struct net_buf **frag,
u16_t *offset) u16_t *offset)
{ {
u16_t len = 0, pos = 0; u16_t len = 0U, pos = 0U;
while (buf && !is_crlf(*(buf->data + pos))) { while (buf && !is_crlf(*(buf->data + pos))) {
if (pos + 1 >= buf->len) { if (pos + 1 >= buf->len) {
len += buf->len; len += buf->len;
buf = buf->frags; buf = buf->frags;
pos = 0; pos = 0U;
} else { } else {
pos++; pos++;
} }
@ -457,7 +457,7 @@ static int net_pkt_setup_ip_data(struct net_pkt *pkt,
struct wncm14a2a_socket *sock) struct wncm14a2a_socket *sock)
{ {
int hdr_len = 0; int hdr_len = 0;
u16_t src_port = 0, dst_port = 0; u16_t src_port = 0U, dst_port = 0U;
#if defined(CONFIG_NET_IPV6) #if defined(CONFIG_NET_IPV6)
if (net_pkt_family(pkt) == AF_INET6) { if (net_pkt_family(pkt) == AF_INET6) {
@ -767,7 +767,7 @@ static void on_cmd_sockread(struct net_buf **buf, u16_t len)
{ {
struct wncm14a2a_socket *sock = NULL; struct wncm14a2a_socket *sock = NULL;
struct net_buf *frag; struct net_buf *frag;
u8_t c = 0; u8_t c = 0U;
u16_t pos; u16_t pos;
int i, actual_length, hdr_len = 0; int i, actual_length, hdr_len = 0;
size_t value_size; size_t value_size;
@ -868,7 +868,7 @@ static void on_cmd_sockread(struct net_buf **buf, u16_t len)
return; return;
} }
c = 0; c = 0U;
} else { } else {
c = c << 4; c = c << 4;
} }
@ -1019,7 +1019,7 @@ static void on_cmd_socknotifyev(struct net_buf **buf, u16_t len)
static int net_buf_ncmp(struct net_buf *buf, const u8_t *s2, size_t n) static int net_buf_ncmp(struct net_buf *buf, const u8_t *s2, size_t n)
{ {
struct net_buf *frag = buf; struct net_buf *frag = buf;
u16_t offset = 0; u16_t offset = 0U;
while ((n > 0) && (*(frag->data + offset) == *s2) && (*s2 != '\0')) { while ((n > 0) && (*(frag->data + offset) == *s2) && (*s2 != '\0')) {
if (offset == frag->len) { if (offset == frag->len) {
@ -1027,7 +1027,7 @@ static int net_buf_ncmp(struct net_buf *buf, const u8_t *s2, size_t n)
break; break;
} }
frag = frag->frags; frag = frag->frags;
offset = 0; offset = 0U;
} else { } else {
offset++; offset++;
} }

View file

@ -161,7 +161,7 @@ static int slip_send(struct device *dev, struct net_pkt *pkt)
/* This writes ethernet header */ /* This writes ethernet header */
if (!send_header_once && ll_reserve) { if (!send_header_once && ll_reserve) {
for (i = 0; i < ll_reserve; i++) { for (i = 0U; i < ll_reserve; i++) {
slip_writeb_esc(*ptr++); slip_writeb_esc(*ptr++);
} }
} }
@ -173,7 +173,7 @@ static int slip_send(struct device *dev, struct net_pkt *pkt)
* link layer header always. * link layer header always.
*/ */
send_header_once = true; send_header_once = true;
ll_reserve = 0; ll_reserve = 0U;
ptr = frag->data; ptr = frag->data;
} }
#else #else
@ -181,7 +181,7 @@ static int slip_send(struct device *dev, struct net_pkt *pkt)
ptr = frag->data; ptr = frag->data;
#endif #endif
for (i = 0; i < frag->len; ++i) { for (i = 0U; i < frag->len; ++i) {
c = *ptr++; c = *ptr++;
slip_writeb_esc(c); slip_writeb_esc(c);
} }

View file

@ -158,7 +158,7 @@ static int intel_gna_setup_page_table(void *physical, size_t size,
return -EINVAL; return -EINVAL;
} }
for (page = 0; page < GNA_NUM_PAGES(size); page++) { for (page = 0U; page < GNA_NUM_PAGES(size); page++) {
dir_index = GNA_VA_PG_DIR(virt_addr); dir_index = GNA_VA_PG_DIR(virt_addr);
table_index = GNA_VA_PG_TABLE(virt_addr); table_index = GNA_VA_PG_TABLE(virt_addr);
gna_page_table[dir_index].entry[table_index] = gna_page_table[dir_index].entry[table_index] =

View file

@ -257,7 +257,7 @@ void pci_read(u32_t controller, union pci_addr_reg addr,
case 4: case 4:
default: default:
access_size = SYS_PCI_ACCESS_32BIT; access_size = SYS_PCI_ACCESS_32BIT;
access_offset = 0; access_offset = 0U;
break; break;
} }
@ -348,7 +348,7 @@ void pci_write(u32_t controller, union pci_addr_reg addr,
case 4: case 4:
default: default:
access_size = SYS_PCI_ACCESS_32BIT; access_size = SYS_PCI_ACCESS_32BIT;
access_offset = 0; access_offset = 0U;
break; break;
} }
@ -389,7 +389,7 @@ void pci_header_get(u32_t controller,
/* fill in the PCI header from the device */ /* fill in the PCI header from the device */
for (i = 0; i < PCI_HEADER_WORDS; i++) { for (i = 0U; i < PCI_HEADER_WORDS; i++) {
pci_ctrl_addr.field.reg = i; pci_ctrl_addr.field.reg = i;
pci_read(controller, pci_read(controller,
pci_ctrl_addr, pci_ctrl_addr,

View file

@ -163,7 +163,7 @@ static int pinmux_initialize(struct device *device)
{ {
u32_t pin; u32_t pin;
for (pin = 0; pin < ARRAY_SIZE(pin_mux_off); pin++) { for (pin = 0U; pin < ARRAY_SIZE(pin_mux_off); pin++) {
pinmux_set(NULL, pin, 0); pinmux_set(NULL, pin, 0);
} }

View file

@ -111,7 +111,7 @@ static u8_t pwm_led_esp32_get_gpio_config(u8_t pin,
{ {
u8_t i; u8_t i;
for (i = 0; i < 16; i++) { for (i = 0U; i < 16; i++) {
if (ch_cfg[i].gpio == pin) { if (ch_cfg[i].gpio == pin) {
return i; return i;
} }
@ -180,10 +180,10 @@ static void pwm_led_esp32_duty_set(int speed_mode, int channel, int duty_val)
{ {
union pwm_led_esp32_duty duty; union pwm_led_esp32_duty duty;
duty.start = 0; duty.start = 0U;
duty.direction = 1; duty.direction = 1U;
duty.cycle = 1; duty.cycle = 1U;
duty.scale = 0; duty.scale = 0U;
pwm_led_esp32_duty_config(speed_mode, channel, duty_val << 4, duty); pwm_led_esp32_duty_config(speed_mode, channel, duty_val << 4, duty);
} }

View file

@ -42,7 +42,7 @@ static u32_t pwm_period_check(struct pwm_data *data, u8_t map_size,
} }
/* fail if requested period does not match already running period */ /* fail if requested period does not match already running period */
for (i = 0; i < map_size; i++) { for (i = 0U; i < map_size; i++) {
if ((data->map[i].pwm != pwm) && if ((data->map[i].pwm != pwm) &&
(data->map[i].pulse_cycles != 0) && (data->map[i].pulse_cycles != 0) &&
(period_cycles != data->period_cycles)) { (period_cycles != data->period_cycles)) {
@ -59,7 +59,7 @@ static u8_t pwm_channel_map(struct pwm_data *data, u8_t map_size,
u8_t i; u8_t i;
/* find pin, if already present */ /* find pin, if already present */
for (i = 0; i < map_size; i++) { for (i = 0U; i < map_size; i++) {
if (pwm == data->map[i].pwm) { if (pwm == data->map[i].pwm) {
return i; return i;
} }
@ -176,11 +176,11 @@ static int pwm_nrf5_sw_pin_set(struct device *dev, u32_t pwm,
return 0; return 0;
pin_set_pwm_off: pin_set_pwm_off:
data->map[channel].pulse_cycles = 0; data->map[channel].pulse_cycles = 0U;
bool pwm_active = false; bool pwm_active = false;
/* stop timer if all channels are inactive */ /* stop timer if all channels are inactive */
for (channel = 0; channel < config->map_size; channel++) { for (channel = 0U; channel < config->map_size; channel++) {
if (data->map[channel].pulse_cycles) { if (data->map[channel].pulse_cycles) {
pwm_active = true; pwm_active = true;
break; break;

View file

@ -80,7 +80,7 @@ static int __set_one_port(struct device *dev, qm_pwm_t id, u32_t pwm,
* turned off. Let's use the minimum value which is 1 for this case. * turned off. Let's use the minimum value which is 1 for this case.
*/ */
if (off == 0) { if (off == 0) {
off = 1; off = 1U;
} }
/* PWM mode, user-defined count mode, timer disabled */ /* PWM mode, user-defined count mode, timer disabled */
@ -149,7 +149,7 @@ static int pwm_qmsi_pin_set(struct device *dev, u32_t pwm,
*/ */
if (low == 0) { if (low == 0) {
high--; high--;
low = 1; low = 1U;
} }
return __set_one_port(dev, QM_PWM_0, pwm, high, low); return __set_one_port(dev, QM_PWM_0, pwm, high, low);

View file

@ -49,7 +49,7 @@ static int adt7420_attr_set(struct device *dev,
{ {
struct adt7420_data *drv_data = dev->driver_data; struct adt7420_data *drv_data = dev->driver_data;
const struct adt7420_dev_config *cfg = dev->config->config_info; const struct adt7420_dev_config *cfg = dev->config->config_info;
u8_t val8, reg = 0; u8_t val8, reg = 0U;
u16_t rate; u16_t rate;
s64_t value; s64_t value;

Some files were not shown because too many files have changed in this diff Show more