From patchwork Tue Feb 4 16:36:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 3577741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 83FA29F2F5 for ; Tue, 4 Feb 2014 16:37:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB02F20122 for ; Tue, 4 Feb 2014 16:37:19 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFF83200E7 for ; Tue, 4 Feb 2014 16:37:18 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAizo-0003rD-9R; Tue, 04 Feb 2014 16:37:12 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAizm-0007h7-3Y; Tue, 04 Feb 2014 16:37:10 +0000 Received: from smtprelay0095.hostedemail.com ([216.40.44.95] helo=smtprelay.hostedemail.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAizj-0007g1-L0 for linux-arm-kernel@lists.infradead.org; Tue, 04 Feb 2014 16:37:08 +0000 Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id A84F223622; Tue, 4 Feb 2014 16:36:40 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::::::, RULES_HIT:41:355:379:541:599:960:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3870:3871:3872:3874:4250:4321:5007:7652:7875:7904:10004:10400:10848:11026:11232:11473:11657:11658:11914:12043:12291:12296:12438:12517:12519:12555:12683:12740, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: books22_741fbf4bcf531 X-Filterd-Recvd-Size: 3402 Received: from [192.168.1.157] (pool-96-251-49-11.lsanca.fios.verizon.net [96.251.49.11]) (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA; Tue, 4 Feb 2014 16:36:37 +0000 (UTC) Message-ID: <1391531796.2538.21.camel@joe-AO722> Subject: Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM From: Joe Perches To: Holger Schurig , Russell King , linux-arm-kernel Date: Tue, 04 Feb 2014 08:36:36 -0800 In-Reply-To: References: <1391483274-20331-1-git-send-email-sujith@msujith.org> <1391483274-20331-2-git-send-email-sujith@msujith.org> <1391484878.2538.11.camel@joe-AO722> <21232.24855.201543.400943@gargle.gargle.HOWL> X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140204_113707_693471_E38024F6 X-CRM114-Status: GOOD ( 12.35 ) X-Spam-Score: -1.9 (-) Cc: ath9k-devel , Sujith Manoharan , linux-wireless , John Linville X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 On Tue, 2014-02-04 at 08:03 +0100, Holger Schurig wrote: > Joe, look in linux/arch/arm/include/asm/delay.h. The macro udelay > cannot handle large values because of lost-of-precision. > > IMHO udelay on ARM is broken, because it also cannot work with fast > ARM processors (where bogomips >= 3355, which is in sight now). It's > just not broken enought that someone did something against it ... so > the current kludge is good enought. Maybe something like this would be better? --- arch/arm/include/asm/delay.h | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h index dff714d..ac33c56 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h @@ -15,6 +15,8 @@ #ifndef __ASSEMBLY__ +#include + struct delay_timer { unsigned long (*read_current_timer)(void); unsigned long freq; @@ -51,11 +53,34 @@ extern void __bad_udelay(void); #define __udelay(n) arm_delay_ops.udelay(n) #define __const_udelay(n) arm_delay_ops.const_udelay(n) +#ifdef DEBUG +#define __udelay_debug_max_delay(n) \ +do { \ + if (n > MAX_UDELAY_MS * 1000) { \ + pr_debug("udelay(%d) too large - Convert to mdelay\n", n); \ + dump_stack(); \ + } \ +} while (0) +#else +#define __udelay_debug_max_delay(n) \ + do {} while (0) +#endif + #define udelay(n) \ - (__builtin_constant_p(n) ? \ - ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ - __const_udelay((n) * UDELAY_MULT)) : \ - __udelay(n)) +({ \ + if (__builtin_constant_p(n)) { \ + typeof n _n = n; \ + while (_n > MAX_UDELAY_MS * 1000) { \ + __const_udelay(MAX_UDELAY_MS * 1000 * UDELAY_MULT); \ + _n -= MAX_UDELAY_MS * 1000; \ + } \ + if (_n) \ + __const_udelay(_n * 1000 * UDELAY_MULT); \ + } else { \ + __udelay_debug_max_delay(n); \ + __udelay(n); \ + } \ +}) /* Loop-based definitions for assembly code. */ extern void __loop_delay(unsigned long loops);