]> www.infradead.org Git - users/willy/xarray.git/commit
dmaengine: dw: Simplify prepare CTL_LO methods
authorSerge Semin <fancer.lancer@gmail.com>
Fri, 2 Aug 2024 07:50:48 +0000 (10:50 +0300)
committerVinod Koul <vkoul@kernel.org>
Mon, 5 Aug 2024 16:37:47 +0000 (22:07 +0530)
commit1fd6fe89055e6dbb4be8f16b8dcab8602e3603d6
tree733eeef65aa97205a74616f4c7bd9e534f7c2a40
parentd04b21bfa1c50a2ade4816cab6fdc91827b346b1
dmaengine: dw: Simplify prepare CTL_LO methods

Currently the CTL LO fields are calculated on the platform-specific basis.
It's implemented by means of the prepare_ctllo() callbacks using the
ternary operator within the local variables init block at the beginning of
the block scope. The functions code currently is relatively hard to
comprehend and isn't that optimal since implies four conditional
statements executed and two additional local variables defined. Let's
simplify the DW AHB DMA prepare_ctllo() method by unrolling the ternary
operators into the normal if-else statement, dropping redundant
master-interface ID variables and initializing the local variables based
on the singly evaluated DMA-transfer direction check. Thus the method will
look much more readable since now the fields content can be easily
inferred right from the if-else branch. Provide the same update in the
Intel DMA32 core driver for the sake of the driver code unification.

Note besides of the effects described above this update is basically a
preparation before dropping the max burst encoding callback. The dropping
will require to call the burst fields calculation methods right in the
prepare_ctllo() callbacks. It would have made the later functions code
even more complex should they were left in the original state.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Acked-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20240802075100.6475-4-fancer.lancer@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dw/dw.c
drivers/dma/dw/idma32.c