Skip to content

Commit 2a24490

Browse files
decsnycfriedt
authored andcommitted
dma_mcux_edma: Simplify channel gap compliation
One #ifdef outside the functions is simpler to read than two #ifdefs inside the functions. Signed-off-by: Declan Snyder <[email protected]>
1 parent 7610eba commit 2a24490

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/dma/dma_mcux_edma.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,37 +150,32 @@ struct dma_mcux_edma_data {
150150
#define EDMA_HW_TCD_CSR(dev, ch) (DEV_BASE(dev)->CH[ch].TCD_CSR)
151151
#endif
152152

153+
#if DMA_MCUX_HAS_CHANNEL_GAP
153154
/*
154155
* The hardware channel (takes the gap into account) is used when access DMA registers.
155156
* For data structures in the shim driver still use the primitive channel.
156157
*/
157158
static ALWAYS_INLINE uint32_t dma_mcux_edma_add_channel_gap(const struct device *dev,
158159
uint32_t channel)
159160
{
160-
#if DMA_MCUX_HAS_CHANNEL_GAP
161161
const struct dma_mcux_edma_config *config = DEV_CFG(dev);
162162

163163
return (channel < config->channel_gap[0]) ? channel :
164164
(channel + 1 + config->channel_gap[1] - config->channel_gap[0]);
165-
#else
166-
ARG_UNUSED(dev);
167-
return channel;
168-
#endif
169165
}
170166

171167
static ALWAYS_INLINE uint32_t dma_mcux_edma_remove_channel_gap(const struct device *dev,
172168
uint32_t channel)
173169
{
174-
#if DMA_MCUX_HAS_CHANNEL_GAP
175170
const struct dma_mcux_edma_config *config = DEV_CFG(dev);
176171

177172
return (channel < config->channel_gap[0]) ? channel :
178173
(channel + config->channel_gap[0] - config->channel_gap[1] - 1);
179-
#else
180-
ARG_UNUSED(dev);
181-
return channel;
182-
#endif
183174
}
175+
#else
176+
#define dma_mcux_edma_add_channel_gap(dev, channel) channel
177+
#define dma_mcux_edma_remove_channel_gap(dev, channel) channel
178+
#endif /* DMA_MCUX_HAS_CHANNEL_GAP */
184179

185180
static bool data_size_valid(const size_t data_size)
186181
{

0 commit comments

Comments
 (0)