Skip to content

Commit

Permalink
mtd: define `mtd_is_*()' functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brian Norris authored and Artem Bityutskiy committed Sep 21, 2011
1 parent b61bf5b commit 7387ce7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/linux/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,16 @@ void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);

void mtd_erase_callback(struct erase_info *instr);

static inline int mtd_is_bitflip(int err) {
return err == -EUCLEAN;
}

static inline int mtd_is_eccerr(int err) {
return err == -EBADMSG;
}

static inline int mtd_is_bitflip_or_eccerr(int err) {
return mtd_is_bitflip(err) || mtd_is_eccerr(err);
}

#endif /* __MTD_MTD_H__ */

0 comments on commit 7387ce7

Please sign in to comment.