On 05/24/2013 07:54 AM, Vinod Koul wrote:
> On Fri, May 24, 2013 at 07:58:04AM +0200, Lars-Peter Clausen wrote:
>> This one needs both.
>>>> + jzcfg.mode = JZ4740_DMA_MODE_SINGLE;
>>>> + jzcfg.request_type = config->slave_id;
>>>> + chan->config = *config;
>>>> + jz4740_dma_configure(chan->jz_chan, &jzcfg);
>>>> + return 0;
>>> You are NOT use src_addr/dstn_addr? How else are you passing the periphral
>> I'm saving the whole config, which will later be used to retrieve the source
>> dest address.
> well I missed that and it is a bad idea. You dont know when client has
> freed/thrown the pointer so copy this instead..
I do copy the full config, not just the pointer to the config. Although
src_addr and dest_addr are the only two fields which are used later on at this
point. So I could change it to just copy src_addr and dest_addr, or well just
one of them depending on the direction.
>>>> +static int jz4740_dma_alloc_chan_resources(struct dma_chan *c)
>>>> + struct jz4740_dmaengine_chan *chan = to_jz4740_dma_chan(c);
>>>> + chan->jz_chan = jz4740_dma_request(chan, NULL);
>>>> + if (!chan->jz_chan)
>>>> + return -EBUSY;
>>>> + jz4740_dma_set_complete_cb(chan->jz_chan, jz4740_dma_complete_cb);
>>>> + return 0;
>>> Zero is not expected value, you need to return the descriptors allocated
>> Well, zero descriptors have been allocated. As far as I can see only a
>> return value is treated as an error. Also the core doesn't seem to use the
>> return value for anything else but checking if it is an error.
> This is the API defination
> * @device_alloc_chan_resources: allocate resources and return the
> * number of allocated descriptors
But 0 is still the number of descriptors that have been pre-allocated.