Re: [PATCH] ufs: Use str_enable_disable-like helpers

From: Krzysztof Kozlowski
Date: Wed Jan 15 2025 - 14:20:57 EST


On 15/01/2025 18:53, Bart Van Assche wrote:
> On 1/14/25 12:07 PM, Krzysztof Kozlowski wrote:
>> 2. Is slightly shorter thus also easier to read.
>
> Does this change really make code easier to read? It forces readers
> of the code to look up a function definition. Isn't there a general

There is no general preference, up to you.

> preference in the Linux kernel to inline function definitions if the
> function body is shorter than or close to the length of the function
> name? I'm referring to functions like this one:
>
> static inline const char *str_up_down(bool v)
> {
> return v ? "up" : "down";
> }
>
> Bart.


It's subjective - in some places ternary is really complicating, from my
other patch:

data & XCSI_DLXINFR_SOTERR ? "true" : "false",
video->hq_mode ? "on" : "off", video->jpeg_hq_quality);

note that's ternary is split here:

dstat & BT848_DSTATUS_HLOC
? "yes" : "no");

I understand if you don't find the code here better.

Best regards,
Krzysztof