[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJe_ZhfYgz5LEO7VqOJ8Qo+PZWrMNNvdfvCGQWMMq-TrbmL+xw@mail.gmail.com>
Date: Tue, 17 Jan 2012 15:40:44 +0530
From: Jassi Brar <jaswinder.singh@...aro.org>
To: Viresh Kumar <viresh.kumar@...com>
Cc: "vinod.koul@...el.com" <vinod.koul@...el.com>,
Pratyush ANAND <pratyush.anand@...com>,
Rajeev KUMAR <rajeev-dlh.kumar@...com>,
"linux@....linux.org.uk" <linux@....linux.org.uk>,
Bhupesh SHARMA <bhupesh.sharma@...com>,
Armando VISCONTI <armando.visconti@...com>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
Mirko GARDI <mirko.gardi@...com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Vipin KUMAR <vipin.kumar@...com>,
Shiraz HASHIM <shiraz.hashim@...com>,
Amit VIRDI <Amit.VIRDI@...com>,
Vipul Kumar SAMAR <vipulkumar.samar@...com>,
"viresh.linux@...il.com" <viresh.linux@...il.com>,
Deepak SIKRI <deepak.sikri@...com>,
Bhavna YADAV <bhavna.yadav@...com>,
"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Vincenzo FRASCINO <Vincenzo.FRASCINO@...com>
Subject: Re: [PATCH 8/8] dmaengine/dw_dmac: Add support for DMA_SLAVE_CONFIG
On 16 January 2012 17:12, Viresh Kumar <viresh.kumar@...com> wrote:
> On 1/16/2012 3:20 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.
>> + *
>> + * 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists