diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-07-30 22:07:45 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2022-09-05 11:52:28 +0530 |
commit | 8c79fd35e1e793361ed30eaa79b3c5752e6c69fb (patch) | |
tree | 6e8fc6696e3475cb1174c57cef20a5fa7504d6bc /drivers/dma/stm32-dmamux.c | |
parent | e1c9832b0964327399d43dc481a8c85285b23ad5 (diff) |
dmaengine: stm32-dmamux: Simplify code and save a few bytes of memory
STM32_DMAMUX_MAX_DMA_REQUESTS is small (i.e. 32) and when the 'dma_inuse'
bitmap is allocated, there is already a check that 'dma_req' is <= this
limit.
So, there is no good reason to dynamically allocate this bitmap. This
just waste some memory and some cycles.
Use DECLARE_BITMAP with the maximum bitmap size instead.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/2d8c24359b2daa32ce0597a2949b7b2bebaf23de.1659211633.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/stm32-dmamux.c')
-rw-r--r-- | drivers/dma/stm32-dmamux.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c index 865dd2ff1828..ee3cbbf51006 100644 --- a/drivers/dma/stm32-dmamux.c +++ b/drivers/dma/stm32-dmamux.c @@ -39,7 +39,7 @@ struct stm32_dmamux_data { u32 dma_requests; /* Number of DMA requests connected to DMAMUX */ u32 dmamux_requests; /* Number of DMA requests routed toward DMAs */ spinlock_t lock; /* Protects register access */ - unsigned long *dma_inuse; /* Used DMA channel */ + DECLARE_BITMAP(dma_inuse, STM32_DMAMUX_MAX_DMA_REQUESTS); /* Used DMA channel */ u32 ccr[STM32_DMAMUX_MAX_DMA_REQUESTS]; /* Used to backup CCR register * in suspend */ @@ -229,12 +229,6 @@ static int stm32_dmamux_probe(struct platform_device *pdev) stm32_dmamux->dma_requests = dma_req; stm32_dmamux->dma_reqs[0] = count; - stm32_dmamux->dma_inuse = devm_kcalloc(&pdev->dev, - BITS_TO_LONGS(dma_req), - sizeof(unsigned long), - GFP_KERNEL); - if (!stm32_dmamux->dma_inuse) - return -ENOMEM; if (device_property_read_u32(&pdev->dev, "dma-requests", &stm32_dmamux->dmamux_requests)) { |