mtdcore.c (f01387d2693813eb5271a3448e6a082322c7d75d) mtdcore.c (990a3af0c20590954be01a95c2c3fcef9360a836)
1/*
2 * Core registration and callback routines for MTD
3 * drivers and users.
4 *
5 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
6 * Copyright © 2006 Red Hat UK Limited
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 284 unchanged lines hidden (view full) ---

293{
294 struct mtd_info *mtd = dev_get_drvdata(dev);
295
296 return snprintf(buf, PAGE_SIZE, "%u\n", mtd->ecc_step_size);
297
298}
299static DEVICE_ATTR(ecc_step_size, S_IRUGO, mtd_ecc_step_size_show, NULL);
300
1/*
2 * Core registration and callback routines for MTD
3 * drivers and users.
4 *
5 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
6 * Copyright © 2006 Red Hat UK Limited
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 284 unchanged lines hidden (view full) ---

293{
294 struct mtd_info *mtd = dev_get_drvdata(dev);
295
296 return snprintf(buf, PAGE_SIZE, "%u\n", mtd->ecc_step_size);
297
298}
299static DEVICE_ATTR(ecc_step_size, S_IRUGO, mtd_ecc_step_size_show, NULL);
300
301static ssize_t mtd_ecc_stats_corrected_show(struct device *dev,
302 struct device_attribute *attr, char *buf)
303{
304 struct mtd_info *mtd = dev_get_drvdata(dev);
305 struct mtd_ecc_stats *ecc_stats = &mtd->ecc_stats;
306
307 return snprintf(buf, PAGE_SIZE, "%u\n", ecc_stats->corrected);
308}
309static DEVICE_ATTR(corrected_bits, S_IRUGO,
310 mtd_ecc_stats_corrected_show, NULL);
311
312static ssize_t mtd_ecc_stats_errors_show(struct device *dev,
313 struct device_attribute *attr, char *buf)
314{
315 struct mtd_info *mtd = dev_get_drvdata(dev);
316 struct mtd_ecc_stats *ecc_stats = &mtd->ecc_stats;
317
318 return snprintf(buf, PAGE_SIZE, "%u\n", ecc_stats->failed);
319}
320static DEVICE_ATTR(ecc_failures, S_IRUGO, mtd_ecc_stats_errors_show, NULL);
321
322static ssize_t mtd_badblocks_show(struct device *dev,
323 struct device_attribute *attr, char *buf)
324{
325 struct mtd_info *mtd = dev_get_drvdata(dev);
326 struct mtd_ecc_stats *ecc_stats = &mtd->ecc_stats;
327
328 return snprintf(buf, PAGE_SIZE, "%u\n", ecc_stats->badblocks);
329}
330static DEVICE_ATTR(bad_blocks, S_IRUGO, mtd_badblocks_show, NULL);
331
332static ssize_t mtd_bbtblocks_show(struct device *dev,
333 struct device_attribute *attr, char *buf)
334{
335 struct mtd_info *mtd = dev_get_drvdata(dev);
336 struct mtd_ecc_stats *ecc_stats = &mtd->ecc_stats;
337
338 return snprintf(buf, PAGE_SIZE, "%u\n", ecc_stats->bbtblocks);
339}
340static DEVICE_ATTR(bbt_blocks, S_IRUGO, mtd_bbtblocks_show, NULL);
341
301static struct attribute *mtd_attrs[] = {
302 &dev_attr_type.attr,
303 &dev_attr_flags.attr,
304 &dev_attr_size.attr,
305 &dev_attr_erasesize.attr,
306 &dev_attr_writesize.attr,
307 &dev_attr_subpagesize.attr,
308 &dev_attr_oobsize.attr,
309 &dev_attr_numeraseregions.attr,
310 &dev_attr_name.attr,
311 &dev_attr_ecc_strength.attr,
312 &dev_attr_ecc_step_size.attr,
342static struct attribute *mtd_attrs[] = {
343 &dev_attr_type.attr,
344 &dev_attr_flags.attr,
345 &dev_attr_size.attr,
346 &dev_attr_erasesize.attr,
347 &dev_attr_writesize.attr,
348 &dev_attr_subpagesize.attr,
349 &dev_attr_oobsize.attr,
350 &dev_attr_numeraseregions.attr,
351 &dev_attr_name.attr,
352 &dev_attr_ecc_strength.attr,
353 &dev_attr_ecc_step_size.attr,
354 &dev_attr_corrected_bits.attr,
355 &dev_attr_ecc_failures.attr,
356 &dev_attr_bad_blocks.attr,
357 &dev_attr_bbt_blocks.attr,
313 &dev_attr_bitflip_threshold.attr,
314 NULL,
315};
316ATTRIBUTE_GROUPS(mtd);
317
318static struct device_type mtd_devtype = {
319 .name = "mtd",
320 .groups = mtd_groups,

--- 918 unchanged lines hidden ---
358 &dev_attr_bitflip_threshold.attr,
359 NULL,
360};
361ATTRIBUTE_GROUPS(mtd);
362
363static struct device_type mtd_devtype = {
364 .name = "mtd",
365 .groups = mtd_groups,

--- 918 unchanged lines hidden ---