summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2014-07-30 10:30:21 +0200
committerVinod Koul <vinod.koul@intel.com>2014-07-30 19:14:17 +0530
commit92e4a3bf3812b0b0d06c6736fe4d83e1442640ef (patch)
tree3d91eb776b1321734283149faf2ae17de7fa787e /drivers/dma
parent2795eedf2fbd816f1bba0e8eb5f33434a67d61c2 (diff)
dmaengine: sun6i: Remove switch statement from buswidth convertion routine
Since the conversion routine is quite trivial, we don't need this switch, and we can just use a simple calculation. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/sun6i-dma.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index c771d90b8ded..609c5d8cb947 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -248,20 +248,11 @@ static inline int convert_burst(u32 maxburst, u8 *burst)
static inline int convert_buswidth(enum dma_slave_buswidth addr_width, u8 *width)
{
- switch (addr_width) {
- case DMA_SLAVE_BUSWIDTH_1_BYTE:
- *width = 0;
- break;
- case DMA_SLAVE_BUSWIDTH_2_BYTES:
- *width = 1;
- break;
- case DMA_SLAVE_BUSWIDTH_4_BYTES:
- *width = 2;
- break;
- default:
+ if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) ||
+ (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES))
return -EINVAL;
- }
+ *width = addr_width >> 1;
return 0;
}