[PATCH 0/2] always use partition wrappers; drivers return bitflips

Mike Dunn mikedunn at newsguy.com
Tue Dec 20 13:42:14 EST 2011


Hi,

These two patches accomplish the goal of returning bitflip info from the drivers
to mtd without requiring the huge patch that results from changing the prototype
of the read() method.

The first patch ensures that driver methods always go through the wrappers in
the partitioning code by creating a "partition" that spans the entire device on
otherwise unpartitioned devices.

Now that the methods always pass through the mtd code via the partitioning
wrappers, the second patch tweaks the meaning of the return code from the
driver's read() and read_oob() methods.  Where previously, in the absence of a
hard error, the driver returned either -EUCLEAN (one or more bitflips were
corrected) or 0 (no bitflips), the driver now returns, absent an error, the
maximum number of bitflips corrected on any single page.  The original set of
possible values (and their meanings) returned from mtd to the higher layer
remains unchanged for now.

This bifurcation of the driver <-> mtd and mtd <-> higher layer is admitedly a
little kludgy and potentially confusing for driver writers, but has the
advantage of touching few files.  With two exceptions, all drivers for devices
with ecc capability go through the nand or onenand interfaces, limiting the
changes to the nand and onenand infrastructure code.  Absent an error, devices
without ecc already return 0 always, so they comply with the modified api by
default.

If this flies, I'll follow up with patches to implement the change in the
meaning of -EUCLEAN returned from mtd that was previously discussed. Otherwise,
I can resubmit the large patch with the change to the read() prototype in lieu
of patch 2/2.

Thanks,
Mike

Mike Dunn (2):
  MTD: pass driver methods through partition wrappers on unpartitioned
    devices
  MTD: read(), read_oob() driver methods return num bitflips

 drivers/mtd/devices/docg3.c        |    5 +++-
 drivers/mtd/mtdcore.c              |   17 ++++++++++++--
 drivers/mtd/mtdpart.c              |   39 +++++++++++++++++++++++++++--------
 drivers/mtd/nand/alauda.c          |    4 +-
 drivers/mtd/nand/nand_base.c       |   10 +++++++-
 drivers/mtd/onenand/onenand_base.c |    6 +++-
 6 files changed, 62 insertions(+), 19 deletions(-)

-- 
1.7.3.4




More information about the linux-mtd mailing list