summaryrefslogtreecommitdiff
path: root/fs/pstore/ram_core.c
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-07-09 17:03:19 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-17 09:46:52 -0700
commit5ca5d4e61d0cac15f36160ab48425c6e43bf2e2f (patch)
tree7e35f66cc7863798f32e96fb2062b6006352dc04 /fs/pstore/ram_core.c
parent4a53ffae6afc94bab803087245b3b45e712c21c8 (diff)
pstore/ram: Make ECC size configurable
This is now pretty straightforward: instead of using bool, just pass an integer. For backwards compatibility ramoops.ecc=1 means 16 bytes ECC (using 1 byte for ECC isn't much of use anyway). Suggested-by: Arve Hjønnevåg <arve@android.com> 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/pstore/ram_core.c')
-rw-r--r--fs/pstore/ram_core.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 3f4d6e64f6d7..7e5a2a9154ca 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -171,7 +171,8 @@ static void persistent_ram_ecc_old(struct persistent_ram_zone *prz)
}
}
-static int persistent_ram_init_ecc(struct persistent_ram_zone *prz)
+static int persistent_ram_init_ecc(struct persistent_ram_zone *prz,
+ int ecc_size)
{
int numerr;
struct persistent_ram_buffer *buffer = prz->buffer;
@@ -184,7 +185,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz)
return 0;
prz->ecc_block_size = 128;
- prz->ecc_size = 16;
+ prz->ecc_size = ecc_size;
ecc_blocks = DIV_ROUND_UP(prz->buffer_size, prz->ecc_block_size);
ecc_total = (ecc_blocks + 1) * prz->ecc_size;
@@ -390,13 +391,13 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
}
static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz,
- bool ecc)
+ int ecc_size)
{
int ret;
- prz->ecc = ecc;
+ prz->ecc = ecc_size;
- ret = persistent_ram_init_ecc(prz);
+ ret = persistent_ram_init_ecc(prz, ecc_size);
if (ret)
return ret;
@@ -444,7 +445,7 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start,
size_t size,
- bool ecc)
+ int ecc_size)
{
struct persistent_ram_zone *prz;
int ret = -ENOMEM;
@@ -459,7 +460,7 @@ struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start,
if (ret)
goto err;
- ret = persistent_ram_post_init(prz, ecc);
+ ret = persistent_ram_post_init(prz, ecc_size);
if (ret)
goto err;