all: Update unsigend 'U' suffix due to multiplication

As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
Patrik Flykt 2019-03-28 14:57:54 -06:00 committed by Kumar Gala
commit 21358baa72
60 changed files with 107 additions and 106 deletions

View file

@ -31,7 +31,7 @@ static inline void _region_init(u32_t index, u32_t region_addr, u32_t size,
{ {
u8_t bits = find_msb_set(size) - 1; u8_t bits = find_msb_set(size) - 1;
index = 2 * index; index = index * 2U;
if (bits < ARC_FEATURE_MPU_ALIGNMENT_BITS) { if (bits < ARC_FEATURE_MPU_ALIGNMENT_BITS) {
bits = ARC_FEATURE_MPU_ALIGNMENT_BITS; bits = ARC_FEATURE_MPU_ALIGNMENT_BITS;
@ -98,7 +98,7 @@ static inline int _get_region_index_by_type(u32_t type)
*/ */
static inline bool _is_enabled_region(u32_t r_index) static inline bool _is_enabled_region(u32_t r_index)
{ {
return ((z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + 2 * r_index) return ((z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + r_index * 2U)
& AUX_MPU_RDB_VALID_MASK) == AUX_MPU_RDB_VALID_MASK); & AUX_MPU_RDB_VALID_MASK) == AUX_MPU_RDB_VALID_MASK);
} }
@ -111,9 +111,9 @@ static inline bool _is_in_region(u32_t r_index, u32_t start, u32_t size)
u32_t r_addr_end; u32_t r_addr_end;
u32_t r_size_lshift; u32_t r_size_lshift;
r_addr_start = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + 2 * r_index) r_addr_start = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + r_index * 2U)
& (~AUX_MPU_RDB_VALID_MASK); & (~AUX_MPU_RDB_VALID_MASK);
r_size_lshift = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + 2 * r_index) r_size_lshift = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + r_index * 2U)
& AUX_MPU_RDP_SIZE_MASK; & AUX_MPU_RDP_SIZE_MASK;
r_size_lshift = (r_size_lshift & 0x3) | ((r_size_lshift >> 7) & 0x1C); r_size_lshift = (r_size_lshift & 0x3) | ((r_size_lshift >> 7) & 0x1C);
r_addr_end = r_addr_start + (1 << (r_size_lshift + 1)); r_addr_end = r_addr_start + (1 << (r_size_lshift + 1));
@ -132,7 +132,7 @@ static inline bool _is_user_accessible_region(u32_t r_index, int write)
{ {
u32_t r_ap; u32_t r_ap;
r_ap = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + 2 * r_index); r_ap = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + r_index * 2U);
r_ap &= AUX_MPU_RDP_ATTR_MASK; r_ap &= AUX_MPU_RDP_ATTR_MASK;

View file

