mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
dmaengine: dw: define DW_DMA_MAX_NR_MASTERS
Instead of using magic number in the code the patch provides DW_DMA_MAX_NR_MASTERS constant. While here, restrict the reading of data width array by amount of the actual number of AHB masters. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Vinod Koul <[email protected]>
This commit is contained in:
parent
cfd8fef322
commit
d8ded50f8b
8 changed files with 13 additions and 10 deletions
|
|
@ -1562,7 +1562,8 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
|
|||
}
|
||||
} else {
|
||||
dw->nr_masters = pdata->nr_masters;
|
||||
memcpy(dw->data_width, pdata->data_width, 4);
|
||||
for (i = 0; i < dw->nr_masters; i++)
|
||||
dw->data_width[i] = pdata->data_width[i];
|
||||
}
|
||||
|
||||
/* Calculate all channel mask before DMA setup */
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
|
|||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct dw_dma_platform_data *pdata;
|
||||
u32 tmp, arr[4];
|
||||
u32 tmp, arr[DW_DMA_MAX_NR_MASTERS];
|
||||
|
||||
if (!np) {
|
||||
dev_err(&pdev->dev, "Missing DT data\n");
|
||||
|
|
@ -126,7 +126,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
|
|||
pdata->block_size = tmp;
|
||||
|
||||
if (!of_property_read_u32(np, "dma-masters", &tmp)) {
|
||||
if (tmp > 4)
|
||||
if (tmp > DW_DMA_MAX_NR_MASTERS)
|
||||
return NULL;
|
||||
|
||||
pdata->nr_masters = tmp;
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ struct dw_dma {
|
|||
|
||||
/* hardware configuration */
|
||||
unsigned char nr_masters;
|
||||
unsigned char data_width[4];
|
||||
unsigned char data_width[DW_DMA_MAX_NR_MASTERS];
|
||||
};
|
||||
|
||||
static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw)
|
||||
|
|
|
|||
Loading…
Reference in a new issue