diff options
author | Liu Ying <Ying.Liu@freescale.com> | 2015-11-27 14:29:53 +0800 |
---|---|---|
committer | Octavian Purdila <octavian.purdila@nxp.com> | 2017-02-23 14:21:42 +0200 |
commit | 4a0564d3fb73bac19eca2668d606c22bdbddca95 (patch) | |
tree | 9bf72f1cf91c4e394feaa215fb78b5c2c050718e /drivers/mxc | |
parent | 1414130fea66f2ac74e567b2d597c9725e3ddf0d (diff) |
MLK-11911-7 mxc IPUv3: common: Convert macro tri_cur_buf_mask/shift to function
This patch converts macro tri_cur_buf_mask/shift to function to address the
following issue reported by Coverity:
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: dma_chan * 2 != 63 is always true regardless of
the values of its operands. This occurs as the logical first operand of '?:'.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
Diffstat (limited to 'drivers/mxc')
-rw-r--r-- | drivers/mxc/ipu3/ipu_common.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mxc/ipu3/ipu_common.c b/drivers/mxc/ipu3/ipu_common.c index 8ba5f9987cb9..605b38fcf73c 100644 --- a/drivers/mxc/ipu3/ipu_common.c +++ b/drivers/mxc/ipu3/ipu_common.c @@ -117,10 +117,22 @@ static inline int _ipu_is_sync_irq(uint32_t irq) (reg_num == 14) || (reg_num == 15)); } +static inline uint32_t tri_cur_buf_mask(uint32_t dma_chan) +{ + uint32_t mask = 1UL << ((dma_chan * 2) & 0x1F); + + return mask * 3; +} + +static inline uint32_t tri_cur_buf_shift(uint32_t dma_chan) +{ + uint32_t mask = 1UL << ((dma_chan * 2) & 0x1F); + + return ffs(mask) - 1; +} + #define idma_is_valid(ch) (ch != NO_DMA) #define idma_mask(ch) (idma_is_valid(ch) ? (1UL << (ch & 0x1F)) : 0) -#define tri_cur_buf_mask(ch) (idma_mask(ch*2) * 3) -#define tri_cur_buf_shift(ch) (ffs(idma_mask(ch*2)) - 1) static inline bool idma_is_set(struct ipu_soc *ipu, uint32_t reg, uint32_t dma) { |