Received: by 10.213.65.68 with SMTP id h4csp569784imn; Tue, 13 Mar 2018 13:24:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELtO7M/LyrluU6mVOUMGljIZ/TsLgJX0iPnLMTUOV+8zufoN1Ci8+iMa5d4IuYDV97KeqCK8 X-Received: by 2002:a17:902:4201:: with SMTP id g1-v6mr1727046pld.62.1520972683383; Tue, 13 Mar 2018 13:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520972683; cv=none; d=google.com; s=arc-20160816; b=SlRjEnZfyBbjLwKsvviHPFsyLDAiGinDRSlHR/A5W1nQ0IcLxLRRNXEjI6/EHqyfWM JreRUqhTUdZ6YbDSpb7oE+F1l/rP3+Ipp1cERROFlOmyNfpguibYUUwCCRbPdlH1yGOC 7Aq0RWkVSmfESASR3go0JR2b0leY0T5Nd//9hoxcMqR4wu3SjDtXlQoIoxxDiFEr2pry sK8N2XeED2vytaUvcQLn5mD/9NguLw7/TBHoYI2pYKctPyilJtRbCA/gnoAme5MtBmi3 D3J9/k4DnkpnwKfy2Fut5uPSJF20rC6A/6w/kzbi6QpaxgyZdgy2CoOcJv0Ojj15Ugiv 2smQ== 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=RM29mda18RYiOnSyEjWFtsn3Lk3tqddgKBnqN8GK86o=; b=RPBhTfRUW7jsMO2a2GdXMz5l3qpgzggcK2Gv++ghErZeYEg8Mo7VgO//nBRy9uKYS1 DiDHJVxvKd1VqhAq2jOcnCqCEtRKdGNB8mvxthknYEJMA14S2kee+6d37eBEdPiMVuIm x7+yILgcgAWJ+CfmEj7qhCvwrQWLC0y+yR0AyaZr/+H/u47eh+aB6KRgChHXDZgcg9DU sxXJ/YkalXjTmBFb/XHILZ7VSvsEh5J8KYv3XGhTj00R6owIK2xC3/2Z/4vcyFmH9942 Kcs9wJ0JW4xkSKQtufyLCfe7U0GkWY2qgh3BdNv6lSYbu4/eizHjjanCc5028MBL5PMe KTVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ht7oAROa; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69-v6si658388pla.390.2018.03.13.13.24.28; Tue, 13 Mar 2018 13:24:43 -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=pass header.i=@gmail.com header.s=20161025 header.b=ht7oAROa; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752800AbeCMUXR (ORCPT + 99 others); Tue, 13 Mar 2018 16:23:17 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:40475 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752392AbeCMUXQ (ORCPT ); Tue, 13 Mar 2018 16:23:16 -0400 Received: by mail-qt0-f195.google.com with SMTP id y6so1093701qtm.7 for ; Tue, 13 Mar 2018 13:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=RM29mda18RYiOnSyEjWFtsn3Lk3tqddgKBnqN8GK86o=; b=ht7oAROa0xLTGN6uc0s6vaBF9Aiofu4J+OCyROvjxfhWXpPEKri6eoCA9+O4P9c6Go lBbOGLdL0aRfWN9bQ9LTfsP+qqf1M9Ca0V8TdkHdb6UjbLMCP9hI/EJ8sjwB1SLCtZwv +JVCkdOaluFdoh1b5WyUJljXyqVbPcVew05w/9DxUf0f80bRSrvTxVHTikfiGlxy9GM5 qrVV576y1bcD5X3qDYJWhio69DrkpZHYafEPcaf5+O1v3fYgySHF8t+RrRYUw+eynp+/ vaOMHSLxfqJL8J/Aes9QCY7Ri6BN9UOjsEMaZORR4oOvf5WL8I7+3g/2ZSpKjo6fLun+ FuwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=RM29mda18RYiOnSyEjWFtsn3Lk3tqddgKBnqN8GK86o=; b=BonIuGGYb+RCLNv7/ktsdQcNlmuXaYStYHfEiLW5n8p2pSmpZSVPO3gVXOAPO0H4T0 Ub5x0AgsFUztHPwg1mBNzVnUBiE4iUCsGAkS5AfYG7QcA/SMxtv1u0Si0gkiHJF0XMDt 3wNtQGqFvOphPblTMCD/KLTXsQGbqF9/3vQJkhJXhqorfgU7CZkMbglqEn6Nuik729cM gK1zBTJoblPfq4qHf7yX3m0W/mgNY+Uu/alTRsXpgNMlDyQjZxfTImGbz2s6PbA6fleW mP59+3defLfd0GT54CAVZR+DulTb7YiD43QshWqaMOtIt3KTqd8pFMGJ7lMvpR5M1bO/ 8kFA== X-Gm-Message-State: AElRT7HNA3fdHPifNgYsJK4Q5n88ubkj3eU5jpivAmvPAvX4e5XcxvXw +wxboTb+02aaWmPh3XIhb8B6B3SadZZ5mWE30mIUeYkS X-Received: by 10.237.59.253 with SMTP id s58mr3084471qte.83.1520972595779; Tue, 13 Mar 2018 13:23:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Tue, 13 Mar 2018 13:23:15 -0700 (PDT) In-Reply-To: <30bd9559-0e44-bd18-6b9a-ec35bc8276f3@amd.com> References: <152055660594.63229.5131049527614494130.stgit@sosxen2.amd.com> <152055664720.63229.16209149030018336339.stgit@sosxen2.amd.com> <30bd9559-0e44-bd18-6b9a-ec35bc8276f3@amd.com> From: Andy Shevchenko Date: Tue, 13 Mar 2018 22:23:15 +0200 Message-ID: Subject: Re: [PATCH v2 1/5] iommu/amd - Add debugfs support To: Gary R Hook Cc: iommu@lists.linux-foundation.org, Joerg Roedel , Linux Kernel Mailing List 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 Tue, Mar 13, 2018 at 8:54 PM, Gary R Hook wrote: > On 03/13/2018 12:16 PM, Andy Shevchenko wrote: >> On Fri, Mar 9, 2018 at 2:50 AM, Gary R Hook wrote: >>> +#include >>> +#include >>> +#include >> >> >> Keep in order? > What order would that be? These few needed files are listed in the same > order as which they appear in amd_iommu.c. I'm gonna need a preference > spelled out, please (and a rationale, so I may better understand). To increase readability and avoid potential header duplication (here is can bus protocol implementation where the problem exists for real, even in new code!) >>> +/* DebugFS helpers */ >>> +#define OBUFP (obuf + oboff) >>> +#define OBUFLEN obuflen >>> +#define OBUFSPC (OBUFLEN - oboff) >>> +#define OSCNPRINTF(fmt, ...) \ >>> + scnprintf(OBUFP, OBUFSPC, fmt, ## __VA_ARGS__) >> >> >> I don't see any advantages of this. Other way around, they will simple >> makes things hard to read an understand in place. > > > I used this technique in the CCP driver code (where it was accepted), in an > effort to do the opposite of what you claim: make the code more readable. > Given the 80 column limit, a large number of arguments, and very long > statements, IMO something needs to give. I don't find the use of #defines to > be obfuscating. > > I'm not trying to argue, but rather simply state the perspective / reasoning > I used to create a source file I feel is manageable. I have 17 more iommu > patches built upon this strategy, and this seems to be advantageous for all > of them. It's fine to me as long as it's fine to maintainer, but honestly speaking I would avoid such code as much as possible. Imagine that your "advantage" basically becomes disadvantage to everyone else who is not familiar with the code. Each time I see macro in the code, I would need to at least step on it, run cscope, read, and come back. And at this point of time I already forgot what this code is doing, it does use sNprintf() or sCNprintf() or whatever wrapper on top of either... >>> + for (i = start ; i <= end ; i++) >> Missed {} > Wasn't sure about the M.O. given that the body of this loop is a single if > statement. And I don't see anywhere in > https://www.kernel.org/doc/html/latest/process/coding-style.html > in section 3.1 where curly braces are called for in this situation. May I > ask for clarification on the style rule, please? You can do nothing, though I'm guided by the end of section 3.0 (though it tells only about 'if' case). >>> @@ -89,6 +89,7 @@ >>> #define ACPI_DEVFLAG_ATSDIS 0x10000000 >>> >>> #define LOOP_TIMEOUT 100000 >>> + >>> /* >>> * ACPI table definitions >>> * >> Doesn't belong to the patch. > I'm sorry, I don't understand. The added blank line doesn't belong to the > patch? Correct. -- With Best Regards, Andy Shevchenko