lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131115175155.GQ16735@n2100.arm.linux.org.uk>
Date:	Fri, 15 Nov 2013 17:51:55 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	"Shevchenko, Andriy" <andriy.shevchenko@...el.com>
Cc:	Florian Meier <florian.meier@...lo.de>,
	"Koul, Vinod" <vinod.koul@...el.com>,
	"Williams, Dan J" <dan.j.williams@...el.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Mark Brown <broonie@...nel.org>,
	dmaengine <dmaengine@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCHv5] dmaengine: Add support for BCM2835

On Fri, Nov 15, 2013 at 05:43:45PM +0000, Shevchenko, Andriy wrote:
> On Fri, 2013-11-15 at 17:28 +0100, Florian Meier wrote:
> > +static size_t bcm2835_dma_desc_size_pos(struct bcm2835_desc *d, dma_addr_t addr)
> > +{
> > +	unsigned i;
> > +	size_t size;
> 
> size = 0 here is better.

See my other comment to Joe.

> > +	for (size = i = 0; i < d->frames; i++) {
> > +		struct bcm2835_dma_cb *control_block =
> > +			&d->control_block_base[i];
> > +		size_t this_size = control_block->length;
> > +		dma_addr_t dma;
> > +
> > +		if (d->dir == DMA_DEV_TO_MEM)
> > +			dma = control_block->dst;
> > +		else
> > +			dma = control_block->src;
> 
> Do you think it must be dependent on the direction?

Of course it does.  Take a moment to think about it please.

> Do you have information of how many bytes transferred already in the DMA
> controller registers? Would it be better to use it?
> 
> > +		if (size)
> > +			size += this_size;
> > +		else if (addr >= dma && addr < dma + this_size)
> > +			size += dma + this_size - addr;
> 
> += -> =

No functional change, as 'size' has to be initialised anyway.  The
code is fine.

> > +	if (!pdev->dev.dma_mask)
> > +		pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
> > +
> > +	rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
> > +	if (rc)
> > +		return rc;
> > +	dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> 
> There is nice helper you may use instead of those two above and remove
> 'if' condition as well.

There is _now_ but at the time this is being developed, it wasn't there.
Such a change is probably only appropriate at least after -rc1 has
happened.  Since I'm the one who introduced that helper, and I haven't
said to use it yet in this driver, that suggests I've already thought
about this point...

> > +module_platform_driver(bcm2835_dma_driver);
> 
> Is it possible to get driver initialized after that one that uses it?

Doesn't quite make sense.  If you're asking whether other drivers can
try to make use of this driver before it's initialised, then the answer
is no.  We have mechanisms to cope with that - see deferred probing.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