diff options
| author | Brian Norris <computersforpeace@gmail.com> | 2011-09-20 21:30:51 -0400 |
|---|---|---|
| committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-21 02:19:06 -0400 |
| commit | 7387ce773256f446bdd0280b2449b635441f906e (patch) | |
| tree | 571ea27188a58341ae00f32802106c5c345587c3 /include/linux/mtd | |
| parent | b61bf5bbf619fc66ca866a27038da0b91cafb92d (diff) | |
mtd: define `mtd_is_*()' functions
These functions can be used instead of referencing -EUCLEAN and -EBADMSG
all over the place. They should help make code a little bit more
readable.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'include/linux/mtd')
| -rw-r--r-- | include/linux/mtd/mtd.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 37d082793f62..4bce1eb952cf 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -348,4 +348,16 @@ void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); | |||
| 348 | 348 | ||
| 349 | void mtd_erase_callback(struct erase_info *instr); | 349 | void mtd_erase_callback(struct erase_info *instr); |
| 350 | 350 | ||
| 351 | static inline int mtd_is_bitflip(int err) { | ||
| 352 | return err == -EUCLEAN; | ||
| 353 | } | ||
| 354 | |||
| 355 | static inline int mtd_is_eccerr(int err) { | ||
| 356 | return err == -EBADMSG; | ||
| 357 | } | ||
| 358 | |||
| 359 | static inline int mtd_is_bitflip_or_eccerr(int err) { | ||
| 360 | return mtd_is_bitflip(err) || mtd_is_eccerr(err); | ||
| 361 | } | ||
| 362 | |||
| 351 | #endif /* __MTD_MTD_H__ */ | 363 | #endif /* __MTD_MTD_H__ */ |
