From: Steven Rostedt <rostedt@goodmis.org>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: "Juri Lelli" <juri.lelli@redhat.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Takashi Iwai" <tiwai@suse.de>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Linus Walleij" <linus.walleij@linaro.org>,
dri-devel@lists.freedesktop.org,
"Jaroslav Kysela" <perex@perex.cz>,
"Ben Segall" <bsegall@google.com>,
"Perry Yuan" <perry.yuan@amd.com>,
"Prashant Gaikwad" <pgaikwad@nvidia.com>,
"Pavel Machek" <pavel@ucw.cz>,
"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
linux-clk@vger.kernel.org,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Abel Wu" <wuyun.abel@bytedance.com>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Karol Herbst" <kherbst@redhat.com>,
"Samuel Holland" <samuel@sholland.org>,
"Sebastian Reichel" <sebastian.reichel@collabora.com>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
linux-acpi@vger.kernel.org, "Danilo Krummrich" <dakr@redhat.com>,
"Mel Gorman" <mgorman@suse.de>,
linux-sunxi@lists.linux.dev, "Guenter Roeck" <linux@roeck-us.net>,
"Jean Delvare" <jdelvare@suse.com>,
linux-pm@vger.kernel.org,
"Potnuri Bharat Teja" <bharat@chelsio.com>,
"James Morris" <jmorris@namei.org>,
linux-sound@vger.kernel.org,
"Thomas Gleixner" <tglx@linutronix.de>,
linux-omap@vger.kernel.org,
"Zhihao Cheng" <chengzhihao1@huawei.com>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"Niklas Cassel" <cassel@kernel.org>,
"Scott Branden" <sbranden@broadcom.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
"Dmitry Kasatkin" <dmitry.kasatkin@gmail.com>,
"Tejun Heo" <tj@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Elad Nachman" <enachman@marvell.com>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Lukasz Luba" <lukasz.luba@arm.com>,
linux-fbdev@vger.kernel.org, linux-usb@vger.kernel.org,
"Zefan Li" <lizefan.x@bytedance.com>,
nouveau@lists.freedesktop.org,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"Clemens Ladisch" <clemens@ladisch.de>,
"Mimi Zohar" <zohar@linux.ibm.com>,
"Mahesh J Salgaonkar" <mahesh@linux.ibm.com>,
"Hu Ziji" <huziji@marvell.com>,
"Eric Dumazet" <edumazet@google.com>,
keyrings@vger.kernel.org, "Oliver O'Halloran" <oohall@gmail.com>,
linux-i2c@vger.kernel.org,
"Gregory Greenman" <gregory.greenman@intel.com>,
"Ingo Molnar" <mingo@kernel.org>,
linux-security-module@vger.kernel.org,
"Valentin Schneider" <vschneid@redhat.com>,
"Corey Minyard" <minyard@acm.org>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Lee Jones" <lee@kernel.org>, "Hugh Dickins" <hughd@google.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
linux-rockchip@lists.infradead.org,
linux-trace-kernel@vger.kernel.org,
"Andi Shyti" <andi.shyti@kernel.org>,
"Robert Richter" <rrichter@amd.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Brian Foster" <bfoster@redhat.com>,
"Maxime Ripard" <mripard@kernel.org>,
linux-gpio@vger.kernel.org, "Jason Baron" <jbaron@akamai.com>,
linux-rpi-kernel@lists.infradead.org,
"Bjorn Helgaas" <bhelgaas@google.com>,
cgroups@vger.kernel.org, "Allen Pais" <apais@linux.microsoft.com>,
linux-arm-kernel@lists.infradead.org,
"Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Stephen Boyd" <sboyd@kernel.org>,
"Roberto Sassu" <roberto.sassu@huawei.com>,
linux-integrity@vger.kernel.org,
"Daniel Bristot de Oliveira" <bristot@redhat.com>,
"Len Brown" <lenb@kernel.org>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Miri Korenblit" <miriam.rachel.korenblit@intel.com>,
"Arseniy Krasnov" <AVKrasnov@sberdevices.ru>,
"Ulf Hansson" <ulf.hansson@linaro.org>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
linux-pci@vger.kernel.org,
"Michael Turquette" <mturquette@baylibre.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
alsa-devel@alsa-project.org, "Nuno Sa" <nuno.sa@analog.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
linux-mtd@lists.infradead.org, linux-hardening@vger.kernel.org,
linux-phy@lists.infradead.org,
"Jiri Slaby" <jirislaby@kernel.org>,
linux-staging@lists.linux.dev,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Nikita Kravets" <teackot@gmail.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Chen-Yu Tsai" <wens@csie.org>,
"Abdel Alkuor" <abdelalkuor@geotab.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Lyude Paul" <lyude@redhat.com>,
"Kees Cook" <keescook@chromium.org>,
"Ray Jui" <rjui@broadcom.com>,
intel-gfx@lists.freedesktop.org,
"Johannes Berg" <johannes.berg@intel.com>,
"Paul Moore" <paul@paul-moore.com>,
"Mark Brown" <broonie@kernel.org>,
"Borislav Petkov" <bp@alien8.de>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Stanley Chang" <stanley_chang@realtek.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
openipmi-developer@list
Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string()
Date: Tue, 4 Jun 2024 11:52:35 -0400 [thread overview]
Message-ID: <20240604115235.044acfd6@gandalf.local.home> (raw)
In-Reply-To: <87tti9cfry.fsf@intel.com>
On Tue, 04 Jun 2024 10:45:37 +0300
Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Sun, 02 Jun 2024, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > Make two APIs look similar. Hence convert match_string() to be
> > a 2-argument macro. In order to avoid unneeded churn, convert
> > all users as well. There is no functional change intended.
>
> Why do we think it's a good idea to increase and normalize the use of
> double-underscore function names across the kernel, like
> __match_string() in this case? It should mean "reserved for the
> implementation, not to be called directly".
>
> If it's to be used directly, it should be named accordingly, right?
>
> Being in line with __sysfs_match_string() isn't a great argument alone,
> because this adds three times the number of __match_string() calls than
> there are __sysfs_match_string() calls. It's not a good model to follow.
> Arguably both should be renamed.
Agreed. I want to get rid of any functions starting with an underscore
except for those that are basically the same function used internally for
convenience.
Perhaps "match_string_dynamic()"? Where it is used for dynamically
allocated arrays without known size. Or, allow a third parameter for
dynamic arrays.
#define match_string(_a, _s, ...)
char _______STR[] = __stringify((__VA_ARGS__)); \
if (sizeof(_______STR) > 3) \
__match_string(_a, _s, ##__VA_ARGS__); \
else \
__match_string(_a, _s, ARRAY_SIZE(_a));
What the above stringify((__VA_ARGS__)) does is to check the size of any
args added to match_string(). if there isn't any, it will turn into:
"()\0", which is of size 3. If you add an argument, it will be:
"(<arg>)\0", which will have a size greater than three.
(trace_printk() does this trick in include/linux/kernel.h).
This way, both:
match_string(array, sting);
or
match_string(array, string, size);
will work.
-- Steve
next prev parent reply other threads:[~2024-06-04 18:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-02 15:57 [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string() Andy Shevchenko
2024-06-03 22:00 ` Bjorn Helgaas
2024-06-04 1:29 ` Damien Le Moal
2024-06-04 1:37 ` Zhihao Cheng
2024-06-04 6:42 ` Daniel Bristot de Oliveira
2024-06-04 7:25 ` Heiko Stübner
2024-06-04 7:45 ` Jani Nikula
2024-06-04 15:52 ` Steven Rostedt [this message]
2024-06-10 8:08 ` Linus Walleij
2024-06-04 7:55 ` Vinod Koul
2024-06-04 7:55 ` Wolfram Sang
2024-06-04 8:23 ` Sakari Ailus
2024-06-04 8:28 ` Hans de Goede
2024-06-04 13:41 ` Andi Shyti
2024-06-04 18:25 ` Rodrigo Vivi
2024-06-04 18:42 ` Linus Torvalds
2024-06-05 4:28 ` Gautham R. Shenoy
2024-06-05 11:17 ` AngeloGioacchino Del Regno
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=20240604115235.044acfd6@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=AVKrasnov@sberdevices.ru \
--cc=abdelalkuor@geotab.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=andi.shyti@kernel.org \
--cc=andrew@lunn.ch \
--cc=apais@linux.microsoft.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bfoster@redhat.com \
--cc=bharat@chelsio.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=bristot@redhat.com \
--cc=broonie@kernel.org \
--cc=bsegall@google.com \
--cc=cassel@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=chengzhihao1@huawei.com \
--cc=clemens@ladisch.de \
--cc=dakr@redhat.com \
--cc=daniel.lezcano@linaro.org \
--cc=daniel@ffwll.ch \
--cc=dave.hansen@linux.intel.com \
--cc=dietmar.eggemann@arm.com \
--cc=dmitry.kasatkin@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=enachman@marvell.com \
--cc=gautham.shenoy@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@bootlin.com \
--cc=gregory.greenman@intel.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=heiko@sntech.de \
--cc=hkallweit1@gmail.com \
--cc=hughd@google.com \
--cc=huziji@marvell.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jbaron@akamai.com \
--cc=jdelvare@suse.com \
--cc=jernej.skrabec@gmail.com \
--cc=jirislaby@kernel.org \
--cc=jmorris@namei.org \
--cc=johannes.berg@intel.com \
--cc=jonathanh@nvidia.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=juri.lelli@redhat.com \
--cc=keescook@chromium.org \
--cc=keyrings@vger.kernel.org \
--cc=kherbst@redhat.com \
--cc=kishon@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lee@kernel.org \
--cc=lenb@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lizefan.x@bytedance.com \
--cc=lukasz.luba@arm.com \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mahesh@linux.ibm.com \
--cc=matthias.bgg@gmail.com \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=minyard@acm.org \
--cc=miriam.rachel.korenblit@intel.com \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=naveen.n.rao@linux.ibm.com \
--cc=nouveau@lists.freedesktop.org \
--cc=nuno.sa@analog.com \
--cc=oohall@gmail.com \
--cc=openipmi-developer@list \
--cc=pabeni@redhat.com \
--cc=paul@paul-moore.com \
--cc=pavel@ucw.cz \
--cc=perex@perex.cz \
--cc=perry.yuan@amd.com \
--cc=peterz@infradead.org \
--cc=pgaikwad@nvidia.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rjui@broadcom.com \
--cc=roberto.sassu@huawei.com \
--cc=rodrigo.vivi@intel.com \
--cc=rrichter@amd.com \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=sbranden@broadcom.com \
--cc=sebastian.reichel@collabora.com \
--cc=serge@hallyn.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=stanley_chang@realtek.com \
--cc=teackot@gmail.com \
--cc=tglx@linutronix.de \
--cc=tiwai@suse.de \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tursulin@ursulin.net \
--cc=ulf.hansson@linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=vschneid@redhat.com \
--cc=wens@csie.org \
--cc=wuyun.abel@bytedance.com \
--cc=zohar@linux.ibm.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