[PATCH v2 1/1] dt: Add general DMA window parser

Stephen Warren swarren at wwwdotorg.org
Mon Apr 23 14:16:40 EDT 2012


On 04/23/2012 05:53 AM, Hiroshi Doyu wrote:
> From: Hiroshi DOYU <hdoyu at nvidia.com>
> 
> This code was based on:
> 	"arch/microblaze/kernel/prom_parse.c"
> 	"arch/powerpc/kernel/prom_parse.c"
> 
> "ibm," prefix could be supported with some modification.

That'd probably be a good idea. If it isn't supported, then this code
can't be used as a replacement for the PPC and Microblaze code.

> +int of_parse_dma_window(struct device_node *dn,
> +			const char *propname, int index,
> +			unsigned long *busno,
> +			dma_addr_t *addr, size_t *size)
> +{
> +	const __be32 *dma_window, *end;
> +	int bytes, cur_index = 0;
> +
> +	if (!dn || !propname || !addr || !size)
> +		return -EINVAL;

Instead of erroring out if (!propname), perhaps:

if (!propname)
    propname = "dma-window";

so that only drivers using bindings before this common binding was
defined actually need to write out the property name?

> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
...
> +extern int of_parse_dma_window(struct device_node *dev,
> +			       const char *propname, int index,
> +			       unsigned long *busno,
> +			       dma_addr_t *phys, size_t *size);

This function has the same name as the PPC and Microblaze code it's
based on. Is that going to cause compile and link errors due to
duplicate symbol definitions?



More information about the linux-arm-kernel mailing list