public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: derailing into patch style discussion
Date: Thu, 12 Apr 2018 20:48:58 +0200	[thread overview]
Message-ID: <39a257c1-a336-45f6-d3ec-cd295cb812de@redhat.com> (raw)
In-Reply-To: <20180412181359.rvt2s4fhyuxmj465@bivouac.eciton.net>

On 04/12/18 20:13, Leif Lindholm wrote:
> Since you already have my r-b on the set, I'll pick up the style
> topic, partly because I'm not sure if I've ever explained my
> thinking publicly in words that anyone other than Ard understands.
> 
> On Thu, Apr 12, 2018 at 07:45:19PM +0200, Laszlo Ersek wrote:
>>> Well, there are a couple of places where I could nitpick on
>>> alphabetical sorting of includes,
>>
>> And, believe me, you would have my total agreement :), but in such
>> cases, there's always a fork in the road: (a) add a separate patch that
>> first sorts the includes and [LibraryClasses], without functional
>> changes, or (b) just stick with the existing disorder, and get in and
>> out as surgically as possible. My personal preference is (a), but it has
>> drawn disagreement -- even accusations of pedantry :) :) --, and/or
>> suggestions to squash such patches with functional changes, in the past,
>> so I trod more lightly now. Rest assured, I didn't *miss* those places,
>> I just elected to close my eyes! ;)
> 
> Right :)
> 
> So, yes - I do strongly agree with the idea of keeping functionality
> and style changes separate (ask Evan), so that wasn't exactly what I
> was referring to.
> 
> In general my internal "optimal" situation is one where the purely
> functional diff leaves the code in a (quite subjectively, since it's
> still not conformant) better state on average than it was.
> 
> My subjective mark of optimal is that which would minimise any
> subsequent patch that was _only_ a style cleanup.
> 
> To pick an example from this set (1/10):
> diff --git a/Omap35xxPkg/InterruptDxe/InterruptDxe.inf
> b/Omap35xxPkg/InterruptDxe/InterruptDxe.inf
> index 6deb8c3f675c..61ad89af2758 100644
> --- a/Omap35xxPkg/InterruptDxe/InterruptDxe.inf
> +++ b/Omap35xxPkg/InterruptDxe/InterruptDxe.inf
> @@ -41,14 +41,14 @@ [LibraryClasses]
>    PrintLib
>    UefiDriverEntryPoint
>    IoLib
>    ArmLib
> 
>  [Protocols]
>  -  gHardwareInterruptProtocolGuid
>  -  gEfiCpuArchProtocolGuid
>  +  gHardwareInterruptProtocolGuid  ## PRODUCES
>  +  gEfiCpuArchProtocolGuid         ## CONSUMES ## NOTIFY
> 
> ---
> This one is pretty straightforward - without touching any non-modified
> lines, these _could_ be reordered alphabetically.
> 
> (Yes, that change may have functional side-effects, but only on
> undefined behaviour, so no different from rebasing to a version with
> newer BaseTools can give you.)
> 
> Where the minimum diff logic comes in is in situations like (6/10):
> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
> b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
> index 812dafd065b2..c40ac27a6599 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
> @@ -28,12 +28,13 @@ [Sources.common]
>    NorFlashBlockIoDxe.c
> 
>  [Packages]
>    MdePkg/MdePkg.dec
>    MdeModulePkg/MdeModulePkg.dec
>    ArmPlatformPkg/ArmPlatformPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> 
> ---
> Applying my "optimal" rule here would have meant inserting the new
> line before MdePkg/MdeModulePkg .decs instead. That way a cleanup
> patch would end up doing
> 
> [Packages]
> +  ArmPlatformPkg/ArmPlatformPkg.dec
>    EmbeddedPkg/EmbeddedPkg.dec
>    MdePkg/MdePkg.dec
>    MdeModulePkg/MdeModulePkg.dec
> -  ArmPlatformPkg/ArmPlatformPkg.dec
> 
> instead of
> 
> [Packages]
> -  MdePkg/MdePkg.dec
> -  MdeModulePkg/MdeModulePkg.dec
>    ArmPlatformPkg/ArmPlatformPkg.dec
>    EmbeddedPkg/EmbeddedPkg.dec
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> 
> 
> Anyway, this is all an aside - I just thought I would give you an
> insight into the mind of Leif.

