Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] dsa: Use str_enable_disable-like helpers
Date: Thu, 16 Jan 2025 13:21:44 +0200	[thread overview]
Message-ID: <20250116112144.vtgaelbpq4lmipd6@skbuf> (raw)
In-Reply-To: <20250115194703.117074-1-krzysztof.kozlowski@linaro.org>

On Wed, Jan 15, 2025 at 08:47:03PM +0100, Krzysztof Kozlowski wrote:
> Replace ternary (condition ? "enable" : "disable") syntax with helpers
> from string_choices.h because:
> 1. Simple function call with one argument is easier to read.  Ternary
>    operator has three arguments and with wrapping might lead to quite
>    long code.
> 2. Is slightly shorter thus also easier to read.
> 3. It brings uniformity in the text - same string.
> 4. Allows deduping by the linker, which results in a smaller binary
>    file.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> 
> I have more of similar patches in progress, but before I start spamming
> you with this let me know if you find such code more readable, specially
> for more complex conditions in ternary operators.

This is a positive change (especially because of reason #4), but I have
2 process-related complaints for the future (especially if more patches
are coming):

- "net: dsa: " for the commit prefix for patches on the "net/dsa/"
  core folder, and "net: dsa: $(driver name): " for patches on
  "drivers/net/dsa/$(driver name)", please
- I have observed a tendency for people with a Marvell DSA switch to
  not care about a Realtek switch and vice versa. Sometimes these people
  backport patches. It would be good for patches which can be split per
  driver to be split per driver, otherwise there is a risk that trivial
  context changes create a deep web of avoidable dependencies.

Not a reason to resend for this right now, just something to be aware of.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

Side note: what are you going to do in the hypothetical situation when
the converted string used to be capitalized (like we have in this set
with "Force"/"Unforce")? Create str_Enable_Disable()?

  parent reply	other threads:[~2025-01-16 11:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-15 19:47 [PATCH net-next] dsa: Use str_enable_disable-like helpers Krzysztof Kozlowski
2025-01-16  9:44 ` Linus Walleij
2025-01-16 11:21 ` Vladimir Oltean [this message]
2025-01-20  9:30 ` patchwork-bot+netdevbpf

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=20250116112144.vtgaelbpq4lmipd6@skbuf \
    --to=olteanv@gmail.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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