Skip to content

Commit

Permalink
efi: use default_groups in kobj_type
Browse files Browse the repository at this point in the history
There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field.  Move the firmware efi sysfs code to use default_groups
field which has been the preferred way since aa30f47 ("kobject: Add
support for default attribute groups to kobj_type") so that we can soon
get rid of the obsolete default_attrs field.

Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
  • Loading branch information
Greg Kroah-Hartman authored and Ard Biesheuvel committed Jan 6, 2022
1 parent f046fff commit 42f4046
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/firmware/efi/efivars.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,12 @@ static struct attribute *def_attrs[] = {
&efivar_attr_raw_var.attr,
NULL,
};
ATTRIBUTE_GROUPS(def);

static struct kobj_type efivar_ktype = {
.release = efivar_release,
.sysfs_ops = &efivar_attr_ops,
.default_attrs = def_attrs,
.default_groups = def_groups,
};

static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
Expand Down
4 changes: 3 additions & 1 deletion drivers/firmware/efi/esrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ static struct attribute *esre1_attrs[] = {
&esre_last_attempt_status.attr,
NULL
};
ATTRIBUTE_GROUPS(esre1);

static void esre_release(struct kobject *kobj)
{
struct esre_entry *entry = to_entry(kobj);
Expand All @@ -157,7 +159,7 @@ static void esre_release(struct kobject *kobj)
static struct kobj_type esre1_ktype = {
.release = esre_release,
.sysfs_ops = &esre_attr_ops,
.default_attrs = esre1_attrs,
.default_groups = esre1_groups,
};


Expand Down
3 changes: 2 additions & 1 deletion drivers/firmware/efi/runtime-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static struct attribute *def_attrs[] = {
&map_attribute_attr.attr,
NULL
};
ATTRIBUTE_GROUPS(def);

static const struct sysfs_ops map_attr_ops = {
.show = map_attr_show,
Expand All @@ -94,7 +95,7 @@ static void map_release(struct kobject *kobj)

static struct kobj_type __refdata map_ktype = {
.sysfs_ops = &map_attr_ops,
.default_attrs = def_attrs,
.default_groups = def_groups,
.release = map_release,
};

Expand Down

0 comments on commit 42f4046

Please sign in to comment.