[PATCH 03/14] mtd: define `is_ecc_error()' macros
Brian Norris
computersforpeace at gmail.com
Wed Sep 7 16:13:30 EDT 2011
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)
+#define is_uncorrected_ecc_error(error) (error == -EBADMSG)
+#define is_ecc_error(error) ((is_corrected_ecc_error(error) || \
+ is_uncorrected_ecc_error(error)))
+
#endif /* __MTD_MTD_H__ */
--
1.7.5.4
More information about the linux-mtd
mailing list