Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2713546rwd; Wed, 17 May 2023 13:24:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7moJONyFwHM0tEIjbiN8XmV6NNVrJ5cfE096mZOjWPd3z0UOaK/qJcue/TfsXastalg7km X-Received: by 2002:a05:6a20:3d91:b0:106:11fa:192c with SMTP id s17-20020a056a203d9100b0010611fa192cmr14879992pzi.61.1684355059544; Wed, 17 May 2023 13:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684355059; cv=none; d=google.com; s=arc-20160816; b=h+Nj2MQTzTNzmeolYp8MIsLT96RpcYUw1+/CPyuv3RziOF/+f8BeW7Xo5AYCDmdhBm Rxe+gYtB4M6M6mpzQ5mXM5OYZp5RgAWEklO66lY7Yptl4xRR+FycNiHR9CnUdq73bj3K uYkDin0uUquGHJw5lEn4VtEZsNPkTNd2xIcofL6kpBu7uRUoe7YCgA/pRAKUWcbwSHQu OuFvPf4CkvQaE4UxsbMQr3z/M4y5N+iNnVEKWspEK1xyQppKzcc5IYt3aEYd0dohRRge jNVKY1CQD35WR5b1kQwOOrg16raOCaLmi/nnD7C0CnfyRiHwAoWBIrfLs/OLpVsB0NN8 0wrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=m2bYrHSz9OYq+06JTejbEVjIxSx/kase0PsUaxhgTxs=; b=HaNvo03ugGtaqPRmqiukXDjiE0kI8K1osppflwscStdgGVgJox20prqOf3uOgApU7Y ivgA2wmfymQ8X5P6pTeloq4qvD779/dZx8mGiBkhAl6FKIHAbMKzS9yDRUOkpmH0ddRW D/HA9zyDUfmEcoG/JliZQ0NvSrx7mJ0oLAflcJdhB8pJmczG0VtvLsKLnwmLq9/PyVVI iux5F6H8du4rNoB21+GCRQKCSoTulxpMz00HcwLntC/IVnJPlcn3m3I5g4W80A5nh4S/ S+X6FzXyJWVSaqJzqzopYQX1Qs+CfGP4xsePwSF6YM8R1m1oIkYyVR9LlZQaSwpaC2nN FowQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o8RfhU1X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gc23-20020a17090b311700b0024e12dc1e4csi2478855pjb.86.2023.05.17.13.24.05; Wed, 17 May 2023 13:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o8RfhU1X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbjEQUTa (ORCPT + 99 others); Wed, 17 May 2023 16:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjEQUT2 (ORCPT ); Wed, 17 May 2023 16:19:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 251EE1FE1 for ; Wed, 17 May 2023 13:19:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE7AA63660 for ; Wed, 17 May 2023 20:19:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DBD5C433EF; Wed, 17 May 2023 20:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684354767; bh=EdzQf92843zcKgv2AnlrdWB7ybXMParLomwvT5wdvTA=; h=From:To:Cc:Subject:Date:From; b=o8RfhU1XwiM4CAiJ0QFug+9ik8R3KZGACA7Wx+uHhMfN39xRyRlqwpjJi89DpSwpO VX9j9xoaXhc8yH4Tada7xU5tVfoD6FtPrzaKg44wuGA72Ftmz8HAJF7kD1D7UtS3oq raUJ2XTY0FtrhQwZUZm/xjPd8d8vi51p6CR7vtNT13opOO3lfc2yB37eJf7G80dwoc T93AJN1xJ1C/5Wu/84SnDlo3xNJUTudwXC4W7bD0AOzY25baHIR0EGkvN79pqLFcgJ SBY3OlQJG8emBV+bP9lIYbruMSq340tWyWv7kkvLBo2aLO4xzX915+HY241YC4RzSQ 7GJ4EeTkIgcOg== From: Arnd Bergmann To: Jaroslav Kysela , Takashi Iwai , Oswald Buddenhagen Cc: Arnd Bergmann , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ALSA: emu10k1: fix 64-bit integer division Date: Wed, 17 May 2023 22:19:17 +0200 Message-Id: <20230517201920.592909-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann 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 --- 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