Skip to content

Commit 41e8df7

Browse files
smalaefabiobaltieri
authored andcommitted
drivers: dma: siwx917: Uniform function naming conventions
-Prefixed Zephyr driver functions with 'siwx917_dma' for consistency -Added 'siwx917_' prefix to local functions -Removed inline declaration for param validation functions Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
1 parent 984b0ea commit 41e8df7

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

drivers/dma/dma_silabs_siwx91x.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct dma_siwx91x_data {
4545
*/
4646
};
4747

48-
static inline int siwx91x_dma_is_peripheral_request(uint32_t dir)
48+
static int siwx91x_is_peripheral_request(uint32_t dir)
4949
{
5050
if (dir == MEMORY_TO_MEMORY) {
5151
return 0;
@@ -58,7 +58,7 @@ static inline int siwx91x_dma_is_peripheral_request(uint32_t dir)
5858
return -1;
5959
}
6060

61-
static inline int siwx91x_dma_data_width(uint32_t data_width)
61+
static int siwx91x_data_width(uint32_t data_width)
6262
{
6363
switch (data_width) {
6464
case 1:
@@ -72,7 +72,7 @@ static inline int siwx91x_dma_data_width(uint32_t data_width)
7272
}
7373
}
7474

75-
static inline int siwx91x_dma_burst_length(uint32_t blen)
75+
static int siwx91x_burst_length(uint32_t blen)
7676
{
7777
switch (blen / 8) {
7878
case 1:
@@ -82,7 +82,7 @@ static inline int siwx91x_dma_burst_length(uint32_t blen)
8282
}
8383
}
8484

85-
static inline int siwx91x_dma_addr_adjustment(uint32_t adjustment)
85+
static int siwx91x_addr_adjustment(uint32_t adjustment)
8686
{
8787
switch (adjustment) {
8888
case 0:
@@ -94,9 +94,9 @@ static inline int siwx91x_dma_addr_adjustment(uint32_t adjustment)
9494
}
9595
}
9696

97-
static int dma_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T udma_handle,
98-
uint32_t channel, const struct dma_config *config,
99-
UDMA_Channel_Info *channel_info)
97+
static int siwx91x_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T udma_handle,
98+
uint32_t channel, const struct dma_config *config,
99+
UDMA_Channel_Info *channel_info)
100100
{
101101
uint32_t dma_transfer_num = config->head_block->block_size / config->source_data_size;
102102
const struct dma_siwx91x_config *cfg = dev->config;
@@ -112,12 +112,12 @@ static int dma_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T udma_h
112112
RSI_UDMA_CHA_CFG_T channel_config = {};
113113
int status;
114114

115-
if (siwx91x_dma_is_peripheral_request(config->channel_direction) < 0) {
115+
if (siwx91x_is_peripheral_request(config->channel_direction) < 0) {
116116
return -EINVAL;
117117
}
118118

119119
channel_config.channelPrioHigh = config->channel_priority;
120-
channel_config.periphReq = siwx91x_dma_is_peripheral_request(config->channel_direction);
120+
channel_config.periphReq = siwx91x_is_peripheral_request(config->channel_direction);
121121
channel_config.dmaCh = channel;
122122

123123
if (channel_config.periphReq) {
@@ -136,29 +136,29 @@ static int dma_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T udma_h
136136
channel_control.totalNumOfDMATrans = dma_transfer_num;
137137
}
138138

139-
if (siwx91x_dma_data_width(config->source_data_size) < 0 ||
140-
siwx91x_dma_data_width(config->dest_data_size) < 0) {
139+
if (siwx91x_data_width(config->source_data_size) < 0 ||
140+
siwx91x_data_width(config->dest_data_size) < 0) {
141141
return -EINVAL;
142142
}
143-
if (siwx91x_dma_burst_length(config->source_burst_length) < 0 ||
144-
siwx91x_dma_burst_length(config->dest_burst_length) < 0) {
143+
if (siwx91x_burst_length(config->source_burst_length) < 0 ||
144+
siwx91x_burst_length(config->dest_burst_length) < 0) {
145145
return -EINVAL;
146146
}
147147

148-
channel_control.srcSize = siwx91x_dma_data_width(config->source_data_size);
149-
channel_control.dstSize = siwx91x_dma_data_width(config->dest_data_size);
150-
if (siwx91x_dma_addr_adjustment(config->head_block->source_addr_adj) < 0 ||
151-
siwx91x_dma_addr_adjustment(config->head_block->dest_addr_adj) < 0) {
148+
channel_control.srcSize = siwx91x_data_width(config->source_data_size);
149+
channel_control.dstSize = siwx91x_data_width(config->dest_data_size);
150+
if (siwx91x_addr_adjustment(config->head_block->source_addr_adj) < 0 ||
151+
siwx91x_addr_adjustment(config->head_block->dest_addr_adj) < 0) {
152152
return -EINVAL;
153153
}
154154

155-
if (siwx91x_dma_addr_adjustment(config->head_block->source_addr_adj) == 0) {
155+
if (siwx91x_addr_adjustment(config->head_block->source_addr_adj) == 0) {
156156
channel_control.srcInc = channel_control.srcSize;
157157
} else {
158158
channel_control.srcInc = UDMA_SRC_INC_NONE;
159159
}
160160

161-
if (siwx91x_dma_addr_adjustment(config->head_block->dest_addr_adj) == 0) {
161+
if (siwx91x_addr_adjustment(config->head_block->dest_addr_adj) == 0) {
162162
channel_control.dstInc = channel_control.dstSize;
163163
} else {
164164
channel_control.dstInc = UDMA_DST_INC_NONE;
@@ -178,7 +178,7 @@ static int dma_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T udma_h
178178
}
179179

180180
/* Function to configure UDMA channel for transfer */
181-
static int dma_siwx91x_configure(const struct device *dev, uint32_t channel,
181+
static int siwx91x_dma_configure(const struct device *dev, uint32_t channel,
182182
struct dma_config *config)
183183
{
184184
const struct dma_siwx91x_config *cfg = dev->config;
@@ -202,7 +202,7 @@ static int dma_siwx91x_configure(const struct device *dev, uint32_t channel,
202202
}
203203

204204
/* Configure dma channel for transfer */
205-
status = dma_channel_config(dev, udma_handle, channel, config, data->chan_info);
205+
status = siwx91x_channel_config(dev, udma_handle, channel, config, data->chan_info);
206206
if (status) {
207207
return status;
208208
}
@@ -214,7 +214,7 @@ static int dma_siwx91x_configure(const struct device *dev, uint32_t channel,
214214
}
215215

216216
/* Function to reload UDMA channel for new transfer */
217-
static int dma_siwx91x_reload(const struct device *dev, uint32_t channel, uint32_t src,
217+
static int siwx91x_dma_reload(const struct device *dev, uint32_t channel, uint32_t src,
218218
uint32_t dst, size_t size)
219219
{
220220
const struct dma_siwx91x_config *cfg = dev->config;
@@ -269,7 +269,7 @@ static int dma_siwx91x_reload(const struct device *dev, uint32_t channel, uint32
269269
}
270270

271271
/* Function to start a DMA transfer */
272-
static int dma_siwx91x_start(const struct device *dev, uint32_t channel)
272+
static int siwx91x_dma_start(const struct device *dev, uint32_t channel)
273273
{
274274
const struct dma_siwx91x_config *cfg = dev->config;
275275
RSI_UDMA_DESC_T *udma_table = cfg->sram_desc_addr;
@@ -296,7 +296,7 @@ static int dma_siwx91x_start(const struct device *dev, uint32_t channel)
296296
}
297297

298298
/* Function to stop a DMA transfer */
299-
static int dma_siwx91x_stop(const struct device *dev, uint32_t channel)
299+
static int siwx91x_dma_stop(const struct device *dev, uint32_t channel)
300300
{
301301
const struct dma_siwx91x_config *cfg = dev->config;
302302
struct dma_siwx91x_data *data = dev->data;
@@ -315,7 +315,7 @@ static int dma_siwx91x_stop(const struct device *dev, uint32_t channel)
315315
}
316316

317317
/* Function to fetch DMA channel status */
318-
static int dma_siwx91x_get_status(const struct device *dev, uint32_t channel,
318+
static int siwx91x_dma_get_status(const struct device *dev, uint32_t channel,
319319
struct dma_status *stat)
320320
{
321321
const struct dma_siwx91x_config *cfg = dev->config;
@@ -342,7 +342,7 @@ static int dma_siwx91x_get_status(const struct device *dev, uint32_t channel,
342342
}
343343

344344
/* Function to initialize DMA peripheral */
345-
static int dma_siwx91x_init(const struct device *dev)
345+
static int siwx91x_dma_init(const struct device *dev)
346346
{
347347
const struct dma_siwx91x_config *cfg = dev->config;
348348
struct dma_siwx91x_data *data = dev->data;
@@ -375,7 +375,7 @@ static int dma_siwx91x_init(const struct device *dev)
375375
return 0;
376376
}
377377

378-
static void dma_siwx91x_isr(const struct device *dev)
378+
static void siwx91x_dma_isr(const struct device *dev)
379379
{
380380
const struct dma_siwx91x_config *cfg = dev->config;
381381
struct dma_siwx91x_data *data = dev->data;
@@ -424,11 +424,11 @@ static void dma_siwx91x_isr(const struct device *dev)
424424

425425
/* Store the Si91x DMA APIs */
426426
static DEVICE_API(dma, siwx91x_dma_api) = {
427-
.config = dma_siwx91x_configure,
428-
.reload = dma_siwx91x_reload,
429-
.start = dma_siwx91x_start,
430-
.stop = dma_siwx91x_stop,
431-
.get_status = dma_siwx91x_get_status,
427+
.config = siwx91x_dma_configure,
428+
.reload = siwx91x_dma_reload,
429+
.start = siwx91x_dma_start,
430+
.stop = siwx91x_dma_stop,
431+
.get_status = siwx91x_dma_get_status,
432432
};
433433

434434
#define SIWX91X_DMA_INIT(inst) \
@@ -438,7 +438,7 @@ static DEVICE_API(dma, siwx91x_dma_api) = {
438438
}; \
439439
static void siwx91x_dma##inst##_irq_configure(void) \
440440
{ \
441-
IRQ_CONNECT(DT_INST_IRQ(inst, irq), DT_INST_IRQ(inst, priority), dma_siwx91x_isr, \
441+
IRQ_CONNECT(DT_INST_IRQ(inst, irq), DT_INST_IRQ(inst, priority), siwx91x_dma_isr, \
442442
DEVICE_DT_INST_GET(inst), 0); \
443443
irq_enable(DT_INST_IRQ(inst, irq)); \
444444
} \
@@ -451,7 +451,7 @@ static DEVICE_API(dma, siwx91x_dma_api) = {
451451
.sram_desc_addr = (RSI_UDMA_DESC_T *)DT_INST_PROP(inst, silabs_sram_desc_addr), \
452452
.irq_configure = siwx91x_dma##inst##_irq_configure, \
453453
}; \
454-
DEVICE_DT_INST_DEFINE(inst, &dma_siwx91x_init, NULL, &dma##inst##_data, &dma##inst##_cfg, \
454+
DEVICE_DT_INST_DEFINE(inst, &siwx91x_dma_init, NULL, &dma##inst##_data, &dma##inst##_cfg, \
455455
PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, &siwx91x_dma_api);
456456

457457
DT_INST_FOREACH_STATUS_OKAY(SIWX91X_DMA_INIT)

0 commit comments

Comments
 (0)