[PATCH 03/14] mtd: define `is_ecc_error()' macros

Brian Norris computersforpeace at gmail.com
Mon Sep 19 14:43:52 EDT 2011


On Sun, Sep 18, 2011 at 9:14 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> On Sun, 2011-09-11 at 16:57 +0300, Artem Bityutskiy wrote:
>> > +#define is_corrected_ecc_error(error) (error == -EUCLEAN)
>>
>> This is not really an error...

I suppose I was just considering the names as describing the error
code, even if it's not fully an error.

>> > +#define is_uncorrected_ecc_error(error) (error == -EBADMSG)
>> > +#define is_ecc_error(error) ((is_corrected_ecc_error(error) || \
>> > +                         is_uncorrected_ecc_error(error)))
>>
>> Could we please have static inline functions instead of macros?

Of course we can! Is there a particular reason? Better type checking?
Or just kernel style? I don't think I see a code-size benefit...

>> I think it is nicer to have mtd_ prefixes, how about these names
>> instead:
>>
>> mtd_is_bitflip()
>> mtd_is_eccerr()
>> mtd_is_bitflip_or_eccerr()
>
> Brian, I was actually waiting for v2 of the patches: 3/14, and
> 9/14-14/14.

Right, I hadn't settled on a name yet and so I haven't rewritten the patches.

I like the fact that your names are shorter. I'm not sure about
`mtd_is_bitflip_or_eccerr()', though; the compound name seems a little
out of place. But maybe it's just better to be clear on exactly what
is covered by the function. Is there a broad category name for
bitflips/ECC errors? I just consider them corrected/uncorrected errors
in flash, thus the naming I gave.

I'll either repost with a better naming scheme or update my patches
with the suggested names.

Brian



More information about the linux-mtd mailing list