]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Merge branch 'for-4.13' into for-linus
authorPetr Mladek <pmladek@suse.com>
Mon, 3 Jul 2017 13:33:39 +0000 (15:33 +0200)
committerPetr Mladek <pmladek@suse.com>
Mon, 3 Jul 2017 13:33:39 +0000 (15:33 +0200)
1  2 
kernel/printk/printk.c

diff --combined kernel/printk/printk.c
index a1db38abac5b750e8ce228b441b27900360665ec,e5278e7d192209a73e1eb770a11cbf3d0bc6c96b..8603a48fcdea3f294e21d089427a20ed37f9fcdc
@@@ -32,7 -32,7 +32,7 @@@
  #include <linux/bootmem.h>
  #include <linux/memblock.h>
  #include <linux/syscalls.h>
 -#include <linux/kexec.h>
 +#include <linux/crash_core.h>
  #include <linux/kdb.h>
  #include <linux/ratelimit.h>
  #include <linux/kmsg_dump.h>
@@@ -269,6 -269,7 +269,6 @@@ static struct console *exclusive_consol
  #define MAX_CMDLINECONSOLES 8
  
  static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];
 -static int console_cmdline_cnt;
  
  static int preferred_console = -1;
  int console_set_on_cmdline;
@@@ -1001,7 -1002,7 +1001,7 @@@ const struct file_operations kmsg_fops 
        .release = devkmsg_release,
  };
  
 -#ifdef CONFIG_KEXEC_CORE
 +#ifdef CONFIG_CRASH_CORE
  /*
   * This appends the listed symbols to /proc/vmcore
   *
   * symbols are specifically used so that utilities can access and extract the
   * dmesg log from a vmcore file after a crash.
   */
 -void log_buf_kexec_setup(void)
 +void log_buf_vmcoreinfo_setup(void)
  {
        VMCOREINFO_SYMBOL(log_buf);
        VMCOREINFO_SYMBOL(log_buf_len);
@@@ -1905,12 -1906,25 +1905,12 @@@ static int __add_preferred_console(cha
         *      See if this tty is not yet registered, and
         *      if we have a slot free.
         */
 -      for (i = 0, c = console_cmdline; i < console_cmdline_cnt; i++, c++) {
 +      for (i = 0, c = console_cmdline;
 +           i < MAX_CMDLINECONSOLES && c->name[0];
 +           i++, c++) {
                if (strcmp(c->name, name) == 0 && c->index == idx) {
 -                      if (brl_options)
 -                              return 0;
 -
 -                      /*
 -                       * Maintain an invariant that will help to find if
 -                       * the matching console is preferred, see
 -                       * register_console():
 -                       *
 -                       * The last non-braille console is always
 -                       * the preferred one.
 -                       */
 -                      if (i != console_cmdline_cnt - 1)
 -                              swap(console_cmdline[i],
 -                                   console_cmdline[console_cmdline_cnt - 1]);
 -
 -                      preferred_console = console_cmdline_cnt - 1;
 -
 +                      if (!brl_options)
 +                              preferred_console = i;
                        return 0;
                }
        }
        braille_set_options(c, brl_options);
  
        c->index = idx;
 -      console_cmdline_cnt++;
        return 0;
  }
  /*
@@@ -2462,12 -2477,23 +2462,12 @@@ void register_console(struct console *n
        }
  
        /*
 -       * See if this console matches one we selected on the command line.
 -       *
 -       * There may be several entries in the console_cmdline array matching
 -       * with the same console, one with newcon->match(), another by
 -       * name/index:
 -       *
 -       *      pl011,mmio,0x87e024000000,115200 -- added from SPCR
 -       *      ttyAMA0 -- added from command line
 -       *
 -       * Traverse the console_cmdline array in reverse order to be
 -       * sure that if this console is preferred then it will be the first
 -       * matching entry.  We use the invariant that is maintained in
 -       * __add_preferred_console().
 +       *      See if this console matches one we selected on
 +       *      the command line.
         */
 -      for (i = console_cmdline_cnt - 1; i >= 0; i--) {
 -              c = console_cmdline + i;
 -
 +      for (i = 0, c = console_cmdline;
 +           i < MAX_CMDLINECONSOLES && c->name[0];
 +           i++, c++) {
                if (!newcon->match ||
                    newcon->match(newcon, c->name, c->index, c->options) != 0) {
                        /* default matching */
@@@ -2615,30 -2641,6 +2615,30 @@@ int unregister_console(struct console *
  }
  EXPORT_SYMBOL(unregister_console);
  
 +/*
 + * Initialize the console device. This is called *early*, so
 + * we can't necessarily depend on lots of kernel help here.
 + * Just do some early initializations, and do the complex setup
 + * later.
 + */
 +void __init console_init(void)
 +{
 +      initcall_t *call;
 +
 +      /* Setup the default TTY line discipline. */
 +      n_tty_init();
 +
 +      /*
 +       * set up the console device so that later boot sequences can
 +       * inform about problems etc..
 +       */
 +      call = __con_initcall_start;
 +      while (call < __con_initcall_end) {
 +              (*call)();
 +              call++;
 +      }
 +}
 +
  /*
   * Some boot consoles access data that is in the init section and which will
   * be discarded after the initcalls have been run. To make sure that no code
@@@ -2720,16 -2722,13 +2720,13 @@@ void wake_up_klogd(void
        preempt_enable();
  }
  
- int printk_deferred(const char *fmt, ...)
+ int vprintk_deferred(const char *fmt, va_list args)
  {
-       va_list args;
        int r;
  
-       preempt_disable();
-       va_start(args, fmt);
        r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, 0, fmt, args);
-       va_end(args);
  
+       preempt_disable();
        __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT);
        irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
        preempt_enable();
        return r;
  }
  
+ int printk_deferred(const char *fmt, ...)
+ {
+       va_list args;
+       int r;
+       va_start(args, fmt);
+       r = vprintk_deferred(fmt, args);
+       va_end(args);
+       return r;
+ }
  /*
   * printk rate limiting, lifted from the networking subsystem.
   *