Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] [v2] ASoC: sophgo: fix 64-bit division build failure
@ 2026-02-02 21:59 Arnd Bergmann
  2026-02-02 22:04 ` Alexander Sverdlin
  2026-02-03 10:59 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-02-02 21:59 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Chen Wang, Inochi Amaoto, Anton D. Stavinskii
  Cc: Arnd Bergmann, Alexander Sverdlin, linux-sound, sophgo,
	linux-kernel

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!

As the input value is actually a 32-bit integer, just change the type
of the temporary value as well.

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

diff --git a/sound/soc/sophgo/cv1800b-sound-adc.c b/sound/soc/sophgo/cv1800b-sound-adc.c
index 794030b713e9..de1c77014c2f 100644
--- a/sound/soc/sophgo/cv1800b-sound-adc.c
+++ b/sound/soc/sophgo/cv1800b-sound-adc.c
@@ -100,7 +100,7 @@ static int cv1800b_adc_setbclk_div(struct cv1800b_priv *priv, unsigned int rate)
 {
 	u32 val;
 	u32 bclk_div;
-	u64 tmp;
+	u32 tmp;
 
 	if (!priv->mclk_rate || !rate)
 		return -EINVAL;
@@ -117,7 +117,7 @@ static int cv1800b_adc_setbclk_div(struct cv1800b_priv *priv, unsigned int rate)
 	}
 
 	if (tmp > 256) {
-		dev_err(priv->dev, "BCLK divider %llu out of range\n", tmp);
+		dev_err(priv->dev, "BCLK divider %u out of range\n", tmp);
 		return -EINVAL;
 	}
 
-- 
2.39.5


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

* Re: [PATCH] [v2] ASoC: sophgo: fix 64-bit division build failure
  2026-02-02 21:59 [PATCH] [v2] ASoC: sophgo: fix 64-bit division build failure Arnd Bergmann
@ 2026-02-02 22:04 ` Alexander Sverdlin
  2026-02-03 10:59 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Sverdlin @ 2026-02-02 22:04 UTC (permalink / raw)
  To: Arnd Bergmann, Chen Wang, Inochi Amaoto, Anton D. Stavinskii
  Cc: Arnd Bergmann, linux-sound, sophgo, linux-kernel

On Mon, 2026-02-02 at 22:59 +0100, Arnd Bergmann wrote:
> 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!
> 
> As the input value is actually a 32-bit integer, just change the type
> of the temporary value as well.
> 
> Fixes: 4cf8752a03e6 ("ASoC: sophgo: add CV1800B internal ADC codec driver")
> Suggested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

> ---
>  sound/soc/sophgo/cv1800b-sound-adc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/sophgo/cv1800b-sound-adc.c b/sound/soc/sophgo/cv1800b-sound-adc.c
> index 794030b713e9..de1c77014c2f 100644
> --- a/sound/soc/sophgo/cv1800b-sound-adc.c
> +++ b/sound/soc/sophgo/cv1800b-sound-adc.c
> @@ -100,7 +100,7 @@ static int cv1800b_adc_setbclk_div(struct cv1800b_priv *priv, unsigned int rate)
>  {
>  	u32 val;
>  	u32 bclk_div;
> -	u64 tmp;
> +	u32 tmp;
>  
>  	if (!priv->mclk_rate || !rate)
>  		return -EINVAL;
> @@ -117,7 +117,7 @@ static int cv1800b_adc_setbclk_div(struct cv1800b_priv *priv, unsigned int rate)
>  	}
>  
>  	if (tmp > 256) {
> -		dev_err(priv->dev, "BCLK divider %llu out of range\n", tmp);
> +		dev_err(priv->dev, "BCLK divider %u out of range\n", tmp);
>  		return -EINVAL;
>  	}
>  

-- 
Alexander Sverdlin.

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

* Re: [PATCH] [v2] ASoC: sophgo: fix 64-bit division build failure
  2026-02-02 21:59 [PATCH] [v2] ASoC: sophgo: fix 64-bit division build failure Arnd Bergmann
  2026-02-02 22:04 ` Alexander Sverdlin
@ 2026-02-03 10:59 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-02-03 10:59 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen Wang,
	Inochi Amaoto, Anton D. Stavinskii, Arnd Bergmann,
	Alexander Sverdlin, linux-sound, sophgo, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

On Mon, Feb 02, 2026 at 10:59:44PM +0100, Arnd Bergmann wrote:
> 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:

I already applied v1, please send an incremental change with whatever's
different (you didn't have a changelog...).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2026-02-03 10:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02 21:59 [PATCH] [v2] ASoC: sophgo: fix 64-bit division build failure Arnd Bergmann
2026-02-02 22:04 ` Alexander Sverdlin
2026-02-03 10:59 ` Mark Brown

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