diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-02 17:17:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:21 -0500 |
commit | d91885bef25be2bab686bed082a5d82e358333b9 (patch) | |
tree | 6ab552efa27a61292bbdf993e87b91646ec669cc | |
parent | 9b949165bd4a86c536cb92a9ce4367effbde9079 (diff) |
kset: convert s390 ipl.c to use kset_create
Dynamically create the kset instead of declaring it statically.
This makes the kobject attributes now work properly that I broke in the
previous patch.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Michael Holzheu <holzheu@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Volker Sameske <sameske@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | arch/s390/kernel/ipl.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 50be9d063d68..c8179fc30baa 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -426,7 +426,7 @@ static struct attribute_group ipl_unknown_attr_group = { | |||
426 | .attrs = ipl_unknown_attrs, | 426 | .attrs = ipl_unknown_attrs, |
427 | }; | 427 | }; |
428 | 428 | ||
429 | static decl_subsys(ipl, NULL); | 429 | static struct kset *ipl_kset; |
430 | 430 | ||
431 | /* | 431 | /* |
432 | * reipl section | 432 | * reipl section |
@@ -602,7 +602,7 @@ static ssize_t reipl_type_store(struct kobject *kobj, | |||
602 | static struct kobj_attribute reipl_type_attr = | 602 | static struct kobj_attribute reipl_type_attr = |
603 | __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store); | 603 | __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store); |
604 | 604 | ||
605 | static decl_subsys(reipl, NULL); | 605 | static struct kset *reipl_kset; |
606 | 606 | ||
607 | /* | 607 | /* |
608 | * dump section | 608 | * dump section |
@@ -699,13 +699,13 @@ static ssize_t dump_type_store(struct kobject *kobj, | |||
699 | static struct kobj_attribute dump_type_attr = | 699 | static struct kobj_attribute dump_type_attr = |
700 | __ATTR(dump_type, 0644, dump_type_show, dump_type_store); | 700 | __ATTR(dump_type, 0644, dump_type_show, dump_type_store); |
701 | 701 | ||
702 | static decl_subsys(dump, NULL); | 702 | static struct kset *dump_kset; |
703 | 703 | ||
704 | /* | 704 | /* |
705 | * Shutdown actions section | 705 | * Shutdown actions section |
706 | */ | 706 | */ |
707 | 707 | ||
708 | static decl_subsys(shutdown_actions, NULL); | 708 | static struct kset *shutdown_actions_kset; |
709 | 709 | ||
710 | /* on panic */ | 710 | /* on panic */ |
711 | 711 | ||
@@ -830,23 +830,23 @@ static int __init ipl_register_fcp_files(void) | |||
830 | { | 830 | { |
831 | int rc; | 831 | int rc; |
832 | 832 | ||
833 | rc = sysfs_create_group(&ipl_subsys.kobj, | 833 | rc = sysfs_create_group(&ipl_kset->kobj, |
834 | &ipl_fcp_attr_group); | 834 | &ipl_fcp_attr_group); |
835 | if (rc) | 835 | if (rc) |
836 | goto out; | 836 | goto out; |
837 | rc = sysfs_create_bin_file(&ipl_subsys.kobj, | 837 | rc = sysfs_create_bin_file(&ipl_kset->kobj, |
838 | &ipl_parameter_attr); | 838 | &ipl_parameter_attr); |
839 | if (rc) | 839 | if (rc) |
840 | goto out_ipl_parm; | 840 | goto out_ipl_parm; |
841 | rc = sysfs_create_bin_file(&ipl_subsys.kobj, | 841 | rc = sysfs_create_bin_file(&ipl_kset->kobj, |
842 | &ipl_scp_data_attr); | 842 | &ipl_scp_data_attr); |
843 | if (!rc) | 843 | if (!rc) |
844 | goto out; | 844 | goto out; |
845 | 845 | ||
846 | sysfs_remove_bin_file(&ipl_subsys.kobj, &ipl_parameter_attr); | 846 | sysfs_remove_bin_file(&ipl_kset->kobj, &ipl_parameter_attr); |
847 | 847 | ||
848 | out_ipl_parm: | 848 | out_ipl_parm: |
849 | sysfs_remove_group(&ipl_subsys.kobj, &ipl_fcp_attr_group); | 849 | sysfs_remove_group(&ipl_kset->kobj, &ipl_fcp_attr_group); |
850 | out: | 850 | out: |
851 | return rc; | 851 | return rc; |
852 | } | 852 | } |
@@ -855,12 +855,12 @@ static int __init ipl_init(void) | |||
855 | { | 855 | { |
856 | int rc; | 856 | int rc; |
857 | 857 | ||
858 | rc = firmware_register(&ipl_subsys); | 858 | ipl_kset = kset_create_and_add("ipl", NULL, &firmware_kset->kobj); |
859 | if (rc) | 859 | if (!ipl_kset) |
860 | return rc; | 860 | return -ENOMEM; |
861 | switch (ipl_info.type) { | 861 | switch (ipl_info.type) { |
862 | case IPL_TYPE_CCW: | 862 | case IPL_TYPE_CCW: |
863 | rc = sysfs_create_group(&ipl_subsys.kobj, | 863 | rc = sysfs_create_group(&ipl_kset->kobj, |
864 | &ipl_ccw_attr_group); | 864 | &ipl_ccw_attr_group); |
865 | break; | 865 | break; |
866 | case IPL_TYPE_FCP: | 866 | case IPL_TYPE_FCP: |
@@ -868,16 +868,16 @@ static int __init ipl_init(void) | |||
868 | rc = ipl_register_fcp_files(); | 868 | rc = ipl_register_fcp_files(); |
869 | break; | 869 | break; |
870 | case IPL_TYPE_NSS: | 870 | case IPL_TYPE_NSS: |
871 | rc = sysfs_create_group(&ipl_subsys.kobj, | 871 | rc = sysfs_create_group(&ipl_kset->kobj, |
872 | &ipl_nss_attr_group); | 872 | &ipl_nss_attr_group); |
873 | break; | 873 | break; |
874 | default: | 874 | default: |
875 | rc = sysfs_create_group(&ipl_subsys.kobj, | 875 | rc = sysfs_create_group(&ipl_kset->kobj, |
876 | &ipl_unknown_attr_group); | 876 | &ipl_unknown_attr_group); |
877 | break; | 877 | break; |
878 | } | 878 | } |
879 | if (rc) | 879 | if (rc) |
880 | firmware_unregister(&ipl_subsys); | 880 | kset_unregister(ipl_kset); |
881 | return rc; | 881 | return rc; |
882 | } | 882 | } |
883 | 883 | ||
@@ -899,7 +899,7 @@ static int __init reipl_nss_init(void) | |||
899 | 899 | ||
900 | if (!MACHINE_IS_VM) | 900 | if (!MACHINE_IS_VM) |
901 | return 0; | 901 | return 0; |
902 | rc = sysfs_create_group(&reipl_subsys.kobj, &reipl_nss_attr_group); | 902 | rc = sysfs_create_group(&reipl_kset->kobj, &reipl_nss_attr_group); |
903 | if (rc) | 903 | if (rc) |
904 | return rc; | 904 | return rc; |
905 | strncpy(reipl_nss_name, kernel_nss_name, NSS_NAME_SIZE + 1); | 905 | strncpy(reipl_nss_name, kernel_nss_name, NSS_NAME_SIZE + 1); |
@@ -914,7 +914,7 @@ static int __init reipl_ccw_init(void) | |||
914 | reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL); | 914 | reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL); |
915 | if (!reipl_block_ccw) | 915 | if (!reipl_block_ccw) |
916 | return -ENOMEM; | 916 | return -ENOMEM; |
917 | rc = sysfs_create_group(&reipl_subsys.kobj, &reipl_ccw_attr_group); | 917 | rc = sysfs_create_group(&reipl_kset->kobj, &reipl_ccw_attr_group); |
918 | if (rc) { | 918 | if (rc) { |
919 | free_page((unsigned long)reipl_block_ccw); | 919 | free_page((unsigned long)reipl_block_ccw); |
920 | return rc; | 920 | return rc; |
@@ -952,7 +952,7 @@ static int __init reipl_fcp_init(void) | |||
952 | reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); | 952 | reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); |
953 | if (!reipl_block_fcp) | 953 | if (!reipl_block_fcp) |
954 | return -ENOMEM; | 954 | return -ENOMEM; |
955 | rc = sysfs_create_group(&reipl_subsys.kobj, &reipl_fcp_attr_group); | 955 | rc = sysfs_create_group(&reipl_kset->kobj, &reipl_fcp_attr_group); |
956 | if (rc) { | 956 | if (rc) { |
957 | free_page((unsigned long)reipl_block_fcp); | 957 | free_page((unsigned long)reipl_block_fcp); |
958 | return rc; | 958 | return rc; |
@@ -974,12 +974,12 @@ static int __init reipl_init(void) | |||
974 | { | 974 | { |
975 | int rc; | 975 | int rc; |
976 | 976 | ||
977 | rc = firmware_register(&reipl_subsys); | 977 | reipl_kset = kset_create_and_add("reipl", NULL, &firmware_kset->kobj); |
978 | if (rc) | 978 | if (!reipl_kset) |
979 | return rc; | 979 | return -ENOMEM; |
980 | rc = sysfs_create_file(&reipl_subsys.kobj, &reipl_type_attr.attr); | 980 | rc = sysfs_create_file(&reipl_kset->kobj, &reipl_type_attr.attr); |
981 | if (rc) { | 981 | if (rc) { |
982 | firmware_unregister(&reipl_subsys); | 982 | kset_unregister(reipl_kset); |
983 | return rc; | 983 | return rc; |
984 | } | 984 | } |
985 | rc = reipl_ccw_init(); | 985 | rc = reipl_ccw_init(); |
@@ -1004,7 +1004,7 @@ static int __init dump_ccw_init(void) | |||
1004 | dump_block_ccw = (void *) get_zeroed_page(GFP_KERNEL); | 1004 | dump_block_ccw = (void *) get_zeroed_page(GFP_KERNEL); |
1005 | if (!dump_block_ccw) | 1005 | if (!dump_block_ccw) |
1006 | return -ENOMEM; | 1006 | return -ENOMEM; |
1007 | rc = sysfs_create_group(&dump_subsys.kobj, &dump_ccw_attr_group); | 1007 | rc = sysfs_create_group(&dump_kset->kobj, &dump_ccw_attr_group); |
1008 | if (rc) { | 1008 | if (rc) { |
1009 | free_page((unsigned long)dump_block_ccw); | 1009 | free_page((unsigned long)dump_block_ccw); |
1010 | return rc; | 1010 | return rc; |
@@ -1028,7 +1028,7 @@ static int __init dump_fcp_init(void) | |||
1028 | dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); | 1028 | dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); |
1029 | if (!dump_block_fcp) | 1029 | if (!dump_block_fcp) |
1030 | return -ENOMEM; | 1030 | return -ENOMEM; |
1031 | rc = sysfs_create_group(&dump_subsys.kobj, &dump_fcp_attr_group); | 1031 | rc = sysfs_create_group(&dump_kset->kobj, &dump_fcp_attr_group); |
1032 | if (rc) { | 1032 | if (rc) { |
1033 | free_page((unsigned long)dump_block_fcp); | 1033 | free_page((unsigned long)dump_block_fcp); |
1034 | return rc; | 1034 | return rc; |
@@ -1063,12 +1063,12 @@ static int __init dump_init(void) | |||
1063 | { | 1063 | { |
1064 | int rc; | 1064 | int rc; |
1065 | 1065 | ||
1066 | rc = firmware_register(&dump_subsys); | 1066 | dump_kset = kset_create_and_add("dump", NULL, &firmware_kset->kobj); |
1067 | if (rc) | 1067 | if (!dump_kset) |
1068 | return rc; | 1068 | return -ENOMEM; |
1069 | rc = sysfs_create_file(&dump_subsys.kobj, &dump_type_attr.attr); | 1069 | rc = sysfs_create_file(&dump_kset->kobj, &dump_type_attr); |
1070 | if (rc) { | 1070 | if (rc) { |
1071 | firmware_unregister(&dump_subsys); | 1071 | kset_unregister(dump_kset); |
1072 | return rc; | 1072 | return rc; |
1073 | } | 1073 | } |
1074 | rc = dump_ccw_init(); | 1074 | rc = dump_ccw_init(); |
@@ -1085,12 +1085,13 @@ static int __init shutdown_actions_init(void) | |||
1085 | { | 1085 | { |
1086 | int rc; | 1086 | int rc; |
1087 | 1087 | ||
1088 | rc = firmware_register(&shutdown_actions_subsys); | 1088 | shutdown_actions_kset = kset_create_and_add("shutdown_actions", NULL, |
1089 | if (rc) | 1089 | &firmware_kset->kobj); |
1090 | return rc; | 1090 | if (!shutdown_actions_kset) |
1091 | rc = sysfs_create_file(&shutdown_actions_subsys.kobj, &on_panic_attr.attr); | 1091 | return -ENOMEM; |
1092 | rc = sysfs_create_file(&shutdown_actions_kset->kobj, &on_panic_attr); | ||
1092 | if (rc) { | 1093 | if (rc) { |
1093 | firmware_unregister(&shutdown_actions_subsys); | 1094 | kset_unregister(shutdown_actions_kset); |
1094 | return rc; | 1095 | return rc; |
1095 | } | 1096 | } |
1096 | atomic_notifier_chain_register(&panic_notifier_list, | 1097 | atomic_notifier_chain_register(&panic_notifier_list, |