Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752074AbdG1OVJ (ORCPT ); Fri, 28 Jul 2017 10:21:09 -0400 Received: from wp244.webpack.hosteurope.de ([80.237.133.13]:54314 "EHLO wp244.webpack.hosteurope.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751761AbdG1OVI (ORCPT ); Fri, 28 Jul 2017 10:21:08 -0400 Date: Fri, 28 Jul 2017 16:21:05 +0200 (CEST) From: Marcus Wolf To: Greg Kroah-Hartman , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org Message-ID: <569585967.8859.1501251665326@ox.hosteurope.de> In-Reply-To: <20170728132339.332897-1-arnd@arndb.de> References: <20170728132339.332897-1-arnd@arndb.de> Subject: Re: [PATCH] staging: pi433: use div_u64 for 64-bit division MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.3-Rev29 X-Originating-Client: com.openexchange.ox.gui.dhtml X-bounce-key: webpack.hosteurope.de;marcus.wolf@wolf-entwicklungen.de;1501251668;df85712d; X-HE-SMSGID: 1db68X-0003kN-Dv Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1618 Lines: 51 Hi Arnd, we already have a patch for this: [PATCH 1/1] staging: pi433: fix problem with division in rf69_set_deviation from 20.07.2017 Maybe I did something wrong, but my first solution was exactly like your proposal. As far as I remeber, I wasn't able to compile it that way. Therefore I made a little bit more complicated fix. If I did something wrong and yours is fine, we should go for yours, because it is a shorter solution. Thanks, Marcus > Arnd Bergmann hat am 28. Juli 2017 um 15:23 geschrieben: > > > 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 > --- > 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 > >