samples/kobject: make attribute_group const
PATCH 2/2 samples/kobject: make attribute_group const
The attr_group structures are allocated once and never modified at runtime. Also to match the const‑qualified parameter of sysfs_create_group().
No functional change.
Signed-off-by Meng-Shao.Liu <[email protected]>
--- samples/kobject/kobject-example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/kobject/kobject-example.c +1 -1
@@ -102,7 +102,7 @@ static struct attribute *attrs[] = {* created for the attributes with the directory being the name of the * attribute group. */ -static struct attribute_group attr_group = { +static const struct attribute_group attr_group = { .attrs = attrs, };
Signature · 1 line
2.43.0
Quoted 5 lines · Meng-Shao.Liu
The
attr_groupstructures are allocated once and never modified at runtime. Also to match the const‑qualified parameter ofsysfs_create_group().No functional change.
This line isn't needed, as there is a functional change, it moves it into read-only memory, right?
thanks,
greg k-h