--- /dev/null
+From d43e6fb4ac4abfe4ef7c102833ed02330ad701e0 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 16 Jan 2017 14:20:54 +0100
+Subject: cpmac: remove hopeless #warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d43e6fb4ac4abfe4ef7c102833ed02330ad701e0 upstream.
+
+The #warning was present 10 years ago when the driver first got merged.
+As the platform is rather obsolete by now, it seems very unlikely that
+the warning will cause anyone to fix the code properly.
+
+kernelci.org reports the warning for every build in the meantime, so
+I think it's better to just turn it into a code comment to reduce
+noise.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/ti/cpmac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/ti/cpmac.c
++++ b/drivers/net/ethernet/ti/cpmac.c
+@@ -1237,7 +1237,7 @@ int cpmac_init(void)
+ goto fail_alloc;
+ }
+
+-#warning FIXME: unhardcode gpio&reset bits
++ /* FIXME: unhardcode gpio&reset bits */
+ ar7_gpio_disable(26);
+ ar7_gpio_disable(27);
+ ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
--- /dev/null
+From 7d6e9105026788c497f0ab32fa16c82f4ab5ff61 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 3 Feb 2017 23:33:23 +0100
+Subject: crypto: improve gcc optimization flags for serpent and wp512
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 7d6e9105026788c497f0ab32fa16c82f4ab5ff61 upstream.
+
+An ancient gcc bug (first reported in 2003) has apparently resurfaced
+on MIPS, where kernelci.org reports an overly large stack frame in the
+whirlpool hash algorithm:
+
+crypto/wp512.c:987:1: warning: the frame size of 1112 bytes is larger than 1024 bytes [-Wframe-larger-than=]
+
+With some testing in different configurations, I'm seeing large
+variations in stack frames size up to 1500 bytes for what should have
+around 300 bytes at most. I also checked the reference implementation,
+which is essentially the same code but also comes with some test and
+benchmarking infrastructure.
+
+It seems that recent compiler versions on at least arm, arm64 and powerpc
+have a partial fix for this problem, but enabling "-fsched-pressure", but
+even with that fix they suffer from the issue to a certain degree. Some
+testing on arm64 shows that the time needed to hash a given amount of
+data is roughly proportional to the stack frame size here, which makes
+sense given that the wp512 implementation is doing lots of loads for
+table lookups, and the problem with the overly large stack is a result
+of doing a lot more loads and stores for spilled registers (as seen from
+inspecting the object code).
+
+Disabling -fschedule-insns consistently fixes the problem for wp512,
+in my collection of cross-compilers, the results are consistently better
+or identical when comparing the stack sizes in this function, though
+some architectures (notable x86) have schedule-insns disabled by
+default.
+
+The four columns are:
+default: -O2
+press: -O2 -fsched-pressure
+nopress: -O2 -fschedule-insns -fno-sched-pressure
+nosched: -O2 -no-schedule-insns (disables sched-pressure)
+
+ default press nopress nosched
+alpha-linux-gcc-4.9.3 1136 848 1136 176
+am33_2.0-linux-gcc-4.9.3 2100 2076 2100 2104
+arm-linux-gnueabi-gcc-4.9.3 848 848 1048 352
+cris-linux-gcc-4.9.3 272 272 272 272
+frv-linux-gcc-4.9.3 1128 1000 1128 280
+hppa64-linux-gcc-4.9.3 1128 336 1128 184
+hppa-linux-gcc-4.9.3 644 308 644 276
+i386-linux-gcc-4.9.3 352 352 352 352
+m32r-linux-gcc-4.9.3 720 656 720 268
+microblaze-linux-gcc-4.9.3 1108 604 1108 256
+mips64-linux-gcc-4.9.3 1328 592 1328 208
+mips-linux-gcc-4.9.3 1096 624 1096 240
+powerpc64-linux-gcc-4.9.3 1088 432 1088 160
+powerpc-linux-gcc-4.9.3 1080 584 1080 224
+s390-linux-gcc-4.9.3 456 456 624 360
+sh3-linux-gcc-4.9.3 292 292 292 292
+sparc64-linux-gcc-4.9.3 992 240 992 208
+sparc-linux-gcc-4.9.3 680 592 680 312
+x86_64-linux-gcc-4.9.3 224 240 272 224
+xtensa-linux-gcc-4.9.3 1152 704 1152 304
+
+aarch64-linux-gcc-7.0.0 224 224 1104 208
+arm-linux-gnueabi-gcc-7.0.1 824 824 1048 352
+mips-linux-gcc-7.0.0 1120 648 1120 272
+x86_64-linux-gcc-7.0.1 240 240 304 240
+
+arm-linux-gnueabi-gcc-4.4.7 840 392
+arm-linux-gnueabi-gcc-4.5.4 784 728 784 320
+arm-linux-gnueabi-gcc-4.6.4 736 728 736 304
+arm-linux-gnueabi-gcc-4.7.4 944 784 944 352
+arm-linux-gnueabi-gcc-4.8.5 464 464 760 352
+arm-linux-gnueabi-gcc-4.9.3 848 848 1048 352
+arm-linux-gnueabi-gcc-5.3.1 824 824 1064 336
+arm-linux-gnueabi-gcc-6.1.1 808 808 1056 344
+arm-linux-gnueabi-gcc-7.0.1 824 824 1048 352
+
+Trying the same test for serpent-generic, the picture is a bit different,
+and while -fno-schedule-insns is generally better here than the default,
+-fsched-pressure wins overall, so I picked that instead.
+
+ default press nopress nosched
+alpha-linux-gcc-4.9.3 1392 864 1392 960
+am33_2.0-linux-gcc-4.9.3 536 524 536 528
+arm-linux-gnueabi-gcc-4.9.3 552 552 776 536
+cris-linux-gcc-4.9.3 528 528 528 528
+frv-linux-gcc-4.9.3 536 400 536 504
+hppa64-linux-gcc-4.9.3 524 208 524 480
+hppa-linux-gcc-4.9.3 768 472 768 508
+i386-linux-gcc-4.9.3 564 564 564 564
+m32r-linux-gcc-4.9.3 712 576 712 532
+microblaze-linux-gcc-4.9.3 724 392 724 512
+mips64-linux-gcc-4.9.3 720 384 720 496
+mips-linux-gcc-4.9.3 728 384 728 496
+powerpc64-linux-gcc-4.9.3 704 304 704 480
+powerpc-linux-gcc-4.9.3 704 296 704 480
+s390-linux-gcc-4.9.3 560 560 592 536
+sh3-linux-gcc-4.9.3 540 540 540 540
+sparc64-linux-gcc-4.9.3 544 352 544 496
+sparc-linux-gcc-4.9.3 544 344 544 496
+x86_64-linux-gcc-4.9.3 528 536 576 528
+xtensa-linux-gcc-4.9.3 752 544 752 544
+
+aarch64-linux-gcc-7.0.0 432 432 656 480
+arm-linux-gnueabi-gcc-7.0.1 616 616 808 536
+mips-linux-gcc-7.0.0 720 464 720 488
+x86_64-linux-gcc-7.0.1 536 528 600 536
+
+arm-linux-gnueabi-gcc-4.4.7 592 440
+arm-linux-gnueabi-gcc-4.5.4 776 448 776 544
+arm-linux-gnueabi-gcc-4.6.4 776 448 776 544
+arm-linux-gnueabi-gcc-4.7.4 768 448 768 544
+arm-linux-gnueabi-gcc-4.8.5 488 488 776 544
+arm-linux-gnueabi-gcc-4.9.3 552 552 776 536
+arm-linux-gnueabi-gcc-5.3.1 552 552 776 536
+arm-linux-gnueabi-gcc-6.1.1 560 560 776 536
+arm-linux-gnueabi-gcc-7.0.1 616 616 808 536
+
+I did not do any runtime tests with serpent, so it is possible that stack
+frame size does not directly correlate with runtime performance here and
+it actually makes things worse, but it's more likely to help here, and
+the reduced stack frame size is probably enough reason to apply the patch,
+especially given that the crypto code is often used in deep call chains.
+
+Link: https://kernelci.org/build/id/58797d7559b5149efdf6c3a9/logs/
+Link: http://www.larc.usp.br/~pbarreto/WhirlpoolPage.html
+Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11488
+Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ crypto/Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/crypto/Makefile
++++ b/crypto/Makefile
+@@ -62,6 +62,7 @@ obj-$(CONFIG_CRYPTO_SHA1) += sha1_generi
+ obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
+ obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
+ obj-$(CONFIG_CRYPTO_WP512) += wp512.o
++CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
+ obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o
+ obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o
+ obj-$(CONFIG_CRYPTO_ECB) += ecb.o
+@@ -85,6 +86,7 @@ obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) +=
+ obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
+ obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
+ obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
++CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
+ obj-$(CONFIG_CRYPTO_AES) += aes_generic.o
+ obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
+ obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
--- /dev/null
+From 3021773c7c3e75e20b693931a19362681e744ea9 Mon Sep 17 00:00:00 2001
+From: Ralf Baechle <ralf@linux-mips.org>
+Date: Tue, 20 Sep 2016 14:33:01 +0200
+Subject: MIPS: DEC: Avoid la pseudo-instruction in delay slots
+
+From: Ralf Baechle <ralf@linux-mips.org>
+
+commit 3021773c7c3e75e20b693931a19362681e744ea9 upstream.
+
+When expanding the la or dla pseudo-instruction in a delay slot the GNU
+assembler will complain should the pseudo-instruction expand to multiple
+actual instructions, since only the first of them will be in the delay
+slot leading to the pseudo-instruction being only partially executed if
+the branch is taken. Use of PTR_LA in the dec int-handler.S leads to
+such warnings:
+
+ arch/mips/dec/int-handler.S: Assembler messages:
+ arch/mips/dec/int-handler.S:149: Warning: macro instruction expanded into multiple instructions in a branch delay slot
+ arch/mips/dec/int-handler.S:198: Warning: macro instruction expanded into multiple instructions in a branch delay slot
+
+Avoid this by open coding the PTR_LA macros.
+
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/dec/int-handler.S | 40 ++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 38 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/dec/int-handler.S
++++ b/arch/mips/dec/int-handler.S
+@@ -146,7 +146,25 @@
+ /*
+ * Find irq with highest priority
+ */
+- PTR_LA t1,cpu_mask_nr_tbl
++ # open coded PTR_LA t1, cpu_mask_nr_tbl
++#if (_MIPS_SZPTR == 32)
++ # open coded la t1, cpu_mask_nr_tbl
++ lui t1, %hi(cpu_mask_nr_tbl)
++ addiu t1, %lo(cpu_mask_nr_tbl)
++
++#endif
++#if (_MIPS_SZPTR == 64)
++ # open coded dla t1, cpu_mask_nr_tbl
++ .set push
++ .set noat
++ lui t1, %highest(cpu_mask_nr_tbl)
++ lui AT, %hi(cpu_mask_nr_tbl)
++ daddiu t1, t1, %higher(cpu_mask_nr_tbl)
++ daddiu AT, AT, %lo(cpu_mask_nr_tbl)
++ dsll t1, 32
++ daddu t1, t1, AT
++ .set pop
++#endif
+ 1: lw t2,(t1)
+ nop
+ and t2,t0
+@@ -195,7 +213,25 @@
+ /*
+ * Find irq with highest priority
+ */
+- PTR_LA t1,asic_mask_nr_tbl
++ # open coded PTR_LA t1,asic_mask_nr_tbl
++#if (_MIPS_SZPTR == 32)
++ # open coded la t1, asic_mask_nr_tbl
++ lui t1, %hi(asic_mask_nr_tbl)
++ addiu t1, %lo(asic_mask_nr_tbl)
++
++#endif
++#if (_MIPS_SZPTR == 64)
++ # open coded dla t1, asic_mask_nr_tbl
++ .set push
++ .set noat
++ lui t1, %highest(asic_mask_nr_tbl)
++ lui AT, %hi(asic_mask_nr_tbl)
++ daddiu t1, t1, %higher(asic_mask_nr_tbl)
++ daddiu AT, AT, %lo(asic_mask_nr_tbl)
++ dsll t1, 32
++ daddu t1, t1, AT
++ .set pop
++#endif
+ 2: lw t2,(t1)
+ nop
+ and t2,t0
--- /dev/null
+From 23ca9b522383d3b9b7991d8586db30118992af4a Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 17 Jan 2017 16:18:46 +0100
+Subject: MIPS: ip22: Fix ip28 build for modern gcc
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 23ca9b522383d3b9b7991d8586db30118992af4a upstream.
+
+kernelci reports a failure of the ip28_defconfig build after upgrading its
+gcc version:
+
+arch/mips/sgi-ip22/Platform:29: *** gcc doesn't support needed option -mr10k-cache-barrier=store. Stop.
+
+The problem apparently is that the -mr10k-cache-barrier=store option is now
+rejected for CPUs other than r10k. Explicitly including the CPU in the
+check fixes this and is safe because both options were introduced in
+gcc-4.4.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/15049/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/sgi-ip22/Platform | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/mips/sgi-ip22/Platform
++++ b/arch/mips/sgi-ip22/Platform
+@@ -25,7 +25,7 @@ endif
+ # Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys
+ #
+ ifdef CONFIG_SGI_IP28
+- ifeq ($(call cc-option-yn,-mr10k-cache-barrier=store), n)
++ ifeq ($(call cc-option-yn,-march=r10000 -mr10k-cache-barrier=store), n)
+ $(error gcc doesn't support needed option -mr10k-cache-barrier=store)
+ endif
+ endif
--- /dev/null
+From b617649468390713db1515ea79fc772d2eb897a8 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 3 Feb 2017 17:43:50 +0100
+Subject: MIPS: ip27: Disable qlge driver in defconfig
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b617649468390713db1515ea79fc772d2eb897a8 upstream.
+
+One of the last remaining failures in kernelci.org is for a gcc bug:
+
+drivers/net/ethernet/qlogic/qlge/qlge_main.c:4819:1: error: insn does not satisfy its constraints:
+drivers/net/ethernet/qlogic/qlge/qlge_main.c:4819:1: internal compiler error: in extract_constrain_insn, at recog.c:2190
+
+This is apparently broken in gcc-6 but fixed in gcc-7, and I cannot
+reproduce the problem here. However, it is clear that ip27_defconfig
+does not actually need this driver as the platform has only PCI-X but
+not PCIe, and the qlge adapter in turn is PCIe-only.
+
+The driver was originally enabled in 2010 along with lots of other
+drivers.
+
+Fixes: 59d302b342e5 ("MIPS: IP27: Make defconfig useful again.")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/15197/
+Signed-off-by: James Hogan <james.hogan@imgtec.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/configs/ip27_defconfig | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/arch/mips/configs/ip27_defconfig
++++ b/arch/mips/configs/ip27_defconfig
+@@ -206,7 +206,6 @@ CONFIG_MLX4_EN=m
+ # CONFIG_MLX4_DEBUG is not set
+ CONFIG_TEHUTI=m
+ CONFIG_BNX2X=m
+-CONFIG_QLGE=m
+ CONFIG_SFC=m
+ CONFIG_BE2NET=m
+ CONFIG_LIBERTAS_THINFIRM=m
--- /dev/null
+From 32eb6e8bee147b45e5e59230630d59541ccbb6e5 Mon Sep 17 00:00:00 2001
+From: James Hogan <james.hogan@imgtec.com>
+Date: Thu, 28 Apr 2016 17:06:16 +0100
+Subject: MIPS: Netlogic: Fix CP0_EBASE redefinition warnings
+
+From: James Hogan <james.hogan@imgtec.com>
+
+commit 32eb6e8bee147b45e5e59230630d59541ccbb6e5 upstream.
+
+A couple of netlogic assembly files define CP0_EBASE to $15, the same as
+CP0_PRID in mipsregs.h, and use it for accessing both CP0_PRId and
+CP0_EBase registers. However commit 609cf6f2291a ("MIPS: CPS: Early
+debug using an ns16550-compatible UART") added a different definition of
+CP0_EBASE to mipsregs.h, which included a register select of 1. This
+causes harmless build warnings like the following:
+
+ arch/mips/netlogic/common/reset.S:53:0: warning: "CP0_EBASE" redefined
+ #define CP0_EBASE $15
+ ^
+ In file included from arch/mips/netlogic/common/reset.S:41:0:
+ ./arch/mips/include/asm/mipsregs.h:63:0: note: this is the location of the previous definition
+ #define CP0_EBASE $15, 1
+ ^
+
+Update the code to use the definitions from mipsregs.h for accessing
+both registers.
+
+Fixes: 609cf6f2291a ("MIPS: CPS: Early debug using an ns16550-compatible UART")
+Signed-off-by: James Hogan <james.hogan@imgtec.com>
+Acked-by: Jayachandran C <jchandra@broadcom.com>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/13183/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/netlogic/common/reset.S | 11 +++++------
+ arch/mips/netlogic/common/smpboot.S | 4 +---
+ 2 files changed, 6 insertions(+), 9 deletions(-)
+
+--- a/arch/mips/netlogic/common/reset.S
++++ b/arch/mips/netlogic/common/reset.S
+@@ -50,7 +50,6 @@
+ #include <asm/netlogic/xlp-hal/sys.h>
+ #include <asm/netlogic/xlp-hal/cpucontrol.h>
+
+-#define CP0_EBASE $15
+ #define SYS_CPU_COHERENT_BASE CKSEG1ADDR(XLP_DEFAULT_IO_BASE) + \
+ XLP_IO_SYS_OFFSET(0) + XLP_IO_PCI_HDRSZ + \
+ SYS_CPU_NONCOHERENT_MODE * 4
+@@ -92,7 +91,7 @@
+ * registers. On XLPII CPUs, usual cache instructions work.
+ */
+ .macro xlp_flush_l1_dcache
+- mfc0 t0, CP0_EBASE, 0
++ mfc0 t0, CP0_PRID
+ andi t0, t0, PRID_IMP_MASK
+ slt t1, t0, 0x1200
+ beqz t1, 15f
+@@ -171,7 +170,7 @@ FEXPORT(nlm_reset_entry)
+ nop
+
+ 1: /* Entry point on core wakeup */
+- mfc0 t0, CP0_EBASE, 0 /* processor ID */
++ mfc0 t0, CP0_PRID /* processor ID */
+ andi t0, PRID_IMP_MASK
+ li t1, 0x1500 /* XLP 9xx */
+ beq t0, t1, 2f /* does not need to set coherent */
+@@ -182,8 +181,8 @@ FEXPORT(nlm_reset_entry)
+ nop
+
+ /* set bit in SYS coherent register for the core */
+- mfc0 t0, CP0_EBASE, 1
+- mfc0 t1, CP0_EBASE, 1
++ mfc0 t0, CP0_EBASE
++ mfc0 t1, CP0_EBASE
+ srl t1, 5
+ andi t1, 0x3 /* t1 <- node */
+ li t2, 0x40000
+@@ -232,7 +231,7 @@ EXPORT(nlm_boot_siblings)
+
+ * NOTE: All GPR contents are lost after the mtcr above!
+ */
+- mfc0 v0, CP0_EBASE, 1
++ mfc0 v0, CP0_EBASE
+ andi v0, 0x3ff /* v0 <- node/core */
+
+ /*
+--- a/arch/mips/netlogic/common/smpboot.S
++++ b/arch/mips/netlogic/common/smpboot.S
+@@ -48,8 +48,6 @@
+ #include <asm/netlogic/xlp-hal/sys.h>
+ #include <asm/netlogic/xlp-hal/cpucontrol.h>
+
+-#define CP0_EBASE $15
+-
+ .set noreorder
+ .set noat
+ .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */
+@@ -86,7 +84,7 @@ NESTED(nlm_boot_secondary_cpus, 16, sp)
+ PTR_L gp, 0(t1)
+
+ /* a0 has the processor id */
+- mfc0 a0, CP0_EBASE, 1
++ mfc0 a0, CP0_EBASE
+ andi a0, 0x3ff /* a0 <- node/core */
+ PTR_LA t0, nlm_early_init_secondary
+ jalr t0
--- /dev/null
+From 9c48568b3692f1a56cbf1935e4eea835e6b185b1 Mon Sep 17 00:00:00 2001
+From: John Crispin <john@phrozen.org>
+Date: Tue, 20 Dec 2016 19:12:46 +0100
+Subject: MIPS: ralink: Cosmetic change to prom_init().
+
+From: John Crispin <john@phrozen.org>
+
+commit 9c48568b3692f1a56cbf1935e4eea835e6b185b1 upstream.
+
+Over the years the code has been changed various times leading to
+argc/argv being defined in a different function to where we actually
+use the variables. Clean this up by moving them to prom_init_cmdline().
+
+Signed-off-by: John Crispin <john@phrozen.org>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/14902/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/ralink/prom.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+--- a/arch/mips/ralink/prom.c
++++ b/arch/mips/ralink/prom.c
+@@ -30,8 +30,10 @@ const char *get_system_type(void)
+ return soc_info.sys_type;
+ }
+
+-static __init void prom_init_cmdline(int argc, char **argv)
++static __init void prom_init_cmdline(void)
+ {
++ int argc;
++ char **argv;
+ int i;
+
+ pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",
+@@ -60,14 +62,11 @@ static __init void prom_init_cmdline(int
+
+ void __init prom_init(void)
+ {
+- int argc;
+- char **argv;
+-
+ prom_soc_init(&soc_info);
+
+ pr_info("SoC Type: %s\n", get_system_type());
+
+- prom_init_cmdline(argc, argv);
++ prom_init_cmdline();
+ }
+
+ void __init prom_free_prom_memory(void)
--- /dev/null
+From 886f9c69fc68f56ddea34d3de51ac1fc2ac8dfbc Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 17 Jan 2017 16:18:43 +0100
+Subject: MIPS: ralink: Remove unused rt*_wdt_reset functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 886f9c69fc68f56ddea34d3de51ac1fc2ac8dfbc upstream.
+
+All pointers to these functions were removed, so now they produce
+warnings:
+
+arch/mips/ralink/rt305x.c:92:13: error: 'rt305x_wdt_reset' defined but not used [-Werror=unused-function]
+
+This removes the functions. If we need them again, the patch can be
+reverted later.
+
+Fixes: f576fb6a0700 ("MIPS: ralink: cleanup the soc specific pinmux data")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: John Crispin <john@phrozen.org>
+Cc: Colin Ian King <colin.king@canonical.com>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/15044/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/ralink/rt288x.c | 10 ----------
+ arch/mips/ralink/rt305x.c | 11 -----------
+ arch/mips/ralink/rt3883.c | 10 ----------
+ 3 files changed, 31 deletions(-)
+
+--- a/arch/mips/ralink/rt288x.c
++++ b/arch/mips/ralink/rt288x.c
+@@ -40,16 +40,6 @@ static struct rt2880_pmx_group rt2880_pi
+ { 0 }
+ };
+
+-static void rt288x_wdt_reset(void)
+-{
+- u32 t;
+-
+- /* enable WDT reset output on pin SRAM_CS_N */
+- t = rt_sysc_r32(SYSC_REG_CLKCFG);
+- t |= CLKCFG_SRAM_CS_N_WDT;
+- rt_sysc_w32(t, SYSC_REG_CLKCFG);
+-}
+-
+ void __init ralink_clk_init(void)
+ {
+ unsigned long cpu_rate, wmac_rate = 40000000;
+--- a/arch/mips/ralink/rt305x.c
++++ b/arch/mips/ralink/rt305x.c
+@@ -89,17 +89,6 @@ static struct rt2880_pmx_group rt5350_pi
+ { 0 }
+ };
+
+-static void rt305x_wdt_reset(void)
+-{
+- u32 t;
+-
+- /* enable WDT reset output on pin SRAM_CS_N */
+- t = rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG);
+- t |= RT305X_SYSCFG_SRAM_CS0_MODE_WDT <<
+- RT305X_SYSCFG_SRAM_CS0_MODE_SHIFT;
+- rt_sysc_w32(t, SYSC_REG_SYSTEM_CONFIG);
+-}
+-
+ static unsigned long rt5350_get_mem_size(void)
+ {
+ void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE);
+--- a/arch/mips/ralink/rt3883.c
++++ b/arch/mips/ralink/rt3883.c
+@@ -63,16 +63,6 @@ static struct rt2880_pmx_group rt3883_pi
+ { 0 }
+ };
+
+-static void rt3883_wdt_reset(void)
+-{
+- u32 t;
+-
+- /* enable WDT reset output on GPIO 2 */
+- t = rt_sysc_r32(RT3883_SYSC_REG_SYSCFG1);
+- t |= RT3883_SYSCFG1_GPIO2_AS_WDT_OUT;
+- rt_sysc_w32(t, RT3883_SYSC_REG_SYSCFG1);
+-}
+-
+ void __init ralink_clk_init(void)
+ {
+ unsigned long cpu_rate, sys_rate;
--- /dev/null
+From d92240d12a9c010e0094bbc9280aae4a6be9a2d5 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 17 Jan 2017 16:18:41 +0100
+Subject: MIPS: ralink: Remove unused timer functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d92240d12a9c010e0094bbc9280aae4a6be9a2d5 upstream.
+
+The functions were originally used for the module unload path,
+but are not referenced any more and just cause warnings:
+
+arch/mips/ralink/timer.c:104:13: error: 'rt_timer_disable' defined but not used [-Werror=unused-function]
+arch/mips/ralink/timer.c:74:13: error: 'rt_timer_free' defined but not used [-Werror=unused-function]
+
+Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
+Fixes: 62ee73d284e7 ("MIPS: ralink: Make timer explicitly non-modular")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
+Cc: John Crispin <john@phrozen.org>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/15041/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/ralink/timer.c | 14 --------------
+ 1 file changed, 14 deletions(-)
+
+--- a/arch/mips/ralink/timer.c
++++ b/arch/mips/ralink/timer.c
+@@ -69,11 +69,6 @@ static int rt_timer_request(struct rt_ti
+ return err;
+ }
+
+-static void rt_timer_free(struct rt_timer *rt)
+-{
+- free_irq(rt->irq, rt);
+-}
+-
+ static int rt_timer_config(struct rt_timer *rt, unsigned long divisor)
+ {
+ if (rt->timer_freq < divisor)
+@@ -99,15 +94,6 @@ static int rt_timer_enable(struct rt_tim
+ return 0;
+ }
+
+-static void rt_timer_disable(struct rt_timer *rt)
+-{
+- u32 t;
+-
+- t = rt_timer_r32(rt, TIMER_REG_TMR0CTL);
+- t &= ~TMR0CTL_ENABLE;
+- rt_timer_w32(rt, TIMER_REG_TMR0CTL, t);
+-}
+-
+ static int rt_timer_probe(struct platform_device *pdev)
+ {
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--- /dev/null
+From 9ddc16ad8e0bc7742fc96d5aaabc5b8698512cd1 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 11 Jan 2017 15:29:48 +0100
+Subject: MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 9ddc16ad8e0bc7742fc96d5aaabc5b8698512cd1 upstream.
+
+In linux-4.10-rc, NF_CT_PROTO_UDPLITE and NF_CT_PROTO_DCCP are bool
+symbols instead of tristate, and kernelci.org reports a bunch of
+warnings for this, like:
+
+arch/mips/configs/malta_kvm_guest_defconfig:63:warning: symbol value 'm' invalid for NF_CT_PROTO_UDPLITE
+arch/mips/configs/malta_defconfig:62:warning: symbol value 'm' invalid for NF_CT_PROTO_DCCP
+arch/mips/configs/malta_defconfig:63:warning: symbol value 'm' invalid for NF_CT_PROTO_UDPLITE
+arch/mips/configs/ip22_defconfig:70:warning: symbol value 'm' invalid for NF_CT_PROTO_DCCP
+arch/mips/configs/ip22_defconfig:71:warning: symbol value 'm' invalid for NF_CT_PROTO_UDPLITE
+
+This changes all the MIPS defconfigs with these symbols to have them
+built-in.
+
+Fixes: 9b91c96c5d1f ("netfilter: conntrack: built-in support for UDPlite")
+Fixes: c51d39010a1b ("netfilter: conntrack: built-in support for DCCP")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/14999/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/configs/ip22_defconfig | 4 ++--
+ arch/mips/configs/malta_defconfig | 4 ++--
+ arch/mips/configs/malta_kvm_defconfig | 4 ++--
+ arch/mips/configs/malta_kvm_guest_defconfig | 4 ++--
+ arch/mips/configs/maltaup_xpa_defconfig | 4 ++--
+ arch/mips/configs/nlm_xlp_defconfig | 2 +-
+ arch/mips/configs/nlm_xlr_defconfig | 2 +-
+ 7 files changed, 12 insertions(+), 12 deletions(-)
+
+--- a/arch/mips/configs/ip22_defconfig
++++ b/arch/mips/configs/ip22_defconfig
+@@ -68,8 +68,8 @@ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NF_CONNTRACK=m
+ CONFIG_NF_CONNTRACK_SECMARK=y
+ CONFIG_NF_CONNTRACK_EVENTS=y
+-CONFIG_NF_CT_PROTO_DCCP=m
+-CONFIG_NF_CT_PROTO_UDPLITE=m
++CONFIG_NF_CT_PROTO_DCCP=y
++CONFIG_NF_CT_PROTO_UDPLITE=y
+ CONFIG_NF_CONNTRACK_AMANDA=m
+ CONFIG_NF_CONNTRACK_FTP=m
+ CONFIG_NF_CONNTRACK_H323=m
+--- a/arch/mips/configs/malta_defconfig
++++ b/arch/mips/configs/malta_defconfig
+@@ -59,8 +59,8 @@ CONFIG_NETFILTER=y
+ CONFIG_NF_CONNTRACK=m
+ CONFIG_NF_CONNTRACK_SECMARK=y
+ CONFIG_NF_CONNTRACK_EVENTS=y
+-CONFIG_NF_CT_PROTO_DCCP=m
+-CONFIG_NF_CT_PROTO_UDPLITE=m
++CONFIG_NF_CT_PROTO_DCCP=y
++CONFIG_NF_CT_PROTO_UDPLITE=y
+ CONFIG_NF_CONNTRACK_AMANDA=m
+ CONFIG_NF_CONNTRACK_FTP=m
+ CONFIG_NF_CONNTRACK_H323=m
+--- a/arch/mips/configs/malta_kvm_defconfig
++++ b/arch/mips/configs/malta_kvm_defconfig
+@@ -60,8 +60,8 @@ CONFIG_NETFILTER=y
+ CONFIG_NF_CONNTRACK=m
+ CONFIG_NF_CONNTRACK_SECMARK=y
+ CONFIG_NF_CONNTRACK_EVENTS=y
+-CONFIG_NF_CT_PROTO_DCCP=m
+-CONFIG_NF_CT_PROTO_UDPLITE=m
++CONFIG_NF_CT_PROTO_DCCP=y
++CONFIG_NF_CT_PROTO_UDPLITE=y
+ CONFIG_NF_CONNTRACK_AMANDA=m
+ CONFIG_NF_CONNTRACK_FTP=m
+ CONFIG_NF_CONNTRACK_H323=m
+--- a/arch/mips/configs/malta_kvm_guest_defconfig
++++ b/arch/mips/configs/malta_kvm_guest_defconfig
+@@ -59,8 +59,8 @@ CONFIG_NETFILTER=y
+ CONFIG_NF_CONNTRACK=m
+ CONFIG_NF_CONNTRACK_SECMARK=y
+ CONFIG_NF_CONNTRACK_EVENTS=y
+-CONFIG_NF_CT_PROTO_DCCP=m
+-CONFIG_NF_CT_PROTO_UDPLITE=m
++CONFIG_NF_CT_PROTO_DCCP=y
++CONFIG_NF_CT_PROTO_UDPLITE=y
+ CONFIG_NF_CONNTRACK_AMANDA=m
+ CONFIG_NF_CONNTRACK_FTP=m
+ CONFIG_NF_CONNTRACK_H323=m
+--- a/arch/mips/configs/maltaup_xpa_defconfig
++++ b/arch/mips/configs/maltaup_xpa_defconfig
+@@ -61,8 +61,8 @@ CONFIG_NETFILTER=y
+ CONFIG_NF_CONNTRACK=m
+ CONFIG_NF_CONNTRACK_SECMARK=y
+ CONFIG_NF_CONNTRACK_EVENTS=y
+-CONFIG_NF_CT_PROTO_DCCP=m
+-CONFIG_NF_CT_PROTO_UDPLITE=m
++CONFIG_NF_CT_PROTO_DCCP=y
++CONFIG_NF_CT_PROTO_UDPLITE=y
+ CONFIG_NF_CONNTRACK_AMANDA=m
+ CONFIG_NF_CONNTRACK_FTP=m
+ CONFIG_NF_CONNTRACK_H323=m
+--- a/arch/mips/configs/nlm_xlp_defconfig
++++ b/arch/mips/configs/nlm_xlp_defconfig
+@@ -111,7 +111,7 @@ CONFIG_NETFILTER=y
+ CONFIG_NF_CONNTRACK=m
+ CONFIG_NF_CONNTRACK_SECMARK=y
+ CONFIG_NF_CONNTRACK_EVENTS=y
+-CONFIG_NF_CT_PROTO_UDPLITE=m
++CONFIG_NF_CT_PROTO_UDPLITE=y
+ CONFIG_NF_CONNTRACK_AMANDA=m
+ CONFIG_NF_CONNTRACK_FTP=m
+ CONFIG_NF_CONNTRACK_H323=m
+--- a/arch/mips/configs/nlm_xlr_defconfig
++++ b/arch/mips/configs/nlm_xlr_defconfig
+@@ -91,7 +91,7 @@ CONFIG_NETFILTER=y
+ CONFIG_NF_CONNTRACK=m
+ CONFIG_NF_CONNTRACK_SECMARK=y
+ CONFIG_NF_CONNTRACK_EVENTS=y
+-CONFIG_NF_CT_PROTO_UDPLITE=m
++CONFIG_NF_CT_PROTO_UDPLITE=y
+ CONFIG_NF_CONNTRACK_AMANDA=m
+ CONFIG_NF_CONNTRACK_FTP=m
+ CONFIG_NF_CONNTRACK_H323=m
--- /dev/null
+From ea58fca1842a5dc410cae4167b01643db971a4e2 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 11 Jan 2017 15:29:50 +0100
+Subject: MIPS: Update ip27_defconfig for SCSI_DH change
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ea58fca1842a5dc410cae4167b01643db971a4e2 upstream.
+
+Since linux-4.3, SCSI_DH is a bool symbol, causing a warning in
+kernelci.org:
+
+arch/mips/configs/ip27_defconfig:136:warning: symbol value 'm' invalid for SCSI_DH
+
+This updates the defconfig to have the feature built-in.
+
+Fixes: 086b91d052eb ("scsi_dh: integrate into the core SCSI code")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/15001/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/configs/ip27_defconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/mips/configs/ip27_defconfig
++++ b/arch/mips/configs/ip27_defconfig
+@@ -134,7 +134,7 @@ CONFIG_LIBFC=m
+ CONFIG_SCSI_QLOGIC_1280=y
+ CONFIG_SCSI_PMCRAID=m
+ CONFIG_SCSI_BFA_FC=m
+-CONFIG_SCSI_DH=m
++CONFIG_SCSI_DH=y
+ CONFIG_SCSI_DH_RDAC=m
+ CONFIG_SCSI_DH_HP_SW=m
+ CONFIG_SCSI_DH_EMC=m
--- /dev/null
+From b3f6046186ef45acfeebc5a59c9fb45cefc685e7 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 11 Jan 2017 15:29:49 +0100
+Subject: MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b3f6046186ef45acfeebc5a59c9fb45cefc685e7 upstream.
+
+Since linux-4.8, CPU_FREQ_STAT is a bool symbol, causing a warning in
+kernelci.org:
+
+arch/mips/configs/lemote2f_defconfig:42:warning: symbol value 'm' invalid for CPU_FREQ_STAT
+
+This updates the defconfig to have the feature built-in.
+
+Fixes: 1aefc75b2449 ("cpufreq: stats: Make the stats code non-modular")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/15000/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/configs/lemote2f_defconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/mips/configs/lemote2f_defconfig
++++ b/arch/mips/configs/lemote2f_defconfig
+@@ -39,7 +39,7 @@ CONFIG_HIBERNATION=y
+ CONFIG_PM_STD_PARTITION="/dev/hda3"
+ CONFIG_CPU_FREQ=y
+ CONFIG_CPU_FREQ_DEBUG=y
+-CONFIG_CPU_FREQ_STAT=m
++CONFIG_CPU_FREQ_STAT=y
+ CONFIG_CPU_FREQ_STAT_DETAILS=y
+ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+ CONFIG_CPU_FREQ_GOV_POWERSAVE=m
--- /dev/null
+From 358c07fcc3b60ab08d77f1684de8bd81bcf49a1a Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 25 Aug 2016 15:17:08 -0700
+Subject: mm: memcontrol: avoid unused function warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 358c07fcc3b60ab08d77f1684de8bd81bcf49a1a upstream.
+
+A bugfix in v4.8-rc2 introduced a harmless warning when
+CONFIG_MEMCG_SWAP is disabled but CONFIG_MEMCG is enabled:
+
+ mm/memcontrol.c:4085:27: error: 'mem_cgroup_id_get_online' defined but not used [-Werror=unused-function]
+ static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
+
+This moves the function inside of the #ifdef block that hides the
+calling function, to avoid the warning.
+
+Fixes: 1f47b61fb407 ("mm: memcontrol: fix swap counter leak on swapout from offline cgroup")
+Link: http://lkml.kernel.org/r/20160824113733.2776701-1-arnd@arndb.de
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Michal Hocko <mhocko@suse.com>
+Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/memcontrol.c | 36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+--- a/mm/memcontrol.c
++++ b/mm/memcontrol.c
+@@ -4150,24 +4150,6 @@ static void mem_cgroup_id_get_many(struc
+ atomic_add(n, &memcg->id.ref);
+ }
+
+-static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
+-{
+- while (!atomic_inc_not_zero(&memcg->id.ref)) {
+- /*
+- * The root cgroup cannot be destroyed, so it's refcount must
+- * always be >= 1.
+- */
+- if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
+- VM_BUG_ON(1);
+- break;
+- }
+- memcg = parent_mem_cgroup(memcg);
+- if (!memcg)
+- memcg = root_mem_cgroup;
+- }
+- return memcg;
+-}
+-
+ static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
+ {
+ if (atomic_sub_and_test(n, &memcg->id.ref)) {
+@@ -5751,6 +5733,24 @@ static int __init mem_cgroup_init(void)
+ subsys_initcall(mem_cgroup_init);
+
+ #ifdef CONFIG_MEMCG_SWAP
++static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
++{
++ while (!atomic_inc_not_zero(&memcg->id.ref)) {
++ /*
++ * The root cgroup cannot be destroyed, so it's refcount must
++ * always be >= 1.
++ */
++ if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
++ VM_BUG_ON(1);
++ break;
++ }
++ memcg = parent_mem_cgroup(memcg);
++ if (!memcg)
++ memcg = root_mem_cgroup;
++ }
++ return memcg;
++}
++
+ /**
+ * mem_cgroup_swapout - transfer a memsw charge to swap
+ * @page: page whose memsw charge to transfer
--- /dev/null
+From 906b268477bc03daaa04f739844c120fe4dbc991 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 3 Feb 2017 10:49:17 +0100
+Subject: mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 906b268477bc03daaa04f739844c120fe4dbc991 upstream.
+
+kernelci.org reports a warning for this driver, as it copies a local
+variable into a 'const char *' string:
+
+ drivers/mtd/maps/pmcmsp-flash.c:149:30: warning: passing argument 1 of 'strncpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
+
+Using kstrndup() simplifies the code and avoids the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Marek Vasut <marek.vasut@gmail.com>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/maps/pmcmsp-flash.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/mtd/maps/pmcmsp-flash.c
++++ b/drivers/mtd/maps/pmcmsp-flash.c
+@@ -139,15 +139,13 @@ static int __init init_msp_flash(void)
+ }
+
+ msp_maps[i].bankwidth = 1;
+- msp_maps[i].name = kmalloc(7, GFP_KERNEL);
++ msp_maps[i].name = kstrndup(flash_name, 7, GFP_KERNEL);
+ if (!msp_maps[i].name) {
+ iounmap(msp_maps[i].virt);
+ kfree(msp_parts[i]);
+ goto cleanup_loop;
+ }
+
+- msp_maps[i].name = strncpy(msp_maps[i].name, flash_name, 7);
+-
+ for (j = 0; j < pcnt; j++) {
+ part_name[5] = '0' + i;
+ part_name[7] = '0' + j;
+usb-serial-digi_acceleport-fix-oob-data-sanity-check.patch
+usb-serial-digi_acceleport-fix-oob-event-processing.patch
+crypto-improve-gcc-optimization-flags-for-serpent-and-wp512.patch
+mips-update-defconfigs-for-nf_ct_proto_dccp-udplite-change.patch
+mips-ip27-disable-qlge-driver-in-defconfig.patch
+mips-update-ip27_defconfig-for-scsi_dh-change.patch
+mips-ip22-fix-ip28-build-for-modern-gcc.patch
+mips-update-lemote2f_defconfig-for-cpu_freq_stat-change.patch
+mtd-pmcmsp-use-kstrndup-instead-of-kmalloc-strncpy.patch
+mips-ralink-cosmetic-change-to-prom_init.patch
+mips-ralink-remove-unused-timer-functions.patch
+mips-ralink-remove-unused-rt-_wdt_reset-functions.patch
+cpmac-remove-hopeless-warning.patch
+mm-memcontrol-avoid-unused-function-warning.patch
+mips-dec-avoid-la-pseudo-instruction-in-delay-slots.patch
+mips-netlogic-fix-cp0_ebase-redefinition-warnings.patch
--- /dev/null
+From 2d380889215fe20b8523345649dee0579821800c Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Tue, 31 Jan 2017 17:17:27 +0100
+Subject: USB: serial: digi_acceleport: fix OOB data sanity check
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 2d380889215fe20b8523345649dee0579821800c upstream.
+
+Make sure to check for short transfers to avoid underflow in a loop
+condition when parsing the receive buffer.
+
+Also fix an off-by-one error in the incomplete sanity check which could
+lead to invalid data being parsed.
+
+Fixes: 8c209e6782ca ("USB: make actual_length in struct urb field u32")
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/digi_acceleport.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/serial/digi_acceleport.c
++++ b/drivers/usb/serial/digi_acceleport.c
+@@ -1483,16 +1483,20 @@ static int digi_read_oob_callback(struct
+ struct usb_serial *serial = port->serial;
+ struct tty_struct *tty;
+ struct digi_port *priv = usb_get_serial_port_data(port);
++ unsigned char *buf = urb->transfer_buffer;
+ int opcode, line, status, val;
+ int i;
+ unsigned int rts;
+
++ if (urb->actual_length < 4)
++ return -1;
++
+ /* handle each oob command */
+- for (i = 0; i < urb->actual_length - 3;) {
+- opcode = ((unsigned char *)urb->transfer_buffer)[i++];
+- line = ((unsigned char *)urb->transfer_buffer)[i++];
+- status = ((unsigned char *)urb->transfer_buffer)[i++];
+- val = ((unsigned char *)urb->transfer_buffer)[i++];
++ for (i = 0; i < urb->actual_length - 4; i += 4) {
++ opcode = buf[i];
++ line = buf[i + 1];
++ status = buf[i + 2];
++ val = buf[i + 3];
+
+ dev_dbg(&port->dev, "digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d\n",
+ opcode, line, status, val);
--- /dev/null
+From 2e46565cf622dd0534a9d8bffe152a577b48d7aa Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Fri, 24 Feb 2017 19:11:28 +0100
+Subject: USB: serial: digi_acceleport: fix OOB-event processing
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 2e46565cf622dd0534a9d8bffe152a577b48d7aa upstream.
+
+A recent change claimed to fix an off-by-one error in the OOB-port
+completion handler, but instead introduced such an error. This could
+specifically led to modem-status changes going unnoticed, effectively
+breaking TIOCMGET.
+
+Note that the offending commit fixes a loop-condition underflow and is
+marked for stable, but should not be backported without this fix.
+
+Reported-by: Ben Hutchings <ben@decadent.org.uk>
+Fixes: 2d380889215f ("USB: serial: digi_acceleport: fix OOB data sanity
+check")
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/digi_acceleport.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/serial/digi_acceleport.c
++++ b/drivers/usb/serial/digi_acceleport.c
+@@ -1492,7 +1492,7 @@ static int digi_read_oob_callback(struct
+ return -1;
+
+ /* handle each oob command */
+- for (i = 0; i < urb->actual_length - 4; i += 4) {
++ for (i = 0; i < urb->actual_length - 3; i += 4) {
+ opcode = buf[i];
+ line = buf[i + 1];
+ status = buf[i + 2];