]> Pileus Git - ~andy/linux/commitdiff
mtd: expose ecc_strength through sysfs
authorMike Dunn <mikedunn@newsguy.com>
Wed, 25 Apr 2012 19:06:07 +0000 (12:06 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 14 May 2012 04:10:45 +0000 (23:10 -0500)
ecc_strength element of struct mtd_info is exposed as a read-only variable in
sysfs.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Documentation/ABI/testing/sysfs-class-mtd
drivers/mtd/mtdcore.c

index 4d55a18889813be097af27112b9e647031bf8fff..43d18180b46ed54e32765af0fbb85a1e0819432e 100644 (file)
@@ -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
+Contact:       linux-mtd@lists.infradead.org
+Description:
+               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.
index c837507dfb1c73021da2a47eebd975bd40573ef9..090e849d3dcdbb7792a767116971812e3d21624e 100644 (file)
@@ -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[] = {
        &dev_attr_type.attr,
        &dev_attr_flags.attr,
@@ -260,6 +269,7 @@ static struct attribute *mtd_attrs[] = {
        &dev_attr_oobsize.attr,
        &dev_attr_numeraseregions.attr,
        &dev_attr_name.attr,
+       &dev_attr_ecc_strength.attr,
        NULL,
 };