Skip to contentSkip to conversation

ASoC: sophgo: fix 64-bit division build failure

PATCH In review Arnd Bergmann 3 participants 3 messages Feb 2 – Feb 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: sophgo: fix 64-bit division build failure

From: Arnd Bergmann <[email protected]>

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")
---
 sound/soc/sophgo/cv1800b-sound-adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sophgo/cv1800b-sound-adc.c +2 -2
index 794030b713e9..de1c77014c2f 100644
@@ -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;
 	}
 
Signature · 1 line
2.39.5
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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:

Quoted 8 lines

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")
Quoted 26 lines

---
 sound/soc/sophgo/cv1800b-sound-adc.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sophgo/cv1800b-sound-adc.c +1 -1
index 794030b713e9..de1c77014c2f 100644
@@ -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;

sound/soc/sophgo/cv1800b-sound-adc.c +0 -0
@@ -117,7 +117,7 @@ static int cv1800b_adc_setbclk_div(struct cv1800b_priv *priv, unsigned int rate)
  	}


  if (tmp > 256) {

sound/soc/sophgo/cv1800b-sound-adc.c +1 -1
-		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;
  }

Signature · 1 line
Alexander Sverdlin.
maintainer
#2 lore raw
In reply to Arnd Bergmann
Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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...).