diff options
| author | Jiri Kosina <jkosina@suse.com> | 2026-02-09 17:33:26 +0100 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-02-09 17:33:26 +0100 |
| commit | ec496f77b4c11036cc835d6f045fb5e5ef1e6530 (patch) | |
| tree | e0f5a8f9ffec9de060b7b617514daecc8bdaca6d /rust/macros/lib.rs | |
| parent | 984d6f361d19486fcd8fc13d29112fe73123f482 (diff) | |
| parent | ae40ace015be442837934c5028a8eba7fe3cd98f (diff) | |
| download | linux-next-ec496f77b4c11036cc835d6f045fb5e5ef1e6530.tar.gz linux-next-ec496f77b4c11036cc835d6f045fb5e5ef1e6530.zip | |
Merge branch 'for-6.20/sony' into for-linus
- Support for Rock band 4 PS4 and PS5 guitars (Rosalie Wanders)
Diffstat (limited to 'rust/macros/lib.rs')
| -rw-r--r-- | rust/macros/lib.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs index 793f712dbf7c..b38002151871 100644 --- a/rust/macros/lib.rs +++ b/rust/macros/lib.rs @@ -29,6 +29,30 @@ use proc_macro::TokenStream; /// The `type` argument should be a type which implements the [`Module`] /// trait. Also accepts various forms of kernel metadata. /// +/// The `params` field describe module parameters. Each entry has the form +/// +/// ```ignore +/// parameter_name: type { +/// default: default_value, +/// description: "Description", +/// } +/// ``` +/// +/// `type` may be one of +/// +/// - [`i8`] +/// - [`u8`] +/// - [`i8`] +/// - [`u8`] +/// - [`i16`] +/// - [`u16`] +/// - [`i32`] +/// - [`u32`] +/// - [`i64`] +/// - [`u64`] +/// - [`isize`] +/// - [`usize`] +/// /// C header: [`include/linux/moduleparam.h`](srctree/include/linux/moduleparam.h) /// /// [`Module`]: ../kernel/trait.Module.html @@ -45,6 +69,12 @@ use proc_macro::TokenStream; /// description: "My very own kernel module!", /// license: "GPL", /// alias: ["alternate_module_name"], +/// params: { +/// my_parameter: i64 { +/// default: 1, +/// description: "This parameter has a default of 1", +/// }, +/// }, /// } /// /// struct MyModule(i32); @@ -53,6 +83,7 @@ use proc_macro::TokenStream; /// fn init(_module: &'static ThisModule) -> Result<Self> { /// let foo: i32 = 42; /// pr_info!("I contain: {}\n", foo); +/// pr_info!("i32 param is: {}\n", module_parameters::my_parameter.read()); /// Ok(Self(foo)) /// } /// } |
