aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-02 16:20:40 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:19 -0500
commit334c6307543a2b8af730a422f466d5f9442b606a (patch)
tree4e6e4dcecfcdb57c1e93c26b0e646dcfd306b2e1
parent97fa5bb74c26fda93757b94ed248f5dabd4ad3d7 (diff)
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: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/firmware/efivars.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 82183c28a12a..ebc38534b02d 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -129,13 +129,6 @@ struct efivar_attribute {
129}; 129};
130 130
131 131
132#define EFI_ATTR(_name, _mode, _show, _store) \
133struct subsys_attribute efi_attr_##_name = { \
134 .attr = {.name = __stringify(_name), .mode = _mode}, \
135 .show = _show, \
136 .store = _store, \
137};
138
139#define EFIVAR_ATTR(_name, _mode, _show, _store) \ 132#define EFIVAR_ATTR(_name, _mode, _show, _store) \
140struct efivar_attribute efivar_attr_##_name = { \ 133struct efivar_attribute efivar_attr_##_name = { \
141 .attr = {.name = __stringify(_name), .mode = _mode}, \ 134 .attr = {.name = __stringify(_name), .mode = _mode}, \
@@ -540,12 +533,12 @@ static struct bin_attribute var_subsys_attr_del_var = {
540 * Let's not leave out systab information that snuck into 533 * Let's not leave out systab information that snuck into
541 * the efivars driver 534 * the efivars driver
542 */ 535 */
543static ssize_t 536static ssize_t systab_show(struct kobject *kobj,
544systab_read(struct kset *kset, char *buf) 537 struct kobj_attribute *attr, char *buf)
545{ 538{
546 char *str = buf; 539 char *str = buf;
547 540
548 if (!kset || !buf) 541 if (!kobj || !buf)
549 return -EINVAL; 542 return -EINVAL;
550 543
551 if (efi.mps != EFI_INVALID_TABLE_ADDR) 544 if (efi.mps != EFI_INVALID_TABLE_ADDR)
@@ -566,13 +559,19 @@ systab_read(struct kset *kset, char *buf)
566 return str - buf; 559 return str - buf;
567} 560}
568 561
569static EFI_ATTR(systab, 0400, systab_read, NULL); 562static struct kobj_attribute efi_attr_systab =
563 __ATTR(systab, 0400, systab_show, NULL);
570 564
571static struct subsys_attribute *efi_subsys_attrs[] = { 565static struct attribute *efi_subsys_attrs[] = {
572 &efi_attr_systab, 566 &efi_attr_systab.attr,
573 NULL, /* maybe more in the future? */ 567 NULL, /* maybe more in the future? */
574}; 568};
575 569
570static struct attribute_group efi_subsys_attr_group = {
571 .attrs = efi_subsys_attrs,
572};
573
574
576static decl_subsys(vars, NULL); 575static decl_subsys(vars, NULL);
577static decl_subsys(efi, NULL); 576static decl_subsys(efi, NULL);
578 577
@@ -651,9 +650,8 @@ efivars_init(void)
651 efi_status_t status = EFI_NOT_FOUND; 650 efi_status_t status = EFI_NOT_FOUND;
652 efi_guid_t vendor_guid; 651 efi_guid_t vendor_guid;
653 efi_char16_t *variable_name; 652 efi_char16_t *variable_name;
654 struct subsys_attribute *attr;
655 unsigned long variable_name_size = 1024; 653 unsigned long variable_name_size = 1024;
656 int i, error = 0; 654 int error = 0;
657 655
658 if (!efi_enabled) 656 if (!efi_enabled)
659 return -ENODEV; 657 return -ENODEV;
@@ -730,12 +728,7 @@ efivars_init(void)
730 " due to error %d\n", error); 728 " due to error %d\n", error);
731 729
732 /* Don't forget the systab entry */ 730 /* Don't forget the systab entry */
733 731 error = sysfs_create_group(&efi_subsys.kobj, &efi_subsys_attr_group);
734 for (i = 0; (attr = efi_subsys_attrs[i]) && !error; i++) {
735 if (attr->show)
736 error = subsys_create_file(&efi_subsys, attr);
737 }
738
739 if (error) 732 if (error)
740 printk(KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n", error); 733 printk(KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n", error);
741 else 734 else