mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Florian Meier <florian.meier@koalo.de>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Vinod Koul <vinod.koul@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	devicetree <devicetree@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-rpi-kernel <linux-rpi-kernel@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	dmaengine <dmaengine@vger.kernel.org>
Subject: Re: [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.

      reply	other threads:[~2013-12-03 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 19:12 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=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=florian.meier@koalo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome