Skip to content

Commit 3acb301

Browse files
fancervinodkoul
authored andcommitted
dmaengine: dw: Define encode_maxburst() above prepare_ctllo() callbacks
As a preparatory change before dropping the encode_maxburst() callbacks let's move dw_dma_encode_maxburst() and idma32_encode_maxburst() to being defined above the dw_dma_prepare_ctllo() and idma32_prepare_ctllo() methods respectively. That's required since the former methods will be called from the later ones directly. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Acked-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20240802075100.6475-5-fancer.lancer@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 1fd6fe8 commit 3acb301

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

drivers/dma/dw/dw.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ static size_t dw_dma_block2bytes(struct dw_dma_chan *dwc, u32 block, u32 width)
6464
return DWC_CTLH_BLOCK_TS(block) << width;
6565
}
6666

67+
static void dw_dma_encode_maxburst(struct dw_dma_chan *dwc, u32 *maxburst)
68+
{
69+
/*
70+
* Fix burst size according to dw_dmac. We need to convert them as:
71+
* 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
72+
*/
73+
*maxburst = *maxburst > 1 ? fls(*maxburst) - 2 : 0;
74+
}
75+
6776
static u32 dw_dma_prepare_ctllo(struct dw_dma_chan *dwc)
6877
{
6978
struct dma_slave_config *sconfig = &dwc->dma_sconfig;
@@ -88,15 +97,6 @@ static u32 dw_dma_prepare_ctllo(struct dw_dma_chan *dwc)
8897
DWC_CTLL_DMS(dms) | DWC_CTLL_SMS(sms);
8998
}
9099

91-
static void dw_dma_encode_maxburst(struct dw_dma_chan *dwc, u32 *maxburst)
92-
{
93-
/*
94-
* Fix burst size according to dw_dmac. We need to convert them as:
95-
* 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
96-
*/
97-
*maxburst = *maxburst > 1 ? fls(*maxburst) - 2 : 0;
98-
}
99-
100100
static void dw_dma_set_device_name(struct dw_dma *dw, int id)
101101
{
102102
snprintf(dw->name, sizeof(dw->name), "dw:dmac%d", id);

drivers/dma/dw/idma32.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ static size_t idma32_block2bytes(struct dw_dma_chan *dwc, u32 block, u32 width)
199199
return IDMA32C_CTLH_BLOCK_TS(block);
200200
}
201201

202+
static void idma32_encode_maxburst(struct dw_dma_chan *dwc, u32 *maxburst)
203+
{
204+
*maxburst = *maxburst > 1 ? fls(*maxburst) - 1 : 0;
205+
}
206+
202207
static u32 idma32_prepare_ctllo(struct dw_dma_chan *dwc)
203208
{
204209
struct dma_slave_config *sconfig = &dwc->dma_sconfig;
@@ -213,11 +218,6 @@ static u32 idma32_prepare_ctllo(struct dw_dma_chan *dwc)
213218
DWC_CTLL_DST_MSIZE(dmsize) | DWC_CTLL_SRC_MSIZE(smsize);
214219
}
215220

216-
static void idma32_encode_maxburst(struct dw_dma_chan *dwc, u32 *maxburst)
217-
{
218-
*maxburst = *maxburst > 1 ? fls(*maxburst) - 1 : 0;
219-
}
220-
221221
static void idma32_set_device_name(struct dw_dma *dw, int id)
222222
{
223223
snprintf(dw->name, sizeof(dw->name), "idma32:dmac%d", id);

0 commit comments

Comments
 (0)