[PATCH v3 1/2] dma: imx-dma: Add oftree support

Markus Pargmann mpa at pengutronix.de
Mon Feb 25 11:53:24 EST 2013


On Mon, Feb 25, 2013 at 04:24:51PM +0000, Arnd Bergmann wrote:
> On Monday 25 February 2013, Markus Pargmann wrote:
> > Adding devicetree support for imx-dma driver. Use driver name for
> > function 'imx_dma_is_general_purpose' because the devicename for
> > devicetree initialized devices is different.
> > 
> > Changes in V3:
> > - Create a imxdma translate function to pass the device object into the
> >   filter function.
> > 
> > Changes in V2:
> > - Change the driver to use generic DMA DT bindings.
> > - Add a imx-dma filter function that sets the dma request line in
> >   private data.
> > 
> > Signed-off-by: Markus Pargmann <mpa at pengutronix.de>
> > Cc: Arnd Bergmann <arnd at arndb.de>
> 
> Looks correct now,
> 
> Reviewed-by: Arnd Bergmann <arnd at arndb.de>
> 
> I have one idea for an optimization though:
> 
> > +static bool imxdma_filter_fn(struct dma_chan *chan, void *param)
> > +{
> > +	struct imxdma_filter_data *fdata = param;
> > +	struct imx_dma_data *data;
> > +
> > +	if (chan->device->dev != fdata->imxdma->dev)
> > +		return false;
> > +
> > +	data = kzalloc(sizeof(*data), GFP_KERNEL);
> > +
> > +	if (!data)
> > +		return false;
> > +
> > +	data->dma_request = fdata->request;
> > +	data->alloc_ctl_filter = true;
> > +	chan->private = data;
> > +
> > +	return true;
> > +}
> 
> There is already a "dma_request" member in "struct imxdma_channel", so
> you could use that instead of allocating the imx_dma_data here.
> 
> Then you don't need to keep track of freeing that memory again, but
> you might have to change a few other functions that look at data->dma_request
> rather than chan->dma_request at the moment and change them to
> use the latter instead. You can copy data->dma_request over in the
> alloc_chan_resources functions for the legacy case.

Thanks, that is much better than the current use of kzalloc. I updated it for v4.

Markus

> 
> 	Arnd

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-arm-kernel mailing list