[PATCH] dma: of-dma: return error when 'dma-cells' not found

Arnd Bergmann arnd at arndb.de
Tue Mar 5 14:48:02 EST 2013


On Tuesday 05 March 2013, Rob Herring wrote:
> > Why would you call of_dma_controller_register() for a dma
> > engine that does not support slave channels, when that is the
> > only purpose of that interface?
> 
> Well maybe then that function should be allowed to fail without erroring
> out. I just fixed it a the line that failed.

We have a lot of interfaces that fall back to silently doing nothing
when there is no need.

> Doing be32_to_cpup directly
> on a function return that can be NULL is not correct either.

Agreed.
 
> > Note that the binding defines #dma-cells as required, and it
> > does not make any sense otherwise.
> 
> The 2nd patch I submitted changes that. It does not make sense to
> require it if you have no requests and hence will never have a phandle
> reference in a slave device.

I still don't see why you would want to use the binding for
dma slaves to describe a dmaengine that does not have slaves.

> The simple fact is that the pl330 had an
> existing binding that worked for the memory to memory only case and
> kernel changes broke this. Kernel changes should not break existing
> device-trees.

Of course we should not break the existing device tree, but I think
it would be more sensible to change the pl330 specific binding in this
case to require the use of the generic dma slave binding only when
there are slaves connected to it.

If the #dma-cells property is absent, the pl330 driver can be changed
not to call of_dma_controller_register.

	Arnd



More information about the linux-arm-kernel mailing list