aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2008-07-01 12:48:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-22 00:55:02 -0400
commit4a0b2b4dbe1335b8b9886ba3dc85a145d5d938ed (patch)
treec2d3a0f86ade5061a1bb9a14aa702323d729fd54 /arch/s390
parent36ce6dad6e3cb3f050ed41e0beac0070d2062b25 (diff)
sysdev: Pass the attribute to the low level sysdev show/store function
This allow to dynamically generate attributes and share show/store functions between attributes. Right now most attributes are generated by special macros and lots of duplicated code. With the attribute passed it's instead possible to attach some data to the attribute and then use that in shared low level functions to do different things. I need this for the dynamically generated bank attributes in the x86 machine check code, but it'll allow some further cleanups. I converted all users in tree to the new show/store prototype. It's a single huge patch to avoid unbisectable sections. Runtime tested: x86-32, x86-64 Compiled only: ia64, powerpc Not compile tested/only grep converted: sh, arm, avr32 Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/smp.c36
-rw-r--r--arch/s390/kernel/time.c35
2 files changed, 48 insertions, 23 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index b6781030cfbd..b795b3e24afd 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -864,7 +864,8 @@ int setup_profiling_timer(unsigned int multiplier)
864} 864}
865 865
866#ifdef CONFIG_HOTPLUG_CPU 866#ifdef CONFIG_HOTPLUG_CPU
867static ssize_t cpu_configure_show(struct sys_device *dev, char *buf) 867static ssize_t cpu_configure_show(struct sys_device *dev,
868 struct sysdev_attribute *attr, char *buf)
868{ 869{
869 ssize_t count; 870 ssize_t count;
870 871
@@ -874,8 +875,9 @@ static ssize_t cpu_configure_show(struct sys_device *dev, char *buf)
874 return count; 875 return count;
875} 876}
876 877
877static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf, 878static ssize_t cpu_configure_store(struct sys_device *dev,
878 size_t count) 879 struct sysdev_attribute *attr,
880 const char *buf, size_t count)
879{ 881{
880 int cpu = dev->id; 882 int cpu = dev->id;
881 int val, rc; 883 int val, rc;
@@ -922,7 +924,8 @@ out:
922static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); 924static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
923#endif /* CONFIG_HOTPLUG_CPU */ 925#endif /* CONFIG_HOTPLUG_CPU */
924 926
925static ssize_t cpu_polarization_show(struct sys_device *dev, char *buf) 927static ssize_t cpu_polarization_show(struct sys_device *dev,
928 struct sysdev_attribute *attr, char *buf)
926{ 929{
927 int cpu = dev->id; 930 int cpu = dev->id;
928 ssize_t count; 931 ssize_t count;
@@ -950,7 +953,8 @@ static ssize_t cpu_polarization_show(struct sys_device *dev, char *buf)
950} 953}
951static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); 954static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL);
952 955
953static ssize_t show_cpu_address(struct sys_device *dev, char *buf) 956static ssize_t show_cpu_address(struct sys_device *dev,
957 struct sysdev_attribute *attr, char *buf)
954{ 958{
955 return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); 959 return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]);
956} 960}
@@ -970,7 +974,8 @@ static struct attribute_group cpu_common_attr_group = {
970 .attrs = cpu_common_attrs, 974 .attrs = cpu_common_attrs,
971}; 975};
972 976
973static ssize_t show_capability(struct sys_device *dev, char *buf) 977static ssize_t show_capability(struct sys_device *dev,
978 struct sysdev_attribute *attr, char *buf)
974{ 979{
975 unsigned int capability; 980 unsigned int capability;
976 int rc; 981 int rc;
@@ -982,7 +987,8 @@ static ssize_t show_capability(struct sys_device *dev, char *buf)
982} 987}
983static SYSDEV_ATTR(capability, 0444, show_capability, NULL); 988static SYSDEV_ATTR(capability, 0444, show_capability, NULL);
984 989
985static ssize_t show_idle_count(struct sys_device *dev, char *buf) 990static ssize_t show_idle_count(struct sys_device *dev,
991 struct sysdev_attribute *attr, char *buf)
986{ 992{
987 struct s390_idle_data *idle; 993 struct s390_idle_data *idle;
988 unsigned long long idle_count; 994 unsigned long long idle_count;
@@ -995,7 +1001,8 @@ static ssize_t show_idle_count(struct sys_device *dev, char *buf)
995} 1001}
996static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); 1002static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL);
997 1003
998static ssize_t show_idle_time(struct sys_device *dev, char *buf) 1004static ssize_t show_idle_time(struct sys_device *dev,
1005 struct sysdev_attribute *attr, char *buf)
999{ 1006{
1000 struct s390_idle_data *idle; 1007 struct s390_idle_data *idle;
1001 unsigned long long new_time; 1008 unsigned long long new_time;
@@ -1112,7 +1119,9 @@ out:
1112 return rc; 1119 return rc;
1113} 1120}
1114 1121
1115static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf, 1122static ssize_t __ref rescan_store(struct sys_device *dev,
1123 struct sysdev_attribute *attr,
1124 const char *buf,
1116 size_t count) 1125 size_t count)
1117{ 1126{
1118 int rc; 1127 int rc;
@@ -1123,7 +1132,9 @@ static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf,
1123static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); 1132static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
1124#endif /* CONFIG_HOTPLUG_CPU */ 1133#endif /* CONFIG_HOTPLUG_CPU */
1125 1134
1126static ssize_t dispatching_show(struct sys_device *dev, char *buf) 1135static ssize_t dispatching_show(struct sys_device *dev,
1136 struct sysdev_attribute *attr,
1137 char *buf)
1127{ 1138{
1128 ssize_t count; 1139 ssize_t count;
1129 1140
@@ -1133,8 +1144,9 @@ static ssize_t dispatching_show(struct sys_device *dev, char *buf)
1133 return count; 1144 return count;
1134} 1145}
1135 1146
1136static ssize_t dispatching_store(struct sys_device *dev, const char *buf, 1147static ssize_t dispatching_store(struct sys_device *dev,
1137 size_t count) 1148 struct sysdev_attribute *attr,
1149 const char *buf, size_t count)
1138{ 1150{
1139 int val, rc; 1151 int val, rc;
1140 char delim; 1152 char delim;
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index f2cede3947b2..ab70d9bd9261 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -1100,7 +1100,9 @@ static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev)
1100 return etr_port1_online ? &etr_port1 : NULL; 1100 return etr_port1_online ? &etr_port1 : NULL;
1101} 1101}
1102 1102
1103static ssize_t etr_online_show(struct sys_device *dev, char *buf) 1103static ssize_t etr_online_show(struct sys_device *dev,
1104 struct sysdev_attribute *attr,
1105 char *buf)
1104{ 1106{
1105 unsigned int online; 1107 unsigned int online;
1106 1108
@@ -1109,7 +1111,8 @@ static ssize_t etr_online_show(struct sys_device *dev, char *buf)
1109} 1111}
1110 1112
1111static ssize_t etr_online_store(struct sys_device *dev, 1113static ssize_t etr_online_store(struct sys_device *dev,
1112 const char *buf, size_t count) 1114 struct sysdev_attribute *attr,
1115 const char *buf, size_t count)
1113{ 1116{
1114 unsigned int value; 1117 unsigned int value;
1115 1118
@@ -1136,7 +1139,9 @@ static ssize_t etr_online_store(struct sys_device *dev,
1136 1139
1137static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); 1140static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store);
1138 1141
1139static ssize_t etr_stepping_control_show(struct sys_device *dev, char *buf) 1142static ssize_t etr_stepping_control_show(struct sys_device *dev,
1143 struct sysdev_attribute *attr,
1144 char *buf)
1140{ 1145{
1141 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? 1146 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ?
1142 etr_eacr.e0 : etr_eacr.e1); 1147 etr_eacr.e0 : etr_eacr.e1);
@@ -1144,7 +1149,8 @@ static ssize_t etr_stepping_control_show(struct sys_device *dev, char *buf)
1144 1149
1145static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); 1150static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL);
1146 1151
1147static ssize_t etr_mode_code_show(struct sys_device *dev, char *buf) 1152static ssize_t etr_mode_code_show(struct sys_device *dev,
1153 struct sysdev_attribute *attr, char *buf)
1148{ 1154{
1149 if (!etr_port0_online && !etr_port1_online) 1155 if (!etr_port0_online && !etr_port1_online)
1150 /* Status word is not uptodate if both ports are offline. */ 1156 /* Status word is not uptodate if both ports are offline. */
@@ -1155,7 +1161,8 @@ static ssize_t etr_mode_code_show(struct sys_device *dev, char *buf)
1155 1161
1156static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); 1162static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL);
1157 1163
1158static ssize_t etr_untuned_show(struct sys_device *dev, char *buf) 1164static ssize_t etr_untuned_show(struct sys_device *dev,
1165 struct sysdev_attribute *attr, char *buf)
1159{ 1166{
1160 struct etr_aib *aib = etr_aib_from_dev(dev); 1167 struct etr_aib *aib = etr_aib_from_dev(dev);
1161 1168
@@ -1166,7 +1173,8 @@ static ssize_t etr_untuned_show(struct sys_device *dev, char *buf)
1166 1173
1167static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); 1174static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL);
1168 1175
1169static ssize_t etr_network_id_show(struct sys_device *dev, char *buf) 1176static ssize_t etr_network_id_show(struct sys_device *dev,
1177 struct sysdev_attribute *attr, char *buf)
1170{ 1178{
1171 struct etr_aib *aib = etr_aib_from_dev(dev); 1179 struct etr_aib *aib = etr_aib_from_dev(dev);
1172 1180
@@ -1177,7 +1185,8 @@ static ssize_t etr_network_id_show(struct sys_device *dev, char *buf)
1177 1185
1178static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); 1186static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL);
1179 1187
1180static ssize_t etr_id_show(struct sys_device *dev, char *buf) 1188static ssize_t etr_id_show(struct sys_device *dev,
1189 struct sysdev_attribute *attr, char *buf)
1181{ 1190{
1182 struct etr_aib *aib = etr_aib_from_dev(dev); 1191 struct etr_aib *aib = etr_aib_from_dev(dev);
1183 1192
@@ -1188,7 +1197,8 @@ static ssize_t etr_id_show(struct sys_device *dev, char *buf)
1188 1197
1189static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); 1198static SYSDEV_ATTR(id, 0400, etr_id_show, NULL);
1190 1199
1191static ssize_t etr_port_number_show(struct sys_device *dev, char *buf) 1200static ssize_t etr_port_number_show(struct sys_device *dev,
1201 struct sysdev_attribute *attr, char *buf)
1192{ 1202{
1193 struct etr_aib *aib = etr_aib_from_dev(dev); 1203 struct etr_aib *aib = etr_aib_from_dev(dev);
1194 1204
@@ -1199,7 +1209,8 @@ static ssize_t etr_port_number_show(struct sys_device *dev, char *buf)
1199 1209
1200static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); 1210static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL);
1201 1211
1202static ssize_t etr_coupled_show(struct sys_device *dev, char *buf) 1212static ssize_t etr_coupled_show(struct sys_device *dev,
1213 struct sysdev_attribute *attr, char *buf)
1203{ 1214{
1204 struct etr_aib *aib = etr_aib_from_dev(dev); 1215 struct etr_aib *aib = etr_aib_from_dev(dev);
1205 1216
@@ -1210,7 +1221,8 @@ static ssize_t etr_coupled_show(struct sys_device *dev, char *buf)
1210 1221
1211static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); 1222static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL);
1212 1223
1213static ssize_t etr_local_time_show(struct sys_device *dev, char *buf) 1224static ssize_t etr_local_time_show(struct sys_device *dev,
1225 struct sysdev_attribute *attr, char *buf)
1214{ 1226{
1215 struct etr_aib *aib = etr_aib_from_dev(dev); 1227 struct etr_aib *aib = etr_aib_from_dev(dev);
1216 1228
@@ -1221,7 +1233,8 @@ static ssize_t etr_local_time_show(struct sys_device *dev, char *buf)
1221 1233
1222static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); 1234static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL);
1223 1235
1224static ssize_t etr_utc_offset_show(struct sys_device *dev, char *buf) 1236static ssize_t etr_utc_offset_show(struct sys_device *dev,
1237 struct sysdev_attribute *attr, char *buf)
1225{ 1238{
1226 struct etr_aib *aib = etr_aib_from_dev(dev); 1239 struct etr_aib *aib = etr_aib_from_dev(dev);
1227 1240