[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231025.181357.1412247050293754016.fujita.tomonori@gmail.com>
Date: Wed, 25 Oct 2023 18:13:57 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: benno.lossin@...ton.me
Cc: fujita.tomonori@...il.com, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, andrew@...n.ch, tmgross@...ch.edu,
miguel.ojeda.sandonis@...il.com, wedsonaf@...il.com, greg@...ah.com
Subject: Re: [PATCH net-next v6 2/5] rust: net::phy add module_phy_driver
macro
On Wed, 25 Oct 2023 08:08:53 +0000
Benno Lossin <benno.lossin@...ton.me> wrote:
>>>>>> +/// Declares a kernel module for PHYs drivers.
>>>>>> +///
>>>>>> +/// This creates a static array of kernel's `struct phy_driver` and registers it.
>>>>>> +/// This also corresponds to the kernel's `MODULE_DEVICE_TABLE` macro, which embeds the information
>>>>>> +/// for module loading into the module binary file. Every driver needs an entry in `device_table`.
>>>>>> +///
>>>>>> +/// # Examples
>>>>>> +///
>>>>>> +/// ```ignore
>>>>>
>>>>> Is this example ignored, because it does not compile?
>>>>
>>>> The old version can't be compiled but the current version can so I'll
>>>> drop ignore.
>>>>
>>>>
>>>>> I think Wedson was wrapping his example with `module!` inside
>>>>> of a module, so maybe try that?
>>>>
>>>> I'm not sure what you mean.
>>>
>>> Wedson did this [1], note the `# mod module_fs_sample`:
>>>
>>> /// # Examples
>>> ///
>>> /// ```
>>> /// # mod module_fs_sample {
>>> /// use kernel::prelude::*;
>>> /// use kernel::{c_str, fs};
>>> ///
>>> /// kernel::module_fs! {
>>> /// type: MyFs,
>>> /// name: "myfs",
>>> /// author: "Rust for Linux Contributors",
>>> /// description: "My Rust fs",
>>> /// license: "GPL",
>>> /// }
>>> ///
>>> /// struct MyFs;
>>> /// impl fs::FileSystem for MyFs {
>>> /// const NAME: &'static CStr = c_str!("myfs");
>>> /// }
>>> /// # }
>>> /// ```
>>>
>>> [1]: https://github.com/wedsonaf/linux/commit/e909f439481cf6a3df00c7064b0d64cee8630fe9#diff-9b893393ed2a537222d79f6e2fceffb7e9d8967791c2016962be3171c446210fR104-R124
>>
>> You are suggesting like the following?
>>
>> /// # Examples
>> ///
>> /// ```
>> /// # mod module_phy_driver_sample {
>> ...
>> /// # }
>> /// ```
>>
>> What benefits?
>
> IIRC Wedson mentioned that without that it did not compile. So
> if it compiles for you without it, I would not add it.
Ah, it's necessary.
Powered by blists - more mailing lists