mtd: ubi debug: Remove the pid print from ubi_assert
[platform/kernel/u-boot.git] / drivers / mtd / ubi / debug.h
index 980eb11..d853520 100644 (file)
@@ -1,8 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (c) International Business Machines Corp., 2006
  *
- * SPDX-License-Identifier:    GPL-2.0+
- *
  * Author: Artem Bityutskiy (Битюцкий Артём)
  */
 
@@ -13,11 +12,13 @@ void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);
 void ubi_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr);
 void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
 
-#define __UBOOT__
 #ifndef __UBOOT__
 #include <linux/random.h>
 #endif
 
+#include <hexdump.h>
+
+#ifndef __UBOOT__
 #define ubi_assert(expr)  do {                                               \
        if (unlikely(!(expr))) {                                             \
                pr_crit("UBI assert failed in %s at %u (pid %d)\n",          \
@@ -25,9 +26,18 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
                dump_stack();                                                \
        }                                                                    \
 } while (0)
+#else
+#define ubi_assert(expr)  do {                                               \
+       if (unlikely(!(expr))) {                                             \
+               pr_crit("UBI assert failed in %s at %u\n",                   \
+                      __func__, __LINE__);                                  \
+               dump_stack();                                                \
+       }                                                                    \
+} while (0)
+#endif
 
-#define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a)                   \
-               print_hex_dump(l, ps, pt, r, g, b, len, a)
+#define ubi_dbg_print_hex_dump(ps, pt, r, g, b, len, a)                      \
+               print_hex_dump(ps, pt, r, g, b, len, a)
 
 #define ubi_dbg_msg(type, fmt, ...) \
        pr_debug("UBI DBG " type " (pid %d): " fmt "\n", current->pid,       \
@@ -118,4 +128,16 @@ static inline int ubi_dbg_chk_gen(const struct ubi_device *ubi)
 {
        return ubi->dbg.chk_gen;
 }
+
+static inline int ubi_dbg_chk_fastmap(const struct ubi_device *ubi)
+{
+       return ubi->dbg.chk_fastmap;
+}
+
+static inline void ubi_enable_dbg_chk_fastmap(struct ubi_device *ubi)
+{
+       ubi->dbg.chk_fastmap = 1;
+}
+
+int ubi_dbg_power_cut(struct ubi_device *ubi, int caller);
 #endif /* !__UBI_DEBUG_H__ */