]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: tegra: tegra210-mixer: Use div_u64() for 64-bit division
authorRosen Penev <rosenp@gmail.com>
Thu, 7 May 2026 23:21:31 +0000 (16:21 -0700)
committerMark Brown <broonie@kernel.org>
Fri, 8 May 2026 00:52:17 +0000 (09:52 +0900)
A MIPS allmodconfig build with LLVM fails during modpost:

  ERROR: modpost: "__udivdi3"
  [sound/soc/tegra/snd-soc-tegra210-mixer.ko] undefined!

tegra210_mixer_configure_gain() divides a 64-bit BIT_ULL() value by the
fade duration. On 32-bit MIPS, clang emits a call to __udivdi3 for that
plain C division, but that compiler helper is not exported to modules.

Use div_u64() for the inverse duration calculation so the driver uses the
kernel's 64-bit division helper instead of emitting a compiler runtime
call.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260507232131.438589-1-rosenp@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/tegra/tegra210_mixer.c

index f05617b5f433567918fe77aacf9b0800f8cd2b0b..bfdd457f740c180d24d2632e5c50624a2f932461 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/io.h>
+#include <linux/math64.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
@@ -157,8 +158,8 @@ static int tegra210_mixer_configure_gain(struct snd_soc_component *cmpnt,
                        if (i == DURATION_N3_ID)
                                val = mixer->duration[id];
                        else if (i == DURATION_INV_N3_ID)
-                               val = (u32)(BIT_ULL(31 + TEGRA210_MIXER_PRESCALAR) /
-                                           mixer->duration[id]);
+                               val = div_u64(BIT_ULL(31 + TEGRA210_MIXER_PRESCALAR),
+                                             mixer->duration[id]);
                        else
                                val = gain_params.duration[i];
                }