[PATCH 03/14] mtd: define `is_ecc_error()' macros
Artem Bityutskiy
dedekind1 at gmail.com
Sun Sep 11 09:57:15 EDT 2011
On Wed, 2011-09-07 at 13:13 -0700, Brian Norris wrote:
> These macros can be used instead of including -EUCLEAN and -EBADMSG all
> over the place. They should help make code a little bit more readable.
>
> Signed-off-by: Brian Norris <computersforpeace at gmail.com>
> ---
> include/linux/mtd/mtd.h | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index ead70ed..1dd74f4 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -348,4 +348,9 @@ void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
>
> void mtd_erase_callback(struct erase_info *instr);
>
> +#define is_corrected_ecc_error(error) (error == -EUCLEAN)
This is not really 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?
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()
--
Best Regards,
Artem Bityutskiy
More information about the linux-mtd
mailing list