From: "Marek Behún" <kabel@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Vinod Koul" <vkoul@kernel.org>,
"Kishon Vijay Abraham I" <kishon@ti.com>,
"Linux Phy" <linux-phy@lists.infradead.org>,
"Kees Cook" <keescook@chromium.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Daniel Scally" <djrscally@gmail.com>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Pali Rohár" <pali@kernel.org>,
josef.schlehofer@nic.cz
Subject: Re: [PATCH linux-phy v2 1/4] string.h: Add str_has_proper_prefix()
Date: Thu, 18 Aug 2022 22:12:36 +0200 [thread overview]
Message-ID: <20220818221236.7b16db07@thinkpad> (raw)
In-Reply-To: <CAHp75VfN1_0Wgop3Fx4DP2ECRTi9gUV87eUQhKgs4LfYGTzbpA@mail.gmail.com>
On Thu, 18 Aug 2022 22:56:14 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Thu, Aug 18, 2022 at 10:48 PM Marek Behún <kabel@kernel.org> wrote:
> > On Thu, 18 Aug 2022 22:10:58 +0300
> > Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > > On Wed, Aug 17, 2022 at 11:06 PM Marek Behún <kabel@kernel.org> wrote:
>
> ...
>
> > > Besides not the good naming (what 'proper' means),
> >
> > The naming comes from similar naming in math: proper subset is as
> > subset that is not equal to the superset. See
> > https://en.wikipedia.org/wiki/Substring :
> > "A proper prefix of a string is not equal to the string itself"
>
> It's nice to learn something, but I still think that name has too
> broad meaning(s) that may easily confuse the developers.
>
> >
> > > the entire function is not needed. You may simply call
> > >
> > > str_has_prefix() && p[len] != '\0';
> > >
> > > Correct?
> >
> > Do you mean that I should implement this function to simply return
> > str_has_prefix() && p[len] != '\0'
> > or that this function should not exist at all and I should do that in
> > the code where I would have used the function?
>
> The latter since this seems do not have users, except a single newcomer,
>
Just out of curiosity I grepped for all usages of str_has_prefix() and
there are some where it str_has_proper_prefix() could detect failure
earlier. For example in kernel/trace/trace_events_user.c in function
user_field_size().
Do you think I should propose converting those? There aren't that many
uses, so probably not.
Marek
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: "Marek Behún" <kabel@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Vinod Koul" <vkoul@kernel.org>,
"Kishon Vijay Abraham I" <kishon@ti.com>,
"Linux Phy" <linux-phy@lists.infradead.org>,
"Kees Cook" <keescook@chromium.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Daniel Scally" <djrscally@gmail.com>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Pali Rohár" <pali@kernel.org>,
josef.schlehofer@nic.cz
Subject: Re: [PATCH linux-phy v2 1/4] string.h: Add str_has_proper_prefix()
Date: Thu, 18 Aug 2022 22:12:36 +0200 [thread overview]
Message-ID: <20220818221236.7b16db07@thinkpad> (raw)
In-Reply-To: <CAHp75VfN1_0Wgop3Fx4DP2ECRTi9gUV87eUQhKgs4LfYGTzbpA@mail.gmail.com>
On Thu, 18 Aug 2022 22:56:14 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Thu, Aug 18, 2022 at 10:48 PM Marek Behún <kabel@kernel.org> wrote:
> > On Thu, 18 Aug 2022 22:10:58 +0300
> > Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > > On Wed, Aug 17, 2022 at 11:06 PM Marek Behún <kabel@kernel.org> wrote:
>
> ...
>
> > > Besides not the good naming (what 'proper' means),
> >
> > The naming comes from similar naming in math: proper subset is as
> > subset that is not equal to the superset. See
> > https://en.wikipedia.org/wiki/Substring :
> > "A proper prefix of a string is not equal to the string itself"
>
> It's nice to learn something, but I still think that name has too
> broad meaning(s) that may easily confuse the developers.
>
> >
> > > the entire function is not needed. You may simply call
> > >
> > > str_has_prefix() && p[len] != '\0';
> > >
> > > Correct?
> >
> > Do you mean that I should implement this function to simply return
> > str_has_prefix() && p[len] != '\0'
> > or that this function should not exist at all and I should do that in
> > the code where I would have used the function?
>
> The latter since this seems do not have users, except a single newcomer,
>
Just out of curiosity I grepped for all usages of str_has_prefix() and
there are some where it str_has_proper_prefix() could detect failure
earlier. For example in kernel/trace/trace_events_user.c in function
user_field_size().
Do you think I should propose converting those? There aren't that many
uses, so probably not.
Marek
next prev parent reply other threads:[~2022-08-18 20:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 20:03 [PATCH linux-phy v2 0/4] mvebu a3720 comphy: Fix serdes transmit amplitude Marek Behún
2022-08-17 20:03 ` Marek Behún
2022-08-17 20:03 ` [PATCH linux-phy v2 1/4] string.h: Add str_has_proper_prefix() Marek Behún
2022-08-17 20:03 ` Marek Behún
2022-08-18 19:10 ` Andy Shevchenko
2022-08-18 19:10 ` Andy Shevchenko
2022-08-18 19:48 ` Marek Behún
2022-08-18 19:48 ` Marek Behún
2022-08-18 19:56 ` Andy Shevchenko
2022-08-18 19:56 ` Andy Shevchenko
2022-08-18 20:03 ` Marek Behún
2022-08-18 20:03 ` Marek Behún
2022-08-18 20:12 ` Marek Behún [this message]
2022-08-18 20:12 ` Marek Behún
2022-08-17 20:03 ` [PATCH linux-phy v2 2/4] device property: Add {fwnode/device}_get_tx_p2p_amplitude() Marek Behún
2022-08-17 20:03 ` Marek Behún
2022-08-18 19:22 ` Andy Shevchenko
2022-08-18 19:22 ` Andy Shevchenko
2022-08-18 19:41 ` Marek Behún
2022-08-18 19:41 ` Marek Behún
2022-08-18 20:10 ` Andy Shevchenko
2022-08-18 20:10 ` Andy Shevchenko
2022-08-18 20:17 ` Marek Behún
2022-08-18 20:17 ` Marek Behún
2022-08-17 20:03 ` [PATCH linux-phy v2 3/4] phy: marvell: phy-mvebu-a3700-comphy: Support changing tx amplitude for ethernet Marek Behún
2022-08-17 20:03 ` Marek Behún
2022-08-17 20:03 ` [PATCH linux-phy v2 4/4] arm64: dts: armada-3720-turris-mox: Change comphy tx amplitude for 2500base-x mode Marek Behún
2022-08-17 20:03 ` Marek Behún
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=20220818221236.7b16db07@thinkpad \
--to=kabel@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=djrscally@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=josef.schlehofer@nic.cz \
--cc=keescook@chromium.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=pali@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=vkoul@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.