[PATCH 05/23] scsi: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
From: Chunguang Xu
Date: Thu Aug 27 2020 - 06:18:49 EST
Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.
Signed-off-by: Chunguang Xu <brookxu@xxxxxxxxxxx>
---
drivers/scsi/megaraid/mega_common.h | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 3a7596e..ba3007d 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -253,16 +253,10 @@
#ifdef DEBUG
#if defined (_ASSERT_PANIC)
-#define ASSERT_ACTION panic
+#define ASSERT(expression) ASSERT_FAIL(expression)
#else
-#define ASSERT_ACTION printk
+#define ASSERT(expression) ASSERT_WARN(expression)
#endif
-
-#define ASSERT(expression) \
- if (!(expression)) { \
- ASSERT_ACTION("assertion failed:(%s), file: %s, line: %d:%s\n", \
- #expression, __FILE__, __LINE__, __func__); \
- }
#else
#define ASSERT(expression)
#endif
--
1.8.3.1