From nobody Mon Jul 27 19:00:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93CDE348C68; Thu, 16 Jul 2026 17:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221785; cv=none; b=pSNwSWU5kPoHT6ea4hH+6cpltGeE5+LoZy1LDjRYlawf4OI/AxiLNrZ+kZ4eRoy07UFfr4fhfW08eq3IhgDdjCWJq6ttm7OLBYRGHnSdo5jMoBx6xYs28RRDUbPz/j2g+yfW8gREGL8Fjbbe2t8Sq+UVOUQgl6bOyiCOm9Toy6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221785; c=relaxed/simple; bh=dBHoPeFN74z8PL2Y8uyMGTiScXZKXOQLXSJUZCoOZ4k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aRnewSx6vSTaXQxatZ7zgsF+YF4WgO+LNGwgTkiYi8Is0M5FPk9ss1klBH5x3dOk5r4tnwlnpITGIAL/Mds5mIx8nR1H8UpDZaURXLPYF8+poUje+Pkt/GnBQypzX4pcgljWzovOk0rZ6b4T8agp+Tqh7QRA4IQyq8MQwXkSM0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=Z/kDlRFh; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="Z/kDlRFh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1784221779; bh=dBHoPeFN74z8PL2Y8uyMGTiScXZKXOQLXSJUZCoOZ4k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Z/kDlRFhDRFgYQgSzQoKmtwdpeG1w4EntJToLPpWO31pBQFdwbqjvfcEyOm85ByYY kCg+CNUGmed4lMAcg69Wsrl0WUNMP9Zvkva2ooQJOdhW9AVbd+cbVmhggZklVF+V66 fu/7Cxz71Oje6RypHiqZnGnxw6whBn6dRpXX2Sj8= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 16 Jul 2026 19:09:26 +0200 Subject: [PATCH 1/6] rust: configfs: remove mutability from some field initializers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260716-configfs-const-base-v1-1-c545a4053cb5@weissschuh.net> References: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> In-Reply-To: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> To: Andreas Hindborg , Breno Leitao , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Rodrigo Vivi , David Airlie , Simona Vetter , Dan Williams , "Rafael J. Wysocki" , Len Brown Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-coco@lists.linux.dev, linux-acpi@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784221778; l=1897; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=dBHoPeFN74z8PL2Y8uyMGTiScXZKXOQLXSJUZCoOZ4k=; b=aVZbs/uCZXHVODH1ABH4MgJRQ4jtEG5Zi7lWJCam5sEMkaRjBjYob9SC7itElVohbe8A6rYQA yn0fmFmJirVDAxMfzaB4EKaDCo0xfVyJDcuL2BzPBWSP+x+Cf8lizUa X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= These fields do not require mutable pointers. Use regular immutable ones. Signed-off-by: Thomas Wei=C3=9Fschuh --- rust/kernel/configfs.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs index 2339c6467325..b33fb2e9adf1 100644 --- a/rust/kernel/configfs.rs +++ b/rust/kernel/configfs.rs @@ -754,8 +754,8 @@ pub const fn new_with_child_ctor( Self { item_type: Opaque::new(bindings::config_item_type { ct_owner: owner.as_ptr(), - ct_group_ops: GroupOperationsVTable::= ::vtable_ptr().cast_mut(), - ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr().cast_mut(), + ct_group_ops: GroupOperationsVTable::= ::vtable_ptr(), + ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr(), ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), ct_bin_attrs: core::ptr::null_mut(), }), @@ -771,8 +771,8 @@ pub const fn new( Self { item_type: Opaque::new(bindings::config_item_type { ct_owner: owner.as_ptr(), - ct_group_ops: core::ptr::null_mut(), - ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr().cast_mut(), + ct_group_ops: core::ptr::null(), + ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr(), ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), ct_bin_attrs: core::ptr::null_mut(), }), --=20 2.55.0 From nobody Mon Jul 27 19:00:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C926243B487; Thu, 16 Jul 2026 17:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221785; cv=none; b=m5aa4i95KdbILmryQmRE6CU0D5kXTn8M9KhNwOg4hKxznSl+6Jt3nEoxJWhmFq1y0cjME5CkKbEqR4JPzLd4z8Q7dH+d/PHffCu3muVjJ9TQ24jgpODH9384n2zMi5SBwh2u1276XEgSEqIuKA2LhvWC1OsTOqTrXaKqbV5VfgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221785; c=relaxed/simple; bh=GubTlQat6UlimM/bcLKvGJ1gJF4TTwUHaWco6h44H3Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Iql6Rkzbu3tf700wA3j/5MvuL4hUMiubRy/0kQeNJHgJcM5P1gIC83DH5jGb6fgiUwqPgnlt5Mj1QA7xePuFJuxK5l15mzRzFZHxyEoGVUMVV1IZNcmdPhSjWnlTfLpk6GrZ2UrL1yvatBSwNTgN+sqzeHxwvevur0AXFP3uP3Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=jFoj39dy; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="jFoj39dy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1784221779; bh=GubTlQat6UlimM/bcLKvGJ1gJF4TTwUHaWco6h44H3Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jFoj39dycLqDhiZ/HE2WOecxEDywP3bgZ4iV95iXaFEZtXShQqiGJ/bYsYnE1bDrv jnDT/1cUrvnKZWESVk/8Hv78qoynxiqOjE3Vj+hS6LUrgqZMA7WARjHgun+iXgt3Ju P/UuUQ1C8vqoZdk33gTnGDKE5+KxNts3SVqDC1yU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 16 Jul 2026 19:09:27 +0200 Subject: [PATCH 2/6] configfs: Constify is_visible/is_visible_bin in configfs_group_operations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260716-configfs-const-base-v1-2-c545a4053cb5@weissschuh.net> References: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> In-Reply-To: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> To: Andreas Hindborg , Breno Leitao , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Rodrigo Vivi , David Airlie , Simona Vetter , Dan Williams , "Rafael J. Wysocki" , Len Brown Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-coco@lists.linux.dev, linux-acpi@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784221778; l=3113; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=GubTlQat6UlimM/bcLKvGJ1gJF4TTwUHaWco6h44H3Y=; b=+sEBU8Jt02gLhwZLB6K47bnC0/qyt/YKihbwKPC9VgN0n6o0EqABg+QnHDz6bwxVU5djJq9LB Lxa3CssRiovA2VWJwM69q10UwWQTZRJqxtJX4gZMHRnfgZ89T5XaxTL X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= These callbacks are never meant to modify their configfs_attribute structure. Enforce this in the type system. As there are only two implementers of these callbacks, adapt them right away, avoiding a phased transition. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Breno Leitao --- drivers/gpu/drm/xe/xe_configfs.c | 4 ++-- drivers/virt/coco/guest/report.c | 4 ++-- include/linux/configfs.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_confi= gfs.c index 32102600a148..a5f696e7b329 100644 --- a/drivers/gpu/drm/xe/xe_configfs.c +++ b/drivers/gpu/drm/xe/xe_configfs.c @@ -843,7 +843,7 @@ static struct configfs_item_operations xe_config_device= _ops =3D { }; =20 static bool xe_config_device_is_visible(struct config_item *item, - struct configfs_attribute *attr, int n) + const struct configfs_attribute *attr, int n) { struct xe_config_group_device *dev =3D to_xe_config_group_device(item); =20 @@ -938,7 +938,7 @@ static struct configfs_attribute *xe_config_sriov_attrs= [] =3D { }; =20 static bool xe_config_sriov_is_visible(struct config_item *item, - struct configfs_attribute *attr, int n) + const struct configfs_attribute *attr, int n) { struct xe_config_group_device *dev =3D to_xe_config_group_device(item->ci= _parent); =20 diff --git a/drivers/virt/coco/guest/report.c b/drivers/virt/coco/guest/rep= ort.c index b254a1416286..96e89ddf4989 100644 --- a/drivers/virt/coco/guest/report.c +++ b/drivers/virt/coco/guest/report.c @@ -381,7 +381,7 @@ static struct configfs_item_operations tsm_report_item_= ops =3D { }; =20 static bool tsm_report_is_visible(struct config_item *item, - struct configfs_attribute *attr, int n) + const struct configfs_attribute *attr, int n) { guard(rwsem_read)(&tsm_rwsem); if (!provider.ops) @@ -394,7 +394,7 @@ static bool tsm_report_is_visible(struct config_item *i= tem, } =20 static bool tsm_report_is_bin_visible(struct config_item *item, - struct configfs_bin_attribute *attr, int n) + const struct configfs_bin_attribute *attr, int n) { guard(rwsem_read)(&tsm_rwsem); if (!provider.ops) diff --git a/include/linux/configfs.h b/include/linux/configfs.h index ef65c75beeaa..5d3fc8822a1d 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h @@ -220,8 +220,8 @@ struct configfs_group_operations { struct config_group *(*make_group)(struct config_group *group, const char= *name); void (*disconnect_notify)(struct config_group *group, struct config_item = *item); void (*drop_item)(struct config_group *group, struct config_item *item); - bool (*is_visible)(struct config_item *item, struct configfs_attribute *a= ttr, int n); - bool (*is_bin_visible)(struct config_item *item, struct configfs_bin_attr= ibute *attr, + bool (*is_visible)(struct config_item *item, const struct configfs_attrib= ute *attr, int n); + bool (*is_bin_visible)(struct config_item *item, const struct configfs_bi= n_attribute *attr, int n); }; =20 --=20 2.55.0 From nobody Mon Jul 27 19:00:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAD4842F717; Thu, 16 Jul 2026 17:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221786; cv=none; b=ZS6toWW0KN2HhaXYSMKBBNPChZJq/JdbZOqlwbRQuQ4E1qtxoIpFd+x5SoLAzWDqguPLWwrL1BpedmvQGszpXh/6SMTvsjeI9hrkZ+K9wyLwwp3eIE6BH39UOokYTW1z/YElZBiqJqspCspKZ7DvxV2lUBJVw0HkAzw0CWsZUAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221786; c=relaxed/simple; bh=9YZesc5wcXlynZX+h2DL+YsI2VfvK0ZmkJiEnkQRKNY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lRGaS3Pf97hJ7id1TgL56ibn3sxFSizr9u56K+TDwGb/qy7yVgpqxQyqHUsQ/beBOYNKkt0mx+mOKAmOx7hzcgEKwQofzY3SdByIUWHQRf++sdmxwBtjPIXoc3OTraYRZEkPhL6MPy6vxaRiNCypYSPjQRJ+2crNpM4SY50P+fo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=PGjNtLke; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="PGjNtLke" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1784221779; bh=9YZesc5wcXlynZX+h2DL+YsI2VfvK0ZmkJiEnkQRKNY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PGjNtLke6YGPB964aaVBz4MAWVNniRPsAqXwlv8pVmFv9TChaWf2Gk/zVXB9DEyG1 VZw3tihOZBwj+lTJ077L+4waZcGSDgZ4nMS1MxvlSsdPR0C7yCFNEuWi1QgOljhe1t 01zc+/tPiDSfvQNVTmIed98XYxEyb5d7orrCtGE4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 16 Jul 2026 19:09:28 +0200 Subject: [PATCH 3/6] configfs: Treat attribute structures as const internally Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260716-configfs-const-base-v1-3-c545a4053cb5@weissschuh.net> References: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> In-Reply-To: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> To: Andreas Hindborg , Breno Leitao , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Rodrigo Vivi , David Airlie , Simona Vetter , Dan Williams , "Rafael J. Wysocki" , Len Brown Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-coco@lists.linux.dev, linux-acpi@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784221778; l=3841; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=9YZesc5wcXlynZX+h2DL+YsI2VfvK0ZmkJiEnkQRKNY=; b=n+mbJ+otyx8qMM6l8Vc3E+5CAxdDYeaMfR9dv5eIQzMk+XXKgH0vhEYfsIEgL6Q0umHcANnma BIkvWu9KfcHBrT9wRpU/i2Jcxjy5UMrgog7uvwZ8+AfffbtJssC83Fn X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The configfs core never modifies the attribute structures defined in driver core. Reflect this in the types used internally in the configfs core. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Breno Leitao --- fs/configfs/configfs_internal.h | 10 +++++----- fs/configfs/dir.c | 6 +++--- fs/configfs/file.c | 6 +++--- fs/configfs/inode.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_interna= l.h index acdeea8e2d69..4bc19cd8d666 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h @@ -104,17 +104,17 @@ static inline struct config_item * to_item(struct den= try * dentry) return ((struct config_item *) sd->s_element); } =20 -static inline struct configfs_attribute * to_attr(struct dentry * dentry) +static inline const struct configfs_attribute * to_attr(struct dentry * de= ntry) { struct configfs_dirent * sd =3D dentry->d_fsdata; - return ((struct configfs_attribute *) sd->s_element); + return ((const struct configfs_attribute *) sd->s_element); } =20 -static inline struct configfs_bin_attribute *to_bin_attr(struct dentry *de= ntry) +static inline const struct configfs_bin_attribute *to_bin_attr(struct dent= ry *dentry) { - struct configfs_attribute *attr =3D to_attr(dentry); + const struct configfs_attribute *attr =3D to_attr(dentry); =20 - return container_of(attr, struct configfs_bin_attribute, cb_attr); + return container_of_const(attr, struct configfs_bin_attribute, cb_attr); } =20 static inline struct config_item *configfs_get_config_item(struct dentry *= dentry) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 3c88f13f1ca2..9a5c2bc4065d 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -461,7 +461,7 @@ static struct dentry * configfs_lookup(struct inode *di= r, */ if ((sd->s_type & CONFIGFS_NOT_PINNED) && !strcmp(configfs_get_name(sd), dentry->d_name.name)) { - struct configfs_attribute *attr =3D sd->s_element; + const struct configfs_attribute *attr =3D sd->s_element; umode_t mode =3D (attr->ca_mode & S_IALLUGO) | S_IFREG; =20 dentry->d_fsdata =3D configfs_get(sd); @@ -622,8 +622,8 @@ static int populate_attrs(struct config_item *item) { const struct config_item_type *t =3D item->ci_type; const struct configfs_group_operations *ops; - struct configfs_attribute *attr; - struct configfs_bin_attribute *bin_attr; + const struct configfs_attribute *attr; + const struct configfs_bin_attribute *bin_attr; int error =3D 0; int i; =20 diff --git a/fs/configfs/file.c b/fs/configfs/file.c index a48cece775a3..6460b000c593 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c @@ -41,8 +41,8 @@ struct configfs_buffer { struct config_item *item; struct module *owner; union { - struct configfs_attribute *attr; - struct configfs_bin_attribute *bin_attr; + const struct configfs_attribute *attr; + const struct configfs_bin_attribute *bin_attr; }; }; =20 @@ -291,7 +291,7 @@ static int __configfs_open_file(struct inode *inode, st= ruct file *file, int type { struct dentry *dentry =3D file->f_path.dentry; struct configfs_fragment *frag =3D to_frag(file); - struct configfs_attribute *attr; + const struct configfs_attribute *attr; struct configfs_buffer *buffer; int error; =20 diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index 68290fe0e374..69f1f24e890f 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c @@ -178,7 +178,7 @@ struct inode *configfs_create(struct dentry *dentry, um= ode_t mode) */ const unsigned char * configfs_get_name(struct configfs_dirent *sd) { - struct configfs_attribute *attr; + const struct configfs_attribute *attr; =20 BUG_ON(!sd || !sd->s_element); =20 --=20 2.55.0 From nobody Mon Jul 27 19:00:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B1C443A805; Thu, 16 Jul 2026 17:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221786; cv=none; b=jBHNvPgi/9Ow9sTtCfxc2fj4mfoEh5kvEcf+l6oAmJVumqXrFR4Htf+CViyzT/OtHMbef74J7L/zHjU/gjvO5Td++7PGI92jUZvQIJwSxfcxapIykIpOWx+44cTsyn9AXllFUTc8netbyYaLAS3Q8uk25JX379VCClWZJNvEmkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221786; c=relaxed/simple; bh=dltgcbowZmeUaJ3uOqqeFmdJ7eim65T+5MLbFYQBbL0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q5D5mWfKyvNb7d4l3YVlICZzJ9dvr5ndnqggYR2/uQXfUHPJw+0O83LviUDagyXcYnbkzQ3VrhVNCpJRG2qv8p/e/zpKY8j6S03ECjw0pnsN7Hupq619OTTRRAVSJtvYsBf5Sw5N0D0BnGmC2ztEB1Meb4Dd5miPtNSrW34mRaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=IuXGRLdz; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="IuXGRLdz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1784221779; bh=dltgcbowZmeUaJ3uOqqeFmdJ7eim65T+5MLbFYQBbL0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=IuXGRLdzw4f6EMx+bMUC8KURlIf+kmJmq86UCLM78bDQBG0BYevEr6YS6mtrSSRst f5CVc8ZwHa+A6EGy+OTgDkyqDwbyWEDGcqHOFsh46hQxOqn8Ab9T7bYKbay7wNeTkR d+DrDHcZqpg5YD4ziKtb9qbyDYmYBvJvHvv6pDNc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 16 Jul 2026 19:09:29 +0200 Subject: [PATCH 4/6] configfs: Constify configfs_bin_attribute Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260716-configfs-const-base-v1-4-c545a4053cb5@weissschuh.net> References: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> In-Reply-To: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> To: Andreas Hindborg , Breno Leitao , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Rodrigo Vivi , David Airlie , Simona Vetter , Dan Williams , "Rafael J. Wysocki" , Len Brown Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-coco@lists.linux.dev, linux-acpi@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784221778; l=5822; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=dltgcbowZmeUaJ3uOqqeFmdJ7eim65T+5MLbFYQBbL0=; b=+ItfgbuT+kmF0PK8QxYS9YMhv1kJXQvCv+7X9O/FnYE5GBzFy57Xd/FFvla3WFPGRW6ZTXBY2 mZhZlW6OC4LCJcZOrVCqjJRJGmRAdRINNctDxlyV0k/nDg8iQYPUi/b X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The configfs_bin_attribute structures defined by driver are never modified. Make them const. As there are only two users of these attributes, adapt them in the same commit to avoid a phased transition. Signed-off-by: Thomas Wei=C3=9Fschuh --- drivers/acpi/acpi_configfs.c | 2 +- drivers/virt/coco/guest/report.c | 2 +- include/linux/configfs.h | 64 ++++++++++++++++++++----------------= ---- rust/kernel/configfs.rs | 4 +-- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c index 12ffec795803..6071699c7165 100644 --- a/drivers/acpi/acpi_configfs.c +++ b/drivers/acpi/acpi_configfs.c @@ -91,7 +91,7 @@ static ssize_t acpi_table_aml_read(struct config_item *cf= g, =20 CONFIGFS_BIN_ATTR(acpi_table_, aml, NULL, MAX_ACPI_TABLE_SIZE); =20 -static struct configfs_bin_attribute *acpi_table_bin_attrs[] =3D { +static const struct configfs_bin_attribute *const acpi_table_bin_attrs[] = =3D { &acpi_table_attr_aml, NULL, }; diff --git a/drivers/virt/coco/guest/report.c b/drivers/virt/coco/guest/rep= ort.c index 96e89ddf4989..ad400fbe53f0 100644 --- a/drivers/virt/coco/guest/report.c +++ b/drivers/virt/coco/guest/report.c @@ -356,7 +356,7 @@ static struct configfs_attribute *tsm_report_attrs[] = =3D { NULL, }; =20 -static struct configfs_bin_attribute *tsm_report_bin_attrs[] =3D { +static const struct configfs_bin_attribute *const tsm_report_bin_attrs[] = =3D { [TSM_REPORT_INBLOB] =3D &tsm_report_attr_inblob, [TSM_REPORT_OUTBLOB] =3D &tsm_report_attr_outblob, [TSM_REPORT_AUXBLOB] =3D &tsm_report_attr_auxblob, diff --git a/include/linux/configfs.h b/include/linux/configfs.h index 5d3fc8822a1d..eff2fb22ab70 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h @@ -67,7 +67,7 @@ struct config_item_type { const struct configfs_item_operations *ct_item_ops; const struct configfs_group_operations *ct_group_ops; struct configfs_attribute **ct_attrs; - struct configfs_bin_attribute **ct_bin_attrs; + const struct configfs_bin_attribute *const *ct_bin_attrs; }; =20 /** @@ -160,41 +160,41 @@ struct configfs_bin_attribute { ssize_t (*write)(struct config_item *, const void *, size_t); }; =20 -#define CONFIGFS_BIN_ATTR(_pfx, _name, _priv, _maxsz) \ -static struct configfs_bin_attribute _pfx##attr_##_name =3D { \ - .cb_attr =3D { \ - .ca_name =3D __stringify(_name), \ - .ca_mode =3D S_IRUGO | S_IWUSR, \ - .ca_owner =3D THIS_MODULE, \ - }, \ - .cb_private =3D _priv, \ - .cb_max_size =3D _maxsz, \ - .read =3D _pfx##_name##_read, \ - .write =3D _pfx##_name##_write, \ +#define CONFIGFS_BIN_ATTR(_pfx, _name, _priv, _maxsz) \ +static const struct configfs_bin_attribute _pfx##attr_##_name =3D { \ + .cb_attr =3D { \ + .ca_name =3D __stringify(_name), \ + .ca_mode =3D S_IRUGO | S_IWUSR, \ + .ca_owner =3D THIS_MODULE, \ + }, \ + .cb_private =3D _priv, \ + .cb_max_size =3D _maxsz, \ + .read =3D _pfx##_name##_read, \ + .write =3D _pfx##_name##_write, \ } =20 -#define CONFIGFS_BIN_ATTR_RO(_pfx, _name, _priv, _maxsz) \ -static struct configfs_bin_attribute _pfx##attr_##_name =3D { \ - .cb_attr =3D { \ - .ca_name =3D __stringify(_name), \ - .ca_mode =3D S_IRUGO, \ - .ca_owner =3D THIS_MODULE, \ - }, \ - .cb_private =3D _priv, \ - .cb_max_size =3D _maxsz, \ - .read =3D _pfx##_name##_read, \ +#define CONFIGFS_BIN_ATTR_RO(_pfx, _name, _priv, _maxsz) \ +static const struct configfs_bin_attribute _pfx##attr_##_name =3D { \ + .cb_attr =3D { \ + .ca_name =3D __stringify(_name), \ + .ca_mode =3D S_IRUGO, \ + .ca_owner =3D THIS_MODULE, \ + }, \ + .cb_private =3D _priv, \ + .cb_max_size =3D _maxsz, \ + .read =3D _pfx##_name##_read, \ } =20 -#define CONFIGFS_BIN_ATTR_WO(_pfx, _name, _priv, _maxsz) \ -static struct configfs_bin_attribute _pfx##attr_##_name =3D { \ - .cb_attr =3D { \ - .ca_name =3D __stringify(_name), \ - .ca_mode =3D S_IWUSR, \ - .ca_owner =3D THIS_MODULE, \ - }, \ - .cb_private =3D _priv, \ - .cb_max_size =3D _maxsz, \ - .write =3D _pfx##_name##_write, \ +#define CONFIGFS_BIN_ATTR_WO(_pfx, _name, _priv, _maxsz) \ +static const struct configfs_bin_attribute _pfx##attr_##_name =3D { \ + .cb_attr =3D { \ + .ca_name =3D __stringify(_name), \ + .ca_mode =3D S_IWUSR, \ + .ca_owner =3D THIS_MODULE, \ + }, \ + .cb_private =3D _priv, \ + .cb_max_size =3D _maxsz, \ + .write =3D _pfx##_name##_write, \ } =20 /* diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs index b33fb2e9adf1..f99a6e376fa3 100644 --- a/rust/kernel/configfs.rs +++ b/rust/kernel/configfs.rs @@ -757,7 +757,7 @@ pub const fn new_with_child_ctor( ct_group_ops: GroupOperationsVTable::= ::vtable_ptr(), ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr(), ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), - ct_bin_attrs: core::ptr::null_mut(), + ct_bin_attrs: core::ptr::null(), }), _p: PhantomData, } @@ -774,7 +774,7 @@ pub const fn new( ct_group_ops: core::ptr::null(), ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr(), ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), - ct_bin_attrs: core::ptr::null_mut(), + ct_bin_attrs: core::ptr::null(), }), _p: PhantomData, } --=20 2.55.0 From nobody Mon Jul 27 19:00:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C070443E07A; Thu, 16 Jul 2026 17:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221790; cv=none; b=XHkitvpSckPq/L8h/R/cr8SLnfPFd6kuqbqtha4v7sPhMCPU4KFxG4uP5xNfShsiUOy5jN1FZxCgpURvQia66x+h+BgLmu6s1g2rD8mHcm6dKdRHlmsQ8EEK2hbyvrEOYwcLylGeiEzNM2kTYyZZw32fKdGdf8ArEo0/+Vnuqgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221790; c=relaxed/simple; bh=rcnAPuhL8Z0tyvLmFviUdVzEcI4fwp6dRZrhwOTqVoA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r3JLTdE9WrjbwHRayGm07B8qIu13NkqRxnUXYoyAW1yoS7FiYtEwfEe8FNCu3vn3V3OCEP5TYhTvhsSedhpNXEA1rZPRaoMYe/xcEJ/bSxs5aYcmGtI0TAKOM33Esfc7DRMRojRcAQ04Fq+Z7w/kupN955wdNTAbtj1gD6S36lk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=nOETgqmV; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="nOETgqmV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1784221779; bh=rcnAPuhL8Z0tyvLmFviUdVzEcI4fwp6dRZrhwOTqVoA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nOETgqmVNkaIt9iGQH/1tiOMAegyFKlI3RwPiCCK4gjxBd9f8iI1S3JDe2PnVCaAz NxGs9kkQ3hD2UNPk26CSQb7Pv9r4aHe98FoTBCMfEUKzxP0P8pbkyv/7ki6/Mnn6kp +slMWZBB5W6VhRNNdOGlrg04PHNiCNFqUxeHUdxM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 16 Jul 2026 19:09:30 +0200 Subject: [PATCH 5/6] configfs: Allow the registration of const struct configfs_attribute Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260716-configfs-const-base-v1-5-c545a4053cb5@weissschuh.net> References: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> In-Reply-To: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> To: Andreas Hindborg , Breno Leitao , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Rodrigo Vivi , David Airlie , Simona Vetter , Dan Williams , "Rafael J. Wysocki" , Len Brown Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-coco@lists.linux.dev, linux-acpi@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784221778; l=3319; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=rcnAPuhL8Z0tyvLmFviUdVzEcI4fwp6dRZrhwOTqVoA=; b=BbbHbm8YNFPQUYzw2eaFmTWdJbpX3GvBgFeLEGXDxWxnIG1Z8xTzlkFqKvEUcuRAd6g3Rl8FE OjFsAUTLCitCBHywW3Vn0JL/8AcrsjEWHYxagQ+dWpIfIh2HzKbjiX+ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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=C3=9Fschuh --- fs/configfs/dir.c | 4 ++-- include/linux/configfs.h | 5 ++++- rust/kernel/configfs.rs | 8 ++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 9a5c2bc4065d..c2152288517c 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -632,8 +632,8 @@ static int populate_attrs(struct config_item *item) =20 ops =3D t->ct_group_ops; =20 - if (t->ct_attrs) { - for (i =3D 0; (attr =3D t->ct_attrs[i]) !=3D NULL; i++) { + if (t->ct_attrs_const) { + for (i =3D 0; (attr =3D t->ct_attrs_const[i]) !=3D NULL; i++) { if (ops && ops->is_visible && !ops->is_visible(item, attr, i)) continue; =20 diff --git a/include/linux/configfs.h b/include/linux/configfs.h index eff2fb22ab70..5bead9173ec1 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h @@ -66,7 +66,10 @@ struct config_item_type { struct module *ct_owner; const struct configfs_item_operations *ct_item_ops; const struct configfs_group_operations *ct_group_ops; - struct configfs_attribute **ct_attrs; + union { + struct configfs_attribute **ct_attrs; + const struct configfs_attribute *const *ct_attrs_const; + }; const struct configfs_bin_attribute *const *ct_bin_attrs; }; =20 diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs index f99a6e376fa3..2ef9cce693b9 100644 --- a/rust/kernel/configfs.rs +++ b/rust/kernel/configfs.rs @@ -756,7 +756,9 @@ pub const fn new_with_child_ctor( ct_owner: owner.as_ptr(), ct_group_ops: GroupOperationsVTable::= ::vtable_ptr(), ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr(), - ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), + __bindgen_anon_1: bindings::config_item_type__bind= gen_ty_1 { + ct_attrs_const: core::ptr::from_ref(attributes= ).cast(), + }, ct_bin_attrs: core::ptr::null(), }), _p: PhantomData, @@ -773,7 +775,9 @@ pub const fn new( ct_owner: owner.as_ptr(), ct_group_ops: core::ptr::null(), ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr(), - ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), + __bindgen_anon_1: bindings::config_item_type__bind= gen_ty_1 { + ct_attrs_const: core::ptr::from_ref(attributes= ).cast(), + }, ct_bin_attrs: core::ptr::null(), }), _p: PhantomData, --=20 2.55.0 From nobody Mon Jul 27 19:00:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BED5143E078; Thu, 16 Jul 2026 17:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221790; cv=none; b=XA9WJukdjbL5dBWsMdOv0sJq56F4FSfA7wcHvanY09VrxNo2wgD/2FI1fLNH5JTH2iJDipFFKv5MM/NSRF9S/MqT7zoaE1Liucob+kbLIqh727rUi/LHncsJARfPDveWpOKAFBWa93ZtHD8eJ5TvdVTkw1PzaOiWdEPPpUiHOCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784221790; c=relaxed/simple; bh=Jqeaf0RHmFHchKboHfe8TOAt/Yn8lf+aa6AK+WDbCKg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PeUkXfpuERyhmHK0JU+c2QDuPEUElBcKLEbl+JWzmxzvbFnmHOfO5T1aKrZVIkSbLb/SL9qQcvjNC56puICwq/9w03rTUaNjZDOUF+k86c+wGArGHHzRf6GKaTSvw4IsnQ1tuq1/dGG5tqD7z4s6q/f9FxR+q/Aw1SV+DOtzDz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=Zf7EijZL; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="Zf7EijZL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1784221779; bh=Jqeaf0RHmFHchKboHfe8TOAt/Yn8lf+aa6AK+WDbCKg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Zf7EijZLkQo1v/bOfZjO64Vgr+61+x6LOIbk2F2XVPt5NpNS+YOEfZVMKvO/LrAkw EBxR+ewG2SeKkW5VnXE7Sm+hZERYjnDJzC593yzsaMvY6Skp6clnL4wXYs4Zu0hpRW JONccwxIld905RKugoIEfKUTCnijiWpKNkeKYTho= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 16 Jul 2026 19:09:31 +0200 Subject: [PATCH 6/6] samples: configfs: constify the configfs_attribute structures Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260716-configfs-const-base-v1-6-c545a4053cb5@weissschuh.net> References: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> In-Reply-To: <20260716-configfs-const-base-v1-0-c545a4053cb5@weissschuh.net> To: Andreas Hindborg , Breno Leitao , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Rodrigo Vivi , David Airlie , Simona Vetter , Dan Williams , "Rafael J. Wysocki" , Len Brown Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-coco@lists.linux.dev, linux-acpi@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784221778; l=3081; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Jqeaf0RHmFHchKboHfe8TOAt/Yn8lf+aa6AK+WDbCKg=; b=7bDJtJqi2GwzcclrqO13otP/cHLvBoTe7MLJ8jjBiXrkkJXi3AfXGL9BGkA/sJ1Ohf1Di9KIa GwLutWLJ9x8AjIIoXiPjTXSpZ30RE48fGviKUafVk3UIuY78ChApoyH X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= To show that the transition machinery works, constify the sample code. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Breno Leitao --- samples/configfs/configfs_sample.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/configfs/configfs_sample.c b/samples/configfs/configfs= _sample.c index c1b108ec4ea0..9788ec9b8e30 100644 --- a/samples/configfs/configfs_sample.c +++ b/samples/configfs/configfs_sample.c @@ -84,7 +84,7 @@ CONFIGFS_ATTR_RO(childless_, showme); CONFIGFS_ATTR(childless_, storeme); CONFIGFS_ATTR_RO(childless_, description); =20 -static struct configfs_attribute *childless_attrs[] =3D { +static const struct configfs_attribute *const childless_attrs[] =3D { &childless_attr_showme, &childless_attr_storeme, &childless_attr_description, @@ -92,7 +92,7 @@ static struct configfs_attribute *childless_attrs[] =3D { }; =20 static const struct config_item_type childless_type =3D { - .ct_attrs =3D childless_attrs, + .ct_attrs_const =3D childless_attrs, .ct_owner =3D THIS_MODULE, }; =20 @@ -148,7 +148,7 @@ static ssize_t simple_child_storeme_store(struct config= _item *item, =20 CONFIGFS_ATTR(simple_child_, storeme); =20 -static struct configfs_attribute *simple_child_attrs[] =3D { +static const struct configfs_attribute *const simple_child_attrs[] =3D { &simple_child_attr_storeme, NULL, }; @@ -164,7 +164,7 @@ static const struct configfs_item_operations simple_chi= ld_item_ops =3D { =20 static const struct config_item_type simple_child_type =3D { .ct_item_ops =3D &simple_child_item_ops, - .ct_attrs =3D simple_child_attrs, + .ct_attrs_const =3D simple_child_attrs, .ct_owner =3D THIS_MODULE, }; =20 @@ -205,7 +205,7 @@ static ssize_t simple_children_description_show(struct = config_item *item, =20 CONFIGFS_ATTR_RO(simple_children_, description); =20 -static struct configfs_attribute *simple_children_attrs[] =3D { +static const struct configfs_attribute *const simple_children_attrs[] =3D { &simple_children_attr_description, NULL, }; @@ -230,7 +230,7 @@ static const struct configfs_group_operations simple_ch= ildren_group_ops =3D { static const struct config_item_type simple_children_type =3D { .ct_item_ops =3D &simple_children_item_ops, .ct_group_ops =3D &simple_children_group_ops, - .ct_attrs =3D simple_children_attrs, + .ct_attrs_const =3D simple_children_attrs, .ct_owner =3D THIS_MODULE, }; =20 @@ -283,7 +283,7 @@ static ssize_t group_children_description_show(struct c= onfig_item *item, =20 CONFIGFS_ATTR_RO(group_children_, description); =20 -static struct configfs_attribute *group_children_attrs[] =3D { +static const struct configfs_attribute *const group_children_attrs[] =3D { &group_children_attr_description, NULL, }; @@ -298,7 +298,7 @@ static const struct configfs_group_operations group_chi= ldren_group_ops =3D { =20 static const struct config_item_type group_children_type =3D { .ct_group_ops =3D &group_children_group_ops, - .ct_attrs =3D group_children_attrs, + .ct_attrs_const =3D group_children_attrs, .ct_owner =3D THIS_MODULE, }; =20 --=20 2.55.0