@ -151,7 +151,7 @@ static int mimxrt1020_evk_init(struct device *dev)
static int mimxrt1020_evk_phy_reset(struct device *dev) static int mimxrt1020_evk_phy_reset(struct device *dev)
{ {
/* RESET PHY chip. */ /* RESET PHY chip. */
k_busy_wait(10*USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 10U);
GPIO_WritePinOutput(GPIO1, 4, 1); GPIO_WritePinOutput(GPIO1, 4, 1);
return 0; return 0;

View file

@ -220,7 +220,7 @@ static int mimxrt1050_evk_init(struct device *dev)
static int mimxrt1050_evk_phy_reset(struct device *dev) static int mimxrt1050_evk_phy_reset(struct device *dev)
{ {
/* RESET PHY chip. */ /* RESET PHY chip. */
k_busy_wait(10*USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 10U);
GPIO_WritePinOutput(GPIO1, 9, 1); GPIO_WritePinOutput(GPIO1, 9, 1);
return 0; return 0;

View file

@ -156,7 +156,7 @@ static int mimxrt1064_evk_init(struct device *dev)
static int mimxrt1064_evk_phy_reset(struct device *dev) static int mimxrt1064_evk_phy_reset(struct device *dev)
{ {
/* RESET PHY chip. */ /* RESET PHY chip. */
k_busy_wait(10*USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 10U);
GPIO_WritePinOutput(GPIO1, 9, 1); GPIO_WritePinOutput(GPIO1, 9, 1);
return 0; return 0;

View file

@ -126,7 +126,7 @@ static int ili9340_write(const struct device *dev, const u16_t x,
u16_t write_h; u16_t write_h;
__ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width"); __ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
__ASSERT((3 * desc->pitch * desc->height) <= desc->bu_size, __ASSERT((desc->pitch * 3U * desc->height) <= desc->bu_size,
"Input buffer to small"); "Input buffer to small");
LOG_DBG("Writing %dx%d (w,h) @ %dx%d (x,y)", desc->width, desc->height, LOG_DBG("Writing %dx%d (w,h) @ %dx%d (x,y)", desc->width, desc->height,
@ -142,17 +142,18 @@ static int ili9340_write(const struct device *dev, const u16_t x,
} }
ili9340_transmit(data, ILI9340_CMD_MEM_WRITE, ili9340_transmit(data, ILI9340_CMD_MEM_WRITE,
(void *) write_data_start, 3 * desc->width * write_h); (void *) write_data_start,
desc->width * 3U * write_h);
tx_bufs.buffers = &tx_buf; tx_bufs.buffers = &tx_buf;
tx_bufs.count = 1; tx_bufs.count = 1;
write_data_start += (3 * desc->pitch); write_data_start += (desc->pitch * 3U);
for (write_cnt = 1U; 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 = desc->width * 3U * write_h;
spi_write(data->spi_dev, &data->spi_config, &tx_bufs); spi_write(data->spi_dev, &data->spi_config, &tx_bufs);
write_data_start += (3 * desc->pitch); write_data_start += (desc->pitch * 3U);
} }
return 0; return 0;

View file

@ -72,10 +72,10 @@ static int sdl_display_init(struct device *dev)
static void sdl_display_write_argb8888(void *disp_buf, static void sdl_display_write_argb8888(void *disp_buf,
const struct display_buffer_descriptor *desc, const void *buf) const struct display_buffer_descriptor *desc, const void *buf)
{ {
__ASSERT((4 * desc->pitch * desc->height) <= desc->buf_size, __ASSERT((desc->pitch * 4U * desc->height) <= desc->buf_size,
"Input buffer to small"); "Input buffer to small");
memcpy(disp_buf, buf, 4 * desc->pitch * desc->height); memcpy(disp_buf, buf, desc->pitch * 4U * desc->height);
} }
static void sdl_display_write_rgb888(u8_t *disp_buf, static void sdl_display_write_rgb888(u8_t *disp_buf,
@ -86,13 +86,13 @@ static void sdl_display_write_rgb888(u8_t *disp_buf,
u32_t pixel; u32_t pixel;
const u8_t *byte_ptr; const u8_t *byte_ptr;
__ASSERT((3 * desc->pitch * desc->height) <= desc->buf_size, __ASSERT((desc->pitch * 3U * desc->height) <= desc->buf_size,
"Input buffer to small"); "Input buffer to small");
for (h_idx = 0U; h_idx < desc->height; ++h_idx) { for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
for (w_idx = 0U; w_idx < desc->width; ++w_idx) { for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
byte_ptr = (const u8_t *)buf + byte_ptr = (const u8_t *)buf +
3 * ((h_idx * desc->pitch) + w_idx); ((h_idx * desc->pitch) + w_idx) * 3U;
pixel = *byte_ptr << 16; pixel = *byte_ptr << 16;
pixel |= *(byte_ptr + 1) << 8; pixel |= *(byte_ptr + 1) << 8;
pixel |= *(byte_ptr + 2); pixel |= *(byte_ptr + 2);
@ -114,7 +114,7 @@ static void sdl_display_write_mono(u8_t *disp_buf,
u32_t one_color; u32_t one_color;
u8_t *disp_buf_start; u8_t *disp_buf_start;
__ASSERT((desc->pitch * desc->height) <= (8 * desc->buf_size), __ASSERT((desc->pitch * desc->height) <= (desc->buf_size * 8U),
"Input buffer to small"); "Input buffer to small");
__ASSERT((desc->height % 8) == 0U, __ASSERT((desc->height % 8) == 0U,
"Input buffer height not aligned per 8 pixels"); "Input buffer height not aligned per 8 pixels");
@ -137,12 +137,12 @@ static void sdl_display_write_mono(u8_t *disp_buf,
pixel = (~one_color) & 0x00FFFFFF; pixel = (~one_color) & 0x00FFFFFF;
} }
*((u32_t *)disp_buf) = pixel; *((u32_t *)disp_buf) = pixel;
disp_buf += (4 * desc->width); disp_buf += (desc->width * 4U);
} }
disp_buf = disp_buf_start; disp_buf = disp_buf_start;
disp_buf += 4; disp_buf += 4;
} }
disp_buf += 7 * (4 * desc->width); disp_buf += 7 * (desc->width * 4U);
} }
} }
@ -207,11 +207,11 @@ static int sdl_display_read(const struct device *dev, const u16_t x,
desc->height, x, y); desc->height, x, y);
__ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width"); __ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
__ASSERT((3 * desc->pitch * desc->height) <= desc->buf_size, __ASSERT((desc->pitch * 3U * desc->height) <= desc->buf_size,
"Input buffer to small"); "Input buffer to small");
return SDL_RenderReadPixels(disp_data->renderer, &rect, 0, buf, return SDL_RenderReadPixels(disp_data->renderer, &rect, 0, buf,
4 * desc->pitch); desc->pitch * 4U);
} }
static void *sdl_display_get_framebuffer(const struct device *dev) static void *sdl_display_get_framebuffer(const struct device *dev)

View file

@ -538,7 +538,7 @@ static int write_op(void *context)
ticks_diff = ticks_diff =
ticker_ticks_diff_get(ticker_ticks_now_get(), ticker_ticks_diff_get(ticker_ticks_now_get(),
ticks_begin); ticks_begin);
if (2 * ticks_diff > if (ticks_diff * 2U >
HAL_TICKER_US_TO_TICKS(w_ctx->slot)) { HAL_TICKER_US_TO_TICKS(w_ctx->slot)) {
nvmc_wait_ready(); nvmc_wait_ready();
return FLASH_OP_ONGOING; return FLASH_OP_ONGOING;

View file

@ -109,7 +109,7 @@ static int config_interrupt(u32_t pin, int flags)
static void config_polarity(u32_t pin, int flags) static void config_polarity(u32_t pin, int flags)
{ {
volatile u32_t *reg = (u32_t *)(GPIO_FUNC0_IN_SEL_CFG_REG + 4 * pin); volatile u32_t *reg = (u32_t *)(GPIO_FUNC0_IN_SEL_CFG_REG + pin * 4U);
if (flags & GPIO_POL_INV) { if (flags & GPIO_POL_INV) {
*reg |= BIT(GPIO_FUNC0_IN_INV_SEL_S); *reg |= BIT(GPIO_FUNC0_IN_INV_SEL_S);

View file

@ -80,7 +80,7 @@ static int i2c_clk_set(Twi *const twi, u32_t speed)
* T_low = ( ( CLDIV × 2^CKDIV ) + 4 ) × T_MCK * T_low = ( ( CLDIV × 2^CKDIV ) + 4 ) × T_MCK
*/ */
while (!div_completed) { while (!div_completed) {
cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (2 * speed)) - 4) cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (speed * 2U)) - 4)
/ (1 << ck_div); / (1 << ck_div);
if (cl_div <= 255U) { if (cl_div <= 255U) {

View file

@ -80,7 +80,7 @@ static int i2c_clk_set(Twihs *const twihs, u32_t speed)
* T_low = ( ( CLDIV × 2^CKDIV ) + 3 ) × T_MCK * T_low = ( ( CLDIV × 2^CKDIV ) + 3 ) × T_MCK
*/ */
while (!div_completed) { while (!div_completed) {
cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (2 * speed)) - 3) cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (speed * 2U)) - 3)
/ (1 << ck_div); / (1 << ck_div);
if (cl_div <= 255U) { if (cl_div <= 255U) {

View file

@ -237,7 +237,7 @@ static int i2c_sifive_configure(struct device *dev, u32_t dev_config)
} }
/* Calculate prescale value */ /* Calculate prescale value */
prescale = (config->f_sys / (5 * i2c_speed)) - 1; prescale = (config->f_sys / (i2c_speed * 5U)) - 1;
/* Configure peripheral with calculated prescale */ /* Configure peripheral with calculated prescale */
sys_write8((u8_t) (0xFF & prescale), I2C_REG(config, REG_PRESCALE_LOW)); sys_write8((u8_t) (0xFF & prescale), I2C_REG(config, REG_PRESCALE_LOW));

View file

@ -353,7 +353,7 @@ static int rf_calibrate(struct cc1200_context *ctx)
return -EIO; return -EIO;
} }
k_busy_wait(5 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 5U);
/* We need to re-enable RX as SCAL shuts off the freq synth */ /* We need to re-enable RX as SCAL shuts off the freq synth */
if (!instruct_sidle(ctx) || if (!instruct_sidle(ctx) ||
@ -363,7 +363,7 @@ static int rf_calibrate(struct cc1200_context *ctx)
return -EIO; return -EIO;
} }
k_busy_wait(10 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 10U);
_cc1200_print_status(get_status(ctx)); _cc1200_print_status(get_status(ctx));

View file

@ -719,7 +719,7 @@ static int cc2520_set_channel(struct device *dev, u16_t channel)
} }
/* See chapter 16 */ /* See chapter 16 */
channel = 11 + 5 * (channel - 11); channel = 11 + (channel - 11) * 5U;
if (!write_reg_freqctrl(cc2520, FREQCTRL_FREQ(channel))) { if (!write_reg_freqctrl(cc2520, FREQCTRL_FREQ(channel))) {
LOG_ERR("Failed"); LOG_ERR("Failed");

View file

@ -468,7 +468,7 @@ static u8_t kw41z_convert_lqi(u8_t hw_lqi)
if (hw_lqi >= 220U) { if (hw_lqi >= 220U) {
return 255; return 255;
} else { } else {
return (51 * hw_lqi) / 44; return (hw_lqi * 51U) / 44;
} }
} }

View file

@ -71,7 +71,7 @@ static int imx_pwm_pin_set(struct device *dev, u32_t pwm,
LOG_DBG("enabled=%d, pulse_cycles=%d, period_cycles=%d," LOG_DBG("enabled=%d, pulse_cycles=%d, period_cycles=%d,"
" duty_cycle=%d\n", enabled, pulse_cycles, period_cycles, " duty_cycle=%d\n", enabled, pulse_cycles, period_cycles,
(100 * pulse_cycles / period_cycles)); (pulse_cycles * 100U / period_cycles));
/* /*
* i.MX PWMv2 has a 4-word sample FIFO. * i.MX PWMv2 has a 4-word sample FIFO.

View file

@ -48,7 +48,7 @@ static int mcux_ftm_pin_set(struct device *dev, u32_t pwm,
return -ENOTSUP; return -ENOTSUP;
} }
duty_cycle = 100 * pulse_cycles / period_cycles; duty_cycle = pulse_cycles * 100U / period_cycles;
data->channel[pwm].dutyCyclePercent = duty_cycle; data->channel[pwm].dutyCyclePercent = duty_cycle;
LOG_DBG("pulse_cycles=%d, period_cycles=%d, duty_cycle=%d", LOG_DBG("pulse_cycles=%d, period_cycles=%d, duty_cycle=%d",

View file

@ -50,7 +50,7 @@ static u32_t __get_tim_clk(u32_t bus_clk,
if (apb_psc == 1U) { if (apb_psc == 1U) {
tim_clk = bus_clk; tim_clk = bus_clk;
} else { } else {
tim_clk = 2 * bus_clk; tim_clk = bus_clk * 2U;
} }
return tim_clk; return tim_clk;

View file

@ -63,7 +63,7 @@ static int bmc150_magn_set_power_mode(struct device *dev,
!state) < 0) { !state) < 0) {
return -EIO; return -EIO;
} }
k_busy_wait(5 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 5U);
return 0; return 0;
case BMC150_MAGN_POWER_MODE_SLEEP: case BMC150_MAGN_POWER_MODE_SLEEP:

View file

@ -217,7 +217,7 @@ int bmi160_acc_slope_config(struct device *dev, enum sensor_attribute attr,
return -EINVAL; return -EINVAL;
} }
reg_val = 512 * (slope_th_ums2 - 1) / (acc_range_g * SENSOR_G); reg_val = (slope_th_ums2 - 1) * 512U / (acc_range_g * SENSOR_G);
if (bmi160_byte_write(dev, BMI160_REG_INT_MOTION1, if (bmi160_byte_write(dev, BMI160_REG_INT_MOTION1,
reg_val) < 0) { reg_val) < 0) {

View file

@ -51,7 +51,7 @@ static int bmm150_set_power_mode(struct device *dev,
!state) < 0) { !state) < 0) {
return -EIO; return -EIO;
} }
k_busy_wait(5 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 5U);
return 0; return 0;
case BMM150_POWER_MODE_SLEEP: case BMM150_POWER_MODE_SLEEP:

View file

@ -75,16 +75,16 @@ static int hdc1008_channel_get(struct device *dev,
*/ */
if (chan == SENSOR_CHAN_AMBIENT_TEMP) { if (chan == SENSOR_CHAN_AMBIENT_TEMP) {
/* val = -40 + 165 * sample / 2^16 */ /* val = -40 + 165 * sample / 2^16 */
tmp = 165 * (u64_t)drv_data->t_sample; tmp = (u64_t)drv_data->t_sample * 165U;
val->val1 = (s32_t)(tmp >> 16) - 40; val->val1 = (s32_t)(tmp >> 16) - 40;
val->val2 = (1000000 * (tmp & 0xFFFF)) >> 16; val->val2 = ((tmp & 0xFFFF) * 1000000U) >> 16;
} else if (chan == SENSOR_CHAN_HUMIDITY) { } else if (chan == SENSOR_CHAN_HUMIDITY) {
/* val = 100 * sample / 2^16 */ /* val = 100 * sample / 2^16 */
u32_t tmp2; u32_t tmp2;
tmp2 = 100 * (u32_t)drv_data->rh_sample; tmp2 = (u32_t)drv_data->rh_sample * 100U;
val->val1 = tmp2 >> 16; val->val1 = tmp2 >> 16;
/* x * 1000000 / 65536 == x * 15625 / 1024 */ /* x * 1000000 / 65536 == x * 15625 / 1024 */
val->val2 = (15625 * (tmp2 & 0xFFFF)) >> 10; val->val2 = ((tmp2 & 0xFFFF) * 15625U) >> 10;
} else { } else {
return -ENOTSUP; return -ENOTSUP;
} }

View file

@ -117,14 +117,14 @@ static int lps25hb_init_chip(struct device *dev)
u8_t chip_id; u8_t chip_id;
lps25hb_power_ctrl(dev, 0); lps25hb_power_ctrl(dev, 0);
k_busy_wait(50 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 50U);
if (lps25hb_power_ctrl(dev, 1) < 0) { if (lps25hb_power_ctrl(dev, 1) < 0) {
LOG_DBG("failed to power on device"); LOG_DBG("failed to power on device");
return -EIO; return -EIO;
} }
k_busy_wait(20 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 20U);
if (i2c_reg_read_byte(data->i2c_master, config->i2c_slave_addr, if (i2c_reg_read_byte(data->i2c_master, config->i2c_slave_addr,
LPS25HB_REG_WHO_AM_I, &chip_id) < 0) { LPS25HB_REG_WHO_AM_I, &chip_id) < 0) {

View file

@ -33,7 +33,7 @@ static inline int lsm6ds0_reboot(struct device *dev)
return -EIO; return -EIO;
} }
k_busy_wait(50 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 50U);
return 0; return 0;
} }

