On 20-09-18, 08:37, Kit Chow wrote: > Resending because earlier post rejected for non-ascii chars... > --- > > > To use dma_find_channel, I call dmaengine_get to populate the per cpu > channel_table[]... > > In dmaengine_get, chan->client_count's for all of the dma channels that it > can acquire are all being set to 2. > > It is set to 2 because, dmaengine_ref_count is incremented first thing in > dmaengine_get. For every non PRIVATE channel, balance_ref_count(chan) is > called before dma_chan_get() increments client_count; > balance_ref_count(chan) will increment client_count (0) to match the value > of dmaengine_ref_count (1) if client_count < dmaengine_ref_count. > > if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask)) > balance_ref_count(chan); <<< sets client_count to 1 > > out: > chan->client_count++; <<< increment to 2. > > > Is the value of 2 initially set for the chan->client_count correct? It > seems like the correct value should be 1. can you send a patch? > If dmaengine_put were called at some later time to undo what dmaengine_get > had done, the dma_chan_put() calls would only be able to decrement the > client_count values from 2 to 1 and will not clean up as client_count is not > 0. Is there something else I am missing that could be decrementing the > client_count (something like balance_ref_count but in the downward > direction)? > > Thanks > > Kit -- ~Vinod