lkml.org 
[lkml]   [2021]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 729/917] dmaengine: stm32-dma: fix stm32_dma_get_max_width
    Date
    From: Amelie Delaunay <amelie.delaunay@foss.st.com>

    [ Upstream commit b20fd5fa310cbf7ec367f263a34382a24c4cee73 ]

    buf_addr parameter of stm32_dma_set_xfer_param function is a dma_addr_t.
    We only need to check the remainder of buf_addr/max_width, so, no need to
    use do_div and extra u64 addr. Use '%' instead.

    Fixes: e0ebdbdcb42a ("dmaengine: stm32-dma: take address into account when computing max width")
    Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
    Link: https://lore.kernel.org/r/20211011094259.315023-3-amelie.delaunay@foss.st.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/dma/stm32-dma.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
    index 9063c727962ed..fdda916555ec5 100644
    --- a/drivers/dma/stm32-dma.c
    +++ b/drivers/dma/stm32-dma.c
    @@ -270,7 +270,6 @@ static enum dma_slave_buswidth stm32_dma_get_max_width(u32 buf_len,
    u32 threshold)
    {
    enum dma_slave_buswidth max_width;
    - u64 addr = buf_addr;

    if (threshold == STM32_DMA_FIFO_THRESHOLD_FULL)
    max_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
    @@ -281,7 +280,7 @@ static enum dma_slave_buswidth stm32_dma_get_max_width(u32 buf_len,
    max_width > DMA_SLAVE_BUSWIDTH_1_BYTE)
    max_width = max_width >> 1;

    - if (do_div(addr, max_width))
    + if (buf_addr % max_width)
    max_width = DMA_SLAVE_BUSWIDTH_1_BYTE;

    return max_width;
    --
    2.33.0


    \
     
     \ /
      Last update: 2021-11-16 01:36    [W:4.020 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site