lkml.org 
[lkml]   [2012]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 8/8] dmaengine/dw_dmac: Add support for DMA_SLAVE_CONFIG
On 1/17/2012 2:45 PM, Viresh Kumar wrote:
>>>>>> >>> >> + * 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.
> I need above conversion. i.e. finding bit no. of first bit set.

Something like:

unsigned int v; // 32-bit word
unsigned int r = 0;

while (v >>= 1)
{
r++;
}

Probably find_first_bit() suits it.

--
viresh


\
 
 \ /
  Last update: 2012-01-17 10:23    [W:0.317 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site