dmaengine: dw-edma: Replace chip ID number with device name
authorSerge Semin <Sergey.Semin@baikalelectronics.ru>
Fri, 13 Jan 2023 17:14:03 +0000 (20:14 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 10 Feb 2023 23:15:23 +0000 (17:15 -0600)
Using an abstract number as the DW eDMA chip identifier isn't practical
because there can be more than one DW eDMA controller on the platform. Some
may be detected as the PCIe Endpoints, and others may be embedded in DW
PCIe Root Port/Endpoint controllers.  An abstract number in, for instance,
the IRQ handlers list, doesn't give a notion regarding their reference to
the particular DMA controller.

To preserve the code simplicity and support multi-eDMA platforms, use the
parental device name to create the DW eDMA controller name.

Link: https://lore.kernel.org/r/20230113171409.30470-22-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>
drivers/dma/dw-edma/dw-edma-core.c
drivers/dma/dw-edma/dw-edma-core.h
drivers/dma/dw-edma/dw-edma-pcie.c
include/linux/dma/edma.h

index 040a88c..e3671bf 100644 (file)
@@ -973,7 +973,8 @@ int dw_edma_probe(struct dw_edma_chip *chip)
        if (!dw->chan)
                return -ENOMEM;
 
-       snprintf(dw->name, sizeof(dw->name), "dw-edma-core:%d", chip->id);
+       snprintf(dw->name, sizeof(dw->name), "dw-edma-core:%s",
+                dev_name(chip->dev));
 
        /* Disable eDMA, only to establish the ideal initial conditions */
        dw_edma_v0_core_off(dw);
index e3ad3e3..0ab2b6d 100644 (file)
@@ -96,7 +96,7 @@ struct dw_edma_irq {
 };
 
 struct dw_edma {
-       char                            name[20];
+       char                            name[32];
 
        struct dma_device               dma;
 
index f530bac..3f9dadc 100644 (file)
@@ -222,7 +222,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
 
        /* Data structure initialization */
        chip->dev = dev;
-       chip->id = pdev->devfn;
 
        chip->mf = vsec_data.mf;
        chip->nr_irqs = nr_irqs;
index 07a23ec..96bfd01 100644 (file)
@@ -76,7 +76,6 @@ enum dw_edma_chip_flags {
  */
 struct dw_edma_chip {
        struct device           *dev;
-       int                     id;
        int                     nr_irqs;
        const struct dw_edma_core_ops   *ops;
        u32                     flags;