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: 3577731 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2FA5BC02DC for ; Tue, 4 Feb 2014 16:36:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CBBB20181 for ; Tue, 4 Feb 2014 16:36:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45D042017D for ; Tue, 4 Feb 2014 16:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754537AbaBDQgm (ORCPT ); Tue, 4 Feb 2014 11:36:42 -0500 Received: from smtprelay0226.hostedemail.com ([216.40.44.226]:47715 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753604AbaBDQgl (ORCPT ); Tue, 4 Feb 2014 11:36:41 -0500 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 Cc: Sujith Manoharan , ath9k-devel , linux-wireless , John Linville 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 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);