From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: Richard Zhao <rizhao@nvidia.com>
Cc: swarren@wwwdotorg.org, vinod.koul@intel.com,
linux-kernel@vger.kernel.org, djbw@fb.com,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] DMA: let filter functions of of_dma_simple_xlate possible check of_node
Date: Fri, 2 Aug 2013 08:06:19 -0400 [thread overview]
Message-ID: <51FBA0BB.6080408@ti.com> (raw)
In-Reply-To: <1375408800-11789-1-git-send-email-rizhao@nvidia.com>
On Thursday 01 August 2013 10:00 PM, Richard Zhao wrote:
> pass of_phandle_args dma_spec to dma_request_channel in of_dma_simple_xlate,
> so the filter function could access of_node in of_phandle_args.
>
Am just curious the reasoning behind doing so. Can you please expand
above bit more with why you need to change it.
> It also remove restriction of #dma-cells has to be one.
>
> Signed-off-by: Richard Zhao <rizhao@nvidia.com>
> ---
> drivers/dma/edma.c | 7 +++++--
> drivers/dma/of-dma.c | 10 ++++------
> drivers/dma/omap-dma.c | 6 ++++--
> 3 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 4f6d87b..54582fd 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -23,6 +23,7 @@
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> +#include <linux/of_dma.h>
>
> #include <linux/platform_data/edma.h>
>
> @@ -604,9 +605,11 @@ static struct platform_driver edma_driver = {
>
> bool edma_filter_fn(struct dma_chan *chan, void *param)
> {
> - if (chan->device->dev->driver == &edma_driver.driver) {
> + struct of_phandle_args *dma_spec = param;
> + if (chan->device->dev->driver == &edma_driver.driver &&
> + dma_spec->np == chan->device->dev->of_node) {
> struct edma_chan *echan = to_edma_chan(chan);
> - unsigned ch_req = *(unsigned *)param;
> + unsigned ch_req = dma_spec->args[0];
> return ch_req == echan->ch_num;
> }
> return false;
> diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
> index 75334bd..e1c4d3b 100644
> --- a/drivers/dma/of-dma.c
> +++ b/drivers/dma/of-dma.c
> @@ -192,11 +192,9 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
> * @dma_spec: pointer to DMA specifier as found in the device tree
> * @of_dma: pointer to DMA controller data
> *
> - * A simple translation function for devices that use a 32-bit value for the
> + * A simple translation function for devices that use dma_spec for the
> * filter_param when calling the DMA engine dma_request_channel() function.
> - * Note that this translation function requires that #dma-cells is equal to 1
> - * and the argument of the dma specifier is the 32-bit filter_param. Returns
> - * pointer to appropriate dma channel on success or NULL on error.
> + * Returns pointer to appropriate dma channel on success or NULL on error.
> */
> struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> struct of_dma *ofdma)
> @@ -207,10 +205,10 @@ struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> if (!info || !info->filter_fn)
> return NULL;
>
> - if (count != 1)
> + if (count < 1)
> return NULL;
>
> return dma_request_channel(info->dma_cap, info->filter_fn,
> - &dma_spec->args[0]);
> + dma_spec);
> }
> EXPORT_SYMBOL_GPL(of_dma_simple_xlate);
> diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
> index ec3fc4f..32547ec 100644
> --- a/drivers/dma/omap-dma.c
> +++ b/drivers/dma/omap-dma.c
> @@ -693,9 +693,11 @@ static struct platform_driver omap_dma_driver = {
>
> bool omap_dma_filter_fn(struct dma_chan *chan, void *param)
> {
> - if (chan->device->dev->driver == &omap_dma_driver.driver) {
> + struct of_phandle_args *dma_spec = param;
> + if (chan->device->dev->driver == &omap_dma_driver.driver &&
> + dma_spec->np == chan->device->dev->of_node) {
> struct omap_chan *c = to_omap_dma_chan(chan);
> - unsigned req = *(unsigned *)param;
> + unsigned req = dma_spec->args[0];
>
> return req == c->dma_sig;
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] DMA: let filter functions of of_dma_simple_xlate possible check of_node
Date: Fri, 2 Aug 2013 08:06:19 -0400 [thread overview]
Message-ID: <51FBA0BB.6080408@ti.com> (raw)
In-Reply-To: <1375408800-11789-1-git-send-email-rizhao@nvidia.com>
On Thursday 01 August 2013 10:00 PM, Richard Zhao wrote:
> pass of_phandle_args dma_spec to dma_request_channel in of_dma_simple_xlate,
> so the filter function could access of_node in of_phandle_args.
>
Am just curious the reasoning behind doing so. Can you please expand
above bit more with why you need to change it.
> It also remove restriction of #dma-cells has to be one.
>
> Signed-off-by: Richard Zhao <rizhao@nvidia.com>
> ---
> drivers/dma/edma.c | 7 +++++--
> drivers/dma/of-dma.c | 10 ++++------
> drivers/dma/omap-dma.c | 6 ++++--
> 3 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 4f6d87b..54582fd 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -23,6 +23,7 @@
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> +#include <linux/of_dma.h>
>
> #include <linux/platform_data/edma.h>
>
> @@ -604,9 +605,11 @@ static struct platform_driver edma_driver = {
>
> bool edma_filter_fn(struct dma_chan *chan, void *param)
> {
> - if (chan->device->dev->driver == &edma_driver.driver) {
> + struct of_phandle_args *dma_spec = param;
> + if (chan->device->dev->driver == &edma_driver.driver &&
> + dma_spec->np == chan->device->dev->of_node) {
> struct edma_chan *echan = to_edma_chan(chan);
> - unsigned ch_req = *(unsigned *)param;
> + unsigned ch_req = dma_spec->args[0];
> return ch_req == echan->ch_num;
> }
> return false;
> diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
> index 75334bd..e1c4d3b 100644
> --- a/drivers/dma/of-dma.c
> +++ b/drivers/dma/of-dma.c
> @@ -192,11 +192,9 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
> * @dma_spec: pointer to DMA specifier as found in the device tree
> * @of_dma: pointer to DMA controller data
> *
> - * A simple translation function for devices that use a 32-bit value for the
> + * A simple translation function for devices that use dma_spec for the
> * filter_param when calling the DMA engine dma_request_channel() function.
> - * Note that this translation function requires that #dma-cells is equal to 1
> - * and the argument of the dma specifier is the 32-bit filter_param. Returns
> - * pointer to appropriate dma channel on success or NULL on error.
> + * Returns pointer to appropriate dma channel on success or NULL on error.
> */
> struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> struct of_dma *ofdma)
> @@ -207,10 +205,10 @@ struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> if (!info || !info->filter_fn)
> return NULL;
>
> - if (count != 1)
> + if (count < 1)
> return NULL;
>
> return dma_request_channel(info->dma_cap, info->filter_fn,
> - &dma_spec->args[0]);
> + dma_spec);
> }
> EXPORT_SYMBOL_GPL(of_dma_simple_xlate);
> diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
> index ec3fc4f..32547ec 100644
> --- a/drivers/dma/omap-dma.c
> +++ b/drivers/dma/omap-dma.c
> @@ -693,9 +693,11 @@ static struct platform_driver omap_dma_driver = {
>
> bool omap_dma_filter_fn(struct dma_chan *chan, void *param)
> {
> - if (chan->device->dev->driver == &omap_dma_driver.driver) {
> + struct of_phandle_args *dma_spec = param;
> + if (chan->device->dev->driver == &omap_dma_driver.driver &&
> + dma_spec->np == chan->device->dev->of_node) {
> struct omap_chan *c = to_omap_dma_chan(chan);
> - unsigned req = *(unsigned *)param;
> + unsigned req = dma_spec->args[0];
>
> return req == c->dma_sig;
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: Richard Zhao <rizhao@nvidia.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <vinod.koul@intel.com>,
<djbw@fb.com>, <swarren@wwwdotorg.org>
Subject: Re: [PATCH] DMA: let filter functions of of_dma_simple_xlate possible check of_node
Date: Fri, 2 Aug 2013 08:06:19 -0400 [thread overview]
Message-ID: <51FBA0BB.6080408@ti.com> (raw)
In-Reply-To: <1375408800-11789-1-git-send-email-rizhao@nvidia.com>
On Thursday 01 August 2013 10:00 PM, Richard Zhao wrote:
> pass of_phandle_args dma_spec to dma_request_channel in of_dma_simple_xlate,
> so the filter function could access of_node in of_phandle_args.
>
Am just curious the reasoning behind doing so. Can you please expand
above bit more with why you need to change it.
> It also remove restriction of #dma-cells has to be one.
>
> Signed-off-by: Richard Zhao <rizhao@nvidia.com>
> ---
> drivers/dma/edma.c | 7 +++++--
> drivers/dma/of-dma.c | 10 ++++------
> drivers/dma/omap-dma.c | 6 ++++--
> 3 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 4f6d87b..54582fd 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -23,6 +23,7 @@
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> +#include <linux/of_dma.h>
>
> #include <linux/platform_data/edma.h>
>
> @@ -604,9 +605,11 @@ static struct platform_driver edma_driver = {
>
> bool edma_filter_fn(struct dma_chan *chan, void *param)
> {
> - if (chan->device->dev->driver == &edma_driver.driver) {
> + struct of_phandle_args *dma_spec = param;
> + if (chan->device->dev->driver == &edma_driver.driver &&
> + dma_spec->np == chan->device->dev->of_node) {
> struct edma_chan *echan = to_edma_chan(chan);
> - unsigned ch_req = *(unsigned *)param;
> + unsigned ch_req = dma_spec->args[0];
> return ch_req == echan->ch_num;
> }
> return false;
> diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
> index 75334bd..e1c4d3b 100644
> --- a/drivers/dma/of-dma.c
> +++ b/drivers/dma/of-dma.c
> @@ -192,11 +192,9 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
> * @dma_spec: pointer to DMA specifier as found in the device tree
> * @of_dma: pointer to DMA controller data
> *
> - * A simple translation function for devices that use a 32-bit value for the
> + * A simple translation function for devices that use dma_spec for the
> * filter_param when calling the DMA engine dma_request_channel() function.
> - * Note that this translation function requires that #dma-cells is equal to 1
> - * and the argument of the dma specifier is the 32-bit filter_param. Returns
> - * pointer to appropriate dma channel on success or NULL on error.
> + * Returns pointer to appropriate dma channel on success or NULL on error.
> */
> struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> struct of_dma *ofdma)
> @@ -207,10 +205,10 @@ struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> if (!info || !info->filter_fn)
> return NULL;
>
> - if (count != 1)
> + if (count < 1)
> return NULL;
>
> return dma_request_channel(info->dma_cap, info->filter_fn,
> - &dma_spec->args[0]);
> + dma_spec);
> }
> EXPORT_SYMBOL_GPL(of_dma_simple_xlate);
> diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
> index ec3fc4f..32547ec 100644
> --- a/drivers/dma/omap-dma.c
> +++ b/drivers/dma/omap-dma.c
> @@ -693,9 +693,11 @@ static struct platform_driver omap_dma_driver = {
>
> bool omap_dma_filter_fn(struct dma_chan *chan, void *param)
> {
> - if (chan->device->dev->driver == &omap_dma_driver.driver) {
> + struct of_phandle_args *dma_spec = param;
> + if (chan->device->dev->driver == &omap_dma_driver.driver &&
> + dma_spec->np == chan->device->dev->of_node) {
> struct omap_chan *c = to_omap_dma_chan(chan);
> - unsigned req = *(unsigned *)param;
> + unsigned req = dma_spec->args[0];
>
> return req == c->dma_sig;
> }
>
next prev parent reply other threads:[~2013-08-02 12:06 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 2:00 [PATCH] DMA: let filter functions of of_dma_simple_xlate possible check of_node Richard Zhao
2013-08-02 2:00 ` Richard Zhao
2013-08-02 2:00 ` Richard Zhao
2013-08-02 12:06 ` Santosh Shilimkar [this message]
2013-08-02 12:06 ` Santosh Shilimkar
2013-08-02 12:06 ` Santosh Shilimkar
2013-08-02 20:52 ` Stephen Warren
2013-08-02 20:52 ` Stephen Warren
2013-08-22 5:19 ` Richard Zhao
2013-08-22 5:19 ` Richard Zhao
2013-08-22 20:18 ` Stephen Warren
2013-08-22 20:18 ` Stephen Warren
2013-08-23 1:29 ` Richard Zhao
2013-08-23 1:29 ` Richard Zhao
2013-08-23 15:57 ` Stephen Warren
2013-08-23 15:57 ` Stephen Warren
2013-08-26 12:17 ` Laurent Pinchart
2013-08-26 12:17 ` Laurent Pinchart
2013-08-26 12:55 ` Richard Zhao
2013-08-26 12:55 ` Richard Zhao
2013-08-26 13:18 ` Laurent Pinchart
2013-08-26 13:18 ` Laurent Pinchart
2013-08-26 14:10 ` Vinod Koul
2013-08-26 14:10 ` Vinod Koul
2013-08-26 18:15 ` Arnd Bergmann
2013-08-26 18:15 ` Arnd Bergmann
2013-08-28 5:37 ` Vinod Koul
2013-08-28 5:37 ` Vinod Koul
2013-08-26 14:49 ` Richard Zhao
2013-08-26 14:49 ` Richard Zhao
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=51FBA0BB.6080408@ti.com \
--to=santosh.shilimkar@ti.com \
--cc=djbw@fb.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rizhao@nvidia.com \
--cc=swarren@wwwdotorg.org \
--cc=vinod.koul@intel.com \
/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.