Re: [PATCH] dmaengine: add CSR SiRFprimaII DMAC driver

From: Barry Song
Date: Thu Sep 08 2011 - 11:27:55 EST


Hi Arnd,
Thanks!

2011/9/8 Arnd Bergmann <arnd@xxxxxxxx>
>
> On Wednesday 07 September 2011, Barry Song wrote:
> > +/*
> > + * The DMA controller consists of 16 independent DMA channels.
> > + * Each channel is allocated to a different function
> > + */
> > +bool sirfsoc_dma_filter_id(struct dma_chan *chan, void *chan_id)
> > +{
> > + Â Â Â unsigned int ch_nr = (unsigned int) chan_id;
> > +
> > + Â Â Â if (ch_nr == chan->chan_id)
> > + Â Â Â Â Â Â Â return true;
> > +
> > + Â Â Â return false;
> > +}
> > +EXPORT_SYMBOL(sirfsoc_dma_filter_id);
> > +
>
> Hi Barry,
>
> It seems wrong that you have to export this function. The dmaengine API
> should be able to work without this, and when you have drivers using the
> interface, those should not rely on a specific implementation as the
> purpose of the API is specifically to hide that.
>
> Am I missing something?

i am not sure whether i have other way to require a special channel
for a special device. it seems dma_request_channel only gives me a
chance to use a filter function since my all channels have same DMA
cap masks.

this filter is used by all drivers with DMA since every dma channel is
fixed to be assigned to one device.

i did do some copy from coh901318.c:
bool coh901318_filter_id(struct dma_chan *chan, void *chan_id)
{
unsigned int ch_nr = (unsigned int) chan_id;

if (ch_nr == to_coh901318_chan(chan)->id)
return true;

return false;
}
EXPORT_SYMBOL(coh901318_filter_id);

if it does become a common filter, we might have a function like:

bool dmaengine_filter_match_channel_id(struct dma_chan *chan, void *chan_id)
{
if (ch_nr == chan->chan_id)
return true;

return false;
}
EXPORT_SYMBOL(dmaengine_filter_match_channel_id);

Another filter is in amba-pl08x.c, it is filtering channel by name:
bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
{
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
char *name = chan_id;

/* Check that the channel is not taken! */
if (!strcmp(plchan->name, name))
return true;

return false;
}

>
> Â Â Â ÂArnd
>

-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/