Commit a9b672e8 authored by Mike Dunn's avatar Mike Dunn Committed by David Woodhouse

mtd: expose ecc_strength through sysfs

ecc_strength element of struct mtd_info is exposed as a read-only variable in
Signed-off-by: default avatarMike Dunn <>
Signed-off-by: default avatarArtem Bityutskiy <>
Signed-off-by: default avatarDavid Woodhouse <>
parent 44df4d11
......@@ -123,3 +123,15 @@ Description:
half page, or a quarter page).
In the case of ECC NOR, it is the ECC block size.
What: /sys/class/mtd/mtdX/ecc_strength
Date: April 2012
KernelVersion: 3.4
Maximum number of bit errors that the device is capable of
correcting within each region covering an ecc step. This will
always be a non-negative integer. Note that some devices will
have multiple ecc steps within each writesize region.
In the case of devices lacking any ECC capability, it is 0.
......@@ -250,6 +250,15 @@ static ssize_t mtd_name_show(struct device *dev,
static DEVICE_ATTR(name, S_IRUGO, mtd_name_show, NULL);
static ssize_t mtd_ecc_strength_show(struct device *dev,
struct device_attribute *attr, char *buf)
struct mtd_info *mtd = dev_get_drvdata(dev);
return snprintf(buf, PAGE_SIZE, "%u\n", mtd->ecc_strength);
static DEVICE_ATTR(ecc_strength, S_IRUGO, mtd_ecc_strength_show, NULL);
static struct attribute *mtd_attrs[] = {
......@@ -260,6 +269,7 @@ static struct attribute *mtd_attrs[] = {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment