Thread (28 messages) 28 messages, 5 authors, 2012-01-19

[PATCH 8/8] dmaengine/dw_dmac: Add support for DMA_SLAVE_CONFIG

From: Jassi Brar <hidden>
Date: 2012-01-17 10:10:47
Also in: lkml

On 16 January 2012 17:12, Viresh Kumar [off-list ref] wrote:
On 1/16/2012 3:20 PM, Viresh KUMAR wrote:
quoted
+ ? ? /*
+ ? ? ?* Fix sconfig's burst size according to dw_dmac. We need to convert
+ ? ? ?* them as: 1 -> 0, 2 -> 1, 4 -> 2, 8 -> 3, 16 -> 4.
+ ? ? ?*
+ ? ? ?* This can be done by findiding least significant bit set: n & (n - 1)
+ ? ? ?*/
+ ? ? sconfig->src_maxburst &= sconfig->src_maxburst - 1;
+ ? ? sconfig->dst_maxburst &= sconfig->dst_maxburst - 1;
Perhaps, this looks incorrect. It will always return 0. :(
Can somebody suggest any inbuild function to do this, i think
Calculating log2(n) which isn't very tidy. For that reason usually we make do
the other way around by saving values as power of 2 and simply left shifting
1 by that value.
In case at hand since most likely only valid values are power of 2,
maybe you can do
    maxburst = ffs(maxburst) - 1

-j
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help