lkml.org 
[lkml]   [2014]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 47/47] mtd: nand: stm_nand_bch: catch unsupported calls
Date
Display a BUG() message and return appropriate/expected value.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/mtd/nand/stm_nand_bch.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c
index 4103d4f..e732bf3 100644
--- a/drivers/mtd/nand/stm_nand_bch.c
+++ b/drivers/mtd/nand/stm_nand_bch.c
@@ -852,6 +852,31 @@ static void flex_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
}
}

+/* Catch calls to non-supported functions */
+static uint16_t flex_read_word_bug(struct mtd_info *mtd)
+{
+ BUG();
+ return 0;
+}
+
+static int flex_block_bad_bug(struct mtd_info *mtd, loff_t ofs, int getchip)
+{
+ BUG();
+ return 1;
+}
+
+static int flex_block_markbad_bug(struct mtd_info *mtd, loff_t ofs)
+{
+ BUG();
+ return 1;
+}
+
+int flex_scan_bbt_bug(struct mtd_info *mtd)
+{
+ BUG();
+ return 1;
+}
+
/*
* Hamming-FLEX operations (optimised replacements for nand_base.c versions)
*/
@@ -1916,7 +1941,12 @@ static void nandi_set_mtd_defaults(struct nandi_controller *nandi,
chip->read_buf = flex_read_buf;
chip->write_buf = flex_write_buf;

+ chip->read_word = flex_read_word_bug;
+ chip->block_bad = flex_block_bad_bug;
+ chip->block_markbad = flex_block_markbad_bug;
+
chip->bbt_options |= NAND_BBT_USE_FLASH;
+ chip->scan_bbt = flex_scan_bbt_bug;

/* mtd_info */
mtd->owner = THIS_MODULE;
--
1.8.3.2


\
 
 \ /
  Last update: 2014-03-25 10:21    [W:0.218 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site