Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp41330imm; Fri, 13 Jul 2018 16:44:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcvsTcfcqXiatq459Vv4Ra3HQiZ3TyMJvH9H0Yd0WXaC6NIAM694oEgW1dCL69+Vhz3PyYL X-Received: by 2002:a17:902:6193:: with SMTP id u19-v6mr8185945plj.133.1531525485400; Fri, 13 Jul 2018 16:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531525485; cv=none; d=google.com; s=arc-20160816; b=LciKCp21sXv/sawSSE/KcDbLp0atjT9WsPy9PJvdbbIhTcI/j+HF0u1FcOWkCklxYJ zpicRVA0g2dbjQRLmCct7qmqW0DM9ffVQZ2R7K+eOp3MzkzouJrfF3ZbOnyTT3MV3Qz1 MMdhvitgyrQW4tuJ4wu+MVgAQ+B2lQjXNubUs/JWkbQrU91TFtFOnhQ8xYxM/GDnHA0m Lv84+VN7qaztd6sbMofiM/mjYUlom6/+FI3OzPvBIsFxyTz7RNPO4zpley92qIbsxy68 ATqW8D72pd4EWTyLIKVB36R6wWqjIy+IImvlsmpbUw1HO9AucqHyHG1gEDTHYqZ0kvQG nXFA== 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=BzhhUTWfymZlQdV1Ye90pVtOOYZ3lU/cYWkKSMbicck=; b=D2KWigaRqWn3AzHbgsg0Elhz34dTpCJdQTvuDX3ZbHbYBUj0mS/IG5VDUqdWWtHViD nc8qrD9prU3Vw+70+uQnodOoIBQRik5R+/+lTPBFDvKTnNupIWQBtFOsc+SlLHne+Wqf G8nv/HHAsGmJgyZ9IDjCVk5jDK2+0AWOzTiqNRz0bHY5QrpcAAlf87kbBY+WSg0a2BzU GoUk+w1ig73Zbcc0MDsi+F6kbv/0HyrUChdz7KQ2CHypLPgY7CdrmXn2jtjlY+AYIbVg Jd/F7HOFO5lOdnMQnD7TON2dlht20gllkJe4uapQUp6LmuUvDL7cmyT/u208Po9oaLPd gZIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=IlPddb0U; 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 r7-v6si15188954pgn.491.2018.07.13.16.44.29; Fri, 13 Jul 2018 16:44:45 -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=IlPddb0U; 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 S1731305AbeGNAAn (ORCPT + 99 others); Fri, 13 Jul 2018 20:00:43 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52928 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729762AbeGNAAn (ORCPT ); Fri, 13 Jul 2018 20:00:43 -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=BzhhUTWfymZlQdV1Ye90pVtOOYZ3lU/cYWkKSMbicck=; b=IlPddb0U+D+d4F5qWm/tjMAzBc QQtLpf3c+puVmxEf+iwBHNGTBdCzL/6ITnsL8zM0IGu2U1+DOBOf7l413GEPzzo39Q7YX7U6WXopt BQTjg9DAP16EcnE9nIvH3EciaeOSSQxuqtr4vcQ4+n5L+qOmSrwxV27D9N+YXw4RHpl00T2MLCkth 9+j0dF0++QITSU1E/sMh/H7ZN2tSJPJCepGvFH0oSi7bBMgj5pfpiu/4+uxalNnEmp5X00qFEcKcf HqncYaP8QzK6kLstvR6ejspKJOwhtZpOB3/MNirHljjgbmaVVGsGvGtL2R4UPB8JFBfDMzKNZ0yQw ivTwOsfQ==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=dragon.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fe7iJ-0005YA-6m; Fri, 13 Jul 2018 23:43:03 +0000 Subject: Re: [PATCH] kernel.h: Add for_each_if() To: 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 , Andy Shevchenko , 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> From: Randy Dunlap Message-ID: <79133322-b04b-f005-f1f6-25c28c5058e4@infradead.org> Date: Fri, 13 Jul 2018 16:42:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: <87bmbavhai.fsf@notabene.neil.brown.name> 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/13/2018 04:37 PM, NeilBrown wrote: > On Wed, Jul 11 2018, Andrew Morton wrote: > >> On Wed, 11 Jul 2018 13:51:08 +0200 Daniel Vetter wrote: >> >>> But I still have the situation that a bunch of maintainers acked this >>> and Andrew Morton defacto nacked it, which I guess means I'll keep the >>> macro in drm? The common way to go about this seems to be to just push >>> the patch series with the ack in some pull request to Linus and ignore >>> the people who raised questions, but not really my thing. >> >> Heh. >> >> But, am I wrong? Code which uses regular kernel style doesn't have >> these issues. We shouldn't be enabling irregular style - we should be >> making such sites more regular. The fact that the compiler generates a >> nice warning in some cases simply helps us with that. > > I think you are wrong .... or at least, not completely correct. > > I think it is perfectly acceptable in Linux to have code like: > > for (....) > if (x) > something(); > else > something_else(); > > Would you agree? If not, then I'm the one who is wrong. Otherwise.... coding-style.rst says: Also, use braces when a loop contains more than a single simple statement: > The problem is that for certain poorly written for_each_foo() macros, > such as blkg_for_each_descendant_pre() (and several others identified in > this patch series), writing > > blkg_for_each_descendant_pre(...) > if (x) > something(); > else > something_else(); > > will trigger a compiler warning. This is inconsistent with the > behaviour of a simple "for". > So I do think that the macros should be fixed, and I don't think that > sprinkling extra braces is an appropriate response. > > I'm not personally convinced that writing > if_no_else(cond) > is easier than just writing > if (!(cond)); else agreed. > in these macros, but I do think that the macros should be fixed and > maybe this is the path-of-least-resistance to getting it done. I'm not opposed to fixing some macros, but some of these macros are just ease-of-less-typing shortcuts. They don't improve readability at all; they harm it. (of course, that is just one opinion :) -- ~Randy