[PATCH 16/16] mtd: ubi: Make debug options configurable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This makes the UBI debug options configurable. This make the debug
options actually available to the user and also allows the compiler
to optimize away the debug code when the options are disabled.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/mtd/ubi/Kconfig | 13 +++++++++++++
 drivers/mtd/ubi/debug.h | 10 ++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig
index ccd547d..4c49793 100644
--- a/drivers/mtd/ubi/Kconfig
+++ b/drivers/mtd/ubi/Kconfig
@@ -77,4 +77,17 @@ config MTD_UBI_FASTMAP
 
 	   If in doubt, say "N".
 
+comment "UBI debugging options"
+
+config MTD_UBI_CHECK_IO
+	bool "Check IO operations"
+	help
+	  When enabled UBI will check if erased blocks are really erased and if areas
+	  written to are empty before writing.
+
+config MTD_UBI_GENERAL_EXTRA_CHECKS
+	bool "general extra checks"
+	help
+	  This enables some general extra checks in UBI
+
 endif # MTD_UBI
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index c1b41b4..511e454 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -74,11 +74,17 @@ static inline int ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi)
 
 static inline int ubi_dbg_chk_io(const struct ubi_device *ubi)
 {
-	return ubi->dbg.chk_io;
+	if (IS_ENABLED(CONFIG_MTD_UBI_CHECK_IO))
+		return 1;
+	else
+		return 0;
 }
 
 static inline int ubi_dbg_chk_gen(const struct ubi_device *ubi)
 {
-	return ubi->dbg.chk_gen;
+	if (IS_ENABLED(CONFIG_MTD_UBI_GENERAL_EXTRA_CHECKS))
+		return 1;
+	else
+		return 0;
 }
 #endif /* !__UBI_DEBUG_H__ */
-- 
2.7.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux