Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf6c7732 authored by Eva Rachel Retuya's avatar Eva Rachel Retuya Committed by Jonathan Cameron
Browse files

staging: iio: tsl2x7x_core: Fix standard deviation calculation



Standard deviation is calculated as the square root of the variance
where variance is the mean of sample_sum and length. Correct the
computation of statP->stddev in accordance to the proper calculation.

Fixes: 3c97c08b ("staging: iio: add TAOS tsl2x7x driver")
Reported-by: default avatarAbhiram Balasubramanian <abhiram@cs.utah.edu>
Signed-off-by: default avatarEva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent d7ed89d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -854,7 +854,7 @@ void tsl2x7x_prox_calculate(int *data, int length,
		tmp = data[i] - statP->mean;
		sample_sum += tmp * tmp;
	}
	statP->stddev = int_sqrt((long)sample_sum) / length;
	statP->stddev = int_sqrt((long)sample_sum / length);
}

/**