Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752306AbdG1O0p (ORCPT ); Fri, 28 Jul 2017 10:26:45 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:35960 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752292AbdG1O0n (ORCPT ); Fri, 28 Jul 2017 10:26:43 -0400 MIME-Version: 1.0 In-Reply-To: <569585967.8859.1501251665326@ox.hosteurope.de> References: <20170728132339.332897-1-arnd@arndb.de> <569585967.8859.1501251665326@ox.hosteurope.de> From: Arnd Bergmann Date: Fri, 28 Jul 2017 16:26:42 +0200 X-Google-Sender-Auth: ad7_80msfAfoH6qcPeYW8nY0twc Message-ID: Subject: Re: [PATCH] staging: pi433: use div_u64 for 64-bit division To: Marcus Wolf Cc: Greg Kroah-Hartman , Linux Kernel Mailing List , devel@driverdev.osuosl.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 844 Lines: 21 On Fri, Jul 28, 2017 at 4:21 PM, Marcus Wolf wrote: > 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. I think the problem with your original patch is that it doesn't work for 'u64 factor': do_div() is a bit tricky to work with, and it does not always accept a 64-bit divisor, while div_u64 will simply convert the divisor to a u32. You can also make 'factor' a 'u32' and keep using do_div. Arnd