Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1698788

[PATCH] staging: pi433: use div_u64 for 64-bit division

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH] staging: pi433: use div_u64 for 64-bit division
Date 2017-07-28 15:30 +0200
Message-ID <u8dv3-4hd-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


I ran into this link error on an ARM OABI build:

drivers/staging/pi433/rf69.o: In function `rf69_set_frequency':
rf69.c:(.text+0xc9c): undefined reference to `__udivdi3'

No idea why I didn't see it with the default EABI configurations,
but the right solution here seems to be to use div_u64()
to get the external division implementation.

Fixes: 874bcba65f9a ("staging: pi433: New driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/pi433/rf69.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index e391ce777bc7..e5267b5638c0 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -238,7 +238,7 @@ int rf69_set_frequency(struct spi_device *spi, u32 frequency)
 	do_div(f_step, 524288); //  524288 = 2^19
 
 	// check input value
-	f_max = f_step * 8388608 / factor;
+	f_max = div_u64(f_step * 8388608, factor);
 	if (frequency > f_max)
 	{
 		dev_dbg(&spi->dev, "setFrequency: illegal input param");
-- 
2.9.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] staging: pi433: use div_u64 for 64-bit division Arnd Bergmann <arnd@arndb.de> - 2017-07-28 15:30 +0200
  Re: [PATCH] staging: pi433: use div_u64 for 64-bit division Marcus Wolf <marcus.wolf@wolf-entwicklungen.de> - 2017-07-28 16:30 +0200
    Re: [PATCH] staging: pi433: use div_u64 for 64-bit division Dan Carpenter <dan.carpenter@oracle.com> - 2017-07-28 16:30 +0200
      Re: [PATCH] staging: pi433: use div_u64 for 64-bit division Marcus Wolf <marcus.wolf@wolf-entwicklungen.de> - 2017-07-28 17:00 +0200
      Send a large patch right now or is it better to do it  later? Marcus Wolf <marcus.wolf@wolf-entwicklungen.de> - 2017-07-28 17:20 +0200
        Re: Send a large patch right now or is it better to do it  later? Dan Carpenter <dan.carpenter@oracle.com> - 2017-07-29 09:30 +0200
    Re: [PATCH] staging: pi433: use div_u64 for 64-bit division Arnd Bergmann <arnd@arndb.de> - 2017-07-28 16:30 +0200

csiph-web