aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2015-03-17 05:36:14 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-03-25 06:49:50 -0400
commit3be7ae6350c2418efc51aa779a31a6e27c47e046 (patch)
tree90abd14752a693c86a1ca65ff967faf28f507dce /arch/s390
parent0f024379ff8bce40d2387bd7de2dbf0921ab5a5c (diff)
s390/ipl: cleanup macro usage
ipl.c uses 3 different macros to create a sysfs show function for ipl attributes. Define IPL_ATTR_SHOW_FN which is used by all macros. Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/ipl.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index dd8a3505e52a..52fbef91d1d9 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -182,24 +182,21 @@ EXPORT_SYMBOL_GPL(diag308);
182 182
183/* SYSFS */ 183/* SYSFS */
184 184
185#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \ 185#define IPL_ATTR_SHOW_FN(_prefix, _name, _format, args...) \
186static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ 186static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \
187 struct kobj_attribute *attr, \ 187 struct kobj_attribute *attr, \
188 char *page) \ 188 char *page) \
189{ \ 189{ \
190 return sprintf(page, _format, _value); \ 190 return snprintf(page, PAGE_SIZE, _format, ##args); \
191} \ 191}
192
193#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
194IPL_ATTR_SHOW_FN(_prefix, _name, _format, _value) \
192static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ 195static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
193 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL); 196 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL)
194 197
195#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \ 198#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \
196static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ 199IPL_ATTR_SHOW_FN(_prefix, _name, _fmt_out, (unsigned long long) _value) \
197 struct kobj_attribute *attr, \
198 char *page) \
199{ \
200 return sprintf(page, _fmt_out, \
201 (unsigned long long) _value); \
202} \
203static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \ 200static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
204 struct kobj_attribute *attr, \ 201 struct kobj_attribute *attr, \
205 const char *buf, size_t len) \ 202 const char *buf, size_t len) \
@@ -213,15 +210,10 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
213static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ 210static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
214 __ATTR(_name,(S_IRUGO | S_IWUSR), \ 211 __ATTR(_name,(S_IRUGO | S_IWUSR), \
215 sys_##_prefix##_##_name##_show, \ 212 sys_##_prefix##_##_name##_show, \
216 sys_##_prefix##_##_name##_store); 213 sys_##_prefix##_##_name##_store)
217 214
218#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\ 215#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\
219static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ 216IPL_ATTR_SHOW_FN(_prefix, _name, _fmt_out, _value) \
220 struct kobj_attribute *attr, \
221 char *page) \
222{ \
223 return sprintf(page, _fmt_out, _value); \
224} \
225static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \ 217static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
226 struct kobj_attribute *attr, \ 218 struct kobj_attribute *attr, \
227 const char *buf, size_t len) \ 219 const char *buf, size_t len) \
@@ -233,7 +225,7 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
233static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ 225static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
234 __ATTR(_name,(S_IRUGO | S_IWUSR), \ 226 __ATTR(_name,(S_IRUGO | S_IWUSR), \
235 sys_##_prefix##_##_name##_show, \ 227 sys_##_prefix##_##_name##_show, \
236 sys_##_prefix##_##_name##_store); 228 sys_##_prefix##_##_name##_store)
237 229
238static void make_attrs_ro(struct attribute **attrs) 230static void make_attrs_ro(struct attribute **attrs)
239{ 231{