View file

@ -98,7 +98,7 @@ static inline int lsm6dsl_reboot(struct device *dev)
} }
/* Wait sensor turn-on time as per datasheet */ /* Wait sensor turn-on time as per datasheet */
k_busy_wait(35 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 35U);
return 0; return 0;
} }

View file

@ -35,7 +35,7 @@ static inline int lsm9ds0_mfd_reboot_memory(struct device *dev)
return -EIO; return -EIO;
} }
k_busy_wait(50 * USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC * 50U);
return 0; return 0;
} }

View file

@ -33,7 +33,7 @@ static void mpu6050_convert_gyro(struct sensor_value *val, s16_t raw_val,
s64_t conv_val; s64_t conv_val;
conv_val = ((s64_t)raw_val * SENSOR_PI * 10) / conv_val = ((s64_t)raw_val * SENSOR_PI * 10) /
(180 * sensitivity_x10); (sensitivity_x10 * 180U);
val->val1 = conv_val / 1000000; val->val1 = conv_val / 1000000;
val->val2 = conv_val % 1000000; val->val2 = conv_val % 1000000;
} }

View file

@ -127,12 +127,12 @@ static int sht3xd_channel_get(struct device *dev,
*/ */
if (chan == SENSOR_CHAN_AMBIENT_TEMP) { if (chan == SENSOR_CHAN_AMBIENT_TEMP) {
/* val = -45 + 175 * sample / (2^16 -1) */ /* val = -45 + 175 * sample / (2^16 -1) */
tmp = 175 * (u64_t)data->t_sample; tmp = (u64_t)data->t_sample * 175U;
val->val1 = (s32_t)(tmp / 0xFFFF) - 45; val->val1 = (s32_t)(tmp / 0xFFFF) - 45;
val->val2 = (1000000 * (tmp % 0xFFFF)) / 0xFFFF; val->val2 = ((tmp % 0xFFFF) * 1000000U) / 0xFFFF;
} else if (chan == SENSOR_CHAN_HUMIDITY) { } else if (chan == SENSOR_CHAN_HUMIDITY) {
/* val = 100 * sample / (2^16 -1) */ /* val = 100 * sample / (2^16 -1) */
u32_t tmp2 = 100 * (u32_t)data->rh_sample; u32_t tmp2 = (u32_t)data->rh_sample * 100U;
val->val1 = tmp2 / 0xFFFF; val->val1 = tmp2 / 0xFFFF;
/* x * 100000 / 65536 == x * 15625 / 1024 */ /* x * 100000 / 65536 == x * 15625 / 1024 */
val->val2 = (tmp2 % 0xFFFF) * 15625U / 1024; val->val2 = (tmp2 % 0xFFFF) * 15625U / 1024;

View file

@ -343,7 +343,7 @@ static int uart_miv_init(struct device *dev)
const struct uart_miv_device_config *const cfg = DEV_CFG(dev); const struct uart_miv_device_config *const cfg = DEV_CFG(dev);
volatile struct uart_miv_regs_t *uart = DEV_UART(dev); volatile struct uart_miv_regs_t *uart = DEV_UART(dev);
/* Calculate divider value to set baudrate */ /* Calculate divider value to set baudrate */
u16_t baud_value = (cfg->sys_clk_freq / (16 * cfg->baud_rate)) - 1; u16_t baud_value = (cfg->sys_clk_freq / (cfg->baud_rate * 16U)) - 1;
/* Set baud rate */ /* Set baud rate */
uart->ctrlreg1 = (u8_t)(baud_value & BAUDVALUE_LSB); uart->ctrlreg1 = (u8_t)(baud_value & BAUDVALUE_LSB);

View file

@ -172,7 +172,7 @@ static int pl011_set_baudrate(struct device *dev,
{ {
/* Avoiding float calculations, bauddiv is left shifted by 6 */ /* Avoiding float calculations, bauddiv is left shifted by 6 */
u64_t bauddiv = (((u64_t)clk) << PL011_FBRD_WIDTH) u64_t bauddiv = (((u64_t)clk) << PL011_FBRD_WIDTH)
/ (16 * baudrate); / (baudrate * 16U);
/* Valid bauddiv value /* Valid bauddiv value
* uart_clk (min) >= 16 x baud_rate (max) * uart_clk (min) >= 16 x baud_rate (max)

View file

@ -165,7 +165,7 @@ static void baudrate_set(struct device *dev,
/* upon reset, the system clock uses the intenal OSC @ 12MHz */ /* upon reset, the system clock uses the intenal OSC @ 12MHz */
div = (16 * baudrate); div = (baudrate * 16U);
rem = sys_clk_freq_hz % div; rem = sys_clk_freq_hz % div;
/* /*

View file

@ -38,7 +38,7 @@ int spi_config(struct device *dev, u32_t frequency, u16_t operation)
} }
/* Set the SPI frequency */ /* Set the SPI frequency */
div = (SPI_CFG(dev)->f_sys / (2 * frequency)) - 1; div = (SPI_CFG(dev)->f_sys / (frequency * 2U)) - 1;
sys_write32((SF_SCKDIV_DIV_MASK & div), SPI_REG(dev, REG_SCKDIV)); sys_write32((SF_SCKDIV_DIV_MASK & div), SPI_REG(dev, REG_SCKDIV));
/* Set the polarity */ /* Set the polarity */

View file

@ -1128,7 +1128,7 @@ int usb_dc_ep_read_wait(u8_t ep, u8_t *data, u32_t max_data_len,
for (j = 0U; j < (bytes_to_copy & 0x3); j++) { for (j = 0U; j < (bytes_to_copy & 0x3); j++) {
*(data + i + j) = *(data + i + j) =
(sys_cpu_to_le32(last_dw) >> (8 * j)) & 0xFF; (sys_cpu_to_le32(last_dw) >> (j * 8U)) & 0xFF;
} }
} }

View file

@ -223,7 +223,7 @@ extern "C" {
.source_id = _id \ .source_id = _id \
}; \ }; \
\ \
if ((BIT(_level) & LOG_FUNCTION_PREFIX_MASK) != 0) {\ if ((BIT(_level) & LOG_FUNCTION_PREFIX_MASK) != 0U) {\
__LOG_INTERNAL(src_level, \ __LOG_INTERNAL(src_level, \
Z_LOG_STR(__VA_ARGS__)); \ Z_LOG_STR(__VA_ARGS__)); \
} else { \ } else { \

View file

@ -87,7 +87,7 @@ static inline bool z_is_idle_thread(void *entry_point)
static inline bool z_is_thread_pending(struct k_thread *thread) static inline bool z_is_thread_pending(struct k_thread *thread)
{ {
return (thread->base.thread_state & _THREAD_PENDING) != 0; return (thread->base.thread_state & _THREAD_PENDING) != 0U;
} }
static inline bool z_is_thread_prevented_from_running(struct k_thread *thread) static inline bool z_is_thread_prevented_from_running(struct k_thread *thread)
@ -117,7 +117,7 @@ static inline bool z_has_thread_started(struct k_thread *thread)
static inline bool z_is_thread_state_set(struct k_thread *thread, u32_t state) static inline bool z_is_thread_state_set(struct k_thread *thread, u32_t state)
{ {
return (thread->base.thread_state & state) != 0; return (thread->base.thread_state & state) != 0U;
} }
static inline bool z_is_thread_queued(struct k_thread *thread) static inline bool z_is_thread_queued(struct k_thread *thread)

View file

@ -75,7 +75,7 @@ static inline int is_metairq(struct k_thread *thread)
#if CONFIG_ASSERT #if CONFIG_ASSERT
static inline bool is_thread_dummy(struct k_thread *thread) static inline bool is_thread_dummy(struct k_thread *thread)
{ {
return (thread->base.thread_state & _THREAD_DUMMY) != 0; return (thread->base.thread_state & _THREAD_DUMMY) != 0U;
} }
#endif #endif

View file

@ -565,12 +565,12 @@ int z_object_validate(struct _k_object *ko, enum k_objects otype,
/* Initialization state checks. _OBJ_INIT_ANY, we don't care */ /* Initialization state checks. _OBJ_INIT_ANY, we don't care */
if (likely(init == _OBJ_INIT_TRUE)) { if (likely(init == _OBJ_INIT_TRUE)) {
/* Object MUST be intialized */ /* Object MUST be intialized */
if (unlikely((ko->flags & K_OBJ_FLAG_INITIALIZED) == 0)) { if (unlikely((ko->flags & K_OBJ_FLAG_INITIALIZED) == 0U)) {
return -EINVAL; return -EINVAL;
} }
} else if (init < _OBJ_INIT_TRUE) { /* _OBJ_INIT_FALSE case */ } else if (init < _OBJ_INIT_TRUE) { /* _OBJ_INIT_FALSE case */
/* Object MUST NOT be initialized */ /* Object MUST NOT be initialized */
if (unlikely((ko->flags & K_OBJ_FLAG_INITIALIZED) != 0)) { if (unlikely((ko->flags & K_OBJ_FLAG_INITIALIZED) != 0U)) {
return -EADDRINUSE; return -EADDRINUSE;
} }
} else { } else {

View file

@ -17,7 +17,7 @@ static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
u16_t h = y2 - y1 + 1; u16_t h = y2 - y1 + 1;
struct display_buffer_descriptor desc; struct display_buffer_descriptor desc;
desc.buf_size = 2 * w * h; desc.buf_size = w * 2U * h;
desc.width = w; desc.width = w;
desc.pitch = w; desc.pitch = w;
desc.height = h; desc.height = h;

View file

@ -17,7 +17,7 @@ static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
u16_t h = y2 - y1 + 1; u16_t h = y2 - y1 + 1;
struct display_buffer_descriptor desc; struct display_buffer_descriptor desc;
desc.buf_size = 4 * w * h; desc.buf_size = w * 4U * h;
desc.width = w; desc.width = w;
desc.pitch = w; desc.pitch = w;
desc.height = h; desc.height = h;
@ -37,7 +37,7 @@ static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
u16_t h = y2 - y1 + 1; u16_t h = y2 - y1 + 1;
struct display_buffer_descriptor desc; struct display_buffer_descriptor desc;
desc.buf_size = 3 * w * h; desc.buf_size = w * 3U * h;
desc.width = w; desc.width = w;
desc.pitch = w; desc.pitch = w;
desc.height = h; desc.height = h;

View file

@ -26,7 +26,7 @@ u16_t crc16(const u8_t *src, size_t len, u16_t polynomial,
crc |= !!(src[i] & (0x80U >> b)); crc |= !!(src[i] & (0x80U >> b));
} }
if (divide != 0) { if (divide != 0U) {
crc = crc ^ polynomial; crc = crc ^ polynomial;
} }
} }

View file

@ -616,7 +616,7 @@ void onoff_handler(struct generic_onoff_state *state)
k_timer_init(ptr_timer, onoff_tt_handler, NULL); k_timer_init(ptr_timer, onoff_tt_handler, NULL);
k_timer_start(ptr_timer, k_timer_start(ptr_timer,
K_MSEC(5 * state->transition->delay), K_MSEC(state->transition->delay * 5U),
K_MSEC(state->transition->quo_tt)); K_MSEC(state->transition->quo_tt));
} }
@ -627,7 +627,7 @@ void level_lightness_handler(struct generic_level_state *state)
k_timer_init(ptr_timer, level_lightness_tt_handler, NULL); k_timer_init(ptr_timer, level_lightness_tt_handler, NULL);
k_timer_start(ptr_timer, k_timer_start(ptr_timer,
K_MSEC(5 * state->transition->delay), K_MSEC(state->transition->delay * 5U),
K_MSEC(state->transition->quo_tt)); K_MSEC(state->transition->quo_tt));
} }
@ -638,7 +638,7 @@ void level_temp_handler(struct generic_level_state *state)
k_timer_init(ptr_timer, level_temp_tt_handler, NULL); k_timer_init(ptr_timer, level_temp_tt_handler, NULL);
k_timer_start(ptr_timer, k_timer_start(ptr_timer,
K_MSEC(5 * state->transition->delay), K_MSEC(state->transition->delay * 5U),
K_MSEC(state->transition->quo_tt)); K_MSEC(state->transition->quo_tt));
} }
@ -649,7 +649,7 @@ void light_lightness_actual_handler(struct light_lightness_state *state)
k_timer_init(ptr_timer, light_lightness_actual_tt_handler, NULL); k_timer_init(ptr_timer, light_lightness_actual_tt_handler, NULL);
k_timer_start(ptr_timer, k_timer_start(ptr_timer,
K_MSEC(5 * state->transition->delay), K_MSEC(state->transition->delay * 5U),
K_MSEC(state->transition->quo_tt)); K_MSEC(state->transition->quo_tt));
} }
@ -660,7 +660,7 @@ void light_lightness_linear_handler(struct light_lightness_state *state)
k_timer_init(ptr_timer, light_lightness_linear_tt_handler, NULL); k_timer_init(ptr_timer, light_lightness_linear_tt_handler, NULL);
k_timer_start(ptr_timer, k_timer_start(ptr_timer,
K_MSEC(5 * state->transition->delay), K_MSEC(state->transition->delay * 5U),
K_MSEC(state->transition->quo_tt)); K_MSEC(state->transition->quo_tt));
} }
@ -671,7 +671,7 @@ void light_ctl_handler(struct light_ctl_state *state)
k_timer_init(ptr_timer, light_ctl_tt_handler, NULL); k_timer_init(ptr_timer, light_ctl_tt_handler, NULL);
k_timer_start(ptr_timer, k_timer_start(ptr_timer,
K_MSEC(5 * state->transition->delay), K_MSEC(state->transition->delay * 5U),
K_MSEC(state->transition->quo_tt)); K_MSEC(state->transition->quo_tt));
} }
@ -682,7 +682,7 @@ void light_ctl_temp_handler(struct light_ctl_state *state)
k_timer_init(ptr_timer, light_ctl_temp_tt_handler, NULL); k_timer_init(ptr_timer, light_ctl_temp_tt_handler, NULL);
k_timer_start(ptr_timer, k_timer_start(ptr_timer,
K_MSEC(5 * state->transition->delay), K_MSEC(state->transition->delay * 5U),
K_MSEC(state->transition->quo_tt)); K_MSEC(state->transition->quo_tt));
} }
/* Messages handlers (End) */ /* Messages handlers (End) */

