Skip to content

Commit

Permalink
samples/kobject: Replace foo_ktype's default_attrs field with groups
Browse files Browse the repository at this point in the history
The kobj_type default_attrs field is being replaced by the
default_groups field. Replace foo_ktype's default_attrs field with
default_groups and use the ATTRIBUTE_GROUPS macro to create
foo_default_groups.

This patch was tested by loading the kset-example module and verifying
that the sysfs files for the attributes in the default group were
created.

Signed-off-by: Kimberly Brown <kimbrownkd@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
kbrown9 authored and gregkh committed Apr 25, 2019
1 parent aa30f47 commit c484a67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion samples/kobject/kset-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ static struct attribute *foo_default_attrs[] = {
&bar_attribute.attr,
NULL, /* need to NULL terminate the list of attributes */
};
ATTRIBUTE_GROUPS(foo_default);

/*
* Our own ktype for our kobjects. Here we specify our sysfs ops, the
Expand All @@ -187,7 +188,7 @@ static struct attribute *foo_default_attrs[] = {
static struct kobj_type foo_ktype = {
.sysfs_ops = &foo_sysfs_ops,
.release = foo_release,
.default_attrs = foo_default_attrs,
.default_groups = foo_default_groups,
};

static struct kset *example_kset;
Expand Down

0 comments on commit c484a67

Please sign in to comment.