[PATCH v6 7/8] iio: adc: at91_adc: use HZ_PER_KHZ instead of raw 1000

From: Abdelnasser Hussein

Date: Thu Dec 03 2026 - 12:34:04 EST


Convert adc_clk to kHz with HZ_PER_KHZ instead of the open-coded
divisor in at91_adc_probe().

Reviewed-by: Joshua Crofts <crofts@xxxxxxxxxx>
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 ca998dc91af4..ed3431b17ad8 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -20,6 +20,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>
@@ -1113,7 +1114,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