* [PATCH] ALSA: emu10k1: fix 64-bit integer division
@ 2023-05-17 20:19 Arnd Bergmann
2023-05-17 20:28 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2023-05-17 20:19 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Oswald Buddenhagen
Cc: Arnd Bergmann, alsa-devel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Division of 64-bit values causes a link failure on 32-bit targets, depending
on compiler version and target architecture:
ERROR: modpost: "__divdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined!
ERROR: modpost: "__udivdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined!
Replace these with the safe div_u64() helpers.
Fixes: bb5ceb43b7bf ("ALSA: emu10k1: fix non-zero mixer control defaults in highres mode")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/pci/emu10k1/emufx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index f64b2b4eb348..7c28789720d1 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -1156,7 +1156,7 @@ snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
ctl->max = 0x7fffffff;
ctl->tlv = snd_emu10k1_db_linear;
ctl->translation = EMU10K1_GPR_TRANSLATION_NEGATE;
- defval = defval * 0x80000000LL / 100 - 1;
+ defval = div_u64(defval * 0x80000000LL, 100) - 1;
} else {
ctl->min = 0;
ctl->max = 100;
@@ -1178,7 +1178,7 @@ snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
ctl->max = 0x7fffffff;
ctl->tlv = snd_emu10k1_db_linear;
ctl->translation = EMU10K1_GPR_TRANSLATION_NEGATE;
- defval = defval * 0x80000000LL / 100 - 1;
+ defval = div_u64(defval * 0x80000000LL, 100) - 1;
} else {
ctl->min = 0;
ctl->max = 100;
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: emu10k1: fix 64-bit integer division
2023-05-17 20:19 [PATCH] ALSA: emu10k1: fix 64-bit integer division Arnd Bergmann
@ 2023-05-17 20:28 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2023-05-17 20:28 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jaroslav Kysela, Takashi Iwai, Oswald Buddenhagen, Arnd Bergmann,
alsa-devel, linux-kernel
On Wed, 17 May 2023 22:19:17 +0200,
Arnd Bergmann wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> Division of 64-bit values causes a link failure on 32-bit targets, depending
> on compiler version and target architecture:
>
> ERROR: modpost: "__divdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined!
> ERROR: modpost: "__udivdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined!
>
> Replace these with the safe div_u64() helpers.
>
> Fixes: bb5ceb43b7bf ("ALSA: emu10k1: fix non-zero mixer control defaults in highres mode")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Another fix patch was already submitted and merged:
https://lore.kernel.org/r/20230517164800.3650699-1-oswald.buddenhagen@gmx.de
Let me know if you still hit the issue with that patch.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-17 20:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17 20:19 [PATCH] ALSA: emu10k1: fix 64-bit integer division Arnd Bergmann
2023-05-17 20:28 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox