Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp874001imm; Wed, 11 Jul 2018 12:29:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfrZxcSWH1PbvZbwUB+TNjYmAC9xmS6krYPotDIMNggrT+HJd/NDSt4t7j3KLiX/+Vic5LB X-Received: by 2002:a63:7454:: with SMTP id e20-v6mr23713749pgn.410.1531337375377; Wed, 11 Jul 2018 12:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337375; cv=none; d=google.com; s=arc-20160816; b=kkrJ991uapYZcRaLwUatuxlUyBkDi9peaW5eKf++Y4JbcCXoj6cvvVncBgNzDkZ76O YVDWzvkfzWj2lRTR0g2ishQ0ohhIjLuV8YpI+FnsmvRQ10l8adSeNgRf2q6YkyQ18DiZ hGd0Gk+xjQUKzqHF0uuBQIUnMDzvIb45st13vOKRTbQ0HrPYGXr2gJL3Bu0lPaABnEWt iNILGFncAp9NorxOfTT9PUXXADzbaezsYmVH09jWNx4k78gW+Xs3OXx5dOhEDMNkbdPD nwvxppnEfykepkddpH7KHUMiaD280pdM0XuWCTvGQYGMp0p7JQajUFOg9FgF+44npXVS JsyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ZkBTDxamdsvJZskX9h8xh0yRuYvMQePOzJ0nQXoxqHQ=; b=W2GYuWsMADt/sxvvyqtSwY/QERPEZt+XUUNyuAkfi+XXa6L7TQxiQjUm8AtAS5OQuu KiZzysvbPIsC5QQ9+1/Tn0TBopBbsdPyQ2vUjP8+LqhGkDFREXbgSD8jxuSd6D8BZWay QDQnV0wkesbH9uKqFcGx5j3vh9zJW42od2YG4hvvFoHCxqbFC1tDRa0/1LgkoaUT2/rz c+xE+gxZoky9+dXRxMXK+MeZI3uDEIYGYL1Zs1duy1obcZj0SHdEib1eGPlI/VbpF8fd uvw0KfSClPUq4uN4jLykTakaYtAtxnaDXA4n/VqtPBu720kd635DgvmmFp6pN2clNGQ5 rDgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l190-v6si18304028pgd.626.2018.07.11.12.29.19; Wed, 11 Jul 2018 12:29:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388190AbeGKQ4V (ORCPT + 99 others); Wed, 11 Jul 2018 12:56:21 -0400 Received: from foss.arm.com ([217.140.101.70]:40478 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387987AbeGKQ4V (ORCPT ); Wed, 11 Jul 2018 12:56:21 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E184880D; Wed, 11 Jul 2018 09:51:09 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8CCFC3F589; Wed, 11 Jul 2018 09:51:08 -0700 (PDT) Date: Wed, 11 Jul 2018 17:51:03 +0100 From: Mark Rutland To: Daniel Vetter Cc: Peter Zijlstra , Andrew Morton , Daniel Vetter , Intel Graphics Development , LKML , DRI Development Subject: Re: [Intel-gfx] [PATCH 11/12] sched: use for_each_if in topology.h Message-ID: <20180711165103.hr7klbun2elfncfx@lakrids.cambridge.arm.com> References: <20180709083650.23549-1-daniel.vetter@ffwll.ch> <20180709083650.23549-11-daniel.vetter@ffwll.ch> <20180709103656.GH2476@hirez.programming.kicks-ass.net> <20180709151258.GV2476@hirez.programming.kicks-ass.net> <20180709155204.GD3008@phenom.ffwll.local> <20180709160342.GA2476@hirez.programming.kicks-ass.net> <20180709161232.up6vnuybvkxn76am@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 09, 2018 at 07:55:20PM +0200, Daniel Vetter wrote: > On Mon, Jul 9, 2018 at 6:12 PM, Mark Rutland wrote: > > 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 complains. Liberally sprinkling {} also shuts > >> > up the compiler, but it's a bit confusing given that a plain for {;;} is > >> > totally fine. And it's confusing since at first glance the compiler > >> > complaining about nested if and ambigous else doesn't make sense since > >> > clearly there's only 1 if there. > >> > >> Ah, so the pattern the compiler tries to warn about is: > >> > >> if (foo) > >> if (bar) > >> /* stmts1 */ > >> else > >> /* stmts2 * > >> > >> Because it might not be immediately obvious with which if the else goes. > >> Which is fair enough I suppose. > >> > >> OK, ACK. > > > > Just to bikeshed, there could be macros other than for_each_*() macros > > that will want to use this internally, so perhaps it would be worth the > > generic version being named something like if_noelse(). > > > > We could always add that as/when required, though. > > I think a better name would be really good, but both when we added it > for i915 and when we move it to drm headers we drew a blank. > if_noelse() describes pretty good what it does, but kinda fails on the > "where should I use it" departement. If there's some consensus I can > sed the patches quickly. Just to be clear: for_each_if() is fine by me, so no need to change things. Sorry for the noise! Mark.