diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-class-mtd | 12 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.c | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-mtd b/Documentation/ABI/testing/sysfs-class-mtd index 4d55a1888981..43d18180b46e 100644 --- a/Documentation/ABI/testing/sysfs-class-mtd +++ b/Documentation/ABI/testing/sysfs-class-mtd | |||
@@ -123,3 +123,15 @@ Description: | |||
123 | half page, or a quarter page). | 123 | half page, or a quarter page). |
124 | 124 | ||
125 | In the case of ECC NOR, it is the ECC block size. | 125 | In the case of ECC NOR, it is the ECC block size. |
126 | |||
127 | What: /sys/class/mtd/mtdX/ecc_strength | ||
128 | Date: April 2012 | ||
129 | KernelVersion: 3.4 | ||
130 | Contact: linux-mtd@lists.infradead.org | ||
131 | Description: | ||
132 | Maximum number of bit errors that the device is capable of | ||
133 | correcting within each region covering an ecc step. This will | ||
134 | always be a non-negative integer. Note that some devices will | ||
135 | have multiple ecc steps within each writesize region. | ||
136 | |||
137 | In the case of devices lacking any ECC capability, it is 0. | ||
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index c837507dfb1c..090e849d3dcd 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -250,6 +250,15 @@ static ssize_t mtd_name_show(struct device *dev, | |||
250 | } | 250 | } |
251 | static DEVICE_ATTR(name, S_IRUGO, mtd_name_show, NULL); | 251 | static DEVICE_ATTR(name, S_IRUGO, mtd_name_show, NULL); |
252 | 252 | ||
253 | static ssize_t mtd_ecc_strength_show(struct device *dev, | ||
254 | struct device_attribute *attr, char *buf) | ||
255 | { | ||
256 | struct mtd_info *mtd = dev_get_drvdata(dev); | ||
257 | |||
258 | return snprintf(buf, PAGE_SIZE, "%u\n", mtd->ecc_strength); | ||
259 | } | ||
260 | static DEVICE_ATTR(ecc_strength, S_IRUGO, mtd_ecc_strength_show, NULL); | ||
261 | |||
253 | static struct attribute *mtd_attrs[] = { | 262 | static struct attribute *mtd_attrs[] = { |
254 | &dev_attr_type.attr, | 263 | &dev_attr_type.attr, |
255 | &dev_attr_flags.attr, | 264 | &dev_attr_flags.attr, |
@@ -260,6 +269,7 @@ static struct attribute *mtd_attrs[] = { | |||
260 | &dev_attr_oobsize.attr, | 269 | &dev_attr_oobsize.attr, |
261 | &dev_attr_numeraseregions.attr, | 270 | &dev_attr_numeraseregions.attr, |
262 | &dev_attr_name.attr, | 271 | &dev_attr_name.attr, |
272 | &dev_attr_ecc_strength.attr, | ||
263 | NULL, | 273 | NULL, |
264 | }; | 274 | }; |
265 | 275 | ||