[PATCH 2/4] samples/kobject: Switch to the new __KOBJ_ATTR() macro

From: Thomas Weißschuh

Date: Fri May 29 2026 - 12:48:54 EST


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@xxxxxxxxxxxxxx>
---
samples/kobject/kobject-example.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/samples/kobject/kobject-example.c b/samples/kobject/kobject-example.c
index 36d87ca0bee2..7404f310dc45 100644
--- a/samples/kobject/kobject-example.c
+++ b/samples/kobject/kobject-example.c
@@ -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);


/*

--
2.54.0