[PATCH v5 7/8] iio: adc: at91_adc: use HZ_PER_KHZ instead of raw 1000
From: Abdelnasser Hussein
Date: Mon Nov 23 2026 - 02:02:10 EST
Use the HZ_PER_KHZ constant from <linux/units.h> when converting the ADC
clock rate to kilohertz instead of open-coding the divisor.
Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@xxxxxxxxx>
---
drivers/iio/adc/at91_adc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 05e8b3deb043..62f8db630640 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -21,6 +21,7 @@
#include <linux/property.h>
#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/units.h>
#include <linux/wait.h>
#include <linux/iio/iio.h>
@@ -1094,7 +1095,7 @@ static int at91_adc_probe(struct platform_device *pdev)
*/
mstrclk = clk_get_rate(st->clk);
adc_clk = clk_get_rate(st->adc_clk);
- adc_clk_khz = adc_clk / 1000;
+ adc_clk_khz = adc_clk / HZ_PER_KHZ;
dev_dbg(dev, "Master clock is set as: %d Hz, adc_clk should set as: %d Hz\n",
mstrclk, adc_clk);
--
2.56.0