/*
   * Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ !
   */
 -__printf(1, 2) __cold int printk_deferred(const char *fmt, ...);
 +__printf(1, 2) __cold int _printk_deferred(const char *fmt, ...);
  
+ extern void __printk_safe_enter(void);
+ extern void __printk_safe_exit(void);
+ /*
+  * The printk_deferred_enter/exit macros are available only as a hack for
+  * some code paths that need to defer all printk console printing. Interrupts
+  * must be disabled for the deferred duration.
+  */
+ #define printk_deferred_enter __printk_safe_enter
+ #define printk_deferred_exit __printk_safe_exit
+ 
  /*
   * Please don't use printk_ratelimit(), because it shares ratelimiting state
   * with all other unrelated printk_ratelimit() callsites.  Instead use
 
  
  #ifdef CONFIG_PRINTK
  
- #define PRINTK_SAFE_CONTEXT_MASK      0x007ffffff
- #define PRINTK_NMI_DIRECT_CONTEXT_MASK        0x008000000
- #define PRINTK_NMI_CONTEXT_MASK               0xff0000000
- 
- #define PRINTK_NMI_CONTEXT_OFFSET     0x010000000
- 
 +/* Flags for a single printk record. */
 +enum printk_info_flags {
 +      LOG_NEWLINE     = 2,    /* text ended with a newline */
 +      LOG_CONT        = 8,    /* text is a fragment of a continuation line */
 +};
 +
  __printf(4, 0)
  int vprintk_store(int facility, int level,
                  const struct dev_printk_info *dev_info,
                local_irq_restore(flags);       \
        } while (0)
  
- #define printk_safe_enter_irq()               \
-       do {                                    \
-               local_irq_disable();            \
-               __printk_safe_enter();          \
-       } while (0)
- 
- #define printk_safe_exit_irq()                        \
-       do {                                    \
-               __printk_safe_exit();           \
-               local_irq_enable();             \
-       } while (0)
- 
  void defer_console_output(void);
  
 +u16 printk_parse_prefix(const char *text, int *level,
 +                      enum printk_info_flags *flags);
  #else
  
  /*
 
   * non-prinatable characters are escaped in the "\xff" notation.
   */
  
 -enum log_flags {
 -      LOG_NEWLINE     = 2,    /* text ended with a newline */
 -      LOG_CONT        = 8,    /* text is a fragment of a continuation line */
 -};
 -
  /* syslog_lock protects syslog_* variables and write access to clear_seq. */
- static DEFINE_RAW_SPINLOCK(syslog_lock);
+ static DEFINE_MUTEX(syslog_lock);
  
  #ifdef CONFIG_PRINTK
  DECLARE_WAIT_QUEUE_HEAD(log_wait);
  {
        const u32 caller_id = printk_caller_id();
        struct prb_reserved_entry e;
 -      enum log_flags lflags = 0;
 +      enum printk_info_flags flags = 0;
        struct printk_record r;
+       unsigned long irqflags;
        u16 trunc_msg_len = 0;
        char prefix_buf[8];
+       u8 *recursion_ptr;
        u16 reserve_size;
        va_list args2;
        u16 text_len;
         * there's a new owner and the console_unlock() from them will do the
         * flush, no worries.
         */
 -      retry = prb_read_valid(prb, console_seq, NULL);
 +      retry = prb_read_valid(prb, next_seq, NULL);
-       printk_safe_exit_irqrestore(flags);
- 
        if (retry && console_trylock())
                goto again;
  }