summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-09-03 20:48:02 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2022-09-03 20:48:02 -0400
commit92d5fd956cd8e11733991d252a2827e6a8b3e9c1 (patch)
tree9daeaeeba220ec8ad1e2888e4ab39462808b7ccd
parentc9addd8e9b65bdc685b31454e8b0b675649ad52e (diff)
fixup! lib: add mean and variance module.mean_and_variance_fixups
-rw-r--r--include/linux/mean_and_variance.h2
-rw-r--r--lib/math/Kconfig5
-rw-r--r--lib/math/mean_and_variance.c2
-rw-r--r--lib/math/mean_and_variance_test.c4
4 files changed, 5 insertions, 8 deletions
diff --git a/include/linux/mean_and_variance.h b/include/linux/mean_and_variance.h
index 280a16dea789..f3ca705cfe3a 100644
--- a/include/linux/mean_and_variance.h
+++ b/include/linux/mean_and_variance.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef STATS_H_
#define STATS_H_
diff --git a/lib/math/Kconfig b/lib/math/Kconfig
index 33aa9afc1ce8..12fe28622e82 100644
--- a/lib/math/Kconfig
+++ b/lib/math/Kconfig
@@ -17,10 +17,7 @@ config RATIONAL
tristate
config MEAN_AND_VARIANCE
- tristate "fast incremental integer mean and vairance module"
- help
- This option provides functions for calculating mean and standard
- deviation incrementally, standard and expotentially weighted variants"
+ tristate
config MEAN_AND_VARIANCE_UNIT_TEST
tristate "mean_and_variance unit tests" if !KUNIT_ALL_TESTS
diff --git a/lib/math/mean_and_variance.c b/lib/math/mean_and_variance.c
index 08c1b3c74198..a54bbc636582 100644
--- a/lib/math/mean_and_variance.c
+++ b/lib/math/mean_and_variance.c
@@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(mean_and_variance_update);
*/
inline s64 get_mean(struct mean_and_variance s)
{
- return s.sum / s.n;
+ return div64_u64(s.sum, s.n);
}
EXPORT_SYMBOL_GPL(get_mean);
diff --git a/lib/math/mean_and_variance_test.c b/lib/math/mean_and_variance_test.c
index ec32dad2246f..10b2f6b2be65 100644
--- a/lib/math/mean_and_variance_test.c
+++ b/lib/math/mean_and_variance_test.c
@@ -65,8 +65,8 @@ static void stats_basic_test(struct kunit *test)
}
/*
-** Test values computed using a spreadsheet from the psuedocode at the bottom:
-** https://fanf2.user.srcf.net/hermes/doc/antiforgery/stats.pdf
+ * Test values computed using a spreadsheet from the psuedocode at the bottom:
+ * https://fanf2.user.srcf.net/hermes/doc/antiforgery/stats.pdf
*/
static void stats_ewm_test(struct kunit *test)