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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Thierry Reding <thierry.reding@xxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/1] dt: Add general DMA window parser
Date: Wed, 18 Apr 2012 12:54:23 +0200
Message-ID: <20120418105423.GA5667@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>

> * PGP Signed by an unknown key
> 
> * Hiroshi Doyu wrote:
> > diff --git a/drivers/of/of_dma.c b/drivers/of/of_dma.c
> > new file mode 100644
> > index 0000000..45c9e88
> > --- /dev/null
> > +++ b/drivers/of/of_dma.c
> > @@ -0,0 +1,35 @@
> > +/*
> > + * Stolen from:
> > + *	"arch/microblaze/kernel/prom_parse.c"
> > + *	"arch/powerpc/kernel/prom_parse.c"
> > + */
> > +
> > +#include <linux/of_address.h>
> > +
> > +void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
> > +		unsigned long *busno, unsigned long *phys, unsigned long *size)
> > +{
> > +	const __be32 *dma_window;
> > +	u32 cells;
> > +	const unsigned char *prop;
> 
> There's no need for this to be const unsigned char *, const void * will do
> just as well.
> 
> > +
> > +	dma_window = dma_window_prop;
> > +
> > +	/* busno is always one cell */
> > +	if (busno)
> > +		*busno = be32_to_cpup(dma_window++);
> > +
> > +	prop = of_get_property(dn, "#dma-address-cells", NULL);
> > +	if (!prop)
> > +		prop = of_get_property(dn, "#address-cells", NULL);
> > +
> > +	cells = prop ? be32_to_cpup(prop) : of_n_addr_cells(dn);
> > +	*phys = of_read_number(dma_window, cells);
> 
> This should probably fail gracefully if phys == NULL, similar to what you do
> for busno.
> 
> > +
> > +	dma_window += cells;
> > +
> > +	prop = of_get_property(dn, "#dma-size-cells", NULL);
> > +	cells = prop ? be32_to_cpup(prop) : of_n_size_cells(dn);
> > +	*size = of_read_number(dma_window, cells);
> 
> Same here.
> 
> > +}
> > +
> 
> And you might want to add a EXPORT_SYMBOL(of_parse_dma_window) here so the
> function can be used from modules.
> 
> Sorry for having you go through another round. I should have looked more
> closely before.

No problem, I'll wait for another comments, and post again later. Thank you for reivew.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux