diff options
-rw-r--r-- | drivers/mtd/inftlcore.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nftlcore.c | 2 | ||||
-rw-r--r-- | drivers/mtd/ssfdc.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/nandbiterrs.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/oobtest.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/pagetest.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/subpagetest.c | 2 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 5 |
8 files changed, 12 insertions, 7 deletions
diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c index 3af351484098..b66b541877f0 100644 --- a/drivers/mtd/inftlcore.c +++ b/drivers/mtd/inftlcore.c | |||
@@ -50,7 +50,7 @@ static void inftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
50 | struct INFTLrecord *inftl; | 50 | struct INFTLrecord *inftl; |
51 | unsigned long temp; | 51 | unsigned long temp; |
52 | 52 | ||
53 | if (mtd->type != MTD_NANDFLASH || mtd->size > UINT_MAX) | 53 | if (!mtd_type_is_nand(mtd) || mtd->size > UINT_MAX) |
54 | return; | 54 | return; |
55 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ | 55 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ |
56 | if (memcmp(mtd->name, "DiskOnChip", 10)) | 56 | if (memcmp(mtd->name, "DiskOnChip", 10)) |
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c index c5f4ebf4b384..46f27de018c3 100644 --- a/drivers/mtd/nftlcore.c +++ b/drivers/mtd/nftlcore.c | |||
@@ -50,7 +50,7 @@ static void nftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
50 | struct NFTLrecord *nftl; | 50 | struct NFTLrecord *nftl; |
51 | unsigned long temp; | 51 | unsigned long temp; |
52 | 52 | ||
53 | if (mtd->type != MTD_NANDFLASH || mtd->size > UINT_MAX) | 53 | if (!mtd_type_is_nand(mtd) || mtd->size > UINT_MAX) |
54 | return; | 54 | return; |
55 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ | 55 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ |
56 | if (memcmp(mtd->name, "DiskOnChip", 10)) | 56 | if (memcmp(mtd->name, "DiskOnChip", 10)) |
diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c index ab2a52a039c3..daf82ba7aba0 100644 --- a/drivers/mtd/ssfdc.c +++ b/drivers/mtd/ssfdc.c | |||
@@ -290,7 +290,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
290 | int cis_sector; | 290 | int cis_sector; |
291 | 291 | ||
292 | /* Check for small page NAND flash */ | 292 | /* Check for small page NAND flash */ |
293 | if (mtd->type != MTD_NANDFLASH || mtd->oobsize != OOB_SIZE || | 293 | if (!mtd_type_is_nand(mtd) || mtd->oobsize != OOB_SIZE || |
294 | mtd->size > UINT_MAX) | 294 | mtd->size > UINT_MAX) |
295 | return; | 295 | return; |
296 | 296 | ||
diff --git a/drivers/mtd/tests/nandbiterrs.c b/drivers/mtd/tests/nandbiterrs.c index 207bf9a9972f..3d8242f592d9 100644 --- a/drivers/mtd/tests/nandbiterrs.c +++ b/drivers/mtd/tests/nandbiterrs.c | |||
@@ -382,7 +382,7 @@ static int __init mtd_nandbiterrs_init(void) | |||
382 | goto exit_mtddev; | 382 | goto exit_mtddev; |
383 | } | 383 | } |
384 | 384 | ||
385 | if (mtd->type != MTD_NANDFLASH) { | 385 | if (!mtd_type_is_nand(mtd)) { |
386 | pr_info("this test requires NAND flash\n"); | 386 | pr_info("this test requires NAND flash\n"); |
387 | err = -ENODEV; | 387 | err = -ENODEV; |
388 | goto exit_nand; | 388 | goto exit_nand; |
diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c index ab81e9a5947e..6c5c3ac0a8f5 100644 --- a/drivers/mtd/tests/oobtest.c +++ b/drivers/mtd/tests/oobtest.c | |||
@@ -360,7 +360,7 @@ static int __init mtd_oobtest_init(void) | |||
360 | return err; | 360 | return err; |
361 | } | 361 | } |
362 | 362 | ||
363 | if (mtd->type != MTD_NANDFLASH) { | 363 | if (!mtd_type_is_nand(mtd)) { |
364 | pr_info("this test requires NAND flash\n"); | 364 | pr_info("this test requires NAND flash\n"); |
365 | goto out; | 365 | goto out; |
366 | } | 366 | } |
diff --git a/drivers/mtd/tests/pagetest.c b/drivers/mtd/tests/pagetest.c index acd991f4bf94..80ecd64c8f58 100644 --- a/drivers/mtd/tests/pagetest.c +++ b/drivers/mtd/tests/pagetest.c | |||
@@ -492,7 +492,7 @@ static int __init mtd_pagetest_init(void) | |||
492 | return err; | 492 | return err; |
493 | } | 493 | } |
494 | 494 | ||
495 | if (mtd->type != MTD_NANDFLASH) { | 495 | if (!mtd_type_is_nand(mtd)) { |
496 | pr_info("this test requires NAND flash\n"); | 496 | pr_info("this test requires NAND flash\n"); |
497 | goto out; | 497 | goto out; |
498 | } | 498 | } |
diff --git a/drivers/mtd/tests/subpagetest.c b/drivers/mtd/tests/subpagetest.c index e41a04f5caab..c6e2d71d1ddd 100644 --- a/drivers/mtd/tests/subpagetest.c +++ b/drivers/mtd/tests/subpagetest.c | |||
@@ -371,7 +371,7 @@ static int __init mtd_subpagetest_init(void) | |||
371 | return err; | 371 | return err; |
372 | } | 372 | } |
373 | 373 | ||
374 | if (mtd->type != MTD_NANDFLASH) { | 374 | if (!mtd_type_is_nand(mtd)) { |
375 | pr_info("this test requires NAND flash\n"); | 375 | pr_info("this test requires NAND flash\n"); |
376 | goto out; | 376 | goto out; |
377 | } | 377 | } |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index f9bfe526d310..88409b813418 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -354,6 +354,11 @@ static inline int mtd_has_oob(const struct mtd_info *mtd) | |||
354 | return mtd->_read_oob && mtd->_write_oob; | 354 | return mtd->_read_oob && mtd->_write_oob; |
355 | } | 355 | } |
356 | 356 | ||
357 | static inline int mtd_type_is_nand(const struct mtd_info *mtd) | ||
358 | { | ||
359 | return mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH; | ||
360 | } | ||
361 | |||
357 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) | 362 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) |
358 | { | 363 | { |
359 | return !!mtd->_block_isbad; | 364 | return !!mtd->_block_isbad; |