[PATCH v2 0/4] kobject: Allow the constification of kobject attributes

From: Thomas Weißschuh

Date: Tue Jul 07 2026 - 12:59:11 EST


Allow kobject attribute to reside in read-only memory.
Both const and non-const attributes are handled by the utility macros
and attributes can be migrated one-by-one.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
Changes in v2:
- Fix the definition of __KOBJ_ATTR_RO_MODE()
- Rebase on v7.2-rc1
- Link to v1: https://patch.msgid.link/20260529-sysfs-const-attr-kobj-attr-prep-v1-0-7e667ba3bb85@xxxxxxxxxxxxxx

To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
To: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
To: Danilo Krummrich <dakr@xxxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: driver-core@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx

---
Thomas Weißschuh (4):
kobject: Provide macros to initialize 'struct kobj_attribute'
samples/kobject: Switch to the new __KOBJ_ATTR() macro
kobject: Allow the constification of kobject attributes
samples/kobject: Constify kobject attributes

include/linux/kobject.h | 75 ++++++++++++++++++++++++++++++++++++---
lib/kobject.c | 8 +++--
samples/kobject/kobject-example.c | 24 ++++++-------
3 files changed, 89 insertions(+), 18 deletions(-)
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260525-sysfs-const-attr-kobj-attr-prep-9a5d72913fee

Best regards,
--
Thomas Weißschuh <linux@xxxxxxxxxxxxxx>