Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-10 Thread Mark Rutland
On Mon, Jul 09, 2018 at 06:03:42PM +0200, Peter Zijlstra wrote: > 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); > > > > Totally contrived, but this

Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-09 Thread Peter Zijlstra
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:

Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-09 Thread Daniel Vetter
On Mon, Jul 9, 2018 at 6:03 PM, Peter Zijlstra wrote: > 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); >> >> Totally contrived, but this complains.

Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-09 Thread Peter Zijlstra
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); > > Totally contrived, but this complains. Liberally sprinkling {} also shuts > up the compiler, but it's a

Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-09 Thread Daniel Vetter
On Mon, Jul 09, 2018 at 05:12:58PM +0200, Peter Zijlstra wrote: > On Mon, Jul 09, 2018 at 05:00:07PM +0200, Daniel Vetter wrote: > > On Mon, Jul 9, 2018 at 12:36 PM, Peter Zijlstra > > wrote: > > > On Mon, Jul 09, 2018 at 10:36:49AM +0200, Daniel Vetter wrote: > > > >> #define

Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-09 Thread Peter Zijlstra
On Mon, Jul 09, 2018 at 05:00:07PM +0200, Daniel Vetter wrote: > On Mon, Jul 9, 2018 at 12:36 PM, Peter Zijlstra wrote: > > On Mon, Jul 09, 2018 at 10:36:49AM +0200, Daniel Vetter wrote: > >> #define for_each_node_with_cpus(node)\ > >> for_each_online_node(node)

Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-09 Thread Daniel Vetter
On Mon, Jul 9, 2018 at 12:36 PM, Peter Zijlstra wrote: > On Mon, Jul 09, 2018 at 10:36:49AM +0200, Daniel Vetter wrote: >> Avoids complaints from gcc about ambiguous else clauses. > > Is that a new thing? I'm fairly sure I've never seen it do that, > >> Signed-off-by: Daniel Vetter >> Cc: Andrew

Re: [PATCH 11/12] sched: use for_each_if in topology.h

2018-07-09 Thread Peter Zijlstra
On Mon, Jul 09, 2018 at 10:36:49AM +0200, Daniel Vetter wrote: > Avoids complaints from gcc about ambiguous else clauses. Is that a new thing? I'm fairly sure I've never seen it do that, > Signed-off-by: Daniel Vetter > Cc: Andrew Morton > Cc: Peter Zijlstra > --- > include/linux/topology.h