[PATCH v2 6/6] iio: proximity: hx9023s: use plain division in get_samp_freq

From: Arnav Kapoor

Date: Thu Nov 26 2026 - 16:38:50 EST


hx9023s_get_samp_freq() computes the fractional part of the sampling
frequency with div_u64(), but nothing here needs 64 bits: KILO % odr
is at most 1000, so the dividend is at most 10^9 and fits in an
unsigned long on 32-bit as well. Use a plain division, and drop the
linux/math64.h include, which has no other user left after the
previous patches.

No functional change.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: Arnav Kapoor <kapoorarnav43@xxxxxxxxx>
---
drivers/iio/proximity/hx9023s.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index c2718723db27..98b65a3e69e1 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -18,7 +18,6 @@
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
-#include <linux/math64.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm.h>
@@ -702,7 +701,7 @@ static int hx9023s_get_samp_freq(struct hx9023s_data *data, int *val, int *val2)

odr = hx9023s_samp_freq_table[index];
*val = KILO / odr;
- *val2 = div_u64((KILO % odr) * MICRO, odr);
+ *val2 = (KILO % odr) * MICRO / odr;

return IIO_VAL_INT_PLUS_MICRO;
}
--
2.53.0