summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-07-16 19:09:30 +0200
committerBreno Leitao <leitao@debian.org>2026-10-16 09:17:20 -0700
commitf7528cd38b87fb59b6e5f96abfd119f0318a52e4 (patch)
treebd3eec8d7e451c925e6f4021fc06128641b18c82 /rust/kernel
parentee4f267ada12bd5eb8b675018bdd60e60da2c089 (diff)
downloadlinux-f7528cd38b87fb59b6e5f96abfd119f0318a52e4.tar.gz
linux-f7528cd38b87fb59b6e5f96abfd119f0318a52e4.zip
configfs: Allow the registration of const struct configfs_attribute
The attribute structure defined in driver code never need to be modified. Allow them to be marked as const. As there are many drivers which use these attributes, prepare for a phased transition by using a union of const and non-const attributes. After all drivers have been migrated to the const variant, the non-const one can be replaced by the const one and the transition machinery will be removed again. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260716-configfs-const-base-v1-5-c545a4053cb5@weissschuh.net Signed-off-by: Breno Leitao <leitao@debian.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r--rust/kernel/configfs.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
index 5052c1bbaf94..0be10cf61927 100644
--- a/rust/kernel/configfs.rs
+++ b/rust/kernel/configfs.rs
@@ -756,7 +756,9 @@ macro_rules! impl_item_type {
ct_owner: owner.as_ptr(),
ct_group_ops: GroupOperationsVTable::<Data, Child>::vtable_ptr(),
ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
- ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
+ __bindgen_anon_1: bindings::config_item_type__bindgen_ty_1 {
+ ct_attrs_const: core::ptr::from_ref(attributes).cast(),
+ },
ct_bin_attrs: core::ptr::null(),
}),
_p: PhantomData,
@@ -773,7 +775,9 @@ macro_rules! impl_item_type {
ct_owner: owner.as_ptr(),
ct_group_ops: core::ptr::null(),
ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
- ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
+ __bindgen_anon_1: bindings::config_item_type__bindgen_ty_1 {
+ ct_attrs_const: core::ptr::from_ref(attributes).cast(),
+ },
ct_bin_attrs: core::ptr::null(),
}),
_p: PhantomData,