all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against unsigned variables. Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
parent
caebf204c6
commit
24d71431e9
559 changed files with 2331 additions and 2328 deletions
|
@ -238,7 +238,7 @@ static void find_modes(struct decim_modes *modes,
|
|||
/* The FIFO is not requested if sample rate is set to zero. Just
|
||||
* return in such case with num_of_modes as zero.
|
||||
*/
|
||||
if (fs == 0) {
|
||||
if (fs == 0U) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -677,7 +677,7 @@ static int source_ipm_helper(struct pdm_chan_cfg *config, u32_t *source_mask,
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((*controller_mask & BIT(pdm_ix)) == 0) {
|
||||
if ((*controller_mask & BIT(pdm_ix)) == 0U) {
|
||||
*controller_mask |= BIT(pdm_ix);
|
||||
*source_mask |= pdm_ix << (ipm << 2);
|
||||
ipm++;
|
||||
|
@ -696,7 +696,7 @@ static int source_ipm_helper(struct pdm_chan_cfg *config, u32_t *source_mask,
|
|||
* if R channel mic was requested first
|
||||
* set the controller to swap the channels
|
||||
*/
|
||||
if ((pdm_lr_mask & BIT(PDM_CHAN_LEFT + (pdm_ix << 1))) == 0) {
|
||||
if ((pdm_lr_mask & BIT(PDM_CHAN_LEFT + (pdm_ix << 1))) == 0U) {
|
||||
*swap_mask |= BIT(pdm_ix);
|
||||
}
|
||||
}
|
||||
|
@ -749,9 +749,9 @@ static int configure_registers(struct device *dev,
|
|||
u32_t source_mask;
|
||||
|
||||
/* OUTCONTROL0 and OUTCONTROL1 */
|
||||
of0 = (config->streams[0].pcm_width == 32) ? 2 : 0;
|
||||
of0 = (config->streams[0].pcm_width == 32U) ? 2 : 0;
|
||||
if (config->channel.req_num_streams > 1) {
|
||||
of1 = (config->streams[1].pcm_width == 32) ? 2 : 0;
|
||||
of1 = (config->streams[1].pcm_width == 32U) ? 2 : 0;
|
||||
} else {
|
||||
of1 = 0;
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ static int configure_registers(struct device *dev,
|
|||
* for starting correct parts of the HW.
|
||||
*/
|
||||
for (i = 0; i < DMIC_HW_CONTROLLERS; i++) {
|
||||
if ((controller_mask & BIT(i)) == 0) {
|
||||
if ((controller_mask & BIT(i)) == 0U) {
|
||||
/* controller is not enabled */
|
||||
continue;
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ static int configure_registers(struct device *dev,
|
|||
BIT(PDM_CHAN_RIGHT)) << (i << 1);
|
||||
} else {
|
||||
dmic_private.mic_en_mask |=
|
||||
((swap_mask & BIT(i)) == 0) ?
|
||||
((swap_mask & BIT(i)) == 0U) ?
|
||||
BIT(PDM_CHAN_LEFT) << (i << 1) :
|
||||
BIT(PDM_CHAN_RIGHT) << (i << 1);
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ static int dmic_set_config(struct device *dev, struct dmic_cfg *config)
|
|||
LOG_DBG("num_chan %u", config->channel.req_num_chan);
|
||||
LOG_DBG("req_num_streams %u", config->channel.req_num_streams);
|
||||
|
||||
if (config->channel.req_num_streams == 0) {
|
||||
if (config->channel.req_num_streams == 0U) {
|
||||
LOG_ERR("req_num_streams is 0");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1281,7 +1281,7 @@ static int dmic_trigger_device(struct device *dev, enum dmic_trigger cmd)
|
|||
|
||||
static inline u8_t dmic_parse_clk_skew_map(u32_t skew_map, u8_t pdm)
|
||||
{
|
||||
return (u8_t)((skew_map >> ((pdm & BIT_MASK(3)) * 4)) & BIT_MASK(4));
|
||||
return (u8_t)((skew_map >> ((pdm & BIT_MASK(3)) * 4U)) & BIT_MASK(4));
|
||||
}
|
||||
|
||||
static int dmic_initialize_device(struct device *dev)
|
||||
|
@ -1391,7 +1391,7 @@ int dmic_configure_dma(struct pcm_stream_cfg *config, u8_t num_streams)
|
|||
|
||||
dma_block.source_address = (u32_t)NULL;
|
||||
dma_block.dest_address = (u32_t)NULL;
|
||||
dma_block.block_size = 0;
|
||||
dma_block.block_size = 0U;
|
||||
dma_block.next_block = NULL;
|
||||
|
||||
ret = dma_config(dmic_private.dma_dev, channel, &dma_cfg);
|
||||
|
|
|
@ -112,7 +112,7 @@ int mpxxdtyy_i2s_configure(struct device *dev, struct dmic_cfg *cfg)
|
|||
}
|
||||
|
||||
factor = sw_filter_lib_init(dev, cfg);
|
||||
if (factor == 0) {
|
||||
if (factor == 0U) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ u16_t sw_filter_lib_init(struct device *dev, struct dmic_cfg *cfg)
|
|||
u32_t audio_freq = cfg->streams->pcm_rate;
|
||||
|
||||
/* calculate oversampling factor based on pdm clock */
|
||||
for (factor = 64; factor <= 128; factor += 64) {
|
||||
for (factor = 64U; factor <= 128U; factor += 64U) {
|
||||
u32_t pdm_bit_clk = (audio_freq * factor *
|
||||
cfg->channel.req_num_chan);
|
||||
|
||||
|
@ -28,12 +28,12 @@ u16_t sw_filter_lib_init(struct device *dev, struct dmic_cfg *cfg)
|
|||
}
|
||||
}
|
||||
|
||||
if (factor != 64 && factor != 128) {
|
||||
if (factor != 64U && factor != 128U) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* init the filter lib */
|
||||
pdm_filter->LP_HZ = audio_freq / 2;
|
||||
pdm_filter->LP_HZ = audio_freq / 2U;
|
||||
pdm_filter->HP_HZ = 10;
|
||||
pdm_filter->Fs = audio_freq;
|
||||
pdm_filter->Out_MicChannels = 1;
|
||||
|
|
|
@ -340,10 +340,10 @@ static int codec_configure_clocks(struct device *dev,
|
|||
LOG_DBG("NDAC: %u MDAC: %u OSR: %u", ndac, mdac, osr);
|
||||
|
||||
if (i2s->options & I2S_OPT_BIT_CLK_MASTER) {
|
||||
bclk_div = osr * mdac / (i2s->word_size * 2); /* stereo */
|
||||
bclk_div = osr * mdac / (i2s->word_size * 2U); /* stereo */
|
||||
if ((bclk_div * i2s->word_size * 2) != (osr * mdac)) {
|
||||
LOG_ERR("Unable to generate BCLK %u from MCLK %u",
|
||||
i2s->frame_clk_freq * i2s->word_size * 2,
|
||||
i2s->frame_clk_freq * i2s->word_size * 2U,
|
||||
cfg->mclk_freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ static int codec_configure_clocks(struct device *dev,
|
|||
}
|
||||
|
||||
/* calculate MCLK divider to get ~1MHz */
|
||||
mclk_div = (cfg->mclk_freq + 1000000 - 1) / 1000000;
|
||||
mclk_div = (cfg->mclk_freq + 1000000 - 1) / 1000000U;
|
||||
/* setup timer clock to be MCLK divided */
|
||||
codec_write_reg(dev, TIMER_MCLK_DIV_ADDR,
|
||||
TIMER_MCLK_DIV_EN_EXT | TIMER_MCLK_DIV_VAL(mclk_div));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue