[PATCH] MTD: drivers return bitlip info to mtd on read
Artem Bityutskiy
dedekind1 at gmail.com
Tue Dec 27 15:57:00 EST 2011
On Tue, 2011-12-27 at 12:26 -0800, Mike Dunn wrote:
> On 12/27/2011 12:33 AM, Artem Bityutskiy wrote:
> > On Mon, 2011-12-26 at 11:38 -0800, Mike Dunn wrote:
> >> This patch changes the meaning of the value returned by the read() and
> >> read_oob() mtd driver methods. Previously, absent a hard error, these functions
> >> returned either -EUCLEAN (one or more bitflips were corrected) or 0 (no
> >> bitflips). Drivers now return, absent a hard error, the maximum number of
> >> bitflips that were corrected on any one page.
> >>
> >> This change is made possible by the fact that all calls to the driver methods
> >> now go through mtd wrapper functions. The values returned by those wrapper
> >> functions have not changed, nor have their meaning. Only the values returned to
> >> the mtd wrappers by the driver have changed.
> >>
> >> Tested with nandsim and onenand_sim. The two drivers that were modified were
> >> compile-tested only.
> >>
> >> Signed-off-by: Mike Dunn <mikedunn at newsguy.com>
> > Hi, I am not sure using the return code is a good way for this.
>
>
> OK. It was a little kludgey, but had the advantage of touching very few drivers
> and leaving the existing function prototypes unchanged.
May be you are right, I need to think. But this is only true when you
are 100% sure no one uses the function pointers directly. The very
reliable way is to rename them, so the offenders would end up with a
compilation error. I am also thinking about out-of-tree drivers.
But I am planning to add leading "_" symbol to the function pointers
(e.g., mtd->read() => mtd->_read()). So this anyway will touch a lot of
code. And then this argument is probably not too strong anymore.
Anyway, let me emphasize that this should not be a show-stopper for
you - proceed with your DoC work meanwile. I'll try to come up with the
changes this week, but no promises, then I'll create a temporary branch
in my tree and we can use it till the end of the 3.3 merge window.
Artem.
More information about the linux-mtd
mailing list