From: Hongbo Li <lihongbo22@huawei.com>
To: Andy Shevchenko <andy@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: <kees@kernel.org>, <jasowang@redhat.com>, <davem@davemloft.net>,
<edumazet@google.com>, <pabeni@redhat.com>,
<akpm@linux-foundation.org>, <linux-hardening@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper
Date: Wed, 4 Sep 2024 10:27:18 +0800 [thread overview]
Message-ID: <56a4c8ec-2cc1-4078-b5d9-fb128be3efeb@huawei.com> (raw)
In-Reply-To: <ZtcmjI-C3zfqjooc@smile.fi.intel.com>
On 2024/9/3 23:09, Andy Shevchenko wrote:
> On Tue, Sep 03, 2024 at 02:25:53PM +0800, Hongbo Li wrote:
>> On 2024/9/2 22:30, Willem de Bruijn wrote:
>>> Andy Shevchenko wrote:
>>>> On Sat, Aug 31, 2024 at 01:07:41PM -0700, Jakub Kicinski wrote:
>>>>> On Sat, 31 Aug 2024 17:58:38 +0800 Hongbo Li wrote:
>
> ...
>
>>>>>> netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n",
>>>>>> - arg ? "disabled" : "enabled");
>>>>>> + str_disabled_enabled(arg));
>>>>>
>>>>> You don't explain the 'why'. How is this an improvement?
>>>>> nack on this and 2 similar networking changes you sent
>>>>
>>>> Side opinion: This makes the messages more unified and not prone to typos
>>>> and/or grammatical mistakes. Unification allows to shrink binary due to
>>>> linker efforts on string literals deduplication.
>>>
>>> This adds a layer of indirection.
>>>
>>> The original code is immediately obvious. When I see the new code I
>>> have to take a detour through cscope to figure out what it does.
>> If they have used it once, there is no need for more jumps, because it's
>> relatively simple.
>>
>> Using a dedicated function seems very elegant and unified, especially for
>> some string printing situations, such as disable/enable. Even in today's
>> kernel tree, there are several different formats that appear:
>> 'enable/disable', 'enabled/disabled', 'en/dis'.
>
> Not to mention that the longer word is the more error prone the spelling.
>
>>> To me, in this case, the benefit is too marginal to justify that.
>
> Hongbo, perhaps you need to add a top comment to the string_choices.h to
> explain the following:
> 1) the convention to use is str_$TRUE_$FALSE(), where $TRUE and $FALSE the
> respective words printed;
> 2) the pros of having unified output,
> 3) including but not limited to the linker deduplication facilities, making
> the binary smaller.
>
> With that you may always point people to the ad-hoc documentation.
>
ok, thank you, and I can try it.
However, with these modifications, I'm not sure whether Willem and Jakub
agree with the changes. If they don't agree, then I'll have to remove
this example in the next version. In the future, we can guide other
developers to use these helpers directly instead of rewriting it themselves.
Thanks,
Hongbo
next prev parent reply other threads:[~2024-09-04 2:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-31 9:58 [PATCH -next 0/4] Introduce several opposite string choice helpers Hongbo Li
2024-08-31 9:58 ` [PATCH -next 1/4] lib/string_choices: " Hongbo Li
2024-08-31 9:58 ` [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper Hongbo Li
2024-08-31 20:07 ` Jakub Kicinski
2024-09-02 1:27 ` Hongbo Li
2024-09-02 6:10 ` Gal Pressman
2024-09-02 16:11 ` Jakub Kicinski
2024-09-02 10:49 ` Andy Shevchenko
2024-09-02 14:30 ` Willem de Bruijn
2024-09-03 6:25 ` Hongbo Li
2024-09-03 15:09 ` Andy Shevchenko
2024-09-04 2:27 ` Hongbo Li [this message]
2024-09-04 14:33 ` Jakub Kicinski
2024-08-31 9:58 ` [PATCH -next 3/4] mm: page_alloc: Make use of str_off_on helper Hongbo Li
2024-08-31 9:58 ` [PATCH net-next 4/4] net: sock: Make use of str_no_yes() helper Hongbo Li
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=56a4c8ec-2cc1-4078-b5d9-fb128be3efeb@huawei.com \
--to=lihongbo22@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=andy@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jasowang@redhat.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@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