Commit d91885be authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9b949165
...@@ -426,7 +426,7 @@ static struct attribute_group ipl_unknown_attr_group = { ...@@ -426,7 +426,7 @@ static struct attribute_group ipl_unknown_attr_group = {
.attrs = ipl_unknown_attrs, .attrs = ipl_unknown_attrs,
}; };
static decl_subsys(ipl, NULL); static struct kset *ipl_kset;
/* /*
* reipl section * reipl section
...@@ -602,7 +602,7 @@ static ssize_t reipl_type_store(struct kobject *kobj, ...@@ -602,7 +602,7 @@ static ssize_t reipl_type_store(struct kobject *kobj,
static struct kobj_attribute reipl_type_attr = static struct kobj_attribute reipl_type_attr =
__ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store); __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store);
static decl_subsys(reipl, NULL); static struct kset *reipl_kset;
/* /*
* dump section * dump section
...@@ -699,13 +699,13 @@ static ssize_t dump_type_store(struct kobject *kobj, ...@@ -699,13 +699,13 @@ static ssize_t dump_type_store(struct kobject *kobj,
static struct kobj_attribute dump_type_attr = static struct kobj_attribute dump_type_attr =
__ATTR(dump_type, 0644, dump_type_show, dump_type_store); __ATTR(dump_type, 0644, dump_type_show, dump_type_store);
static decl_subsys(dump, NULL); static struct kset *dump_kset;
/* /*
* Shutdown actions section * Shutdown actions section
*/ */
static decl_subsys(shutdown_actions, NULL); static struct kset *shutdown_actions_kset;
/* on panic */ /* on panic */
...@@ -830,23 +830,23 @@ static int __init ipl_register_fcp_files(void) ...@@ -830,23 +830,23 @@ static int __init ipl_register_fcp_files(void)
{ {
int rc; int rc;
rc = sysfs_create_group(&ipl_subsys.kobj, rc = sysfs_create_group(&ipl_kset->kobj,
&ipl_fcp_attr_group); &ipl_fcp_attr_group);
if (rc) if (rc)
goto out; goto out;
rc = sysfs_create_bin_file(&ipl_subsys.kobj, rc = sysfs_create_bin_file(&ipl_kset->kobj,
&ipl_parameter_attr); &ipl_parameter_attr);
if (rc) if (rc)
goto out_ipl_parm; goto out_ipl_parm;
rc = sysfs_create_bin_file(&ipl_subsys.kobj, rc = sysfs_create_bin_file(&ipl_kset->kobj,
&ipl_scp_data_attr); &ipl_scp_data_attr);
if (!rc) if (!rc)
goto out; goto out;
sysfs_remove_bin_file(&ipl_subsys.kobj, &ipl_parameter_attr); sysfs_remove_bin_file(&ipl_kset->kobj, &ipl_parameter_attr);
out_ipl_parm: out_ipl_parm:
sysfs_remove_group(&ipl_subsys.kobj, &ipl_fcp_attr_group); sysfs_remove_group(&ipl_kset->kobj, &ipl_fcp_attr_group);
out: out:
return rc; return rc;
} }
...@@ -855,12 +855,12 @@ static int __init ipl_init(void) ...@@ -855,12 +855,12 @@ static int __init ipl_init(void)
{ {
int rc; int rc;
rc = firmware_register(&ipl_subsys); ipl_kset = kset_create_and_add("ipl", NULL, &firmware_kset->kobj);
if (rc) if (!ipl_kset)
return rc; return -ENOMEM;
switch (ipl_info.type) { switch (ipl_info.type) {
case IPL_TYPE_CCW: case IPL_TYPE_CCW:
rc = sysfs_create_group(&ipl_subsys.kobj, rc = sysfs_create_group(&ipl_kset->kobj,
&ipl_ccw_attr_group); &ipl_ccw_attr_group);
break; break;
case IPL_TYPE_FCP: case IPL_TYPE_FCP:
...@@ -868,16 +868,16 @@ static int __init ipl_init(void) ...@@ -868,16 +868,16 @@ static int __init ipl_init(void)
rc = ipl_register_fcp_files(); rc = ipl_register_fcp_files();
break; break;
case IPL_TYPE_NSS: case IPL_TYPE_NSS:
rc = sysfs_create_group(&ipl_subsys.kobj, rc = sysfs_create_group(&ipl_kset->kobj,
&ipl_nss_attr_group); &ipl_nss_attr_group);
break; break;
default: default:
rc = sysfs_create_group(&ipl_subsys.kobj, rc = sysfs_create_group(&ipl_kset->kobj,
&ipl_unknown_attr_group); &ipl_unknown_attr_group);
break; break;
} }
if (rc) if (rc)
firmware_unregister(&ipl_subsys); kset_unregister(ipl_kset);
return rc; return rc;
} }
...@@ -899,7 +899,7 @@ static int __init reipl_nss_init(void) ...@@ -899,7 +899,7 @@ static int __init reipl_nss_init(void)
if (!MACHINE_IS_VM) if (!MACHINE_IS_VM)
return 0; return 0;
rc = sysfs_create_group(&reipl_subsys.kobj, &reipl_nss_attr_group); rc = sysfs_create_group(&reipl_kset->kobj, &reipl_nss_attr_group);
if (rc) if (rc)
return rc; return rc;
strncpy(reipl_nss_name, kernel_nss_name, NSS_NAME_SIZE + 1); strncpy(reipl_nss_name, kernel_nss_name, NSS_NAME_SIZE + 1);
...@@ -914,7 +914,7 @@ static int __init reipl_ccw_init(void) ...@@ -914,7 +914,7 @@ static int __init reipl_ccw_init(void)
reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL); reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL);
if (!reipl_block_ccw) if (!reipl_block_ccw)
return -ENOMEM; return -ENOMEM;
rc = sysfs_create_group(&reipl_subsys.kobj, &reipl_ccw_attr_group); rc = sysfs_create_group(&reipl_kset->kobj, &reipl_ccw_attr_group);
if (rc) { if (rc) {
free_page((unsigned long)reipl_block_ccw); free_page((unsigned long)reipl_block_ccw);
return rc; return rc;
...@@ -952,7 +952,7 @@ static int __init reipl_fcp_init(void) ...@@ -952,7 +952,7 @@ static int __init reipl_fcp_init(void)
reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
if (!reipl_block_fcp) if (!reipl_block_fcp)
return -ENOMEM; return -ENOMEM;
rc = sysfs_create_group(&reipl_subsys.kobj, &reipl_fcp_attr_group); rc = sysfs_create_group(&reipl_kset->kobj, &reipl_fcp_attr_group);
if (rc) { if (rc) {
free_page((unsigned long)reipl_block_fcp); free_page((unsigned long)reipl_block_fcp);
return rc; return rc;
...@@ -974,12 +974,12 @@ static int __init reipl_init(void) ...@@ -974,12 +974,12 @@ static int __init reipl_init(void)
{ {
int rc; int rc;
rc = firmware_register(&reipl_subsys); reipl_kset = kset_create_and_add("reipl", NULL, &firmware_kset->kobj);
if (rc) if (!reipl_kset)
return rc; return -ENOMEM;
rc = sysfs_create_file(&reipl_subsys.kobj, &reipl_type_attr.attr); rc = sysfs_create_file(&reipl_kset->kobj, &reipl_type_attr.attr);
if (rc) { if (rc) {
firmware_unregister(&reipl_subsys); kset_unregister(reipl_kset);
return rc; return rc;
} }
rc = reipl_ccw_init(); rc = reipl_ccw_init();
...@@ -1004,7 +1004,7 @@ static int __init dump_ccw_init(void) ...@@ -1004,7 +1004,7 @@ static int __init dump_ccw_init(void)
dump_block_ccw = (void *) get_zeroed_page(GFP_KERNEL); dump_block_ccw = (void *) get_zeroed_page(GFP_KERNEL);
if (!dump_block_ccw) if (!dump_block_ccw)
return -ENOMEM; return -ENOMEM;
rc = sysfs_create_group(&dump_subsys.kobj, &dump_ccw_attr_group); rc = sysfs_create_group(&dump_kset->kobj, &dump_ccw_attr_group);
if (rc) { if (rc) {
free_page((unsigned long)dump_block_ccw); free_page((unsigned long)dump_block_ccw);
return rc; return rc;
...@@ -1028,7 +1028,7 @@ static int __init dump_fcp_init(void) ...@@ -1028,7 +1028,7 @@ static int __init dump_fcp_init(void)
dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
if (!dump_block_fcp) if (!dump_block_fcp)
return -ENOMEM; return -ENOMEM;
rc = sysfs_create_group(&dump_subsys.kobj, &dump_fcp_attr_group); rc = sysfs_create_group(&dump_kset->kobj, &dump_fcp_attr_group);
if (rc) { if (rc) {
free_page((unsigned long)dump_block_fcp); free_page((unsigned long)dump_block_fcp);
return rc; return rc;
...@@ -1063,12 +1063,12 @@ static int __init dump_init(void) ...@@ -1063,12 +1063,12 @@ static int __init dump_init(void)
{ {
int rc; int rc;
rc = firmware_register(&dump_subsys); dump_kset = kset_create_and_add("dump", NULL, &firmware_kset->kobj);
if (rc) if (!dump_kset)
return rc; return -ENOMEM;
rc = sysfs_create_file(&dump_subsys.kobj, &dump_type_attr.attr); rc = sysfs_create_file(&dump_kset->kobj, &dump_type_attr);
if (rc) { if (rc) {
firmware_unregister(&dump_subsys); kset_unregister(dump_kset);
return rc; return rc;
} }
rc = dump_ccw_init(); rc = dump_ccw_init();
...@@ -1085,12 +1085,13 @@ static int __init shutdown_actions_init(void) ...@@ -1085,12 +1085,13 @@ static int __init shutdown_actions_init(void)
{ {
int rc; int rc;
rc = firmware_register(&shutdown_actions_subsys); shutdown_actions_kset = kset_create_and_add("shutdown_actions", NULL,
if (rc) &firmware_kset->kobj);
return rc; if (!shutdown_actions_kset)
rc = sysfs_create_file(&shutdown_actions_subsys.kobj, &on_panic_attr.attr); return -ENOMEM;
rc = sysfs_create_file(&shutdown_actions_kset->kobj, &on_panic_attr);
if (rc) { if (rc) {
firmware_unregister(&shutdown_actions_subsys); kset_unregister(shutdown_actions_kset);
return rc; return rc;
} }
atomic_notifier_chain_register(&panic_notifier_list, atomic_notifier_chain_register(&panic_notifier_list,
......
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