[PATCH 1/3] rust: module: change author to be a array

From: Guilherme Giacomo Simoes
Date: Wed Feb 12 2025 - 14:48:13 EST


In the module! macro, the author field has a string type. Once that the
modules can has more than one author, this is impossible in the current
scenary.
Change the author field for accept a array string type and enable module
creations with more than one author.

Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
Link: https://github.com/Rust-for-Linux/linux/issues/244
Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@xxxxxxxxx>
---
rust/macros/module.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index cdf94f4982df..09265d18b44d 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -94,7 +94,7 @@ struct ModuleInfo {
type_: String,
license: String,
name: String,
- author: Option<String>,
+ author: Option<Vec<String>>,
description: Option<String>,
alias: Option<Vec<String>>,
firmware: Option<Vec<String>>,
@@ -135,7 +135,7 @@ fn parse(it: &mut token_stream::IntoIter) -> Self {
match key.as_str() {
"type" => info.type_ = expect_ident(it),
"name" => info.name = expect_string_ascii(it),
- "author" => info.author = Some(expect_string(it)),
+ "author" => info.author = Some(expect_string_array(it)),
"description" => info.description = Some(expect_string(it)),
"license" => info.license = expect_string_ascii(it),
"alias" => info.alias = Some(expect_string_array(it)),
@@ -184,7 +184,9 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {

let mut modinfo = ModInfoBuilder::new(info.name.as_ref());
if let Some(author) = info.author {
- modinfo.emit("author", &author);
+ for author in author {
+ modinfo.emit("author", &author);
+ }
}
if let Some(description) = info.description {
modinfo.emit("description", &description);
--
2.34.1