From 923735410da0d89c8c2d50e79dc1f6894fb4ce0d Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 28 Dec 2011 18:35:07 +0200 Subject: [PATCH] --- yaml --- r: 282902 b: refs/heads/master c: fc002e3c320602d0e206f607aca0460540d7637a h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/mtd/mtdchar.c | 2 +- trunk/drivers/mtd/sm_ftl.c | 4 ++-- trunk/include/linux/mtd/mtd.h | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 71e130ab2ef6..15e81adaf8ef 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 33c87b4a2c820316314542ce3f60b8a8c6a96928 +refs/heads/master: fc002e3c320602d0e206f607aca0460540d7637a diff --git a/trunk/drivers/mtd/mtdchar.c b/trunk/drivers/mtd/mtdchar.c index 83b0c82e9c94..c501eec17b38 100644 --- a/trunk/drivers/mtd/mtdchar.c +++ b/trunk/drivers/mtd/mtdchar.c @@ -1004,7 +1004,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) break; case MTD_FILE_MODE_RAW: - if (!mtd->read_oob || !mtd->write_oob) + if (!mtd_has_oob(mtd)) return -EOPNOTSUPP; mfi->mode = arg; diff --git a/trunk/drivers/mtd/sm_ftl.c b/trunk/drivers/mtd/sm_ftl.c index 4ec2af7fb845..072ed5970e2f 100644 --- a/trunk/drivers/mtd/sm_ftl.c +++ b/trunk/drivers/mtd/sm_ftl.c @@ -645,8 +645,8 @@ int sm_get_media_info(struct sm_ftl *ftl, struct mtd_info *mtd) if (!ftl->smallpagenand && mtd->oobsize < SM_OOB_SIZE) return -ENODEV; - /* We use these functions for IO */ - if (!mtd->read_oob || !mtd->write_oob) + /* We use OOB */ + if (!mtd_has_oob(mtd)) return -ENODEV; /* Find geometry information */ diff --git a/trunk/include/linux/mtd/mtd.h b/trunk/include/linux/mtd/mtd.h index f0dd5a305b89..478701566ba7 100644 --- a/trunk/include/linux/mtd/mtd.h +++ b/trunk/include/linux/mtd/mtd.h @@ -454,6 +454,11 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) return do_div(sz, mtd->writesize); } +static inline int mtd_has_oob(const struct mtd_info *mtd) +{ + return mtd->read_oob && mtd->write_oob; +} + /* Kernel-side ioctl definitions */ struct mtd_partition;