From patchwork Tue Sep 4 17:11:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 1403471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id BCE234025E for ; Tue, 4 Sep 2012 17:15:41 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T8wg0-00008O-DL; Tue, 04 Sep 2012 17:12:36 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T8wfx-000084-2P for linux-arm-kernel@lists.infradead.org; Tue, 04 Sep 2012 17:12:34 +0000 X-IronPort-AV: E=McAfee;i="5400,1158,6825"; a="230424120" Received: from pdmz-ns-snip_115.254.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.115.254]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Sep 2012 10:11:52 -0700 Received: from [10.46.166.8] (pdmz-ns-snip_218_1.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id E597110004AB; Tue, 4 Sep 2012 10:11:51 -0700 (PDT) Message-ID: <50463657.1070109@codeaurora.org> Date: Tue, 04 Sep 2012 10:11:51 -0700 From: Stephen Boyd User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: Will Deacon Subject: Re: [PATCH v2 2/2] ARM: delay: add registration mechanism for delay timer sources References: <1346275524-13817-1-git-send-email-will.deacon@arm.com> <1346275524-13817-2-git-send-email-will.deacon@arm.com> <503FFC7D.9050704@codeaurora.org> <20120904100750.GC2458@mudshark.cambridge.arm.com> <20120904104403.GE2458@mudshark.cambridge.arm.com> In-Reply-To: <20120904104403.GE2458@mudshark.cambridge.arm.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [199.106.114.251 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jonathan Austin , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 09/04/12 03:44, Will Deacon wrote: > On Tue, Sep 04, 2012 at 11:07:50AM +0100, Will Deacon wrote: >> On Fri, Aug 31, 2012 at 12:51:25AM +0100, Stephen Boyd wrote: >>>> +void __init register_current_timer_delay(struct delay_timer *timer) >>> const? >> Sure. I'll send an updated patch. > Gah, spoke too soon. This isn't going to work, as the frequency may not be > known until probe time (for example, it could be obtained by the device > tree) so const data isn't going to cut it. > That's fine. We can still do const can't we? I was suggesting you make the argument const and not the data in arch_timer.c const. This way we can be sure that delay.c isn't going to muck with the struct, but the ones who register the struct can fill it in at runtime. Squash this in and test compile? ----8<------ diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h index 50928e8..ab98fdd 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h @@ -63,7 +63,7 @@ extern void __loop_const_udelay(unsigned long); /* Delay-loop timer registration. */ #define ARCH_HAS_READ_CURRENT_TIMER -extern void register_current_timer_delay(struct delay_timer *timer); +extern void register_current_timer_delay(const struct delay_timer *timer); #endif /* __ASSEMBLY__ */ diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c index fe6f4fb..e868ef0 100644 --- a/arch/arm/lib/delay.c +++ b/arch/arm/lib/delay.c @@ -34,7 +34,7 @@ struct arm_delay_ops arm_delay_ops = { .udelay = __loop_udelay, }; -static struct delay_timer *delay_timer; +static const struct delay_timer *delay_timer; static bool delay_calibrated; int read_current_timer(unsigned long *timer_val) @@ -62,7 +62,7 @@ static void __timer_udelay(unsigned long usecs) __timer_const_udelay(usecs * UDELAY_MULT); } -void __init register_current_timer_delay(struct delay_timer *timer) +void __init register_current_timer_delay(const struct delay_timer *timer) { if (!delay_calibrated) { pr_info("Switching to timer-based delay loop\n");