[generic:] preliminary 3.12 support
[openwrt.git] / target / linux / generic / patches-3.3 / 335-mips-kexec-cleanup-kexec-tools-parameter-handling.patch
index abc8971..e0a1103 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/kernel/machine_kexec.c
 +++ b/arch/mips/kernel/machine_kexec.c
-@@ -23,67 +23,104 @@ void (*relocated_kexec_smp_wait) (void *
+@@ -25,67 +25,104 @@ void (*relocated_kexec_smp_wait) (void *
  atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
  #endif
  
@@ -9,7 +9,7 @@
 +#define KEXEC_MIPS_ARGV_MAX_ARGS      (COMMAND_LINE_SIZE / 15)
 +
 +char kexec_argv_buf[KEXEC_MIPS_ARGV_BUF_SIZE] __kexec;
-+int kexec_argv[KEXEC_MIPS_ARGV_MAX_ARGS] __kexec;
++char *kexec_argv[KEXEC_MIPS_ARGV_MAX_ARGS] __kexec;
 +
 +static void
 +machine_kexec_print_args(void)
@@ -39,7 +39,7 @@
 -      int i, argc = 0;
 -      char *bootloader = "kexec";
 -      int *kexec_argv = (int *)kexec_args[1];
-+      void __user *buf;
++      void __user *buf = NULL;
 +      size_t bufsz;
 +      size_t size;
 +      int i;
 +              break;
 +      }
 +
-+      if (i >= image->nr_segments)
++      if (!buf)
 +              return;
 +
 +      size = KEXEC_MIPS_ARGV_BUF_SIZE - 1;
 +      size = min(size, bufsz);
 +      if (size < bufsz)
-+              pr_warn("kexec command line truncated to %d bytes\n", size);
++              pr_warn("kexec command line truncated to %zd bytes\n", size);
 +
 +      /* Copy to kernel space */
 +      copy_from_user(kexec_argv_buf, buf, size);
 +                      continue;
                }
 +
-+              kexec_argv[argc++] = (int) ptr;
++              kexec_argv[argc++] = ptr;
 +              ptr = strchr(ptr, ' ');
        }
  
  
 -      return 0;
 +      kexec_args[0] = argc;
-+      kexec_args[1] = (int) kexec_argv;
++      kexec_args[1] = (unsigned long)kexec_argv;
 +      kexec_args[2] = 0;
 +      kexec_args[3] = 0;
 +
  }
  
  int
-@@ -95,8 +132,14 @@ machine_kexec_prepare(struct kimage *kim
+@@ -97,8 +134,14 @@ machine_kexec_prepare(struct kimage *kim
         *
         * This can be overrided by _machine_kexec_prepare().
         */
  
        if (_machine_kexec_prepare)
                return _machine_kexec_prepare(kimage);
-@@ -152,11 +195,13 @@ machine_kexec(struct kimage *image)
+@@ -154,11 +197,13 @@ machine_kexec(struct kimage *image)
        pr_info("kexec_indirection_page = %p\n",
                        (void *)kexec_indirection_page);