Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp805317imm; Mon, 9 Jul 2018 10:57:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe0kKAZfJgGzznHM4+3zNNn3vG05dJglKiBGC6r6q0DLfoIm+qu/wJDH4p9ot5kXF6bnSBJ X-Received: by 2002:a62:c0c4:: with SMTP id g65-v6mr22147302pfk.72.1531159042421; Mon, 09 Jul 2018 10:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531159042; cv=none; d=google.com; s=arc-20160816; b=GWHJTcjGqMsf5kT77TrqmE+c9aUd0YrioXKnMlHYznvKLJj3YkgPkZFUf3ES/Iu0Qd F6xXMWmM75zaP5KGC1Rd5t9xLp3NYb7hURv3EZScfQ9Qd2fLgdVJqcL5xxDCyL4elzBn 9FTTS+U7pTq3b/vDNMDgW24/Ms66fjYRMgT9d4RQd46EloQ9Gb1ZY5rimDVYrOYesMsD QAv11Mtj8iuI8rUpSfgv8xperbE8mNZ/TLM0idhUQ94YG9+7mfX3LHXf7efNPmZyM4O+ ZAN+e9mQ1Z8YyjwvYYcGac9eM9a5aXETb+ClICi8a2yEKWG7hadvbYk6X+18abzHmWcI d8Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=bbHfMuMrrmphloUUIwdXihmj0pjnBrVZZaFk/LtGvps=; b=M18lpzzxXLjaRNgR9f65bvfaXS0XUJPy0BX1KBLdaYfJuyshicu89z8mYlYnevTEVv HXV6OfCWu0Tpg5KmzOO6dmSnk90ccevAQqTUv25caessNo1ghvmQW7I0YiRC4/rmvkEE P33rppToruh6DpPGD9p5GVNPqzmSbkE15uGxUbL6i6aJLKBSoFbuFV+Dq9KTH+cLx+ZZ A7ZECukIaIlT8bb0oS100S5vz2NDsiXkmJX95QnTBL3kgiWiuxgTscH1fMsqhKWtZI2Y q/p1AKC5TkYjAdYDRkGif5vQS+THDPCh824swNmDKkNIqTlrAconO/fZHl13AN3gGYkr ENAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=RpdGOBd1; 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 44-v6si15564889plb.376.2018.07.09.10.57.07; Mon, 09 Jul 2018 10:57:22 -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; dkim=fail header.i=@ffwll.ch header.s=google header.b=RpdGOBd1; 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 S934129AbeGIRzW (ORCPT + 99 others); Mon, 9 Jul 2018 13:55:22 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:51605 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933757AbeGIRzV (ORCPT ); Mon, 9 Jul 2018 13:55:21 -0400 Received: by mail-it0-f66.google.com with SMTP id g4-v6so10576405iti.1 for ; Mon, 09 Jul 2018 10:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=bbHfMuMrrmphloUUIwdXihmj0pjnBrVZZaFk/LtGvps=; b=RpdGOBd1PlokXPQYMrHkeoCO73158fYQrborQpPt3IIm3JnjZldqYozQc145POZtlK MHoNMaW2tsPdMgZWA/gHcwsufEr0bkR4Ek7PXy6b7vi2UZN/Wnf9zFUYTfKH1EF5FUo5 FOPB/R7L3yRosDcr0Uo8iDFm6GrG5hNhRdGEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=bbHfMuMrrmphloUUIwdXihmj0pjnBrVZZaFk/LtGvps=; b=FPruAB36qmX6BkPNNzLYge5GlDk7b2pjmODSv/syoboeyVeMaTIhbqkr0+9gxa2Bjr 6ag15cx+h8QeSpfeGSdSvsLWDnCSAVCc3uEr05EWyQIrkjEW/Zo5Hzs527870JF0+wJQ 6b36uYlgOwhp6FIvFTerqrEJczujPpk8DdD15kgPVmoYqpPEXLpLrESgWc1tcd6V+DDj FL4v+nDf0C/YfvyEbK5Yb41nbpvdsrZ43YFYDiBFOaIJLlVLHt03Pbq++/cPP+xJFWH6 A0rAeixQAbeVyILsfQ0HA4P8/oX6OSSB7wXaKX1hFQqHKknZtEm41q4eICwW/tckZO2u 00Hw== X-Gm-Message-State: AOUpUlHvX5kbQBCIeXP54CRepo4H4oa3iNREtOGYQEJiO/xLvUfBmdAo RY62kSxeOs/nJ2Xmt72OUpHfSpzuAJpWB9GZxa/Jrw== X-Received: by 2002:a24:558a:: with SMTP id e132-v6mr6153491itb.2.1531158920764; Mon, 09 Jul 2018 10:55:20 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:e492:0:0:0:0:0 with HTTP; Mon, 9 Jul 2018 10:55:20 -0700 (PDT) X-Originating-IP: [2a02:168:5628:0:496f:7dc5:66d7:a057] In-Reply-To: <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> <20180709161232.up6vnuybvkxn76am@lakrids.cambridge.arm.com> From: Daniel Vetter Date: Mon, 9 Jul 2018 19:55:20 +0200 X-Google-Sender-Auth: EHYgHoKt2m29KRhUWAKW_pLCiok Message-ID: Subject: Re: [Intel-gfx] [PATCH 11/12] sched: use for_each_if in topology.h To: Mark Rutland Cc: Peter Zijlstra , Andrew Morton , Daniel Vetter , Intel Graphics Development , LKML , DRI Development Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch