All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charalampos Mitrodimas <charmitro@posteo.net>
To: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
Cc: a.hindborg@kernel.org,  alex.gaynor@gmail.com,
	 aliceryhl@google.com, apw@canonical.com,  arnd@arndb.de,
	 aswinunni01@gmail.com, axboe@kernel.dk,  benno.lossin@proton.me,
	 bhelgaas@google.com, bjorn3_gh@protonmail.com,
	 boqun.feng@gmail.com,  dakr@kernel.org, dwaipayanray1@gmail.com,
	 ethan.twardy@gmail.com, fujita.tomonori@gmail.com,
	 gary@garyguo.net, gregkh@linuxfoundation.org,  joe@perches.com,
	 lukas.bulwahn@gmail.com, ojeda@kernel.org,  pbonzini@redhat.com,
	 tmgross@umich.edu, walmeida@microsoft.com,
	 rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Subject: Re: [PATCH V2 1/2] rust: module: change author to be a array
Date: Fri, 14 Feb 2025 20:19:23 +0000	[thread overview]
Message-ID: <m2y0y8b7p0.fsf@posteo.net> (raw)
In-Reply-To: <20250214184550.120775-2-trintaeoitogc@gmail.com>

Guilherme Giacomo Simoes <trintaeoitogc@gmail.com> writes:

