Skip to content

Commit

Permalink
ASoC: loongson: fix compile testing on 32-bit
Browse files Browse the repository at this point in the history
DIV_ROUND_CLOSEST() does not work on 64-bit variables when building for
a 32-bit target:

ld.lld: error: undefined symbol: __udivdi3
>>> referenced by loongson_i2s.c
>>>               sound/soc/loongson/loongson_i2s.o:(loongson_i2s_hw_params) in archive vmlinux.a

Use DIV_ROUND_CLOSEST_ULL() instead.

Fixes: d240286 ("ASoC: loongson: Add Loongson ASoC Sound Card Support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230616090156.2347850-4-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Arnd Bergmann authored and Mark Brown committed Jun 16, 2023
1 parent 08432e5 commit 928314e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/loongson/loongson_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static int loongson_i2s_hw_params(struct snd_pcm_substream *substream,
bclk_ratio = DIV_ROUND_CLOSEST(sysclk,
(bits * chans * fs * 2)) - 1;
mclk_ratio = clk_rate / sysclk;
mclk_ratio_frac = DIV_ROUND_CLOSEST(((u64)clk_rate << 16),
mclk_ratio_frac = DIV_ROUND_CLOSEST_ULL(((u64)clk_rate << 16),
sysclk) - (mclk_ratio << 16);

regmap_read(i2s->regmap, LS_I2S_CFG, &val);
Expand Down

0 comments on commit 928314e

Please sign in to comment.