diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-02 16:20:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:19 -0500 |
commit | 66ac831e03879c3c7dae76f793e6094e407081d2 (patch) | |
tree | 7335d58e209dc1dc5413041f95f9f58e13c85e11 | |
parent | 89a07e34b16d9dcdf0a9ada3ca0c9a506b490c8f (diff) |
kset: convert efivars to use kset_create for the vars sub-subsystem.
Dynamically create the kset instead of declaring it statically.
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.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 018ca1cd82bc..e17cd8133548 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -572,7 +572,7 @@ static struct attribute_group efi_subsys_attr_group = { | |||
572 | }; | 572 | }; |
573 | 573 | ||
574 | 574 | ||
575 | static decl_subsys(vars, NULL); | 575 | static struct kset *vars_kset; |
576 | static struct kset *efi_kset; | 576 | static struct kset *efi_kset; |
577 | 577 | ||
578 | /* | 578 | /* |
@@ -618,7 +618,7 @@ efivar_create_sysfs_entry(unsigned long variable_name_size, | |||
618 | efi_guid_unparse(vendor_guid, short_name + strlen(short_name)); | 618 | efi_guid_unparse(vendor_guid, short_name + strlen(short_name)); |
619 | 619 | ||
620 | kobject_set_name(&new_efivar->kobj, "%s", short_name); | 620 | kobject_set_name(&new_efivar->kobj, "%s", short_name); |
621 | new_efivar->kobj.kset = &vars_subsys; | 621 | new_efivar->kobj.kset = vars_kset; |
622 | new_efivar->kobj.ktype = &efivar_ktype; | 622 | new_efivar->kobj.ktype = &efivar_ktype; |
623 | i = kobject_register(&new_efivar->kobj); | 623 | i = kobject_register(&new_efivar->kobj); |
624 | if (i) { | 624 | if (i) { |
@@ -675,12 +675,10 @@ efivars_init(void) | |||
675 | goto out_free; | 675 | goto out_free; |
676 | } | 676 | } |
677 | 677 | ||
678 | vars_subsys.kobj.kset = efi_kset; | 678 | vars_kset = kset_create_and_add("vars", NULL, &efi_kset->kobj); |
679 | 679 | if (!vars_kset) { | |
680 | error = subsystem_register(&vars_subsys); | 680 | printk(KERN_ERR "efivars: Subsystem registration failed.\n"); |
681 | 681 | error = -ENOMEM; | |
682 | if (error) { | ||
683 | printk(KERN_ERR "efivars: Subsystem registration failed with error %d.\n", error); | ||
684 | goto out_firmware_unregister; | 682 | goto out_firmware_unregister; |
685 | } | 683 | } |
686 | 684 | ||
@@ -715,12 +713,12 @@ efivars_init(void) | |||
715 | * Now add attributes to allow creation of new vars | 713 | * Now add attributes to allow creation of new vars |
716 | * and deletion of existing ones... | 714 | * and deletion of existing ones... |
717 | */ | 715 | */ |
718 | error = sysfs_create_bin_file(&vars_subsys.kobj, | 716 | error = sysfs_create_bin_file(&vars_kset->kobj, |
719 | &var_subsys_attr_new_var); | 717 | &var_subsys_attr_new_var); |
720 | if (error) | 718 | if (error) |
721 | printk(KERN_ERR "efivars: unable to create new_var sysfs file" | 719 | printk(KERN_ERR "efivars: unable to create new_var sysfs file" |
722 | " due to error %d\n", error); | 720 | " due to error %d\n", error); |
723 | error = sysfs_create_bin_file(&vars_subsys.kobj, | 721 | error = sysfs_create_bin_file(&vars_kset->kobj, |
724 | &var_subsys_attr_del_var); | 722 | &var_subsys_attr_del_var); |
725 | if (error) | 723 | if (error) |
726 | printk(KERN_ERR "efivars: unable to create del_var sysfs file" | 724 | printk(KERN_ERR "efivars: unable to create del_var sysfs file" |
@@ -733,7 +731,7 @@ efivars_init(void) | |||
733 | else | 731 | else |
734 | goto out_free; | 732 | goto out_free; |
735 | 733 | ||
736 | subsystem_unregister(&vars_subsys); | 734 | kset_unregister(vars_kset); |
737 | 735 | ||
738 | out_firmware_unregister: | 736 | out_firmware_unregister: |
739 | kset_unregister(efi_kset); | 737 | kset_unregister(efi_kset); |
@@ -756,7 +754,7 @@ efivars_exit(void) | |||
756 | efivar_unregister(entry); | 754 | efivar_unregister(entry); |
757 | } | 755 | } |
758 | 756 | ||
759 | subsystem_unregister(&vars_subsys); | 757 | kset_unregister(vars_kset); |
760 | kset_unregister(efi_kset); | 758 | kset_unregister(efi_kset); |
761 | } | 759 | } |
762 | 760 | ||