aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2007-10-12 10:11:15 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-10-12 10:12:59 -0400
commitfc5019c5c7067bcea1e49fe9cd5190285f0c8927 (patch)
tree5845eeb8db37083974016d31e3f31c805b8b3fa3 /drivers/s390/cio
parentfbf9772b8e7917f85f35913b30788c74ea34cad5 (diff)
[S390] cio: Fix some coding style issues in cmf.
Fix some formatting and correct a comment. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r--drivers/s390/cio/cmf.c141
1 files changed, 77 insertions, 64 deletions
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 34a796913b06..ff1e442d4b09 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -45,7 +45,8 @@
45#include "ioasm.h" 45#include "ioasm.h"
46#include "chsc.h" 46#include "chsc.h"
47 47
48/* parameter to enable cmf during boot, possible uses are: 48/*
49 * parameter to enable cmf during boot, possible uses are:
49 * "s390cmf" -- enable cmf and allocate 2 MB of ram so measuring can be 50 * "s390cmf" -- enable cmf and allocate 2 MB of ram so measuring can be
50 * used on any subchannel 51 * used on any subchannel
51 * "s390cmf=<num>" -- enable cmf and allocate enough memory to measure 52 * "s390cmf=<num>" -- enable cmf and allocate enough memory to measure
@@ -84,6 +85,7 @@ enum cmb_format {
84 CMF_EXTENDED, 85 CMF_EXTENDED,
85 CMF_AUTODETECT = -1, 86 CMF_AUTODETECT = -1,
86}; 87};
88
87/** 89/**
88 * format - actual format for all measurement blocks 90 * format - actual format for all measurement blocks
89 * 91 *
@@ -111,13 +113,13 @@ module_param(format, bool, 0444);
111 * @align: align an allocated block so that the hardware can use it 113 * @align: align an allocated block so that the hardware can use it
112 */ 114 */
113struct cmb_operations { 115struct cmb_operations {
114 int (*alloc) (struct ccw_device*); 116 int (*alloc) (struct ccw_device *);
115 void(*free) (struct ccw_device*); 117 void (*free) (struct ccw_device *);
116 int (*set) (struct ccw_device*, u32); 118 int (*set) (struct ccw_device *, u32);
117 u64 (*read) (struct ccw_device*, int); 119 u64 (*read) (struct ccw_device *, int);
118 int (*readall)(struct ccw_device*, struct cmbdata *); 120 int (*readall)(struct ccw_device *, struct cmbdata *);
119 void (*reset) (struct ccw_device*); 121 void (*reset) (struct ccw_device *);
120 void * (*align) (void *); 122 void *(*align) (void *);
121 123
122 struct attribute_group *attr_group; 124 struct attribute_group *attr_group;
123}; 125};
@@ -130,9 +132,11 @@ struct cmb_data {
130 unsigned long long last_update; /* when last_block was updated */ 132 unsigned long long last_update; /* when last_block was updated */
131}; 133};
132 134
133/* our user interface is designed in terms of nanoseconds, 135/*
136 * Our user interface is designed in terms of nanoseconds,
134 * while the hardware measures total times in its own 137 * while the hardware measures total times in its own
135 * unit.*/ 138 * unit.
139 */
136static inline u64 time_to_nsec(u32 value) 140static inline u64 time_to_nsec(u32 value)
137{ 141{
138 return ((u64)value) * 128000ull; 142 return ((u64)value) * 128000ull;
@@ -159,12 +163,13 @@ static inline u64 time_to_avg_nsec(u32 value, u32 count)
159 return ret; 163 return ret;
160} 164}
161 165
162/* activate or deactivate the channel monitor. When area is NULL, 166/*
167 * Activate or deactivate the channel monitor. When area is NULL,
163 * the monitor is deactivated. The channel monitor needs to 168 * the monitor is deactivated. The channel monitor needs to
164 * be active in order to measure subchannels, which also need 169 * be active in order to measure subchannels, which also need
165 * to be enabled. */ 170 * to be enabled.
166static inline void 171 */
167cmf_activate(void *area, unsigned int onoff) 172static inline void cmf_activate(void *area, unsigned int onoff)
168{ 173{
169 register void * __gpr2 asm("2"); 174 register void * __gpr2 asm("2");
170 register long __gpr1 asm("1"); 175 register long __gpr1 asm("1");
@@ -175,8 +180,8 @@ cmf_activate(void *area, unsigned int onoff)
175 asm("schm" : : "d" (__gpr2), "d" (__gpr1) ); 180 asm("schm" : : "d" (__gpr2), "d" (__gpr1) );
176} 181}
177 182
178static int 183static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc,
179set_schib(struct ccw_device *cdev, u32 mme, int mbfc, unsigned long address) 184 unsigned long address)
180{ 185{
181 int ret; 186 int ret;
182 int retry; 187 int retry;
@@ -484,15 +489,14 @@ static struct cmb_area cmb_area = {
484 489
485/* ****** old style CMB handling ********/ 490/* ****** old style CMB handling ********/
486 491
487/** int maxchannels 492/*
488 *
489 * Basic channel measurement blocks are allocated in one contiguous 493 * Basic channel measurement blocks are allocated in one contiguous
490 * block of memory, which can not be moved as long as any channel 494 * block of memory, which can not be moved as long as any channel
491 * is active. Therefore, a maximum number of subchannels needs to 495 * is active. Therefore, a maximum number of subchannels needs to
492 * be defined somewhere. This is a module parameter, defaulting to 496 * be defined somewhere. This is a module parameter, defaulting to
493 * a resonable value of 1024, or 32 kb of memory. 497 * a resonable value of 1024, or 32 kb of memory.
494 * Current kernels don't allow kmalloc with more than 128kb, so the 498 * Current kernels don't allow kmalloc with more than 128kb, so the
495 * maximum is 4096 499 * maximum is 4096.
496 */ 500 */
497 501
498module_param_named(maxchannels, cmb_area.num_channels, uint, 0444); 502module_param_named(maxchannels, cmb_area.num_channels, uint, 0444);
@@ -516,8 +520,9 @@ struct cmb {
516 u32 reserved[2]; 520 u32 reserved[2];
517}; 521};
518 522
519/* insert a single device into the cmb_area list 523/*
520 * called with cmb_area.lock held from alloc_cmb 524 * Insert a single device into the cmb_area list.
525 * Called with cmb_area.lock held from alloc_cmb.
521 */ 526 */
522static int alloc_cmb_single(struct ccw_device *cdev, 527static int alloc_cmb_single(struct ccw_device *cdev,
523 struct cmb_data *cmb_data) 528 struct cmb_data *cmb_data)
@@ -532,9 +537,11 @@ static int alloc_cmb_single(struct ccw_device *cdev,
532 goto out; 537 goto out;
533 } 538 }
534 539
535 /* find first unused cmb in cmb_area.mem. 540 /*
536 * this is a little tricky: cmb_area.list 541 * Find first unused cmb in cmb_area.mem.
537 * remains sorted by ->cmb->hw_data pointers */ 542 * This is a little tricky: cmb_area.list
543 * remains sorted by ->cmb->hw_data pointers.
544 */
538 cmb = cmb_area.mem; 545 cmb = cmb_area.mem;
539 list_for_each_entry(node, &cmb_area.list, cmb_list) { 546 list_for_each_entry(node, &cmb_area.list, cmb_list) {
540 struct cmb_data *data; 547 struct cmb_data *data;
@@ -558,8 +565,7 @@ out:
558 return ret; 565 return ret;
559} 566}
560 567
561static int 568static int alloc_cmb(struct ccw_device *cdev)
562alloc_cmb (struct ccw_device *cdev)
563{ 569{
564 int ret; 570 int ret;
565 struct cmb *mem; 571 struct cmb *mem;
@@ -670,7 +676,7 @@ static int set_cmb(struct ccw_device *cdev, u32 mme)
670 return set_schib_wait(cdev, mme, 0, offset); 676 return set_schib_wait(cdev, mme, 0, offset);
671} 677}
672 678
673static u64 read_cmb (struct ccw_device *cdev, int index) 679static u64 read_cmb(struct ccw_device *cdev, int index)
674{ 680{
675 struct cmb *cmb; 681 struct cmb *cmb;
676 u32 val; 682 u32 val;
@@ -720,7 +726,7 @@ out:
720 return ret; 726 return ret;
721} 727}
722 728
723static int readall_cmb (struct ccw_device *cdev, struct cmbdata *data) 729static int readall_cmb(struct ccw_device *cdev, struct cmbdata *data)
724{ 730{
725 struct cmb *cmb; 731 struct cmb *cmb;
726 struct cmb_data *cmb_data; 732 struct cmb_data *cmb_data;
@@ -816,10 +822,12 @@ struct cmbe {
816 u32 reserved[7]; 822 u32 reserved[7];
817}; 823};
818 824
819/* kmalloc only guarantees 8 byte alignment, but we need cmbe 825/*
826 * kmalloc only guarantees 8 byte alignment, but we need cmbe
820 * pointers to be naturally aligned. Make sure to allocate 827 * pointers to be naturally aligned. Make sure to allocate
821 * enough space for two cmbes */ 828 * enough space for two cmbes.
822static inline struct cmbe* cmbe_align(struct cmbe *c) 829 */
830static inline struct cmbe *cmbe_align(struct cmbe *c)
823{ 831{
824 unsigned long addr; 832 unsigned long addr;
825 addr = ((unsigned long)c + sizeof (struct cmbe) - sizeof(long)) & 833 addr = ((unsigned long)c + sizeof (struct cmbe) - sizeof(long)) &
@@ -827,7 +835,7 @@ static inline struct cmbe* cmbe_align(struct cmbe *c)
827 return (struct cmbe*)addr; 835 return (struct cmbe*)addr;
828} 836}
829 837
830static int alloc_cmbe (struct ccw_device *cdev) 838static int alloc_cmbe(struct ccw_device *cdev)
831{ 839{
832 struct cmbe *cmbe; 840 struct cmbe *cmbe;
833 struct cmb_data *cmb_data; 841 struct cmb_data *cmb_data;
@@ -873,7 +881,7 @@ out_free:
873 return ret; 881 return ret;
874} 882}
875 883
876static void free_cmbe (struct ccw_device *cdev) 884static void free_cmbe(struct ccw_device *cdev)
877{ 885{
878 struct cmb_data *cmb_data; 886 struct cmb_data *cmb_data;
879 887
@@ -912,7 +920,7 @@ static int set_cmbe(struct ccw_device *cdev, u32 mme)
912} 920}
913 921
914 922
915static u64 read_cmbe (struct ccw_device *cdev, int index) 923static u64 read_cmbe(struct ccw_device *cdev, int index)
916{ 924{
917 struct cmbe *cmb; 925 struct cmbe *cmb;
918 struct cmb_data *cmb_data; 926 struct cmb_data *cmb_data;
@@ -970,7 +978,7 @@ out:
970 return ret; 978 return ret;
971} 979}
972 980
973static int readall_cmbe (struct ccw_device *cdev, struct cmbdata *data) 981static int readall_cmbe(struct ccw_device *cdev, struct cmbdata *data)
974{ 982{
975 struct cmbe *cmb; 983 struct cmbe *cmb;
976 struct cmb_data *cmb_data; 984 struct cmb_data *cmb_data;
@@ -1049,15 +1057,15 @@ static struct cmb_operations cmbops_extended = {
1049}; 1057};
1050 1058
1051 1059
1052static ssize_t 1060static ssize_t cmb_show_attr(struct device *dev, char *buf, enum cmb_index idx)
1053cmb_show_attr(struct device *dev, char *buf, enum cmb_index idx)
1054{ 1061{
1055 return sprintf(buf, "%lld\n", 1062 return sprintf(buf, "%lld\n",
1056 (unsigned long long) cmf_read(to_ccwdev(dev), idx)); 1063 (unsigned long long) cmf_read(to_ccwdev(dev), idx));
1057} 1064}
1058 1065
1059static ssize_t 1066static ssize_t cmb_show_avg_sample_interval(struct device *dev,
1060cmb_show_avg_sample_interval(struct device *dev, struct device_attribute *attr, char *buf) 1067 struct device_attribute *attr,
1068 char *buf)
1061{ 1069{
1062 struct ccw_device *cdev; 1070 struct ccw_device *cdev;
1063 long interval; 1071 long interval;
@@ -1079,8 +1087,9 @@ cmb_show_avg_sample_interval(struct device *dev, struct device_attribute *attr,
1079 return sprintf(buf, "%ld\n", interval); 1087 return sprintf(buf, "%ld\n", interval);
1080} 1088}
1081 1089
1082static ssize_t 1090static ssize_t cmb_show_avg_utilization(struct device *dev,
1083cmb_show_avg_utilization(struct device *dev, struct device_attribute *attr, char *buf) 1091 struct device_attribute *attr,
1092 char *buf)
1084{ 1093{
1085 struct cmbdata data; 1094 struct cmbdata data;
1086 u64 utilization; 1095 u64 utilization;
@@ -1112,14 +1121,16 @@ cmb_show_avg_utilization(struct device *dev, struct device_attribute *attr, char
1112} 1121}
1113 1122
1114#define cmf_attr(name) \ 1123#define cmf_attr(name) \
1115static ssize_t show_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \ 1124static ssize_t show_##name(struct device *dev, \
1116{ return cmb_show_attr((dev), buf, cmb_ ## name); } \ 1125 struct device_attribute *attr, char *buf) \
1117static DEVICE_ATTR(name, 0444, show_ ## name, NULL); 1126{ return cmb_show_attr((dev), buf, cmb_##name); } \
1127static DEVICE_ATTR(name, 0444, show_##name, NULL);
1118 1128
1119#define cmf_attr_avg(name) \ 1129#define cmf_attr_avg(name) \
1120static ssize_t show_avg_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \ 1130static ssize_t show_avg_##name(struct device *dev, \
1121{ return cmb_show_attr((dev), buf, cmb_ ## name); } \ 1131 struct device_attribute *attr, char *buf) \
1122static DEVICE_ATTR(avg_ ## name, 0444, show_avg_ ## name, NULL); 1132{ return cmb_show_attr((dev), buf, cmb_##name); } \
1133static DEVICE_ATTR(avg_##name, 0444, show_avg_##name, NULL);
1123 1134
1124cmf_attr(ssch_rsch_count); 1135cmf_attr(ssch_rsch_count);
1125cmf_attr(sample_count); 1136cmf_attr(sample_count);
@@ -1131,7 +1142,8 @@ cmf_attr_avg(device_active_only_time);
1131cmf_attr_avg(device_busy_time); 1142cmf_attr_avg(device_busy_time);
1132cmf_attr_avg(initial_command_response_time); 1143cmf_attr_avg(initial_command_response_time);
1133 1144
1134static DEVICE_ATTR(avg_sample_interval, 0444, cmb_show_avg_sample_interval, NULL); 1145static DEVICE_ATTR(avg_sample_interval, 0444, cmb_show_avg_sample_interval,
1146 NULL);
1135static DEVICE_ATTR(avg_utilization, 0444, cmb_show_avg_utilization, NULL); 1147static DEVICE_ATTR(avg_utilization, 0444, cmb_show_avg_utilization, NULL);
1136 1148
1137static struct attribute *cmf_attributes[] = { 1149static struct attribute *cmf_attributes[] = {
@@ -1172,12 +1184,16 @@ static struct attribute_group cmf_attr_group_ext = {
1172 .attrs = cmf_attributes_ext, 1184 .attrs = cmf_attributes_ext,
1173}; 1185};
1174 1186
1175static ssize_t cmb_enable_show(struct device *dev, struct device_attribute *attr, char *buf) 1187static ssize_t cmb_enable_show(struct device *dev,
1188 struct device_attribute *attr,
1189 char *buf)
1176{ 1190{
1177 return sprintf(buf, "%d\n", to_ccwdev(dev)->private->cmb ? 1 : 0); 1191 return sprintf(buf, "%d\n", to_ccwdev(dev)->private->cmb ? 1 : 0);
1178} 1192}
1179 1193
1180static ssize_t cmb_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t c) 1194static ssize_t cmb_enable_store(struct device *dev,
1195 struct device_attribute *attr, const char *buf,
1196 size_t c)
1181{ 1197{
1182 struct ccw_device *cdev; 1198 struct ccw_device *cdev;
1183 int ret; 1199 int ret;
@@ -1203,8 +1219,7 @@ static ssize_t cmb_enable_store(struct device *dev, struct device_attribute *att
1203DEVICE_ATTR(cmb_enable, 0644, cmb_enable_show, cmb_enable_store); 1219DEVICE_ATTR(cmb_enable, 0644, cmb_enable_show, cmb_enable_store);
1204 1220
1205/* enable_cmf/disable_cmf: module interface for cmf (de)activation */ 1221/* enable_cmf/disable_cmf: module interface for cmf (de)activation */
1206int 1222int enable_cmf(struct ccw_device *cdev)
1207enable_cmf(struct ccw_device *cdev)
1208{ 1223{
1209 int ret; 1224 int ret;
1210 1225
@@ -1225,8 +1240,7 @@ enable_cmf(struct ccw_device *cdev)
1225 return ret; 1240 return ret;
1226} 1241}
1227 1242
1228int 1243int disable_cmf(struct ccw_device *cdev)
1229disable_cmf(struct ccw_device *cdev)
1230{ 1244{
1231 int ret; 1245 int ret;
1232 1246
@@ -1238,14 +1252,12 @@ disable_cmf(struct ccw_device *cdev)
1238 return ret; 1252 return ret;
1239} 1253}
1240 1254
1241u64 1255u64 cmf_read(struct ccw_device *cdev, int index)
1242cmf_read(struct ccw_device *cdev, int index)
1243{ 1256{
1244 return cmbops->read(cdev, index); 1257 return cmbops->read(cdev, index);
1245} 1258}
1246 1259
1247int 1260int cmf_readall(struct ccw_device *cdev, struct cmbdata *data)
1248cmf_readall(struct ccw_device *cdev, struct cmbdata *data)
1249{ 1261{
1250 return cmbops->readall(cdev, data); 1262 return cmbops->readall(cdev, data);
1251} 1263}
@@ -1257,15 +1269,16 @@ int cmf_reenable(struct ccw_device *cdev)
1257 return cmbops->set(cdev, 2); 1269 return cmbops->set(cdev, 2);
1258} 1270}
1259 1271
1260static int __init 1272static int __init init_cmf(void)
1261init_cmf(void)
1262{ 1273{
1263 char *format_string; 1274 char *format_string;
1264 char *detect_string = "parameter"; 1275 char *detect_string = "parameter";
1265 1276
1266 /* We cannot really autoprobe this. If the user did not give a parameter, 1277 /*
1267 see if we are running on z990 or up, otherwise fall back to basic mode. */ 1278 * If the user did not give a parameter, see if we are running on a
1268 1279 * machine supporting extended measurement blocks, otherwise fall back
1280 * to basic mode.
1281 */
1269 if (format == CMF_AUTODETECT) { 1282 if (format == CMF_AUTODETECT) {
1270 if (!css_characteristics_avail || 1283 if (!css_characteristics_avail ||
1271 !css_general_characteristics.ext_mb) { 1284 !css_general_characteristics.ext_mb) {
@@ -1284,7 +1297,7 @@ init_cmf(void)
1284 cmbops = &cmbops_basic; 1297 cmbops = &cmbops_basic;
1285 break; 1298 break;
1286 case CMF_EXTENDED: 1299 case CMF_EXTENDED:
1287 format_string = "extended"; 1300 format_string = "extended";
1288 cmbops = &cmbops_extended; 1301 cmbops = &cmbops_extended;
1289 break; 1302 break;
1290 default: 1303 default: