From nobody Fri Apr 3 06:35:48 2026 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C196A30F950 for ; Wed, 18 Feb 2026 12:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771419222; cv=none; b=agmhTNZcxbUhU1/3WdxhADm9UiGug1w+Svd+iD8ewoolAyL9wxfego7xed8ZE/4XpIx2DFjSUkakLggUbavGubgIeM3skowBs/qQGlJZXU/zTXjwoYlZ5QFDM1bXnhuKz6vIYQ93GnzsaFLyUVC06dvetJoKOXTMyLb2onkciZg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771419222; c=relaxed/simple; bh=veU5TcgEYyCy1wNNBap2rC6OOe0JEAczI/QDmzajykI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ToFcnLXCwMdwIF/lhTp2gMt17RbWLo+rj4OpJm6U6FAw5K5CYLhAcRVqnr4u+3TafGpNd4FilIX2njQtbkOcPQZoGwltuut0nCn1b5QIaB/K+tbl9RwMUtPeOnlj10jqE44AvVyqC+EWkTnlt+5F9czPzqot0ky18ohH5aEDGlE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DW2H9+ui; arc=none smtp.client-ip=209.85.215.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DW2H9+ui" Received: by mail-pg1-f193.google.com with SMTP id 41be03b00d2f7-c636487ccaeso1976640a12.1 for ; Wed, 18 Feb 2026 04:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771419221; x=1772024021; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kFam5Du7VImRJOMy7ZXZVGOriiUs2AeEepbg/77PsKc=; b=DW2H9+uinHLgwz5AIftml5WRo4elum0spqUortKDtrv9Mrjr7j0OgJrvsMKDq5aYhH gAJvET0GC5UatJRfmsu59yXiVvM7+NCLbozpZw4von4Ig2gNIlC5wG9AT/0YbbzJDsH4 xriPWyzb3w7Z4mwfcq0LEmHLABrUw4Nxck3kGULgBmak/DOAGkr583UQ1JAYjM5xlAwj o5pMd5aeZM17bNDB5HtlKzM1t2RgvzxxvWPYWYWEkXL6uaSD95QA1OYCmIs5T68sydBE pkrmMhAo2qpztEsmf9cwOCviXdpHoaB3e3J+OxxBuUrZcl7svwYnZAWQq926w12L2HWJ SSsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771419221; x=1772024021; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kFam5Du7VImRJOMy7ZXZVGOriiUs2AeEepbg/77PsKc=; b=wo65x0c9rkaCM4twm1lIMWUepLwdhDHl4S1JoYqsBZM7KAvrJ1iMKfUtMqR/LmCSv9 Qkqe2gQflBZgLvXjwEdNubfzDJrpsFfi/d17hj1c4jjjzSWrTW9f7gdf6CKARiyivlfl jfmA2i2grhj0czm3fgkaFLTTxQsAqPjzEldbHrYFuTZcbhVi6ClognIPYRwoHpKbWqIk hMxXqCjwa1M3nabxxFjlEtgSLzbENTcFqBJMCqBsZjxyhrNVTPfROuP4Asy92L64ria/ 5C8fbDyndF4BgNrrZK6qPbE6L+wMYWTKT4KuUmLCZKOAcVVpywiNRDEmwAtLfWqbF9/y jiRA== X-Forwarded-Encrypted: i=1; AJvYcCWmBKvmormWgkVYkSObTL88CJQ+RKJNkJS571XJ4u83kY+8MJfRQSYTAuOSd6x9L/rWdcFJng11rsJAiKM=@vger.kernel.org X-Gm-Message-State: AOJu0YzgehqZRH2HObo+tepNrY5CR2XI1xRsIjJkFxy5IIRiJYLdvQTP 3/x7S5ChH6C14ccFbnYdV/LzVqOQmWCVJprUgVaBDjRvpgq11qKoXxYP X-Gm-Gg: AZuq6aJWFls9UvvCGZSsBMmGmUgpg2dWtt5tNbphWAVDPMhm4TsRS21dwuLKGypkprO E8Do0xBsLNvMs+touQJge25Jp85jcPkB/UjMG80MNcn8SCKDqL8dnmidTJpFaSW82gvQyWDIxeN kWzztmDsVIrml16G56uber4zKTtif50QocOH0hFAz6fpUeM2XWrZkAtZaoEaMN+yvPOE2CIASSb EcPOV0vss6wE3dyMkMc35Fzbau019GRrcz/Za9yOkU/yebKnBRSRIrHWqhFcu1PDwCaMzezZQi4 Df8TPWP17eTbq/LnB1s5fRhRDjUynAgnvwU359QeMAawEmRFhk48PNxuVLsaVOT6qDM6FrBWXSx JBtfEgZ9Tu0dzCa1c7o33Qhg1ItYZppaGOV7JDh+KwNdPKOkIdnivThhjhxAPJVoWveEWeQEQX8 eODIdkJfU9LCKtk6h6OfQ7YbREdIKbXxLkOmMUUj5H X-Received: by 2002:a17:902:ce06:b0:2aa:d630:cd5d with SMTP id d9443c01a7336-2ad50f742d4mr17178385ad.44.1771419221059; Wed, 18 Feb 2026 04:53:41 -0800 (PST) Received: from debian.ari ([152.58.183.81]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ad1a73c6easm179460295ad.39.2026.02.18.04.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Feb 2026 04:53:40 -0800 (PST) From: Archit Anant 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 Subject: [PATCH v2] staging: iio: impedance-analyzer: ad5933: use div64_ul() instead of do_div() Date: Wed, 18 Feb 2026 18:23:27 +0530 Message-Id: <20260218125327.21467-1-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Also replace explicit casting and shifting with the BIT_ULL(27) macro for clarity. Note: A mathematical simplification to `(freq * BIT_ULL(29)) / mclk` was suggested during review to improve precision. However, as confirmed by maintainers, the original driver's truncation via `(mclk / 4)` might be intentional or relied upon by userspace. Since hardware is not available for verification, this patch preserves the original logic to avoid regression risk in the absence of testing. Issue identified by coccicheck using do_div.cocci. Changes in v2: - Replaced explicit `(u64)(1 << 27)` with `BIT_ULL(27)` as suggested by And= y Shevchenko. - Kept original arithmetic logic `(mclk / 4)` to preserve behavior. Signed-off-by: Archit Anant Reviewed-by: Andy Shevchenko --- 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/stag= ing/iio/impedance-analyzer/ad5933.c index 85a4223295cd..f6d3d98b6c6a 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -5,6 +5,7 @@ * Copyright 2011 Analog Devices Inc. */ =20 +#include #include #include #include @@ -194,8 +195,7 @@ static int ad5933_set_freq(struct ad5933_state *st, u8 d8[4]; } dat; =20 - freqreg =3D (u64)freq * (u64)(1 << 27); - do_div(freqreg, st->mclk_hz / 4); + freqreg =3D div64_ul(BIT_ULL(27) * freq, st->mclk_hz / 4); =20 switch (reg) { case AD5933_REG_FREQ_START: --=20 2.39.5