[PATCH 1/1] drivers/media/dvb-frontends/dib8000.c: replace shift loop by ilog2

From: Fabian Frederick
Date: Tue May 20 2014 - 12:33:58 EST



Cc: Mauro Carvalho Chehab <m.chehab@xxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
drivers/media/dvb-frontends/dib8000.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c
index 1632d78..8625634 100644
--- a/drivers/media/dvb-frontends/dib8000.c
+++ b/drivers/media/dvb-frontends/dib8000.c
@@ -1922,14 +1922,12 @@ static const s32 lut_1000ln_mant[] =
s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode)
{
struct dib8000_state *state = fe->demodulator_priv;
- u32 ix = 0, tmp_val = 0, exp = 0, mant = 0;
+ u32 ix = 0, exp = 0, mant = 0;
s32 val;

val = dib8000_read32(state, 384);
if (mode) {
- tmp_val = val;
- while (tmp_val >>= 1)
- exp++;
+ exp = ilog2(val);
mant = (val * 1000 / (1<<exp));
ix = (u8)((mant-1000)/100); /* index of the LUT */
val = (lut_1000ln_mant[ix] + 693*(exp-20) - 6908);
--
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/