Skip to content

Commit 21358ba

Browse files
pflgalak
authored andcommitted
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 <[email protected]>
1 parent 2fb87b9 commit 21358ba

File tree

60 files changed

+107
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+107
-106
lines changed

arch/arc/core/mpu/arc_mpu_v2_internal.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static inline void _region_init(u32_t index, u32_t region_addr, u32_t size,
3131
{
3232
u8_t bits = find_msb_set(size) - 1;
3333

34-
index = 2 * index;
34+
index = index * 2U;
3535

3636
if (bits < ARC_FEATURE_MPU_ALIGNMENT_BITS) {
3737
bits = ARC_FEATURE_MPU_ALIGNMENT_BITS;
@@ -98,7 +98,7 @@ static inline int _get_region_index_by_type(u32_t type)
9898
*/
9999
static inline bool _is_enabled_region(u32_t r_index)
100100
{
101-
return ((z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + 2 * r_index)
101+
return ((z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + r_index * 2U)
102102
& AUX_MPU_RDB_VALID_MASK) == AUX_MPU_RDB_VALID_MASK);
103103
}
104104

@@ -111,9 +111,9 @@ static inline bool _is_in_region(u32_t r_index, u32_t start, u32_t size)
111111
u32_t r_addr_end;
112112
u32_t r_size_lshift;
113113

114-
r_addr_start = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + 2 * r_index)
114+
r_addr_start = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + r_index * 2U)
115115
& (~AUX_MPU_RDB_VALID_MASK);
116-
r_size_lshift = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + 2 * r_index)
116+
r_size_lshift = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + r_index * 2U)
117117
& AUX_MPU_RDP_SIZE_MASK;
118118
r_size_lshift = (r_size_lshift & 0x3) | ((r_size_lshift >> 7) & 0x1C);
119119
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)
132132
{
133133
u32_t r_ap;
134134

135-
r_ap = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + 2 * r_index);
135+
r_ap = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + r_index * 2U);
136136

137137
r_ap &= AUX_MPU_RDP_ATTR_MASK;
138138

