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

From: Fabian Frederick
Date: Tue May 20 2014 - 12:32:31 EST



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

diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c
index effb87f..d40dcd5 100644
--- a/drivers/media/dvb-frontends/dib7000p.c
+++ b/drivers/media/dvb-frontends/dib7000p.c
@@ -1783,7 +1783,7 @@ static const s32 lut_1000ln_mant[] = {
static s32 dib7000p_get_adc_power(struct dvb_frontend *fe)
{
struct dib7000p_state *state = fe->demodulator_priv;
- u32 tmp_val = 0, exp = 0, mant = 0;
+ u32 exp = 0, mant = 0;
s32 pow_i;
u16 buf[2];
u8 ix = 0;
@@ -1793,10 +1793,7 @@ static s32 dib7000p_get_adc_power(struct dvb_frontend *fe)
pow_i = (buf[0] << 16) | buf[1];
dprintk("raw pow_i = %d", pow_i);

- tmp_val = pow_i;
- while (tmp_val >>= 1)
- exp++;
-
+ exp = ilog2(pow_i);
mant = (pow_i * 1000 / (1 << exp));
dprintk(" mant = %d exp = %d", mant / 1000, exp);

--
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/