[PATCH v2] gpio: Use str_enable_disable-like helpers

Krzysztof Kozlowski krzysztof.kozlowski at linaro.org
Wed Jan 15 05:00:14 PST 2025


On 15/01/2025 12:51, Linus Walleij wrote:
> On Tue, Jan 14, 2025 at 8:14 PM Krzysztof Kozlowski
> <krzysztof.kozlowski at linaro.org> 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.
>>
>> Reviewed-by: Florian Fainelli <florian.fainelli at broadcom.com>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> 
> For a while I was critical about the string helpers but since both Andy
> and Krzysztof like them, I will consider myself convinced and start to
> like them instead.

It is pretty subjective, so I also find reasonable not to accept them to
your subsystem. To me they bring more benefits in complicated cases like:
	(data_in ^ in_pol) & msk  ? "hi" : "lo",

or from pinctr (note the line break):

			seq_puts(s, pin->output_value ?
				 "high" : "low");

Anyway, thanks for review!

Best regards,
Krzysztof



More information about the linux-arm-kernel mailing list