Commit 334c6307 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

kobject: convert efivars to kobj_attr interface

This cleans up a lot of code and gets rid of a unneeded macro, and gets
us one step closer to deleting the deprecated subsys_attr code.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Matt Tolentino <matthew.e.tolentino@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 97fa5bb7
...@@ -129,13 +129,6 @@ struct efivar_attribute { ...@@ -129,13 +129,6 @@ struct efivar_attribute {
}; };
#define EFI_ATTR(_name, _mode, _show, _store) \
struct subsys_attribute efi_attr_##_name = { \
.attr = {.name = __stringify(_name), .mode = _mode}, \
.show = _show, \
.store = _store, \
};
#define EFIVAR_ATTR(_name, _mode, _show, _store) \ #define EFIVAR_ATTR(_name, _mode, _show, _store) \
struct efivar_attribute efivar_attr_##_name = { \ struct efivar_attribute efivar_attr_##_name = { \
.attr = {.name = __stringify(_name), .mode = _mode}, \ .attr = {.name = __stringify(_name), .mode = _mode}, \
...@@ -540,12 +533,12 @@ static struct bin_attribute var_subsys_attr_del_var = { ...@@ -540,12 +533,12 @@ static struct bin_attribute var_subsys_attr_del_var = {
* Let's not leave out systab information that snuck into * Let's not leave out systab information that snuck into
* the efivars driver * the efivars driver
*/ */
static ssize_t static ssize_t systab_show(struct kobject *kobj,
systab_read(struct kset *kset, char *buf) struct kobj_attribute *attr, char *buf)
{ {
char *str = buf; char *str = buf;
if (!kset || !buf) if (!kobj || !buf)
return -EINVAL; return -EINVAL;
if (efi.mps != EFI_INVALID_TABLE_ADDR) if (efi.mps != EFI_INVALID_TABLE_ADDR)
...@@ -566,13 +559,19 @@ systab_read(struct kset *kset, char *buf) ...@@ -566,13 +559,19 @@ systab_read(struct kset *kset, char *buf)
return str - buf; return str - buf;
} }
static EFI_ATTR(systab, 0400, systab_read, NULL); static struct kobj_attribute efi_attr_systab =
__ATTR(systab, 0400, systab_show, NULL);
static struct subsys_attribute *efi_subsys_attrs[] = { static struct attribute *efi_subsys_attrs[] = {
&efi_attr_systab, &efi_attr_systab.attr,
NULL, /* maybe more in the future? */ NULL, /* maybe more in the future? */
}; };
static struct attribute_group efi_subsys_attr_group = {
.attrs = efi_subsys_attrs,
};
static decl_subsys(vars, NULL); static decl_subsys(vars, NULL);
static decl_subsys(efi, NULL); static decl_subsys(efi, NULL);
...@@ -651,9 +650,8 @@ efivars_init(void) ...@@ -651,9 +650,8 @@ efivars_init(void)
efi_status_t status = EFI_NOT_FOUND; efi_status_t status = EFI_NOT_FOUND;
efi_guid_t vendor_guid; efi_guid_t vendor_guid;
efi_char16_t *variable_name; efi_char16_t *variable_name;
struct subsys_attribute *attr;
unsigned long variable_name_size = 1024; unsigned long variable_name_size = 1024;
int i, error = 0; int error = 0;
if (!efi_enabled) if (!efi_enabled)
return -ENODEV; return -ENODEV;
...@@ -730,12 +728,7 @@ efivars_init(void) ...@@ -730,12 +728,7 @@ efivars_init(void)
" due to error %d\n", error); " due to error %d\n", error);
/* Don't forget the systab entry */ /* Don't forget the systab entry */
error = sysfs_create_group(&efi_subsys.kobj, &efi_subsys_attr_group);
for (i = 0; (attr = efi_subsys_attrs[i]) && !error; i++) {
if (attr->show)
error = subsys_create_file(&efi_subsys, attr);
}
if (error) if (error)
printk(KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n", error); printk(KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n", error);
else else
......
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