aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-02 17:17:00 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:20 -0500
commit9b949165bd4a86c536cb92a9ce4367effbde9079 (patch)
tree292177f95b251331a54abc6dc79e6e60f066246d /arch/s390
parent79393fc46ede43451a500a132e5de9856f5a4c83 (diff)
kobject: convert s390 ipl.c to kobj_attr interface
This makes the code a bit simpler and and gets us one step closer to deleting the deprecated subsys_attr code. NOTE, this needs the next patch in the series in order to work properly. This will build, but the sysfs files will not properly operate. Thanks to Cornelia for the build fix on this 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>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/ipl.c80
1 files changed, 48 insertions, 32 deletions
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index cae793af5423..50be9d063d68 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -162,22 +162,25 @@ EXPORT_SYMBOL_GPL(diag308);
162/* SYSFS */ 162/* SYSFS */
163 163
164#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \ 164#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
165static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \ 165static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \
166 struct kobj_attribute *attr, \
166 char *page) \ 167 char *page) \
167{ \ 168{ \
168 return sprintf(page, _format, _value); \ 169 return sprintf(page, _format, _value); \
169} \ 170} \
170static struct subsys_attribute sys_##_prefix##_##_name##_attr = \ 171static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
171 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL); 172 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL);
172 173
173#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \ 174#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \
174static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \ 175static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \
176 struct kobj_attribute *attr, \
175 char *page) \ 177 char *page) \
176{ \ 178{ \
177 return sprintf(page, _fmt_out, \ 179 return sprintf(page, _fmt_out, \
178 (unsigned long long) _value); \ 180 (unsigned long long) _value); \
179} \ 181} \
180static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \ 182static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
183 struct kobj_attribute *attr, \
181 const char *buf, size_t len) \ 184 const char *buf, size_t len) \
182{ \ 185{ \
183 unsigned long long value; \ 186 unsigned long long value; \
@@ -186,25 +189,27 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \
186 _value = value; \ 189 _value = value; \
187 return len; \ 190 return len; \
188} \ 191} \
189static struct subsys_attribute sys_##_prefix##_##_name##_attr = \ 192static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
190 __ATTR(_name,(S_IRUGO | S_IWUSR), \ 193 __ATTR(_name,(S_IRUGO | S_IWUSR), \
191 sys_##_prefix##_##_name##_show, \ 194 sys_##_prefix##_##_name##_show, \
192 sys_##_prefix##_##_name##_store); 195 sys_##_prefix##_##_name##_store);
193 196
194#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\ 197#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\
195static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \ 198static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \
199 struct kobj_attribute *attr, \
196 char *page) \ 200 char *page) \
197{ \ 201{ \
198 return sprintf(page, _fmt_out, _value); \ 202 return sprintf(page, _fmt_out, _value); \
199} \ 203} \
200static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \ 204static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
205 struct kobj_attribute *attr, \
201 const char *buf, size_t len) \ 206 const char *buf, size_t len) \
202{ \ 207{ \
203 if (sscanf(buf, _fmt_in, _value) != 1) \ 208 if (sscanf(buf, _fmt_in, _value) != 1) \
204 return -EINVAL; \ 209 return -EINVAL; \
205 return len; \ 210 return len; \
206} \ 211} \
207static struct subsys_attribute sys_##_prefix##_##_name##_attr = \ 212static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
208 __ATTR(_name,(S_IRUGO | S_IWUSR), \ 213 __ATTR(_name,(S_IRUGO | S_IWUSR), \
209 sys_##_prefix##_##_name##_show, \ 214 sys_##_prefix##_##_name##_show, \
210 sys_##_prefix##_##_name##_store); 215 sys_##_prefix##_##_name##_store);
@@ -270,14 +275,16 @@ void __init setup_ipl_info(void)
270struct ipl_info ipl_info; 275struct ipl_info ipl_info;
271EXPORT_SYMBOL_GPL(ipl_info); 276EXPORT_SYMBOL_GPL(ipl_info);
272 277
273static ssize_t ipl_type_show(struct kset *kset, char *page) 278static ssize_t ipl_type_show(struct kobject *kobj, struct kobj_attribute *attr,
279 char *page)
274{ 280{
275 return sprintf(page, "%s\n", ipl_type_str(ipl_info.type)); 281 return sprintf(page, "%s\n", ipl_type_str(ipl_info.type));
276} 282}
277 283
278static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); 284static struct kobj_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
279 285
280static ssize_t sys_ipl_device_show(struct kset *kset, char *page) 286static ssize_t sys_ipl_device_show(struct kobject *kobj,
287 struct kobj_attribute *attr, char *page)
281{ 288{
282 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; 289 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
283 290
@@ -292,7 +299,7 @@ static ssize_t sys_ipl_device_show(struct kset *kset, char *page)
292 } 299 }
293} 300}
294 301
295static struct subsys_attribute sys_ipl_device_attr = 302static struct kobj_attribute sys_ipl_device_attr =
296 __ATTR(device, S_IRUGO, sys_ipl_device_show, NULL); 303 __ATTR(device, S_IRUGO, sys_ipl_device_show, NULL);
297 304
298static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr, 305static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr,
@@ -367,7 +374,8 @@ static struct attribute_group ipl_fcp_attr_group = {
367 374
368/* CCW ipl device attributes */ 375/* CCW ipl device attributes */
369 376
370static ssize_t ipl_ccw_loadparm_show(struct kset *kset, char *page) 377static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
378 struct kobj_attribute *attr, char *page)
371{ 379{
372 char loadparm[LOADPARM_LEN + 1] = {}; 380 char loadparm[LOADPARM_LEN + 1] = {};
373 381
@@ -379,7 +387,7 @@ static ssize_t ipl_ccw_loadparm_show(struct kset *kset, char *page)
379 return sprintf(page, "%s\n", loadparm); 387 return sprintf(page, "%s\n", loadparm);
380} 388}
381 389
382static struct subsys_attribute sys_ipl_ccw_loadparm_attr = 390static struct kobj_attribute sys_ipl_ccw_loadparm_attr =
383 __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL); 391 __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL);
384 392
385static struct attribute *ipl_ccw_attrs[] = { 393static struct attribute *ipl_ccw_attrs[] = {
@@ -465,7 +473,8 @@ static void reipl_get_ascii_loadparm(char *loadparm)
465 strstrip(loadparm); 473 strstrip(loadparm);
466} 474}
467 475
468static ssize_t reipl_ccw_loadparm_show(struct kset *kset, char *page) 476static ssize_t reipl_ccw_loadparm_show(struct kobject *kobj,
477 struct kobj_attribute *attr, char *page)
469{ 478{
470 char buf[LOADPARM_LEN + 1]; 479 char buf[LOADPARM_LEN + 1];
471 480
@@ -473,7 +482,8 @@ static ssize_t reipl_ccw_loadparm_show(struct kset *kset, char *page)
473 return sprintf(page, "%s\n", buf); 482 return sprintf(page, "%s\n", buf);
474} 483}
475 484
476static ssize_t reipl_ccw_loadparm_store(struct kset *kset, 485static ssize_t reipl_ccw_loadparm_store(struct kobject *kobj,
486 struct kobj_attribute *attr,
477 const char *buf, size_t len) 487 const char *buf, size_t len)
478{ 488{
479 int i, lp_len; 489 int i, lp_len;
@@ -500,7 +510,7 @@ static ssize_t reipl_ccw_loadparm_store(struct kset *kset,
500 return len; 510 return len;
501} 511}
502 512
503static struct subsys_attribute sys_reipl_ccw_loadparm_attr = 513static struct kobj_attribute sys_reipl_ccw_loadparm_attr =
504 __ATTR(loadparm, 0644, reipl_ccw_loadparm_show, 514 __ATTR(loadparm, 0644, reipl_ccw_loadparm_show,
505 reipl_ccw_loadparm_store); 515 reipl_ccw_loadparm_store);
506 516
@@ -568,13 +578,15 @@ static int reipl_set_type(enum ipl_type type)
568 return 0; 578 return 0;
569} 579}
570 580
571static ssize_t reipl_type_show(struct kset *kset, char *page) 581static ssize_t reipl_type_show(struct kobject *kobj,
582 struct kobj_attribute *attr, char *page)
572{ 583{
573 return sprintf(page, "%s\n", ipl_type_str(reipl_type)); 584 return sprintf(page, "%s\n", ipl_type_str(reipl_type));
574} 585}
575 586
576static ssize_t reipl_type_store(struct kset *kset, const char *buf, 587static ssize_t reipl_type_store(struct kobject *kobj,
577 size_t len) 588 struct kobj_attribute *attr,
589 const char *buf, size_t len)
578{ 590{
579 int rc = -EINVAL; 591 int rc = -EINVAL;
580 592
@@ -587,7 +599,7 @@ static ssize_t reipl_type_store(struct kset *kset, const char *buf,
587 return (rc != 0) ? rc : len; 599 return (rc != 0) ? rc : len;
588} 600}
589 601
590static struct subsys_attribute reipl_type_attr = 602static struct kobj_attribute reipl_type_attr =
591 __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store); 603 __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store);
592 604
593static decl_subsys(reipl, NULL); 605static decl_subsys(reipl, NULL);
@@ -663,13 +675,15 @@ static int dump_set_type(enum dump_type type)
663 return 0; 675 return 0;
664} 676}
665 677
666static ssize_t dump_type_show(struct kset *kset, char *page) 678static ssize_t dump_type_show(struct kobject *kobj,
679 struct kobj_attribute *attr, char *page)
667{ 680{
668 return sprintf(page, "%s\n", dump_type_str(dump_type)); 681 return sprintf(page, "%s\n", dump_type_str(dump_type));
669} 682}
670 683
671static ssize_t dump_type_store(struct kset *kset, const char *buf, 684static ssize_t dump_type_store(struct kobject *kobj,
672 size_t len) 685 struct kobj_attribute *attr,
686 const char *buf, size_t len)
673{ 687{
674 int rc = -EINVAL; 688 int rc = -EINVAL;
675 689
@@ -682,7 +696,7 @@ static ssize_t dump_type_store(struct kset *kset, const char *buf,
682 return (rc != 0) ? rc : len; 696 return (rc != 0) ? rc : len;
683} 697}
684 698
685static struct subsys_attribute dump_type_attr = 699static struct kobj_attribute dump_type_attr =
686 __ATTR(dump_type, 0644, dump_type_show, dump_type_store); 700 __ATTR(dump_type, 0644, dump_type_show, dump_type_store);
687 701
688static decl_subsys(dump, NULL); 702static decl_subsys(dump, NULL);
@@ -695,13 +709,15 @@ static decl_subsys(shutdown_actions, NULL);
695 709
696/* on panic */ 710/* on panic */
697 711
698static ssize_t on_panic_show(struct kset *kset, char *page) 712static ssize_t on_panic_show(struct kobject *kobj,
713 struct kobj_attribute *attr, char *page)
699{ 714{
700 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action)); 715 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action));
701} 716}
702 717
703static ssize_t on_panic_store(struct kset *kset, const char *buf, 718static ssize_t on_panic_store(struct kobject *kobj,
704 size_t len) 719 struct kobj_attribute *attr,
720 const char *buf, size_t len)
705{ 721{
706 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0) 722 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0)
707 on_panic_action = SHUTDOWN_REIPL; 723 on_panic_action = SHUTDOWN_REIPL;
@@ -717,7 +733,7 @@ static ssize_t on_panic_store(struct kset *kset, const char *buf,
717 return len; 733 return len;
718} 734}
719 735
720static struct subsys_attribute on_panic_attr = 736static struct kobj_attribute on_panic_attr =
721 __ATTR(on_panic, 0644, on_panic_show, on_panic_store); 737 __ATTR(on_panic, 0644, on_panic_show, on_panic_store);
722 738
723void do_reipl(void) 739void do_reipl(void)
@@ -961,7 +977,7 @@ static int __init reipl_init(void)
961 rc = firmware_register(&reipl_subsys); 977 rc = firmware_register(&reipl_subsys);
962 if (rc) 978 if (rc)
963 return rc; 979 return rc;
964 rc = subsys_create_file(&reipl_subsys, &reipl_type_attr); 980 rc = sysfs_create_file(&reipl_subsys.kobj, &reipl_type_attr.attr);
965 if (rc) { 981 if (rc) {
966 firmware_unregister(&reipl_subsys); 982 firmware_unregister(&reipl_subsys);
967 return rc; 983 return rc;
@@ -1050,7 +1066,7 @@ static int __init dump_init(void)
1050 rc = firmware_register(&dump_subsys); 1066 rc = firmware_register(&dump_subsys);
1051 if (rc) 1067 if (rc)
1052 return rc; 1068 return rc;
1053 rc = subsys_create_file(&dump_subsys, &dump_type_attr); 1069 rc = sysfs_create_file(&dump_subsys.kobj, &dump_type_attr.attr);
1054 if (rc) { 1070 if (rc) {
1055 firmware_unregister(&dump_subsys); 1071 firmware_unregister(&dump_subsys);
1056 return rc; 1072 return rc;
@@ -1072,7 +1088,7 @@ static int __init shutdown_actions_init(void)
1072 rc = firmware_register(&shutdown_actions_subsys); 1088 rc = firmware_register(&shutdown_actions_subsys);
1073 if (rc) 1089 if (rc)
1074 return rc; 1090 return rc;
1075 rc = subsys_create_file(&shutdown_actions_subsys, &on_panic_attr); 1091 rc = sysfs_create_file(&shutdown_actions_subsys.kobj, &on_panic_attr.attr);
1076 if (rc) { 1092 if (rc) {
1077 firmware_unregister(&shutdown_actions_subsys); 1093 firmware_unregister(&shutdown_actions_subsys);
1078 return rc; 1094 return rc;