summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/debug.h
diff options
context:
space:
mode:
authorZhaoLong Wang <wangzhaolong1@huawei.com>2023-12-26 09:01:10 +0800
committerRichard Weinberger <richard@nod.at>2024-01-06 23:39:29 +0100
commite30948f7c0730d9fb2271ff3eadd43eda4e44740 (patch)
tree13f97eec2dcc10674324dd4ed7ee6e1a8df1154d /drivers/mtd/ubi/debug.h
parent6931fb44858c3b9da9f35fdc8d9cbeef0b4b50a3 (diff)
ubi: Split io_failures into write_failure and erase_failure
The emulate_io_failures debugfs entry controls both write failure and erase failure. This patch split io_failures to write_failure and erase_failure. Signed-off-by: ZhaoLong Wang <wangzhaolong1@huawei.com> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi/debug.h')
-rw-r--r--drivers/mtd/ubi/debug.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index f2f499feff49..8cdd25eee013 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -92,10 +92,12 @@ static inline int ubi_dbg_erase_failure(const struct ubi_device *ubi)
/* Emulate bit-flips */
#define MASK_BITFLIPS (1 << 2)
/* Emulates -EIO during write/erase */
-#define MASK_IO_FAILURE (1 << 3)
+#define MASK_WRITE_FAILURE (1 << 3)
+#define MASK_ERASE_FAILURE (1 << 4)
extern bool should_fail_bitflips(void);
-extern bool should_fail_io_failures(void);
+extern bool should_fail_write_failure(void);
+extern bool should_fail_erase_failure(void);
extern bool should_fail_power_cut(void);
static inline bool ubi_dbg_fail_bitflip(const struct ubi_device *ubi)
@@ -107,15 +109,15 @@ static inline bool ubi_dbg_fail_bitflip(const struct ubi_device *ubi)
static inline bool ubi_dbg_fail_write(const struct ubi_device *ubi)
{
- if (ubi->dbg.emulate_failures & MASK_IO_FAILURE)
- return should_fail_io_failures();
+ if (ubi->dbg.emulate_failures & MASK_WRITE_FAILURE)
+ return should_fail_write_failure();
return false;
}
static inline bool ubi_dbg_fail_erase(const struct ubi_device *ubi)
{
- if (ubi->dbg.emulate_failures & MASK_IO_FAILURE)
- return should_fail_io_failures();
+ if (ubi->dbg.emulate_failures & MASK_ERASE_FAILURE)
+ return should_fail_erase_failure();
return false;
}