Re: [PATCH V7 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks
From: Joe Perches
Date: Fri Jul 02 2021 - 12:42:38 EST
On Fri, 2021-07-02 at 18:19 +0200, Peter Zijlstra wrote:
> On Fri, Jul 02, 2021 at 09:00:22AM -0700, Joe Perches wrote:
> > On Fri, 2021-07-02 at 13:22 +0200, Peter Zijlstra wrote:
> > > On Tue, Jun 22, 2021 at 05:42:49PM +0800, Zhu Lingshan wrote:
> > > > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> > []
> > > > + if (perf_guest_cbs && perf_guest_cbs->handle_intel_pt_intr)
> > > > + static_call_update(x86_guest_handle_intel_pt_intr,
> > > > + perf_guest_cbs->handle_intel_pt_intr);
> > > > +}
> > >
> > > Coding style wants { } on that last if().
> >
> > That's just your personal preference.
>
> As a maintainer, those carry weight, also that's tip rules:
>
> https://lore.kernel.org/lkml/20181107171149.165693799@xxxxxxxxxxxxx/
Right, definitely so.
But merely referencing 'coding style' is ambiguous at best.
btw:
ASCII commonly refers to '{' and '}', the curly brackets, to be braces
and '[' and ']', the square brackets, to be brackets.
It might be clearer to use that terminology.
belts and braces, etc...
cheers, Joe
----------------
+Bracket rules
+^^^^^^^^^^^^^
+
+Brackets should be omitted only if the statement which follows 'if', 'for',
+'while' etc. is truly a single line::
+
+ if (foo)
+ do_something();
+
+The following is not considered to be a single line statement even
+though C does not require brackets::
+
+ for (i = 0; i < end; i++)
+ if (foo[i])
+ do_something(foo[i]);
+
+Adding brackets around the outer loop enhances the reading flow::
+
+ for (i = 0; i < end; i++) {
+ if (foo[i])
+ do_something(foo[i]);
+ }