[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180709163023.GB2476@hirez.programming.kicks-ass.net>
Date: Mon, 9 Jul 2018 18:30:23 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: LKML <linux-kernel@...r.kernel.org>,
DRI Development <dri-devel@...ts.freedesktop.org>,
Intel Graphics Development <intel-gfx@...ts.freedesktop.org>,
Daniel Vetter <daniel.vetter@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 11/12] sched: use for_each_if in topology.h
On Mon, Jul 09, 2018 at 05:52:04PM +0200, Daniel Vetter wrote:
> for_each_something(foo)
> if (foo->bla)
> call_bla(foo);
> else
> call_default(foo);
Note that the kernel coding style 'discourages' this style and would
like you to write:
for_each_something(foo) {
if (foo->bla)
call_bla(foo);
else
call_default(foo);
}
Which avoids the entire problem. See CodingStyle-3:
Also, use braces when a loop contains more than a single simple statement:
.. code-block:: c
while (condition) {
if (test)
do_something();
}
Powered by blists - more mailing lists