From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Vinod Koul <vinod.koul@intel.com>, Arnd Bergmann <arnd@arndb.de>,
Viresh Kumar <viresh.kumar@linaro.org>,
linux-kernel@vger.kernel.org,
spear-devel <spear-devel@list.st.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH 3/4] dw_dmac: make build of DT related methods optional
Date: Fri, 22 Mar 2013 16:43:20 +0200 [thread overview]
Message-ID: <1363963401-7924-4-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1363963401-7924-1-git-send-email-andriy.shevchenko@linux.intel.com>
There is no reason to build custom filter function and translation function
inside the driver in case we have no DT platform.
This patch introduces new method dw_dma_of_controller_register() and moves all
DT related stuff under #ifdef CONFIG_OF. It also helps to distinguish the real
-ENODEV return code of fake one when of_dma_controller_register is not
implemented.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/dw_dmac.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 274fd7d..9b2e186 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1244,6 +1244,7 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
/*----------------------------------------------------------------------*/
+#ifdef CONFIG_OF
struct dw_dma_of_filter_args {
struct dw_dma *dw;
unsigned int req;
@@ -1303,6 +1304,19 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
return dma_request_channel(cap, dw_dma_of_filter, &fargs);
}
+static void dw_dma_of_controller_register(struct dw_dma *dw)
+{
+ struct device *dev = dw->dma.dev;
+ int err;
+
+ err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
+ if (err)
+ dev_err(dev, "could not register of_dma_controller\n");
+}
+#else /* !CONFIG_OF */
+static inline void dw_dma_of_controller_register(struct dw_dma *dw) {}
+#endif /* !CONFIG_OF */
+
/* --------------------- Cyclic DMA API extensions -------------------- */
/**
@@ -1843,13 +1857,8 @@ static int dw_probe(struct platform_device *pdev)
dma_async_device_register(&dw->dma);
- if (pdev->dev.of_node) {
- err = of_dma_controller_register(pdev->dev.of_node,
- dw_dma_of_xlate, dw);
- if (err && err != -ENODEV)
- dev_err(&pdev->dev,
- "could not register of_dma_controller\n");
- }
+ if (pdev->dev.of_node)
+ dw_dma_of_controller_register(dw);
return 0;
}
--
1.8.2.rc0.22.gb3600c3
next prev parent reply other threads:[~2013-03-22 14:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 14:43 [PATCH 0/4] dw_dmac: cleanup for DT usage Andy Shevchenko
2013-03-22 14:43 ` [PATCH 1/4] dw_dmac: fix style of the comments Andy Shevchenko
2013-03-23 6:46 ` Viresh Kumar
2013-03-22 14:43 ` [PATCH 2/4] dw_dmac: rename DT related methods to reflect their belonging Andy Shevchenko
2013-03-23 6:47 ` Viresh Kumar
2013-03-22 14:43 ` Andy Shevchenko [this message]
2013-03-22 15:19 ` [PATCH 3/4] dw_dmac: make build of DT related methods optional Arnd Bergmann
2013-03-25 9:04 ` Andy Shevchenko
2013-03-25 22:09 ` Arnd Bergmann
2013-03-22 14:43 ` [PATCH 4/4] dmaengine: dw_dmac: simplify master selection Andy Shevchenko
2013-03-22 14:43 ` Andy Shevchenko
2013-03-23 6:55 ` Viresh Kumar
2013-03-23 6:55 ` Viresh Kumar
2013-03-22 15:20 ` [PATCH 0/4] dw_dmac: cleanup for DT usage Arnd Bergmann
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=1363963401-7924-4-git-send-email-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=spear-devel@list.st.com \
--cc=vinod.koul@intel.com \
--cc=viresh.kumar@linaro.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.