I do see the point -- basically, even if we don't imlement separate
cleanups, and just add the functional changes on top of whatever we
already have, if there are multiple ways to keep the functional changes
purely functional and focused, we had better select the one that at
least doesn't make the style worse. Using your [Packages] example, it's
possible *not* to increase the disorder, without actually sorting those
lines. I fully admit this eluded me -- I considered "messy" all-or-nothing.

I'll try to remember this next time. (It's honestly a bit difficult for
me, because if I take the time & effort to be considerate like this, I'd
mostly (though perhaps not always) just write the patch that cleans up
first.)

Thanks!
Laszlo


  reply	other threads:[~2018-04-12 18:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12  0:55 [PATCH 00/10] ArmPkg, ArmPlatformPkg, ArmVirtPkg, EmbeddedPkg, Omap35xxPkg: depex fixes Laszlo Ersek
2018-04-12  0:55 ` [PATCH 01/10] Omap35xxPkg/InterruptDxe: replace CPU Arch Protocol depex with notify Laszlo Ersek
2018-04-12  0:55 ` [PATCH 02/10] ArmPkg/ArmGicDxe: annotate protocol usage in "ArmGicDxe.inf" Laszlo Ersek
2018-04-12  0:55 ` [PATCH 03/10] ArmPkg/CpuDxe: order CpuDxe after ArmGicDxe via protocol depex Laszlo Ersek
2018-04-12  0:55 ` [PATCH 04/10] EmbeddedPkg: introduce NvVarStoreFormattedLib Laszlo Ersek
2018-04-12  0:55 ` [PATCH 05/10] ArmPlatformPkg/NorFlashDxe: initialize varstore headers eagerly Laszlo Ersek
2018-04-12  0:55 ` [PATCH 06/10] ArmPlatformPkg/NorFlashDxe: cue the variable driver with NvVarStoreFormatted Laszlo Ersek
2018-04-12  0:55 ` [PATCH 07/10] ArmPlatformPkg/NorFlashDxe: depend on gEfiCpuArchProtocolGuid Laszlo Ersek
2018-04-12  0:55 ` [PATCH 08/10] ArmPlatformPkg/PL031RealTimeClockLib: " Laszlo Ersek
2018-04-12  0:55 ` [PATCH 09/10] ArmVirtPkg/PlatformHasAcpiDtDxe: depend on gEfiVariableArchProtocolGuid Laszlo Ersek
2018-04-12  6:28   ` Ard Biesheuvel
2018-04-12  9:05     ` Laszlo Ersek
2018-04-12 10:06       ` Ard Biesheuvel
2018-04-12 15:16       ` Gao, Liming
2018-04-12 16:53         ` Laszlo Ersek
2018-04-12  0:55 ` [PATCH 10/10] ArmVirtPkg/ArmVirtQemu: hook NvVarStoreFormattedLib into VariableRuntimeDxe Laszlo Ersek
2018-04-12 10:09 ` [PATCH 00/10] ArmPkg, ArmPlatformPkg, ArmVirtPkg, EmbeddedPkg, Omap35xxPkg: depex fixes Ard Biesheuvel
2018-04-12 13:39   ` Steve Capper
2018-04-12 16:49     ` Laszlo Ersek
2018-04-12 16:44   ` Laszlo Ersek
2018-04-12 17:23   ` Leif Lindholm
2018-04-12 17:45     ` Laszlo Ersek
2018-04-12 18:13       ` derailing into patch style discussion Leif Lindholm
2018-04-12 18:48         ` Laszlo Ersek [this message]
2018-04-12 16:51 ` [PATCH 00/10] ArmPkg, ArmPlatformPkg, ArmVirtPkg, EmbeddedPkg, Omap35xxPkg: depex fixes Supreeth Venkatesh
2018-04-12 17:46   ` Laszlo Ersek
2018-04-12 19:29 ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39a257c1-a336-45f6-d3ec-cd295cb812de@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox