mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-28 04:17:47 +00:00
[media] m88ds3103: fix SNR reporting on 32-bit arch
There was 32-bit calculation overflow. Use div_u64. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
5cb4e2276c
commit
3ae266f80c
@ -879,7 +879,7 @@ static int m88ds3103_read_snr(struct dvb_frontend *fe, u16 *snr)
|
||||
/* SNR(X) dB = 10 * ln(X) / ln(10) dB */
|
||||
tmp = DIV_ROUND_CLOSEST(tmp, 8 * M88DS3103_SNR_ITERATIONS);
|
||||
if (tmp)
|
||||
*snr = 100ul * intlog2(tmp) / intlog2(10);
|
||||
*snr = div_u64((u64) 100 * intlog2(tmp), intlog2(10));
|
||||
else
|
||||
*snr = 0;
|
||||
break;
|
||||
@ -908,7 +908,7 @@ static int m88ds3103_read_snr(struct dvb_frontend *fe, u16 *snr)
|
||||
/* SNR(X) dB = 10 * log10(X) dB */
|
||||
if (signal > noise) {
|
||||
tmp = signal / noise;
|
||||
*snr = 100ul * intlog10(tmp) / (1 << 24);
|
||||
*snr = div_u64((u64) 100 * intlog10(tmp), (1 << 24));
|
||||
} else {
|
||||
*snr = 0;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "dvb_math.h"
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/math64.h>
|
||||
|
||||
#define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw"
|
||||
#define M88DS3103_MCLK_KHZ 96000
|
||||
|
Loading…
Reference in New Issue
Block a user