From patchwork Wed May 17 20:19:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 95538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp36199vqo; Wed, 17 May 2023 13:32:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7upNZODWmG1ij2IUA1CDjP5goYmpEiMQ9ORK3c61FD7oU4qGB8P46trHJ8qO/AKcuCa1iA X-Received: by 2002:a17:902:7294:b0:1ac:9ab5:9d77 with SMTP id d20-20020a170902729400b001ac9ab59d77mr121173pll.12.1684355536639; Wed, 17 May 2023 13:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684355536; cv=none; d=google.com; s=arc-20160816; b=oF7/2ZHqf/4pguI2eagI0xgJSgZVIQbSeY9h17R7MgHO8+dB7KZaIB2BuKYxJEMs1e BsWPd+gN3AyRAhlYi45qtjRWt+BC7TsG0inA6Lq8MK9HZLEWLK4KdtM6uBbGIS3nmLLP OtZaSTULv2+Cx7Q1xBS4j14SD24Un8wGRm5gXxAVLfKz3lxu44dilUu4NW99gyiM7jRM eo5ibmkd6hUzcqOn8vS1kLKm3MCZMkAg3pdjXMg2vFiqxAz4PXNJAguukwDWLEIEObE+ lYLZM2UoQUyao3Ej1uyRxjWY8+65wMobZBLlC56+ayFsW/QlqV/wjic+xz2W7DJjwgn9 wySw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a17090282ca00b001ac94b7f2f0si20447682plz.523.2023.05.17.13.32.03; Wed, 17 May 2023 13:32:16 -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 S229630AbjEQUTa (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766174791431056781?= X-GMAIL-MSGID: =?utf-8?q?1766174791431056781?= 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;