mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
dmaengine: dw-edma: Convert debugfs descs to being heap-allocated
Currently DW eDMA debugfs node descriptors are allocated on the stack, which won't work for multi-eDMA platforms. As a preparation to supporting multi-eDMA systems, allocate each debugfs node separately. Afterwards we'll add info like Read/Write channel flag, channel ID, DW eDMA private data reference. Note: this conversion is mainly required due to having the legacy DW eDMA controllers with indirect Read/Write channels context CSRs access. If we didn't need to synchronize access to these registers, the debugfs code of the driver would have been much simpler. Link: https://lore.kernel.org/r/20230113171409.30470-14-Sergey.Semin@baikalelectronics.ru Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Acked-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
345e3a95b2
commit
782536aac1
1 changed files with 12 additions and 3 deletions
|
@ -53,7 +53,8 @@ struct dw_edma_debugfs_entry {
|
|||
|
||||
static int dw_edma_debugfs_u32_get(void *data, u64 *val)
|
||||
{
|
||||
void __iomem *reg = data;
|
||||
struct dw_edma_debugfs_entry *entry = data;
|
||||
void __iomem *reg = entry->reg;
|
||||
|
||||
if (dw->chip->mf == EDMA_MF_EDMA_LEGACY &&
|
||||
reg >= (void __iomem *)®s->type.legacy.ch) {
|
||||
|
@ -94,14 +95,22 @@ static int dw_edma_debugfs_u32_get(void *data, u64 *val)
|
|||
}
|
||||
DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_edma_debugfs_u32_get, NULL, "0x%08llx\n");
|
||||
|
||||
static void dw_edma_debugfs_create_x32(const struct dw_edma_debugfs_entry entries[],
|
||||
static void dw_edma_debugfs_create_x32(const struct dw_edma_debugfs_entry ini[],
|
||||
int nr_entries, struct dentry *dir)
|
||||
{
|
||||
struct dw_edma_debugfs_entry *entries;
|
||||
int i;
|
||||
|
||||
entries = devm_kcalloc(dw->chip->dev, nr_entries, sizeof(*entries),
|
||||
GFP_KERNEL);
|
||||
if (!entries)
|
||||
return;
|
||||
|
||||
for (i = 0; i < nr_entries; i++) {
|
||||
entries[i] = ini[i];
|
||||
|
||||
debugfs_create_file_unsafe(entries[i].name, 0444, dir,
|
||||
entries[i].reg, &fops_x32);
|
||||
&entries[i], &fops_x32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue