From: Guennadi Liakhovetski Date: Wed, 23 Nov 2011 14:52:30 +0000 (+0100) Subject: mmc: sh_mmcif: simplify clock divisor calculation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=86df174585de79a460e3515ec413ea1f5a0bcf68;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git mmc: sh_mmcif: simplify clock divisor calculation 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 Signed-off-by: Chris Ball --- diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index d5505f3fe2a1..2ec23b0053b6 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -16,6 +16,7 @@ * */ +#include #include #include #include @@ -399,7 +400,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); }