diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-05-26 09:20:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 19:59:28 -0400 |
commit | cac2eb7b580c95e3871a71276c99e2bd751a1624 (patch) | |
tree | 0b786f7975b2fb2cb7f5dff229c9d72e954cbe2c /fs | |
parent | f29e5956aebafe63f81e80f972c44c4a666e5c7f (diff) |
pstore/ram: Give proper names to dump-related variables
We're about to add support for other message types, so let's rename
some variables to not be confused later.
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/pstore/ram.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 453030f9c5bc..9b274b98bf3b 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -68,9 +68,9 @@ struct ramoops_context { | |||
68 | size_t record_size; | 68 | size_t record_size; |
69 | int dump_oops; | 69 | int dump_oops; |
70 | bool ecc; | 70 | bool ecc; |
71 | unsigned int count; | 71 | unsigned int max_dump_cnt; |
72 | unsigned int max_count; | 72 | unsigned int dump_write_cnt; |
73 | unsigned int read_count; | 73 | unsigned int dump_read_cnt; |
74 | struct pstore_info pstore; | 74 | struct pstore_info pstore; |
75 | }; | 75 | }; |
76 | 76 | ||
@@ -81,7 +81,7 @@ static int ramoops_pstore_open(struct pstore_info *psi) | |||
81 | { | 81 | { |
82 | struct ramoops_context *cxt = psi->data; | 82 | struct ramoops_context *cxt = psi->data; |
83 | 83 | ||
84 | cxt->read_count = 0; | 84 | cxt->dump_read_cnt = 0; |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
@@ -94,10 +94,10 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, | |||
94 | struct ramoops_context *cxt = psi->data; | 94 | struct ramoops_context *cxt = psi->data; |
95 | struct persistent_ram_zone *prz; | 95 | struct persistent_ram_zone *prz; |
96 | 96 | ||
97 | if (cxt->read_count >= cxt->max_count) | 97 | if (cxt->dump_read_cnt >= cxt->max_dump_cnt) |
98 | return -EINVAL; | 98 | return -EINVAL; |
99 | 99 | ||
100 | *id = cxt->read_count++; | 100 | *id = cxt->dump_read_cnt++; |
101 | prz = cxt->przs[*id]; | 101 | prz = cxt->przs[*id]; |
102 | 102 | ||
103 | /* Only supports dmesg output so far. */ | 103 | /* Only supports dmesg output so far. */ |
@@ -141,7 +141,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, | |||
141 | size_t size, struct pstore_info *psi) | 141 | size_t size, struct pstore_info *psi) |
142 | { | 142 | { |
143 | struct ramoops_context *cxt = psi->data; | 143 | struct ramoops_context *cxt = psi->data; |
144 | struct persistent_ram_zone *prz = cxt->przs[cxt->count]; | 144 | struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; |
145 | size_t hlen; | 145 | size_t hlen; |
146 | 146 | ||
147 | /* Currently ramoops is designed to only store dmesg dumps. */ | 147 | /* Currently ramoops is designed to only store dmesg dumps. */ |
@@ -172,7 +172,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, | |||
172 | size = prz->buffer_size - hlen; | 172 | size = prz->buffer_size - hlen; |
173 | persistent_ram_write(prz, cxt->pstore.buf, size); | 173 | persistent_ram_write(prz, cxt->pstore.buf, size); |
174 | 174 | ||
175 | cxt->count = (cxt->count + 1) % cxt->max_count; | 175 | cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt; |
176 | 176 | ||
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
@@ -182,7 +182,7 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, | |||
182 | { | 182 | { |
183 | struct ramoops_context *cxt = psi->data; | 183 | struct ramoops_context *cxt = psi->data; |
184 | 184 | ||
185 | if (id >= cxt->max_count) | 185 | if (id >= cxt->max_dump_cnt) |
186 | return -EINVAL; | 186 | return -EINVAL; |
187 | 187 | ||
188 | persistent_ram_free_old(cxt->przs[id]); | 188 | persistent_ram_free_old(cxt->przs[id]); |
@@ -213,7 +213,7 @@ static int __init ramoops_probe(struct platform_device *pdev) | |||
213 | /* Only a single ramoops area allowed at a time, so fail extra | 213 | /* Only a single ramoops area allowed at a time, so fail extra |
214 | * probes. | 214 | * probes. |
215 | */ | 215 | */ |
216 | if (cxt->max_count) | 216 | if (cxt->max_dump_cnt) |
217 | goto fail_out; | 217 | goto fail_out; |
218 | 218 | ||
219 | if (!pdata->mem_size || !pdata->record_size) { | 219 | if (!pdata->mem_size || !pdata->record_size) { |
@@ -239,22 +239,22 @@ static int __init ramoops_probe(struct platform_device *pdev) | |||
239 | goto fail_out; | 239 | goto fail_out; |
240 | } | 240 | } |
241 | 241 | ||
242 | cxt->max_count = pdata->mem_size / pdata->record_size; | 242 | cxt->max_dump_cnt = pdata->mem_size / pdata->record_size; |
243 | cxt->count = 0; | 243 | cxt->dump_read_cnt = 0; |
244 | cxt->size = pdata->mem_size; | 244 | cxt->size = pdata->mem_size; |
245 | cxt->phys_addr = pdata->mem_address; | 245 | cxt->phys_addr = pdata->mem_address; |
246 | cxt->record_size = pdata->record_size; | 246 | cxt->record_size = pdata->record_size; |
247 | cxt->dump_oops = pdata->dump_oops; | 247 | cxt->dump_oops = pdata->dump_oops; |
248 | cxt->ecc = pdata->ecc; | 248 | cxt->ecc = pdata->ecc; |
249 | 249 | ||
250 | cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_count, GFP_KERNEL); | 250 | cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_dump_cnt, GFP_KERNEL); |
251 | if (!cxt->przs) { | 251 | if (!cxt->przs) { |
252 | err = -ENOMEM; | 252 | err = -ENOMEM; |
253 | dev_err(dev, "failed to initialize a prz array\n"); | 253 | dev_err(dev, "failed to initialize a prz array\n"); |
254 | goto fail_out; | 254 | goto fail_out; |
255 | } | 255 | } |
256 | 256 | ||
257 | for (i = 0; i < cxt->max_count; i++) { | 257 | for (i = 0; i < cxt->max_dump_cnt; i++) { |
258 | size_t sz = cxt->record_size; | 258 | size_t sz = cxt->record_size; |
259 | phys_addr_t start = cxt->phys_addr + sz * i; | 259 | phys_addr_t start = cxt->phys_addr + sz * i; |
260 | 260 | ||
@@ -293,7 +293,7 @@ static int __init ramoops_probe(struct platform_device *pdev) | |||
293 | 293 | ||
294 | pr_info("attached 0x%lx@0x%llx (%ux0x%zx), ecc: %s\n", | 294 | pr_info("attached 0x%lx@0x%llx (%ux0x%zx), ecc: %s\n", |
295 | cxt->size, (unsigned long long)cxt->phys_addr, | 295 | cxt->size, (unsigned long long)cxt->phys_addr, |
296 | cxt->max_count, cxt->record_size, | 296 | cxt->max_dump_cnt, cxt->record_size, |
297 | ramoops_ecc ? "on" : "off"); | 297 | ramoops_ecc ? "on" : "off"); |
298 | 298 | ||
299 | return 0; | 299 | return 0; |
@@ -302,7 +302,7 @@ fail_buf: | |||
302 | kfree(cxt->pstore.buf); | 302 | kfree(cxt->pstore.buf); |
303 | fail_clear: | 303 | fail_clear: |
304 | cxt->pstore.bufsize = 0; | 304 | cxt->pstore.bufsize = 0; |
305 | cxt->max_count = 0; | 305 | cxt->max_dump_cnt = 0; |
306 | fail_przs: | 306 | fail_przs: |
307 | for (i = 0; cxt->przs[i]; i++) | 307 | for (i = 0; cxt->przs[i]; i++) |
308 | persistent_ram_free(cxt->przs[i]); | 308 | persistent_ram_free(cxt->przs[i]); |
@@ -321,7 +321,7 @@ static int __exit ramoops_remove(struct platform_device *pdev) | |||
321 | 321 | ||
322 | iounmap(cxt->virt_addr); | 322 | iounmap(cxt->virt_addr); |
323 | release_mem_region(cxt->phys_addr, cxt->size); | 323 | release_mem_region(cxt->phys_addr, cxt->size); |
324 | cxt->max_count = 0; | 324 | cxt->max_dump_cnt = 0; |
325 | 325 | ||
326 | /* TODO(kees): When pstore supports unregistering, call it here. */ | 326 | /* TODO(kees): When pstore supports unregistering, call it here. */ |
327 | kfree(cxt->pstore.buf); | 327 | kfree(cxt->pstore.buf); |