From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Ball Date: Thu, 01 Dec 2011 18:24:20 +0000 Subject: Re: [PATCH] mmc: sh_mmcif: simplify clock divisor calculation Message-Id: <87ehwokv57.fsf@laptop.org> List-Id: References: <1321473366-31053-1-git-send-email-andreiw@vmware.com> <20111117150549.15528e81.akpm@linux-foundation.org> In-Reply-To: (Guennadi Liakhovetski's message of "Wed, 23 Nov 2011 15:52:30 +0100 (CET)") MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Guennadi Liakhovetski Cc: Andrew Morton , Andrei Warkentin , linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org Hi, On Wed, Nov 23 2011, Guennadi Liakhovetski wrote: > Replace ilog2(__rounddown_pow_of_two(x)) with the equivalent but much > simpler fls(x) - 1. > > Reported-by: Andrew Morton > Signed-off-by: Guennadi Liakhovetski > --- > drivers/mmc/host/sh_mmcif.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c > index c021482..824fee5 100644 > --- a/drivers/mmc/host/sh_mmcif.c > +++ b/drivers/mmc/host/sh_mmcif.c > @@ -16,6 +16,7 @@ > * > */ > > +#include > #include > #include > #include > @@ -386,7 +387,7 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk) > sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK); > else > sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR & > - (ilog2(__rounddown_pow_of_two(host->clk / clk)) << 16)); > + ((fls(host->clk / clk) - 1) << 16)); > > sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE); > } Thanks, pushed to mmc-next for 3.3. - Chris. -- Chris Ball One Laptop Per Child