[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250116112144.vtgaelbpq4lmipd6@skbuf>
Date: Thu, 16 Jan 2025 13:21:44 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Andrew Lunn <andrew@...n.ch>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Linus Walleij <linus.walleij@...aro.org>,
Alvin Šipraga <alsi@...g-olufsen.dk>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] dsa: Use str_enable_disable-like helpers
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@...aro.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@...il.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()?
Powered by blists - more mailing lists