[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1111230032200.29085@axis700.grange>
Date: Wed, 23 Nov 2011 00:34:28 +0100 (CET)
From: Guennadi Liakhovetski <g.liakhovetski@....de>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: Andrei Warkentin <andreiw@...are.com>,
linux-kernel@...r.kernel.org,
Rolf Eike Beer <eike-kernel@...tec.de>,
opensuse-kernel@...nsuse.org,
Sergiu Iordache <sergiu@...omium.org>,
Marco Stornelli <marco.stornelli@...il.com>,
Eddie Wai <eddie.wai@...adcom.com>,
Jayamohan Kallickal <jayamohan.kallickal@...lex.com>
Subject: Re: [PATCH] include/log2.h: Fix rounddown_pow_of_two(1)
On Thu, 17 Nov 2011, Andrew Morton wrote:
[snip]
> drivers/mmc/host/sh_mmcif.c unnecessarily uses __rounddown_pow_of_two()
> then feeds the result into ilog2() in an apparent attempt to
> reimplement fls().
Yeah, I was wondering too, but wasn't sufficiently motivated to patch
it;-) I'll test this "obvious" patch tomorrow and submit then:
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 <linux/bitops.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
@@ -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
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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