View file

@ -27,7 +27,7 @@ static void test_counter_interrupt_fn(struct device *counter_dev,
printk("Now: %u\n", now_sec); printk("Now: %u\n", now_sec);
/* Set a new alarm with a double lenght duration */ /* Set a new alarm with a double lenght duration */
config->ticks = 2 * config->ticks; config->ticks = config->ticks * 2U;
printk("Set alarm in %u sec\n", config->ticks); printk("Set alarm in %u sec\n", config->ticks);
counter_set_channel_alarm(counter_dev, ALARM_CHANNEL_ID, user_data); counter_set_channel_alarm(counter_dev, ALARM_CHANNEL_ID, user_data);

View file

@ -201,7 +201,7 @@ static int wait_for_input(int timeout)
return res; return res;
} }
#define ALIVE_TIME (60 * MSEC_PER_SEC) #define ALIVE_TIME (MSEC_PER_SEC * 60U)
static struct mqtt_utf8 password = { static struct mqtt_utf8 password = {
.utf8 = token .utf8 = token

View file

@ -995,7 +995,7 @@ static void update_counter(struct k_work *work)
coap_resource_notify(resource_to_notify); coap_resource_notify(resource_to_notify);
} }
k_delayed_work_submit(&observer_work, 5 * MSEC_PER_SEC); k_delayed_work_submit(&observer_work, MSEC_PER_SEC * 5U);
} }
static int create_pending_request(struct coap_packet *response, static int create_pending_request(struct coap_packet *response,
@ -1099,7 +1099,7 @@ static int send_notification_packet(const struct sockaddr *addr,
} }
} }
k_delayed_work_submit(&observer_work, 5 * MSEC_PER_SEC); k_delayed_work_submit(&observer_work, MSEC_PER_SEC * 5U);
r = send_coap_reply(&response, addr, addr_len); r = send_coap_reply(&response, addr, addr_len);

