Skip to contentSkip to conversation

author field in module! macro should be a array

PATCH Superseded Guilherme Giacomo Simoes 2 participants 4 messages Feb 12, 2025 – Feb 13, 2025

Subsystems (2)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover author field in module! macro should be a array

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.

- In modules that use the author field, change its value to a string array.

- Change the check patch to find poorly formatted arrays in the macro module!

Guilherme Giacomo Simoes (3):
rust: module: change author to be a array
rust: macros: change author field to array
checkpatch: throw error in malformed arrays

 drivers/block/rnull.rs           |  2 +-
 rust/kernel/net/phy.rs           |  4 +-
 rust/kernel/pci.rs               |  2 +-
 rust/macros/lib.rs               |  4 +-
 rust/macros/module.rs            |  8 ++--
 samples/rust/rust_driver_pci.rs  |  2 +-
 samples/rust/rust_minimal.rs     |  2 +-
 samples/rust/rust_misc_device.rs |  2 +-
 samples/rust/rust_print_main.rs  |  2 +-
 scripts/checkpatch.pl            | 68 ++++++++++++++++++++++++++++++++
 10 files changed, 83 insertions(+), 13 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

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

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.

---
 rust/macros/module.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
rust/macros/module.rs +5 -3
index cdf94f4982df..09265d18b44d 100644
@@ -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);
Signature · 1 line
2.34.1
#2 lore raw
In reply to Guilherme Giacomo Simoes
Quoted 4 lines · Guilherme Giacomo Simoes

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.

I think this was a re-send -- in general, please change the title (e.g. increase the version number or at least add "[ PATCH RESEND" or similar) if you need to do a re-send, because otherwise it is hard to follow which is which (e.g. in Lore).

Also, for some reason, Lore has your #2 and #3 patch in another thread -- please try to see if you can fix that when you send the next version. Both git send-email and b4 should do the right thing by default when sending a series.

Thanks!

Cheers,
Miguel

#3 lore raw

Miguel Ojeda <[email protected]> wrotes:

Quoted 4 lines

I think this was a re-send -- in general, please change the title (e.g. increase the version number or at least add "[ PATCH RESEND" or similar) if you need to do a re-send, because otherwise it is hard to follow which is which (e.g. in Lore).

This would can be a v2, because I already sended a patch for authors. But how this patch a lot of changes in comparison to the previous patch I was thinnk that is better send this patch how a new patch, but maybe was be a error.

Quoted 4 lines

Also, for some reason, Lore has your #2 and #3 patch in another thread -- please try to see if you can fix that when you send the next version. Both git send-email and b4 should do the right thing by default when sending a series.

Yeah, I maked a mistake when I send via git send-email... inattention

Thanks,
Guilherme