[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D9ZZ93ZGKC3N.9VGUE5QBJS4H@kernel.org>
Date: Mon, 19 May 2025 10:00:27 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Viresh Kumar" <viresh.kumar@...aro.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>,
"Danilo Krummrich" <dakr@...hat.com>, "Miguel Ojeda" <ojeda@...nel.org>,
"Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>,
"Gary Guo" <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Benno Lossin" <benno.lossin@...ton.me>,
"Andreas Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl"
<aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Danilo
Krummrich" <dakr@...nel.org>
Cc: <linux-pm@...r.kernel.org>, "Vincent Guittot"
<vincent.guittot@...aro.org>, "Stephen Boyd" <sboyd@...nel.org>, "Nishanth
Menon" <nm@...com>, <rust-for-linux@...r.kernel.org>, "Manos Pitsidianakis"
<manos.pitsidianakis@...aro.org>, Alex Bennée
<alex.bennee@...aro.org>, "Joakim Bech" <joakim.bech@...aro.org>, "Rob
Herring" <robh@...nel.org>, "Yury Norov" <yury.norov@...il.com>, "Burak
Emir" <bqe@...gle.com>, "Rasmus Villemoes" <linux@...musvillemoes.dk>,
"Russell King" <linux@...linux.org.uk>, <linux-clk@...r.kernel.org>,
"Michael Turquette" <mturquette@...libre.com>, "Andrew Ballance"
<andrewjballance@...il.com>, "Anisse Astier" <anisse@...ier.eu>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V12 06/15] rust: macros: enable use of hyphens in module
names
On Mon May 19, 2025 at 9:07 AM CEST, Viresh Kumar wrote:
> From: Anisse Astier <anisse@...ier.eu>
>
> Some modules might need naming that contains hyphens "-" to match the
> auto-probing by name in the platform devices that comes from the device
> tree.
>
> But rust identifiers cannot contain hyphens, so replace the module name
> by an underscore anywhere we'd use it as an identifier.
I think this is supposed to read "But Rust identifier cannot contain
hyphens, so replace them with underscores.".
> Signed-off-by: Anisse Astier <anisse@...ier.eu>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> [Viresh: Replace "-" with '-', and fix line length checkpatch warnings]
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
> rust/macros/module.rs | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
One nit below, with or without:
Reviewed-by: Benno Lossin <lossin@...nel.org>
> diff --git a/rust/macros/module.rs b/rust/macros/module.rs
> index a9418fbc9b44..27cc72d474f0 100644
> --- a/rust/macros/module.rs
> +++ b/rust/macros/module.rs
> @@ -185,7 +185,9 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
>
> let info = ModuleInfo::parse(&mut it);
>
> - let mut modinfo = ModInfoBuilder::new(info.name.as_ref());
> + /* Rust does not allow hyphens in identifiers, use underscore instead */
> + let name_identifier = info.name.replace('-', "_");
I think we could just name this variable `ident`.
---
Cheers,
Benno
> + let mut modinfo = ModInfoBuilder::new(name_identifier.as_ref());
> if let Some(author) = info.author {
> modinfo.emit("author", &author);
> }
Powered by blists - more mailing lists