• Serge Semin's avatar
    dmaengine: dw: Simplify prepare CTL_LO methods · 1fd6fe89
    Serge Semin authored
    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: default avatarSerge Semin <fancer.lancer@gmail.com>
    Acked-by: default avatarAndy Shevchenko <andy@kernel.org>
    Link: https://lore.kernel.org/r/20240802075100.6475-4-fancer.lancer@gmail.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
    1fd6fe89
dw.c 3.61 KB