All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Vinod Koul <vkoul@kernel.org>,
	dmaengine@vger.kernel.org, Viresh Kumar <vireshk@kernel.org>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 09/10] dmaengine: dw: platform: Split ACPI helpers to separate module
Date: Tue, 20 Aug 2019 16:15:45 +0300	[thread overview]
Message-ID: <20190820131546.75744-10-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20190820131546.75744-1-andriy.shevchenko@linux.intel.com>

For better maintenance split ACPI helpers to the separate module.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw/Makefile   |  3 ++-
 drivers/dma/dw/acpi.c     | 53 +++++++++++++++++++++++++++++++++++++++
 drivers/dma/dw/internal.h |  8 ++++++
 drivers/dma/dw/platform.c | 52 --------------------------------------
 4 files changed, 63 insertions(+), 53 deletions(-)
 create mode 100644 drivers/dma/dw/acpi.c

diff --git a/drivers/dma/dw/Makefile b/drivers/dma/dw/Makefile
index 63ed895c09aa..5e69815f3cf1 100644
--- a/drivers/dma/dw/Makefile
+++ b/drivers/dma/dw/Makefile
@@ -3,7 +3,8 @@ obj-$(CONFIG_DW_DMAC_CORE)	+= dw_dmac_core.o
 dw_dmac_core-objs	:= core.o dw.o idma32.o
 
 obj-$(CONFIG_DW_DMAC)		+= dw_dmac.o
-dw_dmac-objs		:= platform.o
+dw_dmac-y			:= platform.o
+dw_dmac-$(CONFIG_ACPI)		+= acpi.o
 
 obj-$(CONFIG_DW_DMAC_PCI)	+= dw_dmac_pci.o
 dw_dmac_pci-objs	:= pci.o
diff --git a/drivers/dma/dw/acpi.c b/drivers/dma/dw/acpi.c
new file mode 100644
index 000000000000..f6e8d55b4f6e
--- /dev/null
+++ b/drivers/dma/dw/acpi.c
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2013,2019 Intel Corporation
+
+#include <linux/acpi.h>
+#include <linux/acpi_dma.h>
+
+#include "internal.h"
+
+static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
+{
+	struct acpi_dma_spec *dma_spec = param;
+	struct dw_dma_slave slave = {
+		.dma_dev = dma_spec->dev,
+		.src_id = dma_spec->slave_id,
+		.dst_id = dma_spec->slave_id,
+		.m_master = 0,
+		.p_master = 1,
+	};
+
+	return dw_dma_filter(chan, &slave);
+}
+
+void dw_dma_acpi_controller_register(struct dw_dma *dw)
+{
+	struct device *dev = dw->dma.dev;
+	struct acpi_dma_filter_info *info;
+	int ret;
+
+	if (!has_acpi_companion(dev))
+		return;
+
+	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
+	if (!info)
+		return;
+
+	dma_cap_zero(info->dma_cap);
+	dma_cap_set(DMA_SLAVE, info->dma_cap);
+	info->filter_fn = dw_dma_acpi_filter;
+
+	ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info);
+	if (ret)
+		dev_err(dev, "could not register acpi_dma_controller\n");
+}
+
+void dw_dma_acpi_controller_free(struct dw_dma *dw)
+{
+	struct device *dev = dw->dma.dev;
+
+	if (!has_acpi_companion(dev))
+		return;
+
+	acpi_dma_controller_free(dev);
+}
diff --git a/drivers/dma/dw/internal.h b/drivers/dma/dw/internal.h
index df5c84e2a4fd..acada530aa96 100644
--- a/drivers/dma/dw/internal.h
+++ b/drivers/dma/dw/internal.h
@@ -23,6 +23,14 @@ int do_dw_dma_enable(struct dw_dma_chip *chip);
 
 extern bool dw_dma_filter(struct dma_chan *chan, void *param);
 
