aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2012-05-22 19:33:23 -0400
committerAnton Vorontsov <anton@enomsg.org>2013-04-04 00:50:00 -0400
commitc31ad081e8734aab3fb45d2f32e9969994dd076e (patch)
treed4c55b3c6a07b78e6386560cd2f969341c1ae45a /fs/pstore/ram.c
parent422ca8608c49d1e9bfed1c58a1ca448a8a38c0ad (diff)
pstore/ram: Allow specifying ecc parameters in platform data
Allow specifying ecc parameters in platform data Signed-off-by: Arve Hjønnevåg <arve@android.com> [jstultz: Tweaked commit subject & add commit message] Signed-off-by: John Stultz <john.stultz@linaro.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 38babb3a9384..a5ee252c264e 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -83,7 +83,7 @@ struct ramoops_context {
83 size_t console_size; 83 size_t console_size;
84 size_t ftrace_size; 84 size_t ftrace_size;
85 int dump_oops; 85 int dump_oops;
86 int ecc_size; 86 struct persistent_ram_ecc_info ecc_info;
87 unsigned int max_dump_cnt; 87 unsigned int max_dump_cnt;
88 unsigned int dump_write_cnt; 88 unsigned int dump_write_cnt;
89 unsigned int dump_read_cnt; 89 unsigned int dump_read_cnt;
@@ -322,7 +322,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
322 for (i = 0; i < cxt->max_dump_cnt; i++) { 322 for (i = 0; i < cxt->max_dump_cnt; i++) {
323 size_t sz = cxt->record_size; 323 size_t sz = cxt->record_size;
324 324
325 cxt->przs[i] = persistent_ram_new(*paddr, sz, 0, cxt->ecc_size); 325 cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
326 &cxt->ecc_info);
326 if (IS_ERR(cxt->przs[i])) { 327 if (IS_ERR(cxt->przs[i])) {
327 err = PTR_ERR(cxt->przs[i]); 328 err = PTR_ERR(cxt->przs[i]);
328 dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", 329 dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
@@ -352,7 +353,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
352 return -ENOMEM; 353 return -ENOMEM;
353 } 354 }
354 355
355 *prz = persistent_ram_new(*paddr, sz, sig, cxt->ecc_size); 356 *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info);
356 if (IS_ERR(*prz)) { 357 if (IS_ERR(*prz)) {
357 int err = PTR_ERR(*prz); 358 int err = PTR_ERR(*prz);
358 359
@@ -406,7 +407,7 @@ static int ramoops_probe(struct platform_device *pdev)
406 cxt->console_size = pdata->console_size; 407 cxt->console_size = pdata->console_size;
407 cxt->ftrace_size = pdata->ftrace_size; 408 cxt->ftrace_size = pdata->ftrace_size;
408 cxt->dump_oops = pdata->dump_oops; 409 cxt->dump_oops = pdata->dump_oops;
409 cxt->ecc_size = pdata->ecc_size; 410 cxt->ecc_info = pdata->ecc_info;
410 411
411 paddr = cxt->phys_addr; 412 paddr = cxt->phys_addr;
412 413
@@ -464,9 +465,9 @@ static int ramoops_probe(struct platform_device *pdev)
464 record_size = pdata->record_size; 465 record_size = pdata->record_size;
465 dump_oops = pdata->dump_oops; 466 dump_oops = pdata->dump_oops;
466 467
467 pr_info("attached 0x%lx@0x%llx, ecc: %d\n", 468 pr_info("attached 0x%lx@0x%llx, ecc: %d/%d\n",
468 cxt->size, (unsigned long long)cxt->phys_addr, 469 cxt->size, (unsigned long long)cxt->phys_addr,
469 cxt->ecc_size); 470 cxt->ecc_info.ecc_size, cxt->ecc_info.block_size);
470 471
471 return 0; 472 return 0;
472 473
@@ -538,7 +539,7 @@ static void ramoops_register_dummy(void)
538 * For backwards compatibility ramoops.ecc=1 means 16 bytes ECC 539 * For backwards compatibility ramoops.ecc=1 means 16 bytes ECC
539 * (using 1 byte for ECC isn't much of use anyway). 540 * (using 1 byte for ECC isn't much of use anyway).
540 */ 541 */
541 dummy_data->ecc_size = ramoops_ecc == 1 ? 16 : ramoops_ecc; 542 dummy_data->ecc_info.ecc_size = ramoops_ecc == 1 ? 16 : ramoops_ecc;
542 543
543 dummy = platform_device_register_data(NULL, "ramoops", -1, 544 dummy = platform_device_register_data(NULL, "ramoops", -1,
544 dummy_data, sizeof(struct ramoops_platform_data)); 545 dummy_data, sizeof(struct ramoops_platform_data));