All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Chen Wang <unicorn_wang@outlook.com>,
	Inochi Amaoto <inochiama@gmail.com>,
	"Anton D. Stavinskii" <stavinsky@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-sound@vger.kernel.org, sophgo@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: sophgo: fix 64-bit division build failure
Date: Mon,  2 Feb 2026 10:53:14 +0100	[thread overview]
Message-ID: <20260202095323.1233553-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

cv1800b_adc_setbclk_div() does four 64-bit divisions in a row, which
is rather inefficient on 32-bit systems, and using the plain division
causes a build failure as a result:

ERROR: modpost: "__aeabi_uldivmod" [sound/soc/sophgo/cv1800b-sound-adc.ko] undefined!

Consolidate those into a single division using the div_u64() macro.

Fixes: 4cf8752a03e6 ("ASoC: sophgo: add CV1800B internal ADC codec driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/sophgo/cv1800b-sound-adc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sophgo/cv1800b-sound-adc.c b/sound/soc/sophgo/cv1800b-sound-adc.c
index 794030b713e9..b66761156b99 100644
--- a/sound/soc/sophgo/cv1800b-sound-adc.c
+++ b/sound/soc/sophgo/cv1800b-sound-adc.c
@@ -105,11 +105,8 @@ static int cv1800b_adc_setbclk_div(struct cv1800b_priv *priv, unsigned int rate)
 	if (!priv->mclk_rate || !rate)
 		return -EINVAL;
 
-	tmp = priv->mclk_rate;
-	tmp /= CV1800B_RXADC_WORD_LEN;
-	tmp /= CV1800B_RXADC_CHANNELS;
-	tmp /= rate;
-	tmp /= 2;
+	tmp = div_u64(priv->mclk_rate, CV1800B_RXADC_WORD_LEN *
+		      CV1800B_RXADC_CHANNELS * rate * 2);
 
 	if (!tmp) {
 		dev_err(priv->dev, "computed BCLK divider is zero\n");
-- 
2.39.5


             reply	other threads:[~2026-02-02  9:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02  9:53 Arnd Bergmann [this message]
2026-02-02 21:31 ` [PATCH] ASoC: sophgo: fix 64-bit division build failure Alexander Sverdlin
2026-02-02 22:00   ` Arnd Bergmann
2026-02-02 22:48 ` Mark Brown
2026-02-03  0:11   ` Chen Wang

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=20260202095323.1233553-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=inochiama@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=sophgo@lists.linux.dev \
    --cc=stavinsky@gmail.com \
    --cc=tiwai@suse.com \
    --cc=unicorn_wang@outlook.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.