+#ifdef CONFIG_ACPI
+void dw_dma_acpi_controller_register(struct dw_dma *dw);
+void dw_dma_acpi_controller_free(struct dw_dma *dw);
+#else /* !CONFIG_ACPI */
+static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {}
+static inline void dw_dma_acpi_controller_free(struct dw_dma *dw) {}
+#endif /* !CONFIG_ACPI */
+
 struct dw_dma_chip_pdata {
 	const struct dw_dma_platform_data *pdata;
 	int (*probe)(struct dw_dma_chip *chip);
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index b8514d7895d1..d50e038acb1e 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -19,7 +19,6 @@
 #include <linux/of.h>
 #include <linux/of_dma.h>
 #include <linux/acpi.h>
-#include <linux/acpi_dma.h>
 
 #include "internal.h"
 
@@ -55,57 +54,6 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
 	return dma_request_channel(cap, dw_dma_filter, &slave);
 }
 
-#ifdef CONFIG_ACPI
-static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
-{
-	struct acpi_dma_spec *dma_spec = param;
-	struct dw_dma_slave slave = {
-		.dma_dev = dma_spec->dev,
-		.src_id = dma_spec->slave_id,
-		.dst_id = dma_spec->slave_id,
-		.m_master = 0,
-		.p_master = 1,
-	};
-
-	return dw_dma_filter(chan, &slave);
-}
-
-static void dw_dma_acpi_controller_register(struct dw_dma *dw)
-{
-	struct device *dev = dw->dma.dev;
-	struct acpi_dma_filter_info *info;
-	int ret;
-
-	if (!has_acpi_companion(dev))
-		return;
-
-	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
-	if (!info)
-		return;
-
-	dma_cap_zero(info->dma_cap);
-	dma_cap_set(DMA_SLAVE, info->dma_cap);
-	info->filter_fn = dw_dma_acpi_filter;
-
-	ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info);
-	if (ret)
-		dev_err(dev, "could not register acpi_dma_controller\n");
-}
-
-static void dw_dma_acpi_controller_free(struct dw_dma *dw)
-{
-	struct device *dev = dw->dma.dev;
-
-	if (!has_acpi_companion(dev))
-		return;
-
-	acpi_dma_controller_free(dev);
-}
-#else /* !CONFIG_ACPI */
-static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {}
-static inline void dw_dma_acpi_controller_free(struct dw_dma *dw) {}
-#endif /* !CONFIG_ACPI */
-
 #ifdef CONFIG_OF
 static struct dw_dma_platform_data *
 dw_dma_parse_dt(struct platform_device *pdev)
-- 
2.23.0.rc1


  parent reply	other threads:[~2019-08-20 13:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20 13:15 [PATCH v2 00/10] dmaengine: dw: Enable for Intel Elkhart Lake Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 01/10] dmaengine: acpi: Set up DMA mask based on CSRT Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 02/10] dmaengine: acpi: Add kernel doc parameter descriptions Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 03/10] dmaengine: dw: Export struct dw_dma_chip_pdata for wider use Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 04/10] dmaengine: dw: platform: Use struct dw_dma_chip_pdata Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 05/10] dmaengine: dw: platform: Enable iDMA 32-bit on Intel Elkhart Lake Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 06/10] dmaengine: dw: platform: Use devm_platform_ioremap_resource() Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 07/10] dmaengine: dw: platform: Switch to acpi_dma_controller_register() Andy Shevchenko
2019-08-20 13:15 ` [PATCH v2 08/10] dmaengine: dw: platform: Move handle check to dw_dma_acpi_controller_register() Andy Shevchenko
2019-08-20 13:15 ` Andy Shevchenko [this message]
2019-08-20 13:15 ` [PATCH v2 10/10] dmaengine: dw: platform: Split OF helpers to separate module Andy Shevchenko
2019-08-21  4:11 ` [PATCH v2 00/10] dmaengine: dw: Enable for Intel Elkhart Lake Vinod Koul
2019-08-28 11:53   ` Andy Shevchenko
2019-08-29  4:32     ` Vinod Koul
2019-08-29 10:39       ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190820131546.75744-10-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=vireshk@kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.