Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rust: module: introduce `authors` key

In the `module!` macro, the `author` field is currently of type `String`.

Since modules can have multiple authors, this limitation prevents
specifying more than one.

Add an `authors` field as `Option<Vec<String>>` to allow creating
modules with multiple authors, and change the documentation and all
current users to use it. Eventually, the single `author` field may
be removed.

[ The `modinfo` key needs to still be `author`; otherwise, tooling
may not work properly, e.g.:

$ modinfo --author samples/rust/rust_print.ko
Rust for Linux Contributors

I have also kept the original `author` field (undocumented), so
that we can drop it more easily in a kernel cycle or two.

- Miguel ]

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/244
Reviewed-by: Charalampos Mitrodimas <charmitro@posteo.net>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
Link: https://lore.kernel.org/r/20250309175712.845622-2-trintaeoitogc@gmail.com
[ Fixed `modinfo` key. Kept `author` field. Reworded message
accordingly. Updated my email. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Guilherme Giacomo Simoes and committed by
Miguel Ojeda
38559da6 fc2f191f

+24 -16
+1 -1
drivers/block/rnull.rs
··· 27 27 module! { 28 28 type: NullBlkModule, 29 29 name: "rnull_mod", 30 - author: "Andreas Hindborg", 30 + authors: ["Andreas Hindborg"], 31 31 description: "Rust implementation of the C null block driver", 32 32 license: "GPL v2", 33 33 }
+1 -1
drivers/net/phy/ax88796b_rust.rs
··· 19 19 DeviceId::new_with_driver::<PhyAX88796B>() 20 20 ], 21 21 name: "rust_asix_phy", 22 - author: "FUJITA Tomonori <fujita.tomonori@gmail.com>", 22 + authors: ["FUJITA Tomonori <fujita.tomonori@gmail.com>"], 23 23 description: "Rust Asix PHYs driver", 24 24 license: "GPL", 25 25 }
+1 -1
drivers/net/phy/qt2025.rs
··· 26 26 phy::DeviceId::new_with_driver::<PhyQT2025>(), 27 27 ], 28 28 name: "qt2025_phy", 29 - author: "FUJITA Tomonori <fujita.tomonori@gmail.com>", 29 + authors: ["FUJITA Tomonori <fujita.tomonori@gmail.com>"], 30 30 description: "AMCC QT2025 PHY driver", 31 31 license: "GPL", 32 32 firmware: ["qt2025-2.0.3.3.fw"],
+2 -2
rust/kernel/net/phy.rs
··· 790 790 /// DeviceId::new_with_driver::<PhySample>() 791 791 /// ], 792 792 /// name: "rust_sample_phy", 793 - /// author: "Rust for Linux Contributors", 793 + /// authors: ["Rust for Linux Contributors"], 794 794 /// description: "Rust sample PHYs driver", 795 795 /// license: "GPL", 796 796 /// } ··· 819 819 /// module! { 820 820 /// type: Module, 821 821 /// name: "rust_sample_phy", 822 - /// author: "Rust for Linux Contributors", 822 + /// authors: ["Rust for Linux Contributors"], 823 823 /// description: "Rust sample PHYs driver", 824 824 /// license: "GPL", 825 825 /// }
+1 -1
rust/kernel/pci.rs
··· 103 103 /// kernel::module_pci_driver! { 104 104 /// type: MyDriver, 105 105 /// name: "Module name", 106 - /// author: "Author name", 106 + /// authors: ["Author name"], 107 107 /// description: "Description", 108 108 /// license: "GPL v2", 109 109 /// }
+1 -1
rust/kernel/platform.rs
··· 101 101 /// kernel::module_platform_driver! { 102 102 /// type: MyDriver, 103 103 /// name: "Module name", 104 - /// author: "Author name", 104 + /// authors: ["Author name"], 105 105 /// description: "Description", 106 106 /// license: "GPL v2", 107 107 /// }
+3 -3
rust/macros/lib.rs
··· 37 37 /// module!{ 38 38 /// type: MyModule, 39 39 /// name: "my_kernel_module", 40 - /// author: "Rust for Linux Contributors", 40 + /// authors: ["Rust for Linux Contributors"], 41 41 /// description: "My very own kernel module!", 42 42 /// license: "GPL", 43 43 /// alias: ["alternate_module_name"], ··· 70 70 /// module!{ 71 71 /// type: MyDeviceDriverModule, 72 72 /// name: "my_device_driver_module", 73 - /// author: "Rust for Linux Contributors", 73 + /// authors: ["Rust for Linux Contributors"], 74 74 /// description: "My device driver requires firmware", 75 75 /// license: "GPL", 76 76 /// firmware: ["my_device_firmware1.bin", "my_device_firmware2.bin"], ··· 89 89 /// # Supported argument types 90 90 /// - `type`: type which implements the [`Module`] trait (required). 91 91 /// - `name`: ASCII string literal of the name of the kernel module (required). 92 - /// - `author`: string literal of the author of the kernel module. 92 + /// - `authors`: array of ASCII string literals of the authors of the kernel module. 93 93 /// - `description`: string literal of the description of the kernel module. 94 94 /// - `license`: ASCII string literal of the license of the kernel module (required). 95 95 /// - `alias`: array of ASCII string literals of the alias names of the kernel module.
+8
rust/macros/module.rs
··· 95 95 license: String, 96 96 name: String, 97 97 author: Option<String>, 98 + authors: Option<Vec<String>>, 98 99 description: Option<String>, 99 100 alias: Option<Vec<String>>, 100 101 firmware: Option<Vec<String>>, ··· 109 108 "type", 110 109 "name", 111 110 "author", 111 + "authors", 112 112 "description", 113 113 "license", 114 114 "alias", ··· 138 136 "type" => info.type_ = expect_ident(it), 139 137 "name" => info.name = expect_string_ascii(it), 140 138 "author" => info.author = Some(expect_string(it)), 139 + "authors" => info.authors = Some(expect_string_array(it)), 141 140 "description" => info.description = Some(expect_string(it)), 142 141 "license" => info.license = expect_string_ascii(it), 143 142 "alias" => info.alias = Some(expect_string_array(it)), ··· 188 185 let mut modinfo = ModInfoBuilder::new(info.name.as_ref()); 189 186 if let Some(author) = info.author { 190 187 modinfo.emit("author", &author); 188 + } 189 + if let Some(authors) = info.authors { 190 + for author in authors { 191 + modinfo.emit("author", &author); 192 + } 191 193 } 192 194 if let Some(description) = info.description { 193 195 modinfo.emit("description", &description);
+1 -1
samples/rust/rust_driver_faux.rs
··· 7 7 module! { 8 8 type: SampleModule, 9 9 name: "rust_faux_driver", 10 - author: "Lyude Paul", 10 + authors: ["Lyude Paul"], 11 11 description: "Rust faux device sample", 12 12 license: "GPL", 13 13 }
+1 -1
samples/rust/rust_driver_pci.rs
··· 104 104 kernel::module_pci_driver! { 105 105 type: SampleDriver, 106 106 name: "rust_driver_pci", 107 - author: "Danilo Krummrich", 107 + authors: ["Danilo Krummrich"], 108 108 description: "Rust PCI driver", 109 109 license: "GPL v2", 110 110 }
+1 -1
samples/rust/rust_driver_platform.rs
··· 43 43 kernel::module_platform_driver! { 44 44 type: SampleDriver, 45 45 name: "rust_driver_platform", 46 - author: "Danilo Krummrich", 46 + authors: ["Danilo Krummrich"], 47 47 description: "Rust Platform driver", 48 48 license: "GPL v2", 49 49 }
+1 -1
samples/rust/rust_minimal.rs
··· 7 7 module! { 8 8 type: RustMinimal, 9 9 name: "rust_minimal", 10 - author: "Rust for Linux Contributors", 10 + authors: ["Rust for Linux Contributors"], 11 11 description: "Rust minimal sample", 12 12 license: "GPL", 13 13 }
+1 -1
samples/rust/rust_misc_device.rs
··· 116 116 module! { 117 117 type: RustMiscDeviceModule, 118 118 name: "rust_misc_device", 119 - author: "Lee Jones", 119 + authors: ["Lee Jones"], 120 120 description: "Rust misc device sample", 121 121 license: "GPL", 122 122 }
+1 -1
samples/rust/rust_print_main.rs
··· 8 8 module! { 9 9 type: RustPrint, 10 10 name: "rust_print", 11 - author: "Rust for Linux Contributors", 11 + authors: ["Rust for Linux Contributors"], 12 12 description: "Rust printing macros sample", 13 13 license: "GPL", 14 14 }