All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: nau8810: use 64-bit arithmetic instead of 32-bit
@ 2019-03-13  6:47 John Hsu
  2019-03-22  4:25 ` [PATCH] ASoC: nau8810: fix the issue of 64 bits division John Hsu
  0 siblings, 1 reply; 3+ messages in thread
From: John Hsu @ 2019-03-13  6:47 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, WTLI, John Hsu, lgirdwood, YHCHuang, CTLIN0

Add suffix ULL to constant 256 in order to give the compiler complete
information about the proper arithmetic to use.

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
---
 sound/soc/codecs/nau8810.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/nau8810.c b/sound/soc/codecs/nau8810.c
index bfd74b86c9d2..e7fd0b2645ea 100644
--- a/sound/soc/codecs/nau8810.c
+++ b/sound/soc/codecs/nau8810.c
@@ -505,7 +505,7 @@ static int nau88l0_calc_pll(unsigned int pll_in,
 	f2_max = 0;
 	scal_sel = ARRAY_SIZE(nau8810_mclk_scaler);
 	for (i = 0; i < ARRAY_SIZE(nau8810_mclk_scaler); i++) {
-		f2 = 256 * fs * 4 * nau8810_mclk_scaler[i] / 10;
+		f2 = 256ULL * fs * 4 * nau8810_mclk_scaler[i] / 10;
 		if (f2 > NAU_PLL_FREQ_MIN && f2 < NAU_PLL_FREQ_MAX &&
 			f2_max < f2) {
 			f2_max = f2;
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] ASoC: nau8810: fix the issue of 64 bits division
  2019-03-13  6:47 [PATCH] ASoC: nau8810: use 64-bit arithmetic instead of 32-bit John Hsu
@ 2019-03-22  4:25 ` John Hsu
  2019-03-25 12:22   ` Applied "ASoC: nau8810: fix the issue of 64 bits division" to the asoc tree Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: John Hsu @ 2019-03-22  4:25 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, WTLI, John Hsu, lgirdwood, YHCHuang, CTLIN0

Do division with div_u64 for the PLL calculation.
These errors are fixed and list as follows:
1."__udivdi3" [sound/soc/codecs/snd-soc-nau8810.ko] undefined!
2."__aeabi_uldivmod" [sound/soc/codecs/snd-soc-nau8810.ko] undefined!
3. nau8810.c:(.text.nau8810_calc_pll+0xd8): undefined reference to
`__udivdi3'

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
---
 sound/soc/codecs/nau8810.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/nau8810.c b/sound/soc/codecs/nau8810.c
index 125e205e6687..dd82c65cfa7f 100644
--- a/sound/soc/codecs/nau8810.c
+++ b/sound/soc/codecs/nau8810.c
@@ -505,7 +505,8 @@ static int nau8810_calc_pll(unsigned int pll_in,
 	f2_max = 0;
 	scal_sel = ARRAY_SIZE(nau8810_mclk_scaler);
 	for (i = 0; i < ARRAY_SIZE(nau8810_mclk_scaler); i++) {
-		f2 = 256ULL * fs * 4 * nau8810_mclk_scaler[i] / 10;
+		f2 = 256ULL * fs * 4 * nau8810_mclk_scaler[i];
+		f2 = div_u64(f2, 10);
 		if (f2 > NAU_PLL_FREQ_MIN && f2 < NAU_PLL_FREQ_MAX &&
 			f2_max < f2) {
 			f2_max = f2;
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Applied "ASoC: nau8810: fix the issue of 64 bits division" to the asoc tree
  2019-03-22  4:25 ` [PATCH] ASoC: nau8810: fix the issue of 64 bits division John Hsu
@ 2019-03-25 12:22   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2019-03-25 12:22 UTC (permalink / raw)
  To: John Hsu; +Cc: alsa-devel, WTLI, lgirdwood, YHCHuang, broonie, CTLIN0

The patch

   ASoC: nau8810: fix the issue of 64 bits division

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 3a9ce0f1b2961f6c3ad2a49dcf85449784c18bb5 Mon Sep 17 00:00:00 2001
From: John Hsu <KCHSU0@nuvoton.com>
Date: Fri, 22 Mar 2019 12:25:35 +0800
Subject: [PATCH] ASoC: nau8810: fix the issue of 64 bits division

Do division with div_u64 for the PLL calculation.
These errors are fixed and list as follows:
1."__udivdi3" [sound/soc/codecs/snd-soc-nau8810.ko] undefined!
2."__aeabi_uldivmod" [sound/soc/codecs/snd-soc-nau8810.ko] undefined!
3. nau8810.c:(.text.nau8810_calc_pll+0xd8): undefined reference to
`__udivdi3'

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/nau8810.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/nau8810.c b/sound/soc/codecs/nau8810.c
index 125e205e6687..dd82c65cfa7f 100644
--- a/sound/soc/codecs/nau8810.c
+++ b/sound/soc/codecs/nau8810.c
@@ -505,7 +505,8 @@ static int nau8810_calc_pll(unsigned int pll_in,
 	f2_max = 0;
 	scal_sel = ARRAY_SIZE(nau8810_mclk_scaler);
 	for (i = 0; i < ARRAY_SIZE(nau8810_mclk_scaler); i++) {
-		f2 = 256ULL * fs * 4 * nau8810_mclk_scaler[i] / 10;
+		f2 = 256ULL * fs * 4 * nau8810_mclk_scaler[i];
+		f2 = div_u64(f2, 10);
 		if (f2 > NAU_PLL_FREQ_MIN && f2 < NAU_PLL_FREQ_MAX &&
 			f2_max < f2) {
 			f2_max = f2;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-25 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13  6:47 [PATCH] ASoC: nau8810: use 64-bit arithmetic instead of 32-bit John Hsu
2019-03-22  4:25 ` [PATCH] ASoC: nau8810: fix the issue of 64 bits division John Hsu
2019-03-25 12:22   ` Applied "ASoC: nau8810: fix the issue of 64 bits division" to the asoc tree Mark Brown

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.