All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Yingkun Meng <mengyingkun@loongson.cn>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] ASoC: loongson: fix compile testing on 32-bit
Date: Fri, 16 Jun 2023 11:00:40 +0200	[thread overview]
Message-ID: <20230616090156.2347850-4-arnd@kernel.org> (raw)
In-Reply-To: <20230616090156.2347850-1-arnd@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

DIV_ROUND_CLOSEST() does not work on 64-bit variables when building for
a 32-bit target:

ld.lld: error: undefined symbol: __udivdi3
>>> referenced by loongson_i2s.c
>>>               sound/soc/loongson/loongson_i2s.o:(loongson_i2s_hw_params) in archive vmlinux.a

Use DIV_ROUND_CLOSEST_ULL() instead.

Fixes: d24028606e764 ("ASoC: loongson: Add Loongson ASoC Sound Card Support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/loongson/loongson_i2s.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/loongson/loongson_i2s.c b/sound/soc/loongson/loongson_i2s.c
index f73b6d6f16c23..b919f0fe83615 100644
--- a/sound/soc/loongson/loongson_i2s.c
+++ b/sound/soc/loongson/loongson_i2s.c
@@ -89,7 +89,7 @@ static int loongson_i2s_hw_params(struct snd_pcm_substream *substream,
 		bclk_ratio = DIV_ROUND_CLOSEST(sysclk,
 					       (bits * chans * fs * 2)) - 1;
 		mclk_ratio = clk_rate / sysclk;
-		mclk_ratio_frac = DIV_ROUND_CLOSEST(((u64)clk_rate << 16),
+		mclk_ratio_frac = DIV_ROUND_CLOSEST_ULL(((u64)clk_rate << 16),
 						    sysclk) - (mclk_ratio << 16);
 
 		regmap_read(i2s->regmap, LS_I2S_CFG, &val);
-- 
2.39.2


  parent reply	other threads:[~2023-06-16  9:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  9:00 [PATCH 1/4] ASoC: max98388: fix unused function warnings Arnd Bergmann
2023-06-16  9:00 ` [PATCH 2/4] ASoC: loongson: fix unused PM function warning Arnd Bergmann
2023-06-17  4:08   ` Randy Dunlap
2023-06-16  9:00 ` [PATCH 3/4] ASoC: loongson: add PCI dependency Arnd Bergmann
2023-06-17  4:21   ` Randy Dunlap
2023-06-16  9:00 ` Arnd Bergmann [this message]
2023-06-17  4:06   ` [PATCH 4/4] ASoC: loongson: fix compile testing on 32-bit Randy Dunlap
2023-06-16 13:33 ` [PATCH 1/4] ASoC: max98388: fix unused function warnings Mark Brown
2023-06-17  4:10 ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230616090156.2347850-4-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mengyingkun@loongson.cn \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.