[PATCH 2/3] [media] tda10071: use div_s64() when dividing a s64 integer

2015-08-11 Thread Mauro Carvalho Chehab
Otherwise, it will break on 32 bits archs.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/tda10071.c 
b/drivers/media/dvb-frontends/tda10071.c
index ee6653124618..119d47596ac8 100644
--- a/drivers/media/dvb-frontends/tda10071.c
+++ b/drivers/media/dvb-frontends/tda10071.c
@@ -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 0x-0x */
*strength = (uitmp-181) * 0x / (236-181);
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] [media] tda10071: use div_s64() when dividing a s64 integer

2015-08-11 Thread Antti Palosaari

On 08/12/2015 01:39 AM, Mauro Carvalho Chehab wrote:

Otherwise, it will break on 32 bits archs.


Look good!

Antti



Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/tda10071.c 
b/drivers/media/dvb-frontends/tda10071.c
index ee6653124618..119d47596ac8 100644
--- a/drivers/media/dvb-frontends/tda10071.c
+++ b/drivers/media/dvb-frontends/tda10071.c
@@ -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 0x-0x */
*strength = (uitmp-181) * 0x / (236-181);



--
http://palosaari.fi/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html