Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp711270imm; Mon, 9 Jul 2018 09:14:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe5QK6H9ha25OfjUKigf1jzVwGLxJ8WmLWKz2WXcl/Jm7BYMRMxpr5vO+x4GTm1cxmJnO7N X-Received: by 2002:a65:6301:: with SMTP id g1-v6mr19563601pgv.324.1531152881303; Mon, 09 Jul 2018 09:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531152881; cv=none; d=google.com; s=arc-20160816; b=EuozlkBwwCGrB8KV1ykisAmr7mkE7wyzldVKBwXRox9rKvwAIH8cMcrjsoNYcSTnGf +CKgBhcwz5/TfiRAiaU5+dtNhpKsZHoAXG0LtjMBj9FruerQymhe+fjRh2MuNh+FaZ5w oLLBzBs72V0BlvdATnhGOSsDdRO/KlohfuEhcqJUvURyJYjbHiee8fMs17Ao+Zqqyljp Ob652PNulTV4uaS4lTivb11S2KnZ2lJ/75TYF4O+Vw76sGtKMoAWoHpsdozevE22jesO 1skhNVC7YUFdEBqH3I/2zQxqWeEb1YCci3WxY4MfKutvxGhPsVUeir3Xwtz4A/fhcfVP 9mGw== 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=9o4XPzodjckAAbTttj7iovm9UpqSqksJIpu6DkndAnE=; b=W1ojSxsXUOJ8h986oQxjpYtEo+tr/KTZqFSpzSzDhlIlIe78WHyjn6UjGBc2gYhPkF ymWF+qvV4U+q5fYhewJCQKrHJV1Y6bvGc99187KbovIq4W3KMMIjQ5hHRg6gDJbIegch mt4MX+cxlZ+D4os0jho5rZnoUVD/83pG8wdhkVXfrwXTJT/MwHvUqwul4khH+AtmeCjY ffVNx1byxrGVOyQ7DKxMqW/ovSUzKro3KAUUaBUGu3Fgy/tmUJngJFeKkt5LZZnz3/5G 6LPpRYON2N6AMnQwB9/In9OMkfVFnYapTxy0CqHyfS8CtJL9zsdysHKaD9+v4u9mnak4 Rdgw== 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 y6-v6si14355840pgk.474.2018.07.09.09.14.27; Mon, 09 Jul 2018 09:14:41 -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 S933237AbeGIQMi (ORCPT + 99 others); Mon, 9 Jul 2018 12:12:38 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34356 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754565AbeGIQMg (ORCPT ); Mon, 9 Jul 2018 12:12:36 -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 3AFF2ED1; Mon, 9 Jul 2018 09:12:36 -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 082523F589; Mon, 9 Jul 2018 09:12:34 -0700 (PDT) Date: Mon, 9 Jul 2018 17:12:32 +0100 From: Mark Rutland To: Peter Zijlstra Cc: LKML , DRI Development , Intel Graphics Development , Daniel Vetter , Andrew Morton Subject: Re: [PATCH 11/12] sched: use for_each_if in topology.h Message-ID: <20180709161232.up6vnuybvkxn76am@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180709160342.GA2476@hirez.programming.kicks-ass.net> 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 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. Mark.