samples/kobject: Switch to the new __KOBJ_ATTR() macro

To demonstrate and test the upcoming 'const struct kobj_attribute'
handling, convert the sample to the new macro.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20260707-sysfs-const-attr-kobj-attr-prep-v2-2-35ae1bc0f9ef@weissschuh.net
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
Thomas Weißschuh
2026-07-07 18:56:33 +02:00
committed by Danilo Krummrich
parent 418a74d106
commit a3a9c7453f

View File

@@ -45,7 +45,7 @@ static ssize_t foo_store(struct kobject *kobj, struct kobj_attribute *attr,
/* Sysfs attributes cannot be world-writable. */
static struct kobj_attribute foo_attribute =
__ATTR(foo, 0664, foo_show, foo_store);
__KOBJ_ATTR(foo, 0664, foo_show, foo_store);
/*
* More complex function where we determine which variable is being accessed by
@@ -80,9 +80,9 @@ static ssize_t b_store(struct kobject *kobj, struct kobj_attribute *attr,
}
static struct kobj_attribute baz_attribute =
__ATTR(baz, 0664, b_show, b_store);
__KOBJ_ATTR(baz, 0664, b_show, b_store);
static struct kobj_attribute bar_attribute =
__ATTR(bar, 0664, b_show, b_store);
__KOBJ_ATTR(bar, 0664, b_show, b_store);
/*