View file

@ -426,7 +426,7 @@ int interrupt_test(void)
*/ */
const int max_reps = 8; const int max_reps = 8;
int wh = white[i % ARRAY_SIZE(white)]; int wh = white[i % ARRAY_SIZE(white)];
int delay = 2*spill_time int delay = spill_time * 2U
+ ((wh * (i+1)) % (spill_time * (max_reps - 2))); + ((wh * (i+1)) % (spill_time * (max_reps - 2)));
int alarm = ccount() + delay; int alarm = ccount() + delay;

View file

@ -38,9 +38,9 @@ void lll_chan_set(u32_t chan)
default: default:
if (chan < 11) { if (chan < 11) {
radio_freq_chan_set(4 + (2 * chan)); radio_freq_chan_set(4 + (chan * 2U));
} else if (chan < 40) { } else if (chan < 40) {
radio_freq_chan_set(28 + (2 * (chan - 11))); radio_freq_chan_set(28 + ((chan - 11) * 2U));
} else { } else {
LL_ASSERT(0); LL_ASSERT(0);
} }

View file

@ -1209,7 +1209,7 @@ bool bt_le_conn_params_valid(const struct bt_le_conn_param *param)
} }
if (param->timeout < 10 || param->timeout > 3200 || if (param->timeout < 10 || param->timeout > 3200 ||
((4 * param->timeout) <= ((param->timeout * 4U) <=
((1 + param->latency) * param->interval_max))) { ((1 + param->latency) * param->interval_max))) {
return false; return false;
} }

