From f9ec176cd684c83a60638123da0b34c7c82f0c74 Mon Sep 17 00:00:00 2001 From: Sameer Pujar Date: Thu, 23 Jul 2020 13:43:31 +0530 Subject: [PATCH] ASoC: tegra: Fix build error due to 64-by-32 division Build errors are seen on 32-bit platforms because of a plain 64-by-32 division. For example, following build erros were reported. "ERROR: modpost: "__udivdi3" [sound/soc/tegra/snd-soc-tegra210-dmic.ko] undefined!" "ERROR: modpost: "__divdi3" [sound/soc/tegra/snd-soc-tegra210-dmic.ko] undefined!" This can be fixed by using div_u64() helper from 'math64.h' header. Fixes: 8c8ff982e9e2 ("ASoC: tegra: Add Tegra210 based DMIC driver") Reported-by: Geert Uytterhoeven Reported-by: Randy Dunlap Signed-off-by: Sameer Pujar Link: https://lore.kernel.org/r/1595492011-2411-1-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown --- sound/soc/tegra/tegra210_dmic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c index ff6fd652a9a2..d682414ad90d 100644 --- a/sound/soc/tegra/tegra210_dmic.c +++ b/sound/soc/tegra/tegra210_dmic.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -129,7 +130,7 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream, * Boost Gain Volume control has 100x factor. */ if (dmic->boost_gain) - gain_q23 = (gain_q23 * dmic->boost_gain) / 100; + gain_q23 = div_u64(gain_q23 * dmic->boost_gain, 100); regmap_write(dmic->regmap, TEGRA210_DMIC_LP_FILTER_GAIN, (unsigned int)gain_q23);