boards/arm/mimxrt1020_evk/pinmux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static int mimxrt1020_evk_init(struct device *dev)
151151
static int mimxrt1020_evk_phy_reset(struct device *dev)
152152
{
153153
/* RESET PHY chip. */
154-
k_busy_wait(10*USEC_PER_MSEC);
154+
k_busy_wait(USEC_PER_MSEC * 10U);
155155
GPIO_WritePinOutput(GPIO1, 4, 1);
156156

157157
return 0;

boards/arm/mimxrt1050_evk/pinmux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int mimxrt1050_evk_init(struct device *dev)
220220
static int mimxrt1050_evk_phy_reset(struct device *dev)
221221
{
222222
/* RESET PHY chip. */
223-
k_busy_wait(10*USEC_PER_MSEC);
223+
k_busy_wait(USEC_PER_MSEC * 10U);
224224
GPIO_WritePinOutput(GPIO1, 9, 1);
225225

226226
return 0;

boards/arm/mimxrt1064_evk/pinmux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static int mimxrt1064_evk_init(struct device *dev)
156156
static int mimxrt1064_evk_phy_reset(struct device *dev)
157157
{
158158
/* RESET PHY chip. */
159-
k_busy_wait(10*USEC_PER_MSEC);
159+
k_busy_wait(USEC_PER_MSEC * 10U);
160160
GPIO_WritePinOutput(GPIO1, 9, 1);
161161

162162
return 0;

drivers/display/display_ili9340.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int ili9340_write(const struct device *dev, const u16_t x,
126126
u16_t write_h;
127127

128128
__ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
129-
__ASSERT((3 * desc->pitch * desc->height) <= desc->bu_size,
129+
__ASSERT((desc->pitch * 3U * desc->height) <= desc->bu_size,
130130
"Input buffer to small");
131131

132132
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,
142142
}
143143

144144
ili9340_transmit(data, ILI9340_CMD_MEM_WRITE,
145-
(void *) write_data_start, 3 * desc->width * write_h);
145+
(void *) write_data_start,
146+
desc->width * 3U * write_h);
146147

147148
tx_bufs.buffers = &tx_buf;
148149
tx_bufs.count = 1;
149150

150-
write_data_start += (3 * desc->pitch);
151+
write_data_start += (desc->pitch * 3U);
151152
for (write_cnt = 1U; write_cnt < nbr_of_writes; ++write_cnt) {
152153
tx_buf.buf = (void *)write_data_start;
153-
tx_buf.len = 3 * desc->width * write_h;
154+
tx_buf.len = desc->width * 3U * write_h;
154155
spi_write(data->spi_dev, &data->spi_config, &tx_bufs);
155-
write_data_start += (3 * desc->pitch);
156+
write_data_start += (desc->pitch * 3U);
156157
}
157158

158159
return 0;

drivers/display/display_sdl.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ static int sdl_display_init(struct device *dev)
7272
static void sdl_display_write_argb8888(void *disp_buf,
7373
const struct display_buffer_descriptor *desc, const void *buf)
7474
{
75-
__ASSERT((4 * desc->pitch * desc->height) <= desc->buf_size,
75+
__ASSERT((desc->pitch * 4U * desc->height) <= desc->buf_size,
7676
"Input buffer to small");
7777

78-
memcpy(disp_buf, buf, 4 * desc->pitch * desc->height);
78+
memcpy(disp_buf, buf, desc->pitch * 4U * desc->height);
7979
}
8080

8181
static void sdl_display_write_rgb888(u8_t *disp_buf,
@@ -86,13 +86,13 @@ static void sdl_display_write_rgb888(u8_t *disp_buf,
8686
u32_t pixel;
8787
const u8_t *byte_ptr;
8888

89-
__ASSERT((3 * desc->pitch * desc->height) <= desc->buf_size,
89+
__ASSERT((desc->pitch * 3U * desc->height) <= desc->buf_size,
9090
"Input buffer to small");
9191

9292
for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
9393
for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
9494
byte_ptr = (const u8_t *)buf +
95-
3 * ((h_idx * desc->pitch) + w_idx);
95+
((h_idx * desc->pitch) + w_idx) * 3U;
9696
pixel = *byte_ptr << 16;
9797
pixel |= *(byte_ptr + 1) << 8;
9898
pixel |= *(byte_ptr + 2);
@@ -114,7 +114,7 @@ static void sdl_display_write_mono(u8_t *disp_buf,
114114
u32_t one_color;
115115
u8_t *disp_buf_start;
116116

117-
__ASSERT((desc->pitch * desc->height) <= (8 * desc->buf_size),
117+
__ASSERT((desc->pitch * desc->height) <= (desc->buf_size * 8U),
118118
"Input buffer to small");
119119
__ASSERT((desc->height % 8) == 0U,
120120
"Input buffer height not aligned per 8 pixels");
@@ -137,12 +137,12 @@ static void sdl_display_write_mono(u8_t *disp_buf,
137137
pixel = (~one_color) & 0x00FFFFFF;
138138
}
139139
*((u32_t *)disp_buf) = pixel;
140-
disp_buf += (4 * desc->width);
140+
disp_buf += (desc->width * 4U);
141141
}
142142
disp_buf = disp_buf_start;
143143
disp_buf += 4;
144144
}
145-
disp_buf += 7 * (4 * desc->width);
145+
disp_buf += 7 * (desc->width * 4U);
146146
}
147147
}
148148

@@ -207,11 +207,11 @@ static int sdl_display_read(const struct device *dev, const u16_t x,
207207
desc->height, x, y);
208208

209209
__ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
210-
__ASSERT((3 * desc->pitch * desc->height) <= desc->buf_size,
210+
__ASSERT((desc->pitch * 3U * desc->height) <= desc->buf_size,
211211
"Input buffer to small");
212212

213213
return SDL_RenderReadPixels(disp_data->renderer, &rect, 0, buf,
214-
4 * desc->pitch);
214+
desc->pitch * 4U);
215215
}
216216

217217
static void *sdl_display_get_framebuffer(const struct device *dev)

drivers/flash/soc_flash_nrf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static int write_op(void *context)
538538
ticks_diff =
539539
ticker_ticks_diff_get(ticker_ticks_now_get(),
540540
ticks_begin);
541-
if (2 * ticks_diff >
541+
if (ticks_diff * 2U >
542542
HAL_TICKER_US_TO_TICKS(w_ctx->slot)) {
543543
nvmc_wait_ready();
544544
return FLASH_OP_ONGOING;

drivers/gpio/gpio_esp32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static int config_interrupt(u32_t pin, int flags)
109109

110110
static void config_polarity(u32_t pin, int flags)
111111
{
112-
volatile u32_t *reg = (u32_t *)(GPIO_FUNC0_IN_SEL_CFG_REG + 4 * pin);
112+
volatile u32_t *reg = (u32_t *)(GPIO_FUNC0_IN_SEL_CFG_REG + pin * 4U);
113113

114114
if (flags & GPIO_POL_INV) {
115115
*reg |= BIT(GPIO_FUNC0_IN_INV_SEL_S);

drivers/i2c/i2c_sam_twi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int i2c_clk_set(Twi *const twi, u32_t speed)
8080
* T_low = ( ( CLDIV × 2^CKDIV ) + 4 ) × T_MCK
8181
*/
8282
while (!div_completed) {
83-
cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (2 * speed)) - 4)
83+
cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (speed * 2U)) - 4)
8484
/ (1 << ck_div);
8585

8686
if (cl_div <= 255U) {

drivers/i2c/i2c_sam_twihs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int i2c_clk_set(Twihs *const twihs, u32_t speed)
8080
* T_low = ( ( CLDIV × 2^CKDIV ) + 3 ) × T_MCK
8181
*/
8282
while (!div_completed) {
83-
cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (2 * speed)) - 3)
83+
cl_div = ((SOC_ATMEL_SAM_MCK_FREQ_HZ / (speed * 2U)) - 3)
8484
/ (1 << ck_div);
8585

8686
if (cl_div <= 255U) {

0 commit comments

Comments
 (0)