mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 18:41:23 +00:00
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: 87fd22e0ae
("s390/ipl: add eckd support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
cbc29f107e
commit
c676aac66f
@ -888,23 +888,26 @@ static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb,
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FCP wrapper */
|
#define DEFINE_GENERIC_LOADPARM(name) \
|
||||||
static ssize_t reipl_fcp_loadparm_show(struct kobject *kobj,
|
static ssize_t reipl_##name##_loadparm_show(struct kobject *kobj, \
|
||||||
struct kobj_attribute *attr, char *page)
|
struct kobj_attribute *attr, char *page) \
|
||||||
{
|
{ \
|
||||||
return reipl_generic_loadparm_show(reipl_block_fcp, page);
|
return reipl_generic_loadparm_show(reipl_block_##name, page); \
|
||||||
}
|
} \
|
||||||
|
static ssize_t reipl_##name##_loadparm_store(struct kobject *kobj, \
|
||||||
|
struct kobj_attribute *attr, \
|
||||||
|
const char *buf, size_t len) \
|
||||||
|
{ \
|
||||||
|
return reipl_generic_loadparm_store(reipl_block_##name, buf, len); \
|
||||||
|
} \
|
||||||
|
static struct kobj_attribute sys_reipl_##name##_loadparm_attr = \
|
||||||
|
__ATTR(loadparm, 0644, reipl_##name##_loadparm_show, \
|
||||||
|
reipl_##name##_loadparm_store)
|
||||||
|
|
||||||
static ssize_t reipl_fcp_loadparm_store(struct kobject *kobj,
|
DEFINE_GENERIC_LOADPARM(fcp);
|
||||||
struct kobj_attribute *attr,
|
DEFINE_GENERIC_LOADPARM(nvme);
|
||||||
const char *buf, size_t len)
|
DEFINE_GENERIC_LOADPARM(ccw);
|
||||||
{
|
DEFINE_GENERIC_LOADPARM(nss);
|
||||||
return reipl_generic_loadparm_store(reipl_block_fcp, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct kobj_attribute sys_reipl_fcp_loadparm_attr =
|
|
||||||
__ATTR(loadparm, 0644, reipl_fcp_loadparm_show,
|
|
||||||
reipl_fcp_loadparm_store);
|
|
||||||
|
|
||||||
static ssize_t reipl_fcp_clear_show(struct kobject *kobj,
|
static ssize_t reipl_fcp_clear_show(struct kobject *kobj,
|
||||||
struct kobj_attribute *attr, char *page)
|
struct kobj_attribute *attr, char *page)
|
||||||
@ -994,24 +997,6 @@ DEFINE_IPL_ATTR_RW(reipl_nvme, bootprog, "%lld\n", "%lld\n",
|
|||||||
DEFINE_IPL_ATTR_RW(reipl_nvme, br_lba, "%lld\n", "%lld\n",
|
DEFINE_IPL_ATTR_RW(reipl_nvme, br_lba, "%lld\n", "%lld\n",
|
||||||
reipl_block_nvme->nvme.br_lba);
|
reipl_block_nvme->nvme.br_lba);
|
||||||
|
|
||||||
/* nvme wrapper */
|
|
||||||
static ssize_t reipl_nvme_loadparm_show(struct kobject *kobj,
|
|
||||||
struct kobj_attribute *attr, char *page)
|
|
||||||
{
|
|
||||||
return reipl_generic_loadparm_show(reipl_block_nvme, page);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t reipl_nvme_loadparm_store(struct kobject *kobj,
|
|
||||||
struct kobj_attribute *attr,
|
|
||||||
const char *buf, size_t len)
|
|
||||||
{
|
|
||||||
return reipl_generic_loadparm_store(reipl_block_nvme, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct kobj_attribute sys_reipl_nvme_loadparm_attr =
|
|
||||||
__ATTR(loadparm, 0644, reipl_nvme_loadparm_show,
|
|
||||||
reipl_nvme_loadparm_store);
|
|
||||||
|
|
||||||
static struct attribute *reipl_nvme_attrs[] = {
|
static struct attribute *reipl_nvme_attrs[] = {
|
||||||
&sys_reipl_nvme_fid_attr.attr,
|
&sys_reipl_nvme_fid_attr.attr,
|
||||||
&sys_reipl_nvme_nsid_attr.attr,
|
&sys_reipl_nvme_nsid_attr.attr,
|
||||||
@ -1047,38 +1032,6 @@ static struct kobj_attribute sys_reipl_nvme_clear_attr =
|
|||||||
/* CCW reipl device attributes */
|
/* CCW reipl device attributes */
|
||||||
DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ccw);
|
DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ccw);
|
||||||
|
|
||||||
/* NSS wrapper */
|
|
||||||
static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,
|
|
||||||
struct kobj_attribute *attr, char *page)
|
|
||||||
{
|
|
||||||
return reipl_generic_loadparm_show(reipl_block_nss, page);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t reipl_nss_loadparm_store(struct kobject *kobj,
|
|
||||||
struct kobj_attribute *attr,
|
|
||||||
const char *buf, size_t len)
|
|
||||||
{
|
|
||||||
return reipl_generic_loadparm_store(reipl_block_nss, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* CCW wrapper */
|
|
||||||
static ssize_t reipl_ccw_loadparm_show(struct kobject *kobj,
|
|
||||||
struct kobj_attribute *attr, char *page)
|
|
||||||
{
|
|
||||||
return reipl_generic_loadparm_show(reipl_block_ccw, page);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t reipl_ccw_loadparm_store(struct kobject *kobj,
|
|
||||||
struct kobj_attribute *attr,
|
|
||||||
const char *buf, size_t len)
|
|
||||||
{
|
|
||||||
return reipl_generic_loadparm_store(reipl_block_ccw, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct kobj_attribute sys_reipl_ccw_loadparm_attr =
|
|
||||||
__ATTR(loadparm, 0644, reipl_ccw_loadparm_show,
|
|
||||||
reipl_ccw_loadparm_store);
|
|
||||||
|
|
||||||
static ssize_t reipl_ccw_clear_show(struct kobject *kobj,
|
static ssize_t reipl_ccw_clear_show(struct kobject *kobj,
|
||||||
struct kobj_attribute *attr, char *page)
|
struct kobj_attribute *attr, char *page)
|
||||||
{
|
{
|
||||||
@ -1251,10 +1204,6 @@ static struct kobj_attribute sys_reipl_nss_name_attr =
|
|||||||
__ATTR(name, 0644, reipl_nss_name_show,
|
__ATTR(name, 0644, reipl_nss_name_show,
|
||||||
reipl_nss_name_store);
|
reipl_nss_name_store);
|
||||||
|
|
||||||
static struct kobj_attribute sys_reipl_nss_loadparm_attr =
|
|
||||||
__ATTR(loadparm, 0644, reipl_nss_loadparm_show,
|
|
||||||
reipl_nss_loadparm_store);
|
|
||||||
|
|
||||||
static struct attribute *reipl_nss_attrs[] = {
|
static struct attribute *reipl_nss_attrs[] = {
|
||||||
&sys_reipl_nss_name_attr.attr,
|
&sys_reipl_nss_name_attr.attr,
|
||||||
&sys_reipl_nss_loadparm_attr.attr,
|
&sys_reipl_nss_loadparm_attr.attr,
|
||||||
|
Loading…
Reference in New Issue
Block a user