* [PATCH] mmc: sh_mmcif: simplify clock divisor calculation
[not found] ` <20111117150549.15528e81.akpm@linux-foundation.org>
@ 2011-11-23 14:52 ` Guennadi Liakhovetski
2011-12-01 18:24 ` Chris Ball
0 siblings, 1 reply; 2+ messages in thread
From: Guennadi Liakhovetski @ 2011-11-23 14:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andrei Warkentin, linux-mmc, linux-sh, Chris Ball
Replace ilog2(__rounddown_pow_of_two(x)) with the equivalent but much
simpler fls(x) - 1.
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
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 <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);
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: sh_mmcif: simplify clock divisor calculation
2011-11-23 14:52 ` [PATCH] mmc: sh_mmcif: simplify clock divisor calculation Guennadi Liakhovetski
@ 2011-12-01 18:24 ` Chris Ball
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2011-12-01 18:24 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: Andrew Morton, Andrei Warkentin, linux-mmc, linux-sh
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 <akpm@linux-foundation.org>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> 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 <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, pushed to mmc-next for 3.3.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-01 18:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1321473366-31053-1-git-send-email-andreiw@vmware.com>
[not found] ` <20111117150549.15528e81.akpm@linux-foundation.org>
2011-11-23 14:52 ` [PATCH] mmc: sh_mmcif: simplify clock divisor calculation Guennadi Liakhovetski
2011-12-01 18:24 ` Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).