summaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2015-02-11 08:57:46 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-02-12 03:37:24 -0500
commitf4dce5c9364fffc8947008b17a7e16ea9009950d (patch)
treecce2d2528279df4ab6df4ebb6fb4c91ae037f1b1 /arch/s390/kernel
parent4fd4f1c79935a002b20e6e1b65fa37f46ac61dbe (diff)
s390/cacheinfo: coding style changes
Just some minor coding style changes, while I had to look at the code. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/cache.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/arch/s390/kernel/cache.c b/arch/s390/kernel/cache.c
index f06a2a509ad2..0969d113b3d6 100644
--- a/arch/s390/kernel/cache.c
+++ b/arch/s390/kernel/cache.c
@@ -91,12 +91,9 @@ static inline enum cache_type get_cache_type(struct cache_info *ci, int level)
91{ 91{
92 if (level >= CACHE_MAX_LEVEL) 92 if (level >= CACHE_MAX_LEVEL)
93 return CACHE_TYPE_NOCACHE; 93 return CACHE_TYPE_NOCACHE;
94
95 ci += level; 94 ci += level;
96
97 if (ci->scope != CACHE_SCOPE_SHARED && ci->scope != CACHE_SCOPE_PRIVATE) 95 if (ci->scope != CACHE_SCOPE_SHARED && ci->scope != CACHE_SCOPE_PRIVATE)
98 return CACHE_TYPE_NOCACHE; 96 return CACHE_TYPE_NOCACHE;
99
100 return cache_type_map[ci->type]; 97 return cache_type_map[ci->type];
101} 98}
102 99
@@ -119,14 +116,11 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, int private,
119 ti = CACHE_TI_INSTRUCTION; 116 ti = CACHE_TI_INSTRUCTION;
120 else 117 else
121 ti = CACHE_TI_UNIFIED; 118 ti = CACHE_TI_UNIFIED;
122
123 this_leaf->level = level + 1; 119 this_leaf->level = level + 1;
124 this_leaf->type = type; 120 this_leaf->type = type;
125 this_leaf->coherency_line_size = ecag(EXTRACT_LINE_SIZE, level, ti); 121 this_leaf->coherency_line_size = ecag(EXTRACT_LINE_SIZE, level, ti);
126 this_leaf->ways_of_associativity = ecag(EXTRACT_ASSOCIATIVITY, 122 this_leaf->ways_of_associativity = ecag(EXTRACT_ASSOCIATIVITY, level, ti);
127 level, ti);
128 this_leaf->size = ecag(EXTRACT_SIZE, level, ti); 123 this_leaf->size = ecag(EXTRACT_SIZE, level, ti);
129
130 num_sets = this_leaf->size / this_leaf->coherency_line_size; 124 num_sets = this_leaf->size / this_leaf->coherency_line_size;
131 num_sets /= this_leaf->ways_of_associativity; 125 num_sets /= this_leaf->ways_of_associativity;
132 this_leaf->number_of_sets = num_sets; 126 this_leaf->number_of_sets = num_sets;
@@ -144,7 +138,6 @@ int init_cache_level(unsigned int cpu)
144 138
145 if (!this_cpu_ci) 139 if (!this_cpu_ci)
146 return -EINVAL; 140 return -EINVAL;
147
148 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0); 141 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
149 do { 142 do {
150 ctype = get_cache_type(&ct.ci[0], level); 143 ctype = get_cache_type(&ct.ci[0], level);
@@ -153,27 +146,24 @@ int init_cache_level(unsigned int cpu)
153 /* Separate instruction and data caches */ 146 /* Separate instruction and data caches */
154 leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1; 147 leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1;
155 } while (++level < CACHE_MAX_LEVEL); 148 } while (++level < CACHE_MAX_LEVEL);
156
157 this_cpu_ci->num_levels = level; 149 this_cpu_ci->num_levels = level;
158 this_cpu_ci->num_leaves = leaves; 150 this_cpu_ci->num_leaves = leaves;
159
160 return 0; 151 return 0;
161} 152}
162 153
163int populate_cache_leaves(unsigned int cpu) 154int populate_cache_leaves(unsigned int cpu)
164{ 155{
156 struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
157 struct cacheinfo *this_leaf = this_cpu_ci->info_list;
165 unsigned int level, idx, pvt; 158 unsigned int level, idx, pvt;
166 union cache_topology ct; 159 union cache_topology ct;
167 enum cache_type ctype; 160 enum cache_type ctype;
168 struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
169 struct cacheinfo *this_leaf = this_cpu_ci->info_list;
170 161
171 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0); 162 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
172 for (idx = 0, level = 0; level < this_cpu_ci->num_levels && 163 for (idx = 0, level = 0; level < this_cpu_ci->num_levels &&
173 idx < this_cpu_ci->num_leaves; idx++, level++) { 164 idx < this_cpu_ci->num_leaves; idx++, level++) {
174 if (!this_leaf) 165 if (!this_leaf)
175 return -EINVAL; 166 return -EINVAL;
176
177 pvt = (ct.ci[level].scope == CACHE_SCOPE_PRIVATE) ? 1 : 0; 167 pvt = (ct.ci[level].scope == CACHE_SCOPE_PRIVATE) ? 1 : 0;
178 ctype = get_cache_type(&ct.ci[0], level); 168 ctype = get_cache_type(&ct.ci[0], level);
179 if (ctype == CACHE_TYPE_SEPARATE) { 169 if (ctype == CACHE_TYPE_SEPARATE) {