Skip to content

Commit

Permalink
dmaengine: idma64: useless use of min_t()
Browse files Browse the repository at this point in the history
We use a pattern

	x = min_t(u32, <LOG2_CONSTANT>, __ffs(expr));

There is no need to use min_t() since we can replace it by

	x = __ffs(expr | <2^LOG2_CONST>);

and moreover guarantee that argument of __ffs() will be not zero.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Andy Shevchenko authored and Vinod Koul committed Sep 25, 2015
1 parent 87b0459 commit 22b7440
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/dma/idma64.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ static u64 idma64_hw_desc_fill(struct idma64_hw_desc *hw,
dar = config->dst_addr;
ctllo |= IDMA64C_CTLL_DST_FIX | IDMA64C_CTLL_SRC_INC |
IDMA64C_CTLL_FC_M2P;
src_width = min_t(u32, 2, __ffs(sar | hw->len));
src_width = __ffs(sar | hw->len | 4);
dst_width = __ffs(config->dst_addr_width);
} else { /* DMA_DEV_TO_MEM */
sar = config->src_addr;
dar = hw->phys;
ctllo |= IDMA64C_CTLL_DST_INC | IDMA64C_CTLL_SRC_FIX |
IDMA64C_CTLL_FC_P2M;
src_width = __ffs(config->src_addr_width);
dst_width = min_t(u32, 2, __ffs(dar | hw->len));
dst_width = __ffs(dar | hw->len | 4);
}

lli->sar = sar;
Expand Down

0 comments on commit 22b7440

Please sign in to comment.