From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH 5/5] kernel: tracepoints: add support for relative references Date: Fri, 18 Aug 2017 10:26:16 +0200 Message-ID: <20170818082616.vyk5z5s2kicc66ip@gmail.com> References: <20170814105231.14608-1-ard.biesheuvel@linaro.org> <20170814105231.14608-6-ard.biesheuvel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-wr0-f196.google.com ([209.85.128.196]:33272 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbdHRI0U (ORCPT ); Fri, 18 Aug 2017 04:26:20 -0400 Content-Disposition: inline In-Reply-To: <20170814105231.14608-6-ard.biesheuvel@linaro.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "H. Peter Anvin" , Arnd Bergmann , Heiko Carstens , Kees Cook , Will Deacon , Michael Ellerman , Thomas Garnier , Thomas Gleixner , "Serge E. Hallyn" , Bjorn Helgaas , Benjamin Herrenschmidt , Paul Mackerras , Catalin Marinas , Petr Mladek , Ingo Molnar , James Morris , Andrew Morton , Nicolas Pitre , Steven Rostedt * Ard Biesheuvel wrote: > -static void for_each_tracepoint_range(struct tracepoint * const *begin, > - struct tracepoint * const *end, > +static void for_each_tracepoint_range(const void *begin, const void *end, > void (*fct)(struct tracepoint *tp, void *priv), > void *priv) > { > +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS > + const signed int *iter; > + > + if (!begin) > + return; > + for (iter = begin; iter < (signed int *)end; iter++) { > + fct((struct tracepoint *)((unsigned long)iter + *iter), priv); > + } I think checkpatch is correct here to complain about the unnecessary curly braces here. Plus why the heavy use of 'signed int' here and elsewhere in the patches - why not 'int' ? Plus #2, the heavy use of type casts looks pretty ugly to begin with - is there no way to turn this into more natural code? Thanks, Ingo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com ([209.85.128.196]:33272 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbdHRI0U (ORCPT ); Fri, 18 Aug 2017 04:26:20 -0400 Date: Fri, 18 Aug 2017 10:26:16 +0200 From: Ingo Molnar Subject: Re: [PATCH 5/5] kernel: tracepoints: add support for relative references Message-ID: <20170818082616.vyk5z5s2kicc66ip@gmail.com> References: <20170814105231.14608-1-ard.biesheuvel@linaro.org> <20170814105231.14608-6-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170814105231.14608-6-ard.biesheuvel@linaro.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "H. Peter Anvin" , Arnd Bergmann , Heiko Carstens , Kees Cook , Will Deacon , Michael Ellerman , Thomas Garnier , Thomas Gleixner , "Serge E. Hallyn" , Bjorn Helgaas , Benjamin Herrenschmidt , Paul Mackerras , Catalin Marinas , Petr Mladek , Ingo Molnar , James Morris , Andrew Morton , Nicolas Pitre , Steven Rostedt , Martin Schwidefsky , Sergey Senozhatsky , Jessica Yu Message-ID: <20170818082616.V_-ZNhdEeVgVBgPJyGb-x7YXmSAXha3sUbOJyWbsuog@z> * Ard Biesheuvel wrote: > -static void for_each_tracepoint_range(struct tracepoint * const *begin, > - struct tracepoint * const *end, > +static void for_each_tracepoint_range(const void *begin, const void *end, > void (*fct)(struct tracepoint *tp, void *priv), > void *priv) > { > +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS > + const signed int *iter; > + > + if (!begin) > + return; > + for (iter = begin; iter < (signed int *)end; iter++) { > + fct((struct tracepoint *)((unsigned long)iter + *iter), priv); > + } I think checkpatch is correct here to complain about the unnecessary curly braces here. Plus why the heavy use of 'signed int' here and elsewhere in the patches - why not 'int' ? Plus #2, the heavy use of type casts looks pretty ugly to begin with - is there no way to turn this into more natural code? Thanks, Ingo