From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Dan Williams
<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH V2] dma: tegra: register as an OF DMA controller
Date: Wed, 4 Dec 2013 09:29:34 +0100 [thread overview]
Message-ID: <20131204082929.GC19943@ulmo.nvidia.com> (raw)
In-Reply-To: <529E1C1A.5000709-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 3023 bytes --]
On Tue, Dec 03, 2013 at 10:59:54AM -0700, Stephen Warren wrote:
> On 11/29/2013 07:17 AM, Thierry Reding wrote:
> > On Mon, Nov 25, 2013 at 02:53:36PM -0700, Stephen Warren wrote:
> > [...]
> >> memcpy(&tdc->dma_sconfig, sconfig, sizeof(*sconfig)); + if
> >> (!tdc->slave_id) + tdc->slave_id = sconfig->slave_id;
> >> tdc->config_init = true;
> >
> > This could use some blank lines to unclutter it a bit.
>
> To be honest, I feel the opposite; random blank lines sprinkled in the
> middle of related code make the code structure harder to follow.
I don't think they are random at all, but we can probably go on arguing
about that for a long time. So if you prefer to keep it cluttered, feel
free to do so. =P
> >> @@ -942,7 +947,7 @@ static struct dma_async_tx_descriptor
> >> *tegra_dma_prep_slave_sg( ahb_seq |=
> >> TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32;
> >>
> >> csr |= TEGRA_APBDMA_CSR_ONCE | TEGRA_APBDMA_CSR_FLOW; - csr |=
> >> tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; +
> >> csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
> >
> > Perhaps I'm missing something, but couldn't we reuse the .slave_id
> > field of struct dma_slave_config? It seems like it might be
> > overwritten by the DMA engine core or users when they call
> > dmaengine_slave_config().
>
> The slave ID seems channel-specific to me, and hence should be managed
> at the channel level. struct dma_slave_config is the client-specified
> runtime properties. As you mention, I also worry about client drivers
> trampling over the dma_slave_config data, so storing it where they
> can't doesn't seem like a good idea.
I think you meant "does seem like a good idea"? The reason why this had
me puzzled is probably that I haven't seen this pattern in subsystems
I'm more familiar with. Like you said, it seems like a channel-specific
property, so clients should have no business modifying it.
But I assume there were valid reasons for doing things this way, so I
withdraw my objections.
> >> static int tegra_dma_probe(struct platform_device *pdev) { struct
> >> resource *res; @@ -1383,10 +1402,22 @@ static int
> >> tegra_dma_probe(struct platform_device *pdev) goto err_irq; }
> >>
> >> + tdma->xlate_info.device = &tdma->dma_dev; +
> >> tdma->xlate_info.post_alloc = tegra_dma_of_xlate_post_alloc; +
> >> ret = of_dma_controller_register(pdev->dev.of_node, +
> >> of_dma_slave_xlate, &tdma->xlate_info); + if (ret < 0) { +
> >> dev_err(&pdev->dev, + "Tegra20 APB DMA OF registration failed
> >> %d\n", ret); + goto err_unregister_dma_dev; + }
> >
> > Would it be useful to move this into the core and have it register
> > the OF parts transparently to the driver? That's of course nothing
> > that should be done in this patch.
>
> That'd probably be possible, yes, given a few extra fields in struct
> dma_device, e.g. for the of_xlate function pointer. As you say, I
> won't address it in this patch though.
Okay, that's fine.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2] dma: tegra: register as an OF DMA controller
Date: Wed, 4 Dec 2013 09:29:34 +0100 [thread overview]
Message-ID: <20131204082929.GC19943@ulmo.nvidia.com> (raw)
In-Reply-To: <529E1C1A.5000709@wwwdotorg.org>
On Tue, Dec 03, 2013 at 10:59:54AM -0700, Stephen Warren wrote:
> On 11/29/2013 07:17 AM, Thierry Reding wrote:
> > On Mon, Nov 25, 2013 at 02:53:36PM -0700, Stephen Warren wrote:
> > [...]
> >> memcpy(&tdc->dma_sconfig, sconfig, sizeof(*sconfig)); + if
> >> (!tdc->slave_id) + tdc->slave_id = sconfig->slave_id;
> >> tdc->config_init = true;
> >
> > This could use some blank lines to unclutter it a bit.
>
> To be honest, I feel the opposite; random blank lines sprinkled in the
> middle of related code make the code structure harder to follow.
I don't think they are random at all, but we can probably go on arguing
about that for a long time. So if you prefer to keep it cluttered, feel
free to do so. =P
> >> @@ -942,7 +947,7 @@ static struct dma_async_tx_descriptor
> >> *tegra_dma_prep_slave_sg( ahb_seq |=
> >> TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32;
> >>
> >> csr |= TEGRA_APBDMA_CSR_ONCE | TEGRA_APBDMA_CSR_FLOW; - csr |=
> >> tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; +
> >> csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
> >
> > Perhaps I'm missing something, but couldn't we reuse the .slave_id
> > field of struct dma_slave_config? It seems like it might be
> > overwritten by the DMA engine core or users when they call
> > dmaengine_slave_config().
>
> The slave ID seems channel-specific to me, and hence should be managed
> at the channel level. struct dma_slave_config is the client-specified
> runtime properties. As you mention, I also worry about client drivers
> trampling over the dma_slave_config data, so storing it where they
> can't doesn't seem like a good idea.
I think you meant "does seem like a good idea"? The reason why this had
me puzzled is probably that I haven't seen this pattern in subsystems
I'm more familiar with. Like you said, it seems like a channel-specific
property, so clients should have no business modifying it.
But I assume there were valid reasons for doing things this way, so I
withdraw my objections.
> >> static int tegra_dma_probe(struct platform_device *pdev) { struct
> >> resource *res; @@ -1383,10 +1402,22 @@ static int
> >> tegra_dma_probe(struct platform_device *pdev) goto err_irq; }
> >>
> >> + tdma->xlate_info.device = &tdma->dma_dev; +
> >> tdma->xlate_info.post_alloc = tegra_dma_of_xlate_post_alloc; +
> >> ret = of_dma_controller_register(pdev->dev.of_node, +
> >> of_dma_slave_xlate, &tdma->xlate_info); + if (ret < 0) { +
> >> dev_err(&pdev->dev, + "Tegra20 APB DMA OF registration failed
> >> %d\n", ret); + goto err_unregister_dma_dev; + }
> >
> > Would it be useful to move this into the core and have it register
> > the OF parts transparently to the driver? That's of course nothing
> > that should be done in this patch.
>
> That'd probably be possible, yes, given a few extra fields in struct
> dma_device, e.g. for the of_xlate function pointer. As you say, I
> won't address it in this patch though.
Okay, that's fine.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131204/a2e263e8/attachment.sig>
next prev parent reply other threads:[~2013-12-04 8:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 21:53 [PATCH V2] dma: tegra: register as an OF DMA controller Stephen Warren
2013-11-25 21:53 ` Stephen Warren
[not found] ` <1385416416-3536-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-25 22:09 ` Arnd Bergmann
2013-11-25 22:09 ` Arnd Bergmann
2013-11-25 22:30 ` Stephen Warren
2013-11-25 22:30 ` Stephen Warren
[not found] ` <5293CF9F.6040305-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-25 23:09 ` Dan Williams
2013-11-25 23:09 ` Dan Williams
[not found] ` <CAPcyv4jLh6cyaP2DmnOkc11xeKsB0QtbXQ9VV3BBmHVVt2iHXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-25 23:14 ` Stephen Warren
2013-11-25 23:14 ` Stephen Warren
[not found] ` <5293D9EB.9070900-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-26 1:13 ` Dan Williams
2013-11-26 1:13 ` Dan Williams
2013-11-29 21:08 ` Arnd Bergmann
2013-11-29 21:08 ` Arnd Bergmann
[not found] ` <201311292208.26215.arnd-r2nGTMty4D4@public.gmane.org>
2013-12-03 17:52 ` Stephen Warren
2013-12-03 17:52 ` Stephen Warren
2013-12-04 1:22 ` Arnd Bergmann
2013-12-04 1:22 ` Arnd Bergmann
[not found] ` <201312040222.03604.arnd-r2nGTMty4D4@public.gmane.org>
2013-12-04 17:09 ` Stephen Warren
2013-12-04 17:09 ` Stephen Warren
[not found] ` <529F61D3.3030104-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-04 17:18 ` Lars-Peter Clausen
2013-12-04 17:18 ` Lars-Peter Clausen
2013-12-06 21:16 ` Dan Williams
2013-12-06 21:16 ` Dan Williams
2013-12-06 22:19 ` Arnd Bergmann
2013-12-06 22:19 ` Arnd Bergmann
2013-11-29 14:17 ` Thierry Reding
2013-11-29 14:17 ` Thierry Reding
[not found] ` <20131129141725.GA22771-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-12-03 17:59 ` Stephen Warren
2013-12-03 17:59 ` Stephen Warren
[not found] ` <529E1C1A.5000709-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-04 8:29 ` Thierry Reding [this message]
2013-12-04 8:29 ` Thierry Reding
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=20131204082929.GC19943@ulmo.nvidia.com \
--to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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.