netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Daniel Machon <daniel.machon@microchip.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Lars Povlsen <lars.povlsen@microchip.com>,
	"Steen Hegelund" <Steen.Hegelund@microchip.com>,
	<horatiu.vultur@microchip.com>,
	<jensemil.schulzostergaard@microchip.com>,
	<UNGLinuxDriver@microchip.com>,
	Richard Cochran <richardcochran@gmail.com>, <horms@kernel.org>,
	<justinstitt@google.com>, <gal@nvidia.com>,
	<aakash.r.menon@gmail.com>, <netdev@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 00/15] net: sparx5: prepare for lan969x switch driver
Date: Wed, 2 Oct 2024 14:44:12 -0700	[thread overview]
Message-ID: <63e7cced-5eaf-43ba-bb2c-b7a8609bedd7@intel.com> (raw)
In-Reply-To: <20241002074714.uprnmhf5a2f2hyzw@DEN-DL-M70577>



On 10/2/2024 12:47 AM, Daniel Machon wrote:
> 
> Hi Jakob,
> 
> First off, thank you for your reviews - I really appreciate it.
> 
> Let me address your "variable scope" conerns:
> 
> I had the feeling that this could pontentially be somewhat contentious.
> 
> Basically, this comes down to making the least invasive changes to the
> existing driver code. With this approach:
> 
>     For the SPX5_CONST macro this means shorter lines, and less 80 char
>     wrapping.
> 
>     For the "*regs" variable this means not having to pass in the sparx5
>     pointer to *all* register macros, which requires changes *all* over
>     the code.
> 
> I thought the solution with an in-scope implicit variable was less
> invasive (and maybe even more readable?). Just my opinion, given the
> alternative.
>

Obviously there is style preference here, and someone working
day-in/day-out on the code is likely to know which macros have which
variable dependencies. As an external reviewer, I would not know that,
so I would find it surprising when looking at some code which passes a
parameter which is never directly used.

> Obviously I did a bit of research on this upfront, and I can point to
> *many* places where drivers do the exact same (not justifying the use,
> just pointing that out). Here is an intel driver that does the same [1]
> (look at the *hw variable)

Yea, I'm sure a lot of the old Intel drivers have bad examples :D I've
spent a career trying to improve this.

> 
> I am willing to come up with something different, if you really think
> this is a no-go. Let me hear your thoughts. I think this applies to your
> comments on #2, #3 and #6 as well.
> 

It seems that Jakub Kicinski wants the entire macro removed, and his
opinion as maintainer matters more than mine.

Personally, I'm not opposed to a macro itself especially if the direct
access starts to get very long. However, I think the parameter being
accessed should be, well, a parameter of the macro.

> /Daniel
> 
> [1] https://elixir.bootlin.com/linux/v6.12-rc1/source/drivers/net/ethernet/intel/igb/igb_main.c#L4746
> 
> 

As an example of *why* I don't like this practice: It took me a while to
realize the hw variable was implicit to wr32. And I worked on this driver.

Thanks,
Jake

      reply	other threads:[~2024-10-02 21:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 13:50 [PATCH net-next 00/15] net: sparx5: prepare for lan969x switch driver Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 01/15] net: sparx5: add support for private match data Daniel Machon
2024-10-01 17:43   ` Jacob Keller
2024-10-01 13:50 ` [PATCH net-next 02/15] net: sparx5: add indirection layer to register macros Daniel Machon
2024-10-01 17:52   ` Jacob Keller
2024-10-02  8:07     ` Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 03/15] net: sparx5: rename *spx5 to *sparx5 in a few places Daniel Machon
2024-10-01 17:54   ` Jacob Keller
2024-10-01 13:50 ` [PATCH net-next 04/15] net: sparx5: modify SPX5_PORTS_ALL macro Daniel Machon
2024-10-01 17:54   ` Jacob Keller
2024-10-01 13:50 ` [PATCH net-next 05/15] net: sparx5: add *sparx5 argument to a few functions Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 06/15] net: sparx5: add constants to match data Daniel Machon
2024-10-01 17:56   ` Jacob Keller
2024-10-02 12:47   ` Jakub Kicinski
2024-10-02 13:31     ` Daniel Machon
2024-10-02 14:33       ` Jakub Kicinski
2024-10-02 18:28         ` Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 07/15] net: sparx5: use SPX5_CONST for constants which already have a symbol Daniel Machon
2024-10-01 17:58   ` Jacob Keller
2024-10-01 13:50 ` [PATCH net-next 08/15] net: sparx5: use SPX5_CONST for constants which do not " Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 09/15] net: sparx5: add ops to match data Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 10/15] net: sparx5: ops out chip port to device index/bit functions Daniel Machon
2024-10-01 18:00   ` Jacob Keller
2024-10-02  7:48     ` Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 11/15] net: sparx5: ops out functions for getting certain array values Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 12/15] net: sparx5: ops out function for setting the port mux Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 13/15] net: sparx5: ops out PTP IRQ handler Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 14/15] net: sparx5: ops out function for DSM calendar calculation Daniel Machon
2024-10-01 13:50 ` [PATCH net-next 15/15] net: sparx5: add is_sparx5 macro and use it throughout Daniel Machon
2024-10-01 18:03 ` [PATCH net-next 00/15] net: sparx5: prepare for lan969x switch driver Jacob Keller
2024-10-02  7:47   ` Daniel Machon
2024-10-02 21:44     ` Jacob Keller [this message]

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-all 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=63e7cced-5eaf-43ba-bb2c-b7a8609bedd7@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=aakash.r.menon@gmail.com \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=horms@kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=justinstitt@google.com \
    --cc=kuba@kernel.org \
    --cc=lars.povlsen@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).