Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2480779imm; Mon, 16 Jul 2018 08:43:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd1cgySNx4JTpVEAaCVA4ESCy2po6yOdyo0/nmYe4JET0lSTx0P1tj5U+rdj6Mecgvf/d1R X-Received: by 2002:a17:902:8ec9:: with SMTP id x9-v6mr16642147plo.1.1531755781009; Mon, 16 Jul 2018 08:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531755780; cv=none; d=google.com; s=arc-20160816; b=IYkNqt5CxXPL1wC3SMaNzqS+Vn40e1viYqzKaMSeATSWFk1Fuwa0dTXh5EodzCGy/t 1lpAMg/AwsujufTRpMv4fEgnT60pA2zlq7+NIv0oyAUIFrfReDHIbI3XI5EMNCPVUcaK i5axPhG5uj3H15ogrzsQ19cxlVp/bVYdL23HjM1GOVrU8UwfiRMZIipePsorz1r2S+Ma cnOaldQTgC8MXRgtIG8r1lcSXcDvF/W6mDeIK4poe55JGN3MDJBDZoV2RhJ65Dx6C82k nrabSt0wjtqJ3q8NKBQOrn3jVAc27xyZPYz3JKxoEN4f+d7aiuuAxsnxooKqp6z0x9uP PVZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=i20PPhjABEcbSolqLK+z5XpFdJqDmy9SLONwofQBxlY=; b=cHkOGGYuqiHufVQNzByz3M337n5MNgcrH8UHARwOdIZ1Y+nuFYQrYWMZy7JlI+r0Mh 9uCdGXt6ybQ5DYLIaPmSB7eiKmC5Tq5UzTWCP5T/cOd8G6DebwOu6rr7nw+uyQm4ebP0 KRLtfbeJNl0ybLtvxqQv3knGcVziiZbAv44QIChelR7vpSHEeoHIriMw4Gd1gYw6D2YH qj4Lrn7JdX+QEo0+3fyLNLfFSs9tVhIpXv3e8GFhh0MB20dVo5jMD1VK/0Cfl+2UVvdU PlL/z62gZVtTmKxilrEMsX26w2a3GGRnBi5sAYn+5XIeSen/SobNZh3PmTG+HC0+/n7e Dy9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=15aYdh5o; 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 w26-v6si30135929pgk.372.2018.07.16.08.42.45; Mon, 16 Jul 2018 08:43:00 -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=@infradead.org header.s=merlin.20170209 header.b=15aYdh5o; 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 S1728417AbeGPQKM (ORCPT + 99 others); Mon, 16 Jul 2018 12:10:12 -0400 Received: from merlin.infradead.org ([205.233.59.134]:54660 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727618AbeGPQKM (ORCPT ); Mon, 16 Jul 2018 12:10:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=i20PPhjABEcbSolqLK+z5XpFdJqDmy9SLONwofQBxlY=; b=15aYdh5opmVbVJGsHXX+9lmywt BYckHVqzuW7974NH8tUaaX3sya3WckPn9qFblY53czZOU4YbLj8AdzQa/69/iwZo5B9Qx+aq79iJm WieHjFHTaZ/In+Er9T5lJZN5eypLB3lNG00A0kTFrHu9Uc7JdzVxwniovCeVMmFvp4G3BSnrfmBGV ivNUNhEUU3joV2ZK6L3O7FwbQ6JIyEnNroSviTSRyCAJ56+g02SpGMjDQ8CQhjg0+cYJdi9/bSdny kUkQApjVYTACbOkWG0MYb9CZa1l4JGmDR6X9xRQfb1fORIvUYnbEmJGingwL14O145Pk1XAjPPVxF fE65qqGw==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ff5cn-00034P-RX; Mon, 16 Jul 2018 15:41:22 +0000 Subject: Re: [PATCH] kernel.h: Add for_each_if() To: Andy Shevchenko , NeilBrown , Andrew Morton , Daniel Vetter Cc: LKML , DRI Development , Intel Graphics Development , Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Kees Cook , Ingo Molnar , Greg Kroah-Hartman , Wei Wang , Stefan Agner , Andrei Vagin , Yisheng Xie , Peter Zijlstra , Daniel Vetter References: <20180709083650.23549-1-daniel.vetter@ffwll.ch> <20180709162509.29343-1-daniel.vetter@ffwll.ch> <20180709163001.8fb8148223a57bc46a13fbda@linux-foundation.org> <20180710075328.GG3008@phenom.ffwll.local> <871scbwfd4.fsf@notabene.neil.brown.name> <20180711160547.59f086a587c7f3c8d3c40f0f@linux-foundation.org> <87bmbavhai.fsf@notabene.neil.brown.name> <79133322-b04b-f005-f1f6-25c28c5058e4@infradead.org> From: Randy Dunlap Message-ID: Date: Mon, 16 Jul 2018 08:41:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/16/2018 01:11 AM, Andy Shevchenko wrote: > On Fri, 2018-07-13 at 16:42 -0700, Randy Dunlap wrote: >> On 07/13/2018 04:37 PM, NeilBrown wrote: > >> >> coding-style.rst says: >> Also, use braces when a loop contains more than a single simple >> statement: > > Independently on a) would we use some macro for condition, or b) fix > macros against this kind of nested conditions, there is another > weirdness we would like to avoid, i.e. > > for_each_foo() { > ... > } else { > ... > } > > It is written according to coding style, but too much weird. Yeah, that's odd. Looks like else matches the for loop. (!) > So, summarize this discussion I think we would > - keep for_each_if() in DRM subsystem alone > - fix macros which are using positive condition 'if (cond)' by replacing > with 'if (!cond) {} else' form for sake of robustness. > > Do you agree on that? Sure, both of those sound good to me. thanks, -- ~Randy