Skip to content

Commit

Permalink
[media] tda10071: use div_s64() when dividing a s64 integer
Browse files Browse the repository at this point in the history
Otherwise, it will break on 32 bits archs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
  • Loading branch information
Mauro Carvalho Chehab committed Aug 11, 2015
1 parent 53cc7c9 commit 7d0ddc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/dvb-frontends/tda10071.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static int tda10071_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
unsigned int uitmp;

if (c->strength.stat[0].scale == FE_SCALE_DECIBEL) {
uitmp = c->strength.stat[0].svalue / 1000 + 256;
uitmp = div_s64(c->strength.stat[0].svalue, 1000) + 256;
uitmp = clamp(uitmp, 181U, 236U); /* -75dBm - -20dBm */
/* scale value to 0x0000-0xffff */
*strength = (uitmp-181) * 0xffff / (236-181);
Expand Down

0 comments on commit 7d0ddc9

Please sign in to comment.