Skip to content

Commit c8689cb

Browse files
author
Tobias Huschle
committed
s390/ipl: add DEFINE_GENERIC_LOADPARM()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2160041 Upstream status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Tested: by IBM Build-Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=52482443 Conflicts: part for eckd dump removed, because dump patch not present commit c676aac Author: Sven Schnelle <svens@linux.ibm.com> Date: Sun Jan 29 16:36:03 2023 +0100 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> Signed-off-by: Tobias Huschle <thuschle@redhat.com>
1 parent 5d444d8 commit c8689cb

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
@@ -875,23 +875,26 @@ static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb,
875875
return len;
876876
}
877877

878-
/* FCP wrapper */
879-
static ssize_t reipl_fcp_loadparm_show(struct kobject *kobj,
880-
struct kobj_attribute *attr, char *page)
881-
{
882-
return reipl_generic_loadparm_show(reipl_block_fcp, page);
883-
}
884-
885-
static ssize_t reipl_fcp_loadparm_store(struct kobject *kobj,
886-
struct kobj_attribute *attr,
887-
const char *buf, size_t len)
888-
{
889-
return reipl_generic_loadparm_store(reipl_block_fcp, buf, len);
890-
}
891-
892-
static struct kobj_attribute sys_reipl_fcp_loadparm_attr =
893-
__ATTR(loadparm, 0644, reipl_fcp_loadparm_show,
894-
reipl_fcp_loadparm_store);
878+
#define DEFINE_GENERIC_LOADPARM(name) \
879+
static ssize_t reipl_##name##_loadparm_show(struct kobject *kobj, \
880+
struct kobj_attribute *attr, char *page) \
881+
{ \
882+
return reipl_generic_loadparm_show(reipl_block_##name, page); \
883+
} \
884+
static ssize_t reipl_##name##_loadparm_store(struct kobject *kobj, \
885+
struct kobj_attribute *attr, \
886+
const char *buf, size_t len) \
887+
{ \
888+
return reipl_generic_loadparm_store(reipl_block_##name, buf, len); \
889+
} \
890+
static struct kobj_attribute sys_reipl_##name##_loadparm_attr = \
891+
__ATTR(loadparm, 0644, reipl_##name##_loadparm_show, \
892+
reipl_##name##_loadparm_store)
893+
894+
DEFINE_GENERIC_LOADPARM(fcp);
895+
DEFINE_GENERIC_LOADPARM(nvme);
896+
DEFINE_GENERIC_LOADPARM(ccw);
897+
DEFINE_GENERIC_LOADPARM(nss);
895898

896899
static ssize_t reipl_fcp_clear_show(struct kobject *kobj,
897900
struct kobj_attribute *attr, char *page)
@@ -981,24 +984,6 @@ DEFINE_IPL_ATTR_RW(reipl_nvme, bootprog, "%lld\n", "%lld\n",
981984
DEFINE_IPL_ATTR_RW(reipl_nvme, br_lba, "%lld\n", "%lld\n",
982985
reipl_block_nvme->nvme.br_lba);
983986

984-
/* nvme wrapper */
985-
static ssize_t reipl_nvme_loadparm_show(struct kobject *kobj,
986-
struct kobj_attribute *attr, char *page)
987-
{
988-
return reipl_generic_loadparm_show(reipl_block_nvme, page);
989-
}
990-
991-
static ssize_t reipl_nvme_loadparm_store(struct kobject *kobj,
992-
struct kobj_attribute *attr,
993-
const char *buf, size_t len)
994-
{
995-
return reipl_generic_loadparm_store(reipl_block_nvme, buf, len);
996-
}
997-
998-
static struct kobj_attribute sys_reipl_nvme_loadparm_attr =
999-
__ATTR(loadparm, 0644, reipl_nvme_loadparm_show,
1000-
reipl_nvme_loadparm_store);
1001-
1002987
static struct attribute *reipl_nvme_attrs[] = {
1003988
&sys_reipl_nvme_fid_attr.attr,
1004989
&sys_reipl_nvme_nsid_attr.attr,
@@ -1034,38 +1019,6 @@ static struct kobj_attribute sys_reipl_nvme_clear_attr =
10341019
/* CCW reipl device attributes */
10351020
DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ccw);
10361021

1037-
/* NSS wrapper */
1038-
static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,
1039-
struct kobj_attribute *attr, char *page)
1040-
{
1041-
return reipl_generic_loadparm_show(reipl_block_nss, page);
1042-
}
1043-
1044-
static ssize_t reipl_nss_loadparm_store(struct kobject *kobj,
1045-
struct kobj_attribute *attr,
1046-
const char *buf, size_t len)
1047-
{
1048-
return reipl_generic_loadparm_store(reipl_block_nss, buf, len);
1049-
}
1050-
1051-
/* CCW wrapper */
1052-
static ssize_t reipl_ccw_loadparm_show(struct kobject *kobj,
1053-
struct kobj_attribute *attr, char *page)
1054-
{
1055-
return reipl_generic_loadparm_show(reipl_block_ccw, page);
1056-
}
1057-
1058-
static ssize_t reipl_ccw_loadparm_store(struct kobject *kobj,
1059-
struct kobj_attribute *attr,
1060-
const char *buf, size_t len)
1061-
{
1062-
return reipl_generic_loadparm_store(reipl_block_ccw, buf, len);
1063-
}
1064-
1065-
static struct kobj_attribute sys_reipl_ccw_loadparm_attr =
1066-
__ATTR(loadparm, 0644, reipl_ccw_loadparm_show,
1067-
reipl_ccw_loadparm_store);
1068-
10691022
static ssize_t reipl_ccw_clear_show(struct kobject *kobj,
10701023
struct kobj_attribute *attr, char *page)
10711024
{
@@ -1238,10 +1191,6 @@ static struct kobj_attribute sys_reipl_nss_name_attr =
12381191
__ATTR(name, 0644, reipl_nss_name_show,
12391192
reipl_nss_name_store);
12401193

1241-
static struct kobj_attribute sys_reipl_nss_loadparm_attr =
1242-
__ATTR(loadparm, 0644, reipl_nss_loadparm_show,
1243-
reipl_nss_loadparm_store);
1244-
12451194
static struct attribute *reipl_nss_attrs[] = {
12461195
&sys_reipl_nss_name_attr.attr,
12471196
&sys_reipl_nss_loadparm_attr.attr,

0 commit comments

Comments
 (0)