]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: sophgo: fix 64-bit division build failure
authorArnd Bergmann <arnd@arndb.de>
Mon, 2 Feb 2026 09:53:14 +0000 (10:53 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 2 Feb 2026 12:09:35 +0000 (12:09 +0000)
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>
Link: https://patch.msgid.link/20260202095323.1233553-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sophgo/cv1800b-sound-adc.c

index 794030b713e999dd851390ea98b2c04bb2687cb6..b66761156b9934f491021a0761a868a783559971 100644 (file)
@@ -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");