public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: impedance-analyzer: ad5933: use div64_ul() instead of do_div()
@ 2026-01-22 14:56 Archit Anant
  2026-01-22 15:12 ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Archit Anant @ 2026-01-22 14:56 UTC (permalink / raw)
  To: jic23, lars, Michael.Hennerich
  Cc: gregkh, dlechner, nuno.sa, andy, linux-iio, linux-staging,
	linux-kernel, Archit Anant

Replace do_div() with div64_ul() since the remainder is not used.
div64_ul() is the preferred API for 64-bit by 32-bit division when
only the quotient is needed, as it returns the result directly rather
than modifying the dividend in-place.

Issue identified by coccicheck using do_div.cocci.

Signed-off-by: Archit Anant <architanant5@gmail.com>
---
 drivers/staging/iio/impedance-analyzer/ad5933.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 85a4223295cd..772267f6f093 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -194,8 +194,8 @@ static int ad5933_set_freq(struct ad5933_state *st,
 		u8 d8[4];
 	} dat;
 
-	freqreg = (u64)freq * (u64)(1 << 27);
-	do_div(freqreg, st->mclk_hz / 4);
+	freqreg = div64_ul((u64)freq * (u64)(1 << 27),
+			   st->mclk_hz / 4);
 
 	switch (reg) {
 	case AD5933_REG_FREQ_START:
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-02-18 18:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 14:56 [PATCH] staging: iio: impedance-analyzer: ad5933: use div64_ul() instead of do_div() Archit Anant
2026-01-22 15:12 ` Andy Shevchenko
2026-01-22 15:15   ` Andy Shevchenko
     [not found]     ` <CADJHxWB3b+bH2+HBP+SG0jxhGNcozstBeWeDH_3dgS-4c2G-6g@mail.gmail.com>
2026-01-22 18:03       ` Andy Shevchenko
2026-02-16 15:52         ` Archit Anant
2026-02-16 19:02           ` David Lechner
2026-02-16 19:04             ` David Lechner
2026-02-17 16:46               ` Archit Anant
2026-02-18 18:19                 ` Jonathan Cameron
2026-02-18 18:36                   ` Archit Anant
2026-02-17  8:29           ` Andy Shevchenko
2026-02-17 16:31             ` Archit Anant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox