public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Archit Anant <architanant5@gmail.com>
To: jic23@kernel.org, lars@metafoo.de, Michael.Hennerich@analog.com
Cc: gregkh@linuxfoundation.org, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Archit Anant <architanant5@gmail.com>
Subject: [PATCH] staging: iio: impedance-analyzer: ad5933: use div64_ul() instead of do_div()
Date: Thu, 22 Jan 2026 20:26:33 +0530	[thread overview]
Message-ID: <20260122145633.14938-1-architanant5@gmail.com> (raw)

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


             reply	other threads:[~2026-01-22 14:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 14:56 Archit Anant [this message]
2026-01-22 15:12 ` [PATCH] staging: iio: impedance-analyzer: ad5933: use div64_ul() instead of do_div() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260122145633.14938-1-architanant5@gmail.com \
    --to=architanant5@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox