dmaengine: imx-sdma: utilize compiler to calculate ADDRS_ARRAY_SIZE_V<n>
authorFrank Li <Frank.Li@nxp.com>
Fri, 19 Apr 2024 15:07:28 +0000 (11:07 -0400)
committerVinod Koul <vkoul@kernel.org>
Thu, 25 Apr 2024 09:11:18 +0000 (14:41 +0530)
commit1cb49f389d5985bd9ad6ef37f856f368c3120f77
treed4294c704a16b9f7fb0c4631893335e5d8a6453e
parent458bb56d53c9758ef873b4f373660b1f02b98d86
dmaengine: imx-sdma: utilize compiler to calculate ADDRS_ARRAY_SIZE_V<n>

The macros SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V<n> actually related with the
struct sdma_script_start_addrs.

struct sdma_script_start_addrs {
        ...
/* End of v1 array */
        ...
/* End of v2 array */
...
        /* End of v3 array */
...
        /* End of v4 array */
};

When add new field of sdma_script_start_addrs, it is easy to miss update
SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V<n>.

Employ offsetof for SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V<n> macros instead of
hardcoding numbers. the preprocessing stage will calculate the size for
each version automatically.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20240419150729.1071904-2-Frank.Li@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/imx-sdma.c