Re: [PATCH v13 5/6] rust: samples: add a module parameter to the rust_minimal sample

From: Benno Lossin
Date: Mon Jun 30 2025 - 08:32:15 EST


On Mon Jun 30, 2025 at 2:23 PM CEST, Danilo Krummrich wrote:
> On 6/30/25 2:18 PM, Danilo Krummrich wrote:
>> On 6/30/25 2:12 PM, Andreas Hindborg wrote:
>>> "Danilo Krummrich" <dakr@xxxxxxxxxx> writes:
>>>
>>>> (Sorry for being late on this one, just a minor nit below.)
>>>>
>>>> On 6/12/25 3:40 PM, Andreas Hindborg wrote:
>>>>>    struct RustMinimal {
>>>>> @@ -20,6 +26,10 @@ impl kernel::Module for RustMinimal {
>>>>>        fn init(_module: &'static ThisModule) -> Result<Self> {
>>>>>            pr_info!("Rust minimal sample (init)\n");
>>>>>            pr_info!("Am I built-in? {}\n", !cfg!(MODULE));
>>>>> +        pr_info!(
>>>>> +            "test_parameter: {}\n",
>>>>> +            *module_parameters::test_parameter.get()
>>>>
>>>> Can we please call it something else than get(), maybe obtain(), access() or
>>>> just ref()?
>>>
>>> Probably `ref` is the most precise of the options you propose. I would
>>> go with that one. Or, should it be `as_ref`?
>>
>> Guess that works as well.
>>
>> One question additional question: Can't we just impl Deref for
>> ModuleParamAccess<T>?
>
> Just notice that it would work for now, but not in the future, because this will
> apparently require some lock guard? Then maybe access() describes it best?

What about `value()`?

---
Cheers,
Benno