Commit 605e70c7 authored by Lee, Chun-Yi's avatar Lee, Chun-Yi Committed by Matt Fleming

efi: add efivars kobject to efi sysfs folder

UEFI variable filesystem need a new mount point, so this patch add
efivars kobject to efi_kobj for create a /sys/firmware/efi/efivars
folder.

Cc: Matthew Garrett <mjg@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarLee, Chun-Yi <jlee@suse.com>
Signed-off-by: default avatarJeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent 0c542edd
...@@ -1527,6 +1527,7 @@ void unregister_efivars(struct efivars *efivars) ...@@ -1527,6 +1527,7 @@ void unregister_efivars(struct efivars *efivars)
sysfs_remove_bin_file(&efivars->kset->kobj, efivars->del_var); sysfs_remove_bin_file(&efivars->kset->kobj, efivars->del_var);
kfree(efivars->new_var); kfree(efivars->new_var);
kfree(efivars->del_var); kfree(efivars->del_var);
kobject_put(efivars->kobject);
kset_unregister(efivars->kset); kset_unregister(efivars->kset);
} }
EXPORT_SYMBOL_GPL(unregister_efivars); EXPORT_SYMBOL_GPL(unregister_efivars);
...@@ -1558,6 +1559,14 @@ int register_efivars(struct efivars *efivars, ...@@ -1558,6 +1559,14 @@ int register_efivars(struct efivars *efivars,
goto out; goto out;
} }
efivars->kobject = kobject_create_and_add("efivars", parent_kobj);
if (!efivars->kobject) {
pr_err("efivars: Subsystem registration failed.\n");
error = -ENOMEM;
kset_unregister(efivars->kset);
goto out;
}
/* /*
* Per EFI spec, the maximum storage allocated for both * Per EFI spec, the maximum storage allocated for both
* the variable name and variable data is 1024 bytes. * the variable name and variable data is 1024 bytes.
......
...@@ -662,6 +662,7 @@ struct efivars { ...@@ -662,6 +662,7 @@ struct efivars {
spinlock_t lock; spinlock_t lock;
struct list_head list; struct list_head list;
struct kset *kset; struct kset *kset;
struct kobject *kobject;
struct bin_attribute *new_var, *del_var; struct bin_attribute *new_var, *del_var;
const struct efivar_operations *ops; const struct efivar_operations *ops;
struct efivar_entry *walk_entry; struct efivar_entry *walk_entry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment