Skip to content

Commit c676aac

Browse files
svens-s390hcahca
authored andcommitted
s390/ipl: add DEFINE_GENERIC_LOADPARM()
In the current code each reipl type implements its own pair of loadparm show/store functions. Add a macro to deduplicate the code a bit. Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Fixes: 87fd22e ("s390/ipl: add eckd support") Cc: <stable@vger.kernel.org> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent cbc29f1 commit c676aac

File tree

1 file changed

+20
-71
lines changed

1 file changed

+20
-71
lines changed

arch/s390/kernel/ipl.c

Lines changed: 20 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -888,23 +888,26 @@ static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb,
888888
return len;
889889
}
890890

891-
/* FCP wrapper */
892-
static ssize_t reipl_fcp_loadparm_show(struct kobject *kobj,
893-
struct kobj_attribute *attr, char *page)
894-
{
895-
return reipl_generic_loadparm_show(reipl_block_fcp, page);
896-
}
897-
898-
static ssize_t reipl_fcp_loadparm_store(struct kobject *kobj,
899-
struct kobj_attribute *attr,
900-
const char *buf, size_t len)
901-
{
902-
return reipl_generic_loadparm_store(reipl_block_fcp, buf, len);
903-
}
904-
905-
static struct kobj_attribute sys_reipl_fcp_loadparm_attr =
906-
__ATTR(loadparm, 0644, reipl_fcp_loadparm_show,
907-
reipl_fcp_loadparm_store);
891+
#define DEFINE_GENERIC_LOADPARM(name) \
892+
static ssize_t reipl_##name##_loadparm_show(struct kobject *kobj, \
893+
struct kobj_attribute *attr, char *page) \
894+
{ \
895+
return reipl_generic_loadparm_show(reipl_block_##name, page); \
896+
} \
897+
static ssize_t reipl_##name##_loadparm_store(struct kobject *kobj, \
898+
struct kobj_attribute *attr, \
899+
const char *buf, size_t len) \
900+
{ \
901+
return reipl_generic_loadparm_store(reipl_block_##name, buf, len); \
902+
} \
903+
static struct kobj_attribute sys_reipl_##name##_loadparm_attr = \
904+
__ATTR(loadparm, 0644, reipl_##name##_loadparm_show, \
905+
reipl_##name##_loadparm_store)
906+
907+
DEFINE_GENERIC_LOADPARM(fcp);
908+
DEFINE_GENERIC_LOADPARM(nvme);
909+
DEFINE_GENERIC_LOADPARM(ccw);
910+
DEFINE_GENERIC_LOADPARM(nss);
908911

909912
static ssize_t reipl_fcp_clear_show(struct kobject *kobj,
910913
struct kobj_attribute *attr, char *page)
@@ -994,24 +997,6 @@ DEFINE_IPL_ATTR_RW(reipl_nvme, bootprog, "%lld\n", "%lld\n",
994997
DEFINE_IPL_ATTR_RW(reipl_nvme, br_lba, "%lld\n", "%lld\n",
995998
reipl_block_nvme->nvme.br_lba);
996999

997-
/* nvme wrapper */
998-
static ssize_t reipl_nvme_loadparm_show(struct kobject *kobj,
999-
struct kobj_attribute *attr, char *page)
1000-
{
1001-
return reipl_generic_loadparm_show(reipl_block_nvme, page);
1002-
}
1003-
1004-
static ssize_t reipl_nvme_loadparm_store(struct kobject *kobj,
1005-
struct kobj_attribute *attr,
1006-
const char *buf, size_t len)
1007-
{
1008-
return reipl_generic_loadparm_store(reipl_block_nvme, buf, len);
1009-
}
1010-
1011-
static struct kobj_attribute sys_reipl_nvme_loadparm_attr =
1012-
__ATTR(loadparm, 0644, reipl_nvme_loadparm_show,
1013-
reipl_nvme_loadparm_store);
1014-
10151000
static struct attribute *reipl_nvme_attrs[] = {
10161001
&sys_reipl_nvme_fid_attr.attr,
10171002
&sys_reipl_nvme_nsid_attr.attr,
@@ -1047,38 +1032,6 @@ static struct kobj_attribute sys_reipl_nvme_clear_attr =
10471032
/* CCW reipl device attributes */
10481033
DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ccw);
10491034

1050-
/* NSS wrapper */
1051-
static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,
1052-
struct kobj_attribute *attr, char *page)
1053-
{
1054-
return reipl_generic_loadparm_show(reipl_block_nss, page);
1055-
}
1056-
1057-
static ssize_t reipl_nss_loadparm_store(struct kobject *kobj,
1058-
struct kobj_attribute *attr,
1059-
const char *buf, size_t len)
1060-
{
1061-
return reipl_generic_loadparm_store(reipl_block_nss, buf, len);
1062-
}
1063-
1064-
/* CCW wrapper */
1065-
static ssize_t reipl_ccw_loadparm_show(struct kobject *kobj,
1066-
struct kobj_attribute *attr, char *page)
1067-
{
1068-
return reipl_generic_loadparm_show(reipl_block_ccw, page);
1069-
}
1070-
1071-
static ssize_t reipl_ccw_loadparm_store(struct kobject *kobj,
1072-
struct kobj_attribute *attr,
1073-
const char *buf, size_t len)
1074-
{
1075-
return reipl_generic_loadparm_store(reipl_block_ccw, buf, len);
1076-
}
1077-
1078-
static struct kobj_attribute sys_reipl_ccw_loadparm_attr =
1079-
__ATTR(loadparm, 0644, reipl_ccw_loadparm_show,
1080-
reipl_ccw_loadparm_store);
1081-
10821035
static ssize_t reipl_ccw_clear_show(struct kobject *kobj,
10831036
struct kobj_attribute *attr, char *page)
10841037
{
@@ -1251,10 +1204,6 @@ static struct kobj_attribute sys_reipl_nss_name_attr =
12511204
__ATTR(name, 0644, reipl_nss_name_show,
12521205
reipl_nss_name_store);
12531206

1254-
static struct kobj_attribute sys_reipl_nss_loadparm_attr =
1255-
__ATTR(loadparm, 0644, reipl_nss_loadparm_show,
1256-
reipl_nss_loadparm_store);
1257-
12581207
static struct attribute *reipl_nss_attrs[] = {
12591208
&sys_reipl_nss_name_attr.attr,
12601209
&sys_reipl_nss_loadparm_attr.attr,

0 commit comments

Comments
 (0)