[v1,02/12] dmaengine: acpi: Move index to struct acpi_dma_spec
diff mbox series

Message ID 20190806094054.64871-2-andriy.shevchenko@linux.intel.com
State Changes Requested
Headers show
Series
  • [v1,01/12] dmaengine: acpi: Set up DMA mask based on CSRT
Related show

Commit Message

andriy.shevchenko@linux.intel.com Aug. 6, 2019, 9:40 a.m. UTC
In the future ->acpi_dma_xlate() callback function may use the index
of FixedDMA() descriptor to be utilized for channel direction setting.

As a preparation step move index from local data structure to
struct acpi_dma_spec.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/acpi-dma.c   | 5 ++---
 include/linux/acpi_dma.h | 2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c
index 4d66ee059808..b17373ee7ce0 100644
--- a/drivers/dma/acpi-dma.c
+++ b/drivers/dma/acpi-dma.c
@@ -318,7 +318,6 @@  static int acpi_dma_update_dma_spec(struct acpi_dma *adma,
 
 struct acpi_dma_parser_data {
 	struct acpi_dma_spec dma_spec;
-	size_t index;
 	size_t n;
 };
 
@@ -334,7 +333,7 @@  static int acpi_dma_parse_fixed_dma(struct acpi_resource *res, void *data)
 	if (res->type == ACPI_RESOURCE_TYPE_FIXED_DMA) {
 		struct acpi_resource_fixed_dma *dma = &res->data.fixed_dma;
 
-		if (pdata->n++ == pdata->index) {
+		if (pdata->n++ == pdata->dma_spec.index) {
 			pdata->dma_spec.chan_id = dma->channels;
 			pdata->dma_spec.slave_id = dma->request_lines;
 		}
@@ -372,9 +371,9 @@  struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev,
 		return ERR_PTR(-ENODEV);
 
 	memset(&pdata, 0, sizeof(pdata));
-	pdata.index = index;
 
 	/* Initial values for the request line and channel */
+	dma_spec->index = index;
 	dma_spec->chan_id = -1;
 	dma_spec->slave_id = -1;
 
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h
index 72cedb916a9c..2caebb8fb158 100644
--- a/include/linux/acpi_dma.h
+++ b/include/linux/acpi_dma.h
@@ -18,12 +18,14 @@ 
 
 /**
  * struct acpi_dma_spec - slave device DMA resources
+ * @index:	index of FixedDMA() resource
  * @chan_id:	channel unique id
  * @slave_id:	request line unique id
  * @dev:	struct device of the DMA controller to be used in the filter
  *		function
  */
 struct acpi_dma_spec {
+	size_t		index;
 	int		chan_id;
 	int		slave_id;
 	struct device	*dev;