From patchwork Fri Feb 12 14:27:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8292301 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BC3049F3CD for ; Fri, 12 Feb 2016 14:28:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3E4F203EB for ; Fri, 12 Feb 2016 14:28:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 073D6203E3 for ; Fri, 12 Feb 2016 14:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751326AbcBLO2L (ORCPT ); Fri, 12 Feb 2016 09:28:11 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:50368 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbcBLO2J (ORCPT ); Fri, 12 Feb 2016 09:28:09 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0Mboqj-1akOV42oIn-00J41m; Fri, 12 Feb 2016 15:27:31 +0100 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Nicolas Pitre , Stefan Richter , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] zl10353: use div_u64 instead of do_div Date: Fri, 12 Feb 2016 15:27:18 +0100 Message-Id: <1455287246-3540549-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:xhjj5z53o6GSsvlrONgnBqJv2r7zR9xK7tMgbvRGTTX+AU6x84x D1i6QHejkshx+TWgzZuoiJs4R49qO5bCPgyZoDJSZL0cXwWpkd3tq/8DFp1R/jiuZanTGys JsglScmRR7vvKVP4Lj3gLLZU9ItRJoNccO12nPfd66Uf/Ch7y7MduoERAiaPM9D1MEOsZ+F ce8Qy0q9AivGMt4wyYN8g== X-UI-Out-Filterresults: notjunk:1; V01:K0:7Q6i34XLqhI=:4h8vnNZaJLi1USuFjMy4xW ZKIMLwT4Efm6X3+K1T+eBN4ItQt/2bgs9eN9rdAHDkJLxTE+Xefl34pxkPfZxsDsVbR0kj0gK +12a9/LMM6r++k9Lm9AfOb6xeE6pVmNWWaxnmYqC+Hwu0wrjlhjxNbWR14Hg/IpVMc5lg4Jie sRa7on3/kaQYlyTXUc2Z6ZJ+PO7l7wx3WN7Gfnh1sF0qma7muBVCoKUZeET3Sc4Wkh7Fjlwq/ XhWkX0gc/I1kV1k7GjSG2uFYCCMMOgFooh3XmaUfHcfw2XmTHrTNBn5RopaRfiWYJ/5ufOrMB xK56oKBBVpiB9E3coUVCcbRVoBctxrPixpwfqCs6PtKCAYSFQgTdPPHY8KHCDaK4xZR2fTOrx vi8ORsIMGmrOYGmyyFBI7tkKdCOESHsnegaohS9QryU/AGtU6ApnKTt3HM8lS8AyJq6BW1Bok 1O8DddJCmtTLishuNQMva5YcepsX7E17vxq0w0Ebeu3eWdwPHr4DhubzEzCMZ8C9QZBIy2Tz6 9OyZ+iaXc4JzkufO91N90L/wU5YB3hBkLOGkmvrftkYBkwfKlBdhDYxjTPtwz3VfWyWUQrS1N +Ld57dMXM0g3Jgy4SqOXSmsUbkyiBWywjfRmd0+Hh/sBqgD02qTaFwES/5i//dLaUoLnvOaW2 NfuiXL3qWU1I++wEfCF1eFCmc1n4LXzYpc1q7XxkU9UAH0ve/P0pvQ37DtMjJsrrm8mU= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I noticed a build error in some randconfig builds in the zl10353 driver: dvb-frontends/zl10353.c:138: undefined reference to `____ilog2_NaN' dvb-frontends/zl10353.c:138: undefined reference to `__aeabi_uldivmod' The problem can be tracked down to the use of -fprofile-arcs (using CONFIG_GCOV_PROFILE_ALL) in combination with CONFIG_PROFILE_ALL_BRANCHES on gcc version 4.9 or higher, when it fails to reliably optimize constant expressions. Using div_u64() instead of do_div() makes the code slightly more readable by both humans and by gcc, which gives the compiler enough of a break to figure it all out. Signed-off-by: Arnd Bergmann --- drivers/media/dvb-frontends/zl10353.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/zl10353.c b/drivers/media/dvb-frontends/zl10353.c index ef9764a02d4c..160c88710553 100644 --- a/drivers/media/dvb-frontends/zl10353.c +++ b/drivers/media/dvb-frontends/zl10353.c @@ -135,8 +135,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, value = (u64)10 * (1 << 23) / 7 * 125; value = (bw * value) + adc_clock / 2; - do_div(value, adc_clock); - *nominal_rate = value; + *nominal_rate = div_u64(value, adc_clock); dprintk("%s: bw %d, adc_clock %d => 0x%x\n", __func__, bw, adc_clock, *nominal_rate); @@ -163,8 +162,7 @@ static void zl10353_calc_input_freq(struct dvb_frontend *fe, if (ife > adc_clock / 2) ife = adc_clock - ife; } - value = (u64)65536 * ife + adc_clock / 2; - do_div(value, adc_clock); + value = div_u64((u64)65536 * ife + adc_clock / 2, adc_clock); *input_freq = -value; dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n",