Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339674

[PATCH v2 10/15] dmaengine: dw: pass platform data via struct dw_dma_chip

From Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 10/15] dmaengine: dw: pass platform data via struct dw_dma_chip
Date 2016-02-22 17:10 +0100
Message-ID <r51dD-8d4-5@gated-at.bofh.it> (permalink)
References <r51dD-8d4-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We pass struct dw_dma_chip to the dw_dma_probe() anyway, thus we may use it to
pass platform data as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mans Rullgard <mans@mansr.com>
---
 drivers/ata/sata_dwc_460ex.c          |  2 +-
 drivers/dma/dw/core.c                 |  3 ++-
 drivers/dma/dw/pci.c                  |  3 ++-
 drivers/dma/dw/platform.c             |  3 ++-
 include/linux/dma/dw.h                | 14 ++++++++------
 sound/soc/intel/common/sst-firmware.c |  2 +-
 6 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 80bdcab..2cb6f7e 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1248,7 +1248,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
 	hsdev->dma->dev = &ofdev->dev;
 
 	/* Initialize AHB DMAC */
-	err = dw_dma_probe(hsdev->dma, NULL);
+	err = dw_dma_probe(hsdev->dma);
 	if (err)
 		goto error_dma_iomap;
 
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 4ce4e64..e2502d4 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -1473,8 +1473,9 @@ EXPORT_SYMBOL(dw_dma_cyclic_free);
 
 /*----------------------------------------------------------------------*/
 
-int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
+int dw_dma_probe(struct dw_dma_chip *chip)
 {
+	struct dw_dma_platform_data	*pdata = chip->pdata;
 	struct dw_dma		*dw;
 	bool			autocfg = false;
 	unsigned int		dw_params;
diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
index 358f968..c47cbf5 100644
--- a/drivers/dma/dw/pci.c
+++ b/drivers/dma/dw/pci.c
@@ -49,8 +49,9 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
 	chip->dev = &pdev->dev;
 	chip->regs = pcim_iomap_table(pdev)[0];
 	chip->irq = pdev->irq;
+	chip->pdata = pdata;
 
-	ret = dw_dma_probe(chip, pdata);
+	ret = dw_dma_probe(chip);
 	if (ret)
 		return ret;
 
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index 51b7a0a..1fc1207 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -183,6 +183,7 @@ static int dw_probe(struct platform_device *pdev)
 		pdata = dw_dma_parse_dt(pdev);
 
 	chip->dev = dev;
+	chip->pdata = pdata;
 
 	chip->clk = devm_clk_get(chip->dev, "hclk");
 	if (IS_ERR(chip->clk))
@@ -193,7 +194,7 @@ static int dw_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(&pdev->dev);
 
-	err = dw_dma_probe(chip, pdata);
+	err = dw_dma_probe(chip);
 	if (err)
 		goto err_dw_dma_probe;
 
diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h
index 7145644..c9a3914 100644
--- a/include/linux/dma/dw.h
+++ b/include/linux/dma/dw.h
@@ -27,17 +27,19 @@ struct dw_dma;
  * @regs:		memory mapped I/O space
  * @clk:		hclk clock
  * @dw:			struct dw_dma that is filed by dw_dma_probe()
+ * @pdata:		pointer to platform data
  */
 struct dw_dma_chip {
-	struct device	*dev;
-	int		irq;
-	void __iomem	*regs;
-	struct clk	*clk;
-	struct dw_dma	*dw;
+	struct device			*dev;
+	int				irq;
+	void __iomem			*regs;
+	struct clk			*clk;
+	struct dw_dma			*dw;
+	struct dw_dma_platform_data	*pdata;
 };
 
 /* Export to the platform drivers */
-int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
+int dw_dma_probe(struct dw_dma_chip *chip);
 int dw_dma_remove(struct dw_dma_chip *chip);
 
 /* DMA API extensions */
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
index ef4881e..2599352 100644
--- a/sound/soc/intel/common/sst-firmware.c
+++ b/sound/soc/intel/common/sst-firmware.c
@@ -203,7 +203,7 @@ static struct dw_dma_chip *dw_probe(struct device *dev, struct resource *mem,
 
 	chip->dev = dev;
 
-	err = dw_dma_probe(chip, NULL);
+	err = dw_dma_probe(chip);
 	if (err)
 		return ERR_PTR(err);
 
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/15] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 10/15] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 14/15] dmaengine: dw: move residue to a descriptor Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 07/15] dmaengine: dw: revisit data_width property Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 09/15] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 01/15] dmaengine: dw: fix byte order of hw descriptor fields Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 11/15] dmaengine: dw: platform: use field-by-field initialization Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 08/15] dmaengine: dw: define counter variables as unsigned int Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 15/15] dmaengine: dw: set cdesc to NULL when free cyclic transfers Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 02/15] dmaengine: dw: clear LLP_[SD]_EN bits in last descriptor of a chain Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 13/15] dmaengine: dw: move dwc->initialized to dwc->flags Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 04/15] dmaengine: dw: set src and dst master select according to xfer direction Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 12/15] dmaengine: dw: move dwc->paused to dwc->flags Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 03/15] dmaengine: dw: rename masters to reflect actual topology Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 06/15] dmaengine: dw: substitute dma_read_byaddr by dma_readl_native Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100
  [PATCH v2 05/15] dmaengine: dw: set LMS field in descriptors Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-22 17:10 +0100

csiph-web