View file

@ -1330,7 +1330,7 @@ static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf)
u8_t expect_len; u8_t expect_len;
expect_len = (link.rx.buf->len - 20U - expect_len = (link.rx.buf->len - 20U -
(23 * (link.rx.last_seg - 1))); ((link.rx.last_seg - 1) * 23U));
if (expect_len != buf->len) { if (expect_len != buf->len) {
BT_ERR("Incorrect last seg len: %u != %u", BT_ERR("Incorrect last seg len: %u != %u",
expect_len, buf->len); expect_len, buf->len);

View file

@ -913,7 +913,7 @@ static inline s32_t ack_timeout(struct seg_rx *rx)
/* The acknowledgment timer shall be set to a minimum of /* The acknowledgment timer shall be set to a minimum of
* 150 + 50 * TTL milliseconds. * 150 + 50 * TTL milliseconds.
*/ */
to = K_MSEC(150 + (50 * ttl)); to = K_MSEC(150 + (ttl * 50U));
/* 100 ms for every not yet received segment */ /* 100 ms for every not yet received segment */
to += K_MSEC(((rx->seg_n + 1) - popcount(rx->block)) * 100U); to += K_MSEC(((rx->seg_n + 1) - popcount(rx->block)) * 100U);

View file

@ -174,7 +174,7 @@ static int timestamp_print(const struct log_output *log_output,
remainder = timestamp % freq; remainder = timestamp % freq;
ms = (remainder * 1000U) / freq; ms = (remainder * 1000U) / freq;
us = (1000 * (1000 * remainder - (ms * freq))) / freq; us = (1000 * (remainder * 1000U - (ms * freq))) / freq;
if (IS_ENABLED(CONFIG_LOG_BACKEND_NET) && if (IS_ENABLED(CONFIG_LOG_BACKEND_NET) &&
flags & LOG_OUTPUT_FLAG_FORMAT_SYSLOG) { flags & LOG_OUTPUT_FLAG_FORMAT_SYSLOG) {

View file

@ -1010,7 +1010,7 @@ static inline struct net_nbr *handle_ns_neighbor(struct net_pkt *pkt,
struct net_linkaddr_storage lladdr; struct net_linkaddr_storage lladdr;
struct net_linkaddr nbr_lladdr; struct net_linkaddr nbr_lladdr;
lladdr.len = 8 * ll_len - 2; lladdr.len = ll_len * 8U - 2;
if (net_pkt_read(pkt, lladdr.addr, lladdr.len)) { if (net_pkt_read(pkt, lladdr.addr, lladdr.len)) {
return NULL; return NULL;

View file

@ -42,7 +42,7 @@ static struct k_mbox_msg message;
#define PRINT_ONE_RESULT() \ #define PRINT_ONE_RESULT() \
PRINT_F(output_file, "|%11u|%32u|%32u|\n", putsize, puttime, \ PRINT_F(output_file, "|%11u|%32u|%32u|\n", putsize, puttime, \
(u32_t)((1000000 * (u64_t)putsize) / SAFE_DIVISOR(puttime))) (u32_t)(((u64_t)putsize * 1000000U) / SAFE_DIVISOR(puttime)))
#define PRINT_OVERHEAD() \ #define PRINT_OVERHEAD() \
PRINT_F(output_file, \ PRINT_F(output_file, \
@ -52,7 +52,7 @@ static struct k_mbox_msg message;
#define PRINT_XFER_RATE() \ #define PRINT_XFER_RATE() \
PRINT_F(output_file, "| raw transfer rate: %10u KB/sec (without" \ PRINT_F(output_file, "| raw transfer rate: %10u KB/sec (without" \
" overhead) |\n", \ " overhead) |\n", \
(u32_t)(1000000 * (u64_t)(putsize >> 1) \ (u32_t)((u64_t)(putsize >> 1) * 1000000U \
/ SAFE_DIVISOR(puttime - empty_msg_put_time))) / SAFE_DIVISOR(puttime - empty_msg_put_time)))
#endif #endif

View file

@ -72,9 +72,9 @@
puttime[0], \ puttime[0], \
puttime[1], \ puttime[1], \
puttime[2], \ puttime[2], \
(u32_t)((1000000 * (u64_t)putsize) / SAFE_DIVISOR(puttime[0])), \ (u32_t)(((u64_t)putsize * 1000000U) / SAFE_DIVISOR(puttime[0])), \
(u32_t)((1000000 * (u64_t)putsize) / SAFE_DIVISOR(puttime[1])), \ (u32_t)(((u64_t)putsize * 1000000U) / SAFE_DIVISOR(puttime[1])), \
(u32_t)((1000000 * (u64_t)putsize) / SAFE_DIVISOR(puttime[2]))) (u32_t)(((u64_t)putsize * 1000000U) / SAFE_DIVISOR(puttime[2])))
#endif /* FLOAT */ #endif /* FLOAT */
/* /*

View file

@ -129,16 +129,16 @@ int hex2bin(uint8_t *buf, const size_t buflen, const char *hex,
void string2scalar(unsigned int *scalar, unsigned int num_word32, char *str) void string2scalar(unsigned int *scalar, unsigned int num_word32, char *str)
{ {
unsigned int num_bytes = 4 * num_word32; unsigned int num_bytes = num_word32 * 4U;
uint8_t tmp[num_bytes]; uint8_t tmp[num_bytes];
size_t hexlen = strlen(str); size_t hexlen = strlen(str);
int padding; int padding;
padding = 2 * num_bytes - strlen(str); padding = num_bytes * 2U - strlen(str);
if (0 > padding) { if (0 > padding) {
printf("Error: 2 * num_bytes(%d) < strlen(hex) (%zu)\n", printf("Error: 2 * num_bytes(%d) < strlen(hex) (%zu)\n",
2 * num_bytes, strlen(str)); num_bytes * 2U, strlen(str));
k_panic(); k_panic();
} }
@ -182,7 +182,7 @@ int check_ecc_result(const int num, const char *name,
const unsigned int *computed, const unsigned int *computed,
const unsigned int num_word32, const bool verbose) const unsigned int num_word32, const bool verbose)
{ {
uint32_t num_bytes = 4 * num_word32; uint32_t num_bytes = num_word32 * 4U;
if (memcmp(computed, expected, num_bytes)) { if (memcmp(computed, expected, num_bytes)) {
TC_PRINT("\n Vector #%02d check %s - FAILURE:\n\n", num, name); TC_PRINT("\n Vector #%02d check %s - FAILURE:\n\n", num, name);

View file

@ -16,7 +16,7 @@ static void top_handler(struct device *dev, void *user_data);
void *exp_user_data = (void *)199; void *exp_user_data = (void *)199;
#if defined(CONFIG_COUNTER_MCUX_RTC) || defined(CONFIG_COUNTER_RTC_STM32) #if defined(CONFIG_COUNTER_MCUX_RTC) || defined(CONFIG_COUNTER_RTC_STM32)
#define COUNTER_PERIOD_US (2*USEC_PER_SEC) #define COUNTER_PERIOD_US (USEC_PER_SEC * 2U)
#else #else
#define COUNTER_PERIOD_US 20000 #define COUNTER_PERIOD_US 20000
#endif #endif
@ -307,7 +307,7 @@ void test_multiple_alarms_instance(const char *dev_name)
err = counter_set_channel_alarm(dev, 1, &alarm_cfg2); err = counter_set_channel_alarm(dev, 1, &alarm_cfg2);
zassert_equal(0, err, "Counter set alarm failed\n"); zassert_equal(0, err, "Counter set alarm failed\n");
k_busy_wait(1.2*counter_ticks_to_us(dev, 2*ticks)); k_busy_wait(1.2*counter_ticks_to_us(dev, ticks * 2U));
tmp_alarm_cnt = alarm_cnt; /* to avoid passing volatile to the macro */ tmp_alarm_cnt = alarm_cnt; /* to avoid passing volatile to the macro */
zassert_equal(2, tmp_alarm_cnt, "Counter set alarm failed\n"); zassert_equal(2, tmp_alarm_cnt, "Counter set alarm failed\n");
zassert_equal(&alarm_cfg2, clbk_data[0], zassert_equal(&alarm_cfg2, clbk_data[0],

View file

@ -196,9 +196,9 @@ void ticklessTestThread(void)
* calibrated TSC diff and measured result * calibrated TSC diff and measured result
*/ */
if (diff_tsc > cal_tsc) { if (diff_tsc > cal_tsc) {
diff_per = (100 * (diff_tsc - cal_tsc)) / cal_tsc; diff_per = ((diff_tsc - cal_tsc) * 100U) / cal_tsc;
} else { } else {
diff_per = (100 * (cal_tsc - diff_tsc)) / cal_tsc; diff_per = ((cal_tsc - diff_tsc) * 100U) / cal_tsc;
} }
printk("variance in time stamp diff: %d percent\n", (s32_t)diff_per); printk("variance in time stamp diff: %d percent\n", (s32_t)diff_per);

View file

@ -1271,13 +1271,13 @@ without:
return -EINVAL; return -EINVAL;
} }
if ((frag_offset & 0xfff8) != 0) { if ((frag_offset & 0xfff8) != 0U) {
DBG("Invalid fragment offset %d\n", DBG("Invalid fragment offset %d\n",
frag_offset & 0xfff8); frag_offset & 0xfff8);
return -EINVAL; return -EINVAL;
} }
if ((frag_offset & 0x0001) != 1) { if ((frag_offset & 0x0001) != 1U) {
DBG("Fragment More flag should be set\n"); DBG("Fragment More flag should be set\n");
return -EINVAL; return -EINVAL;
} }
@ -1317,13 +1317,13 @@ without:
return -EINVAL; return -EINVAL;
} }
if ((frag_offset & 0xfff8) != 1232) { if ((frag_offset & 0xfff8) != 1232U) {
DBG("Invalid fragment offset %d\n", DBG("Invalid fragment offset %d\n",
frag_offset & 0xfff8); frag_offset & 0xfff8);
return -EINVAL; return -EINVAL;
} }
if ((frag_offset & 0x0001) != 0) { if ((frag_offset & 0x0001) != 0U) {
DBG("Fragment More flag should be unset\n"); DBG("Fragment More flag should be unset\n");
return -EINVAL; return -EINVAL;
} }

View file

@ -1515,7 +1515,7 @@ static bool test_tcp_seq_validity(void)
} }
tcp->send_ack = sys_get_be32(tcp_hdr->seq) + tcp->send_ack = sys_get_be32(tcp_hdr->seq) +
2 * get_recv_wnd(tcp); get_recv_wnd(tcp) * 2U;
if (net_tcp_validate_seq(tcp, tcp_hdr)) { if (net_tcp_validate_seq(tcp, tcp_hdr)) {
DBG("3) Sequence validation failed (send_ack %u vs seq %u)\n", DBG("3) Sequence validation failed (send_ack %u vs seq %u)\n",
tcp->send_ack, sys_get_be32(tcp_hdr->seq)); tcp->send_ack, sys_get_be32(tcp_hdr->seq));
@ -1523,7 +1523,7 @@ static bool test_tcp_seq_validity(void)
} }
tcp->send_ack = sys_get_be32(tcp_hdr->seq) - tcp->send_ack = sys_get_be32(tcp_hdr->seq) -
2 * get_recv_wnd(tcp); get_recv_wnd(tcp) * 2U;
if (net_tcp_validate_seq(tcp, tcp_hdr)) { if (net_tcp_validate_seq(tcp, tcp_hdr)) {
DBG("4) Sequence validation failed (send_ack %u vs seq %u)\n", DBG("4) Sequence validation failed (send_ack %u vs seq %u)\n",
tcp->send_ack, sys_get_be32(tcp_hdr->seq)); tcp->send_ack, sys_get_be32(tcp_hdr->seq));

View file

@ -90,7 +90,7 @@ void test_posix_realtime(void)
*/ */
s64_t last_delta = 0; s64_t last_delta = 0;
for (int i = 1; i <= 20; i++) { for (int i = 1; i <= 20; i++) {
usleep(90 * USEC_PER_MSEC); usleep(USEC_PER_MSEC * 90U);
ret = clock_gettime(CLOCK_REALTIME, &rts); ret = clock_gettime(CLOCK_REALTIME, &rts);
zassert_equal(ret, 0, "Fail to read realitime clock"); zassert_equal(ret, 0, "Fail to read realitime clock");

View file

@ -95,7 +95,7 @@ void test_posix_mqueue(void)
zassert_equal(pthread_attr_destroy(&attr[i]), 0, NULL); zassert_equal(pthread_attr_destroy(&attr[i]), 0, NULL);
} }
usleep(10 * USEC_PER_MSEC); usleep(USEC_PER_MSEC * 10U);
for (i = 0; i < N_THR; i++) { for (i = 0; i < N_THR; i++) {
pthread_join(newthread[i], &retval); pthread_join(newthread[i], &retval);

View file

@ -94,7 +94,7 @@ void *thread_top_exec(void *p1)
pthread_cond_wait(&cvar0, &lock); pthread_cond_wait(&cvar0, &lock);
} else { } else {
pthread_mutex_unlock(&lock); pthread_mutex_unlock(&lock);
usleep(500 * USEC_PER_MSEC); usleep(USEC_PER_MSEC * 500U);
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
} }