> 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.
>
> Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Link: https://github.com/Rust-for-Linux/linux/issues/244
> Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
> ---
>  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 +-
>  9 files changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/block/rnull.rs b/drivers/block/rnull.rs
> index ddf3629d8894..cb133993f27f 100644
> --- a/drivers/block/rnull.rs
> +++ b/drivers/block/rnull.rs
> @@ -27,7 +27,7 @@
>  module! {
>      type: NullBlkModule,
>      name: "rnull_mod",
> -    author: "Andreas Hindborg",
> +    author: ["Andreas Hindborg"],
>      description: "Rust implementation of the C null block driver",
>      license: "GPL v2",
>  }
> diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
> index bb654a28dab3..b179ac3a8d00 100644
> --- a/rust/kernel/net/phy.rs
> +++ b/rust/kernel/net/phy.rs
> @@ -790,7 +790,7 @@ const fn as_int(&self) -> u32 {
>  ///         DeviceId::new_with_driver::<PhySample>()
>  ///     ],
>  ///     name: "rust_sample_phy",
> -///     author: "Rust for Linux Contributors",
> +///     author: ["Rust for Linux Contributors"],
>  ///     description: "Rust sample PHYs driver",
>  ///     license: "GPL",
>  /// }
> @@ -819,7 +819,7 @@ const fn as_int(&self) -> u32 {
>  /// module! {
>  ///     type: Module,
>  ///     name: "rust_sample_phy",
> -///     author: "Rust for Linux Contributors",
> +///     author: ["Rust for Linux Contributors"],
>  ///     description: "Rust sample PHYs driver",
>  ///     license: "GPL",
>  /// }
> diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
> index 4c98b5b9aa1e..1218eaa7be02 100644
> --- a/rust/kernel/pci.rs
> +++ b/rust/kernel/pci.rs
> @@ -103,7 +103,7 @@ extern "C" fn remove_callback(pdev: *mut bindings::pci_dev) {
>  /// kernel::module_pci_driver! {
>  ///     type: MyDriver,
>  ///     name: "Module name",
> -///     author: "Author name",
> +///     author: ["Author name"],
>  ///     description: "Description",
>  ///     license: "GPL v2",
>  /// }
> diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
> index d61bc6a56425..8d74e18caf96 100644
> --- a/rust/macros/lib.rs
> +++ b/rust/macros/lib.rs
> @@ -36,7 +36,7 @@
>  /// module!{
>  ///     type: MyModule,
>  ///     name: "my_kernel_module",
> -///     author: "Rust for Linux Contributors",
> +///     author: ["Rust for Linux Contributors"],
>  ///     description: "My very own kernel module!",
>  ///     license: "GPL",
>  ///     alias: ["alternate_module_name"],
> @@ -69,7 +69,7 @@
>  /// module!{
>  ///     type: MyDeviceDriverModule,
>  ///     name: "my_device_driver_module",
> -///     author: "Rust for Linux Contributors",
> +///     author: ["Rust for Linux Contributors"],
>  ///     description: "My device driver requires firmware",
>  ///     license: "GPL",
>  ///     firmware: ["my_device_firmware1.bin", "my_device_firmware2.bin"],
> 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);
> +        }

I wonder if we should make this "for author in authors", for code
clarity concerns.

>      }
>      if let Some(description) = info.description {
>          modinfo.emit("description", &description);
> diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
> index 1fb6e44f3395..5784677c797b 100644
> --- a/samples/rust/rust_driver_pci.rs
> +++ b/samples/rust/rust_driver_pci.rs
> @@ -104,7 +104,7 @@ fn drop(&mut self) {
>  kernel::module_pci_driver! {
>      type: SampleDriver,
>      name: "rust_driver_pci",
> -    author: "Danilo Krummrich",
> +    author: ["Danilo Krummrich"],
>      description: "Rust PCI driver",
>      license: "GPL v2",
>  }
> diff --git a/samples/rust/rust_minimal.rs b/samples/rust/rust_minimal.rs
> index 4aaf117bf8e3..74279c3bd039 100644
> --- a/samples/rust/rust_minimal.rs
> +++ b/samples/rust/rust_minimal.rs
> @@ -7,7 +7,7 @@
>  module! {
>      type: RustMinimal,
>      name: "rust_minimal",
> -    author: "Rust for Linux Contributors",
> +    author: ["Rust for Linux Contributors"],
>      description: "Rust minimal sample",
>      license: "GPL",
>  }
> diff --git a/samples/rust/rust_misc_device.rs b/samples/rust/rust_misc_device.rs
> index 40ad7266c225..e840c12005cc 100644
> --- a/samples/rust/rust_misc_device.rs
> +++ b/samples/rust/rust_misc_device.rs
> @@ -116,7 +116,7 @@
>  module! {
>      type: RustMiscDeviceModule,
>      name: "rust_misc_device",
> -    author: "Lee Jones",
> +    author: ["Lee Jones"],
>      description: "Rust misc device sample",
>      license: "GPL",
>  }
> diff --git a/samples/rust/rust_print_main.rs b/samples/rust/rust_print_main.rs
> index 7e8af5f176a3..f6d51b0884fb 100644
> --- a/samples/rust/rust_print_main.rs
> +++ b/samples/rust/rust_print_main.rs
> @@ -8,7 +8,7 @@
>  module! {
>      type: RustPrint,
>      name: "rust_print",
> -    author: "Rust for Linux Contributors",
> +    author: ["Rust for Linux Contributors"],
>      description: "Rust printing macros sample",
>      license: "GPL",
>  }

It could be that you developed this with an old tree history. You missed
changing the author for the samples/rust/rust_driver_platform.rs sample.

  reply	other threads:[~2025-02-14 20:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14 18:45 [PATCH V2 0/2] author field in module! macro should be a array Guilherme Giacomo Simoes
2025-02-14 18:45 ` [PATCH V2 1/2] rust: module: change author to " Guilherme Giacomo Simoes
2025-02-14 20:19   ` Charalampos Mitrodimas [this message]
2025-02-15  1:11     ` Guilherme Giacomo Simoes
2025-02-15  1:39   ` Benno Lossin
2025-02-15 13:52     ` Guilherme Giacomo Simoes
2025-02-15 14:34       ` Benno Lossin
2025-02-16 12:35   ` kernel test robot
2025-02-14 18:45 ` [PATCH V2 2/2] checkpatch: throw error in malformed arrays Guilherme Giacomo Simoes
2025-02-15  5:24   ` Joe Perches

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=m2y0y8b7p0.fsf@posteo.net \
    --to=charmitro@posteo.net \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apw@canonical.com \
    --cc=arnd@arndb.de \
    --cc=aswinunni01@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=benno.lossin@proton.me \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dwaipayanray1@gmail.com \
    --cc=ethan.twardy@gmail.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=trintaeoitogc@gmail.com \
    --cc=walmeida@microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.