From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv8] dmaengine: Add support for BCM2835
Date: Tue, 3 Dec 2013 12:12:22 +0000 [thread overview]
Message-ID: <20131203121222.GS16735@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1386072258.1871.44.camel@smile>
On Tue, Dec 03, 2013 at 02:04:18PM +0200, Andy Shevchenko wrote:
> On Mon, 2013-12-02 at 20:12 +0100, Florian Meier wrote:
> > +static void bcm2835_dma_free(struct bcm2835_dmadev *od)
> > +{
> > + while (!list_empty(&od->ddev.channels)) {
> > + struct bcm2835_chan *c = list_first_entry(&od->ddev.channels,
> > + struct bcm2835_chan, vc.chan.device_node);
> > +
>
> list_for_each_entry_safe() suits well here.
>
> > + list_del(&c->vc.chan.device_node);
> > + tasklet_kill(&c->vc.task);
> > + }
For such a loop, where we're deleting all entries in a list,
list_for_each_entry_safe() is a little heavier than necessary. This
is how the code would look:
static void bcm2835_dma_free(struct bcm2835_dmadev *od)
{
struct bcm2835_chan *c, *next;
list_for_each_entry_safe(c, next, &od->ddev.channels,
vc.chan.device_node) {
list_del(&c->vc.chan.device_node);
tasklet_kill(&c->vc.task);
}
I see very little gain in this approach.
prev parent reply other threads:[~2013-12-03 12:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-02 19:12 [PATCHv8] dmaengine: Add support for BCM2835 Florian Meier
2013-12-03 12:04 ` Andy Shevchenko
2013-12-03 12:12 ` Russell King - ARM Linux [this message]
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=20131203121222.GS16735@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox