--- /dev/null
+From 21753583056d48a5fad964d6f272e28168426845 Mon Sep 17 00:00:00 2001
+From: Mark Rutland <mark.rutland@arm.com>
+Date: Thu, 27 Oct 2016 17:46:24 -0700
+Subject: h8300: fix syscall restarting
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+commit 21753583056d48a5fad964d6f272e28168426845 upstream.
+
+Back in commit f56141e3e2d9 ("all arches, signal: move restart_block to
+struct task_struct"), all architectures and core code were changed to
+use task_struct::restart_block. However, when h8300 support was
+subsequently restored in v4.2, it was not updated to account for this,
+and maintains thread_info::restart_block, which is not kept in sync.
+
+This patch drops the redundant restart_block from thread_info, and moves
+h8300 to the common one in task_struct, ensuring that syscall restarting
+always works as expected.
+
+Fixes: f56141e3e2d9 ("all arches, signal: move restart_block to struct task_struct")
+Link: http://lkml.kernel.org/r/1476714934-11635-1-git-send-email-mark.rutland@arm.com
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
+Cc: uclinux-h8-devel@lists.sourceforge.jp
+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>
+
+---
+ arch/h8300/include/asm/thread_info.h | 4 ----
+ arch/h8300/kernel/signal.c | 2 +-
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
+--- a/arch/h8300/include/asm/thread_info.h
++++ b/arch/h8300/include/asm/thread_info.h
+@@ -31,7 +31,6 @@ struct thread_info {
+ int cpu; /* cpu we're on */
+ int preempt_count; /* 0 => preemptable, <0 => BUG */
+ mm_segment_t addr_limit;
+- struct restart_block restart_block;
+ };
+
+ /*
+@@ -44,9 +43,6 @@ struct thread_info {
+ .cpu = 0, \
+ .preempt_count = INIT_PREEMPT_COUNT, \
+ .addr_limit = KERNEL_DS, \
+- .restart_block = { \
+- .fn = do_no_restart_syscall, \
+- }, \
+ }
+
+ #define init_thread_info (init_thread_union.thread_info)
+--- a/arch/h8300/kernel/signal.c
++++ b/arch/h8300/kernel/signal.c
+@@ -79,7 +79,7 @@ restore_sigcontext(struct sigcontext *us
+ unsigned int er0;
+
+ /* Always make any pending restarted system calls return -EINTR */
+- current_thread_info()->restart_block.fn = do_no_restart_syscall;
++ current->restart_block.fn = do_no_restart_syscall;
+
+ /* restore passed registers */
+ #define COPY(r) do { err |= get_user(regs->r, &usc->sc_##r); } while (0)
i2c-xgene-avoid-dma_buffer-overrun.patch
i2c-core-fix-null-pointer-dereference-under-race-condition.patch
drm-dp-mst-clear-port-pdt-when-tearing-down-the-i2c-adapter.patch
+spi-fsl-espi-avoid-processing-uninitalized-data-on-error.patch
+spi-mark-device-nodes-only-in-case-of-successful-instantiation.patch
+h8300-fix-syscall-restarting.patch
--- /dev/null
+From 5c0ba57744b1422d528f19430dd66d6803cea86f Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 25 Oct 2016 22:57:10 +0200
+Subject: spi: fsl-espi: avoid processing uninitalized data on error
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 5c0ba57744b1422d528f19430dd66d6803cea86f upstream.
+
+When we get a spurious interrupt in fsl_espi_irq, we end up
+processing four uninitalized bytes of data, as shown in this
+warning message:
+
+ drivers/spi/spi-fsl-espi.c: In function 'fsl_espi_irq':
+ drivers/spi/spi-fsl-espi.c:462:4: warning: 'rx_data' may be used uninitialized in this function [-Wmaybe-uninitialized]
+
+This adds another check so we skip the data in this case.
+
+Fixes: 6319a68011b8 ("spi/fsl-espi: avoid infinite loops on fsl_espi_cpu_irq()")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi-fsl-espi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/spi/spi-fsl-espi.c
++++ b/drivers/spi/spi-fsl-espi.c
+@@ -581,7 +581,7 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi
+
+ mspi->len -= rx_nr_bytes;
+
+- if (mspi->rx)
++ if (rx_nr_bytes && mspi->rx)
+ mspi->get_rx(rx_data, mspi);
+ }
+
--- /dev/null
+From e0af98a7e025a7263ae7e50264f6f79ed29642a7 Mon Sep 17 00:00:00 2001
+From: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
+Date: Mon, 17 Oct 2016 15:59:56 +0200
+Subject: spi: mark device nodes only in case of successful instantiation
+
+From: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
+
+commit e0af98a7e025a7263ae7e50264f6f79ed29642a7 upstream.
+
+Instantiated SPI device nodes are marked with OF_POPULATE. This was
+introduced in bd6c164. On unloading, loaded device nodes will of course
+be unmarked. The problem are nodes that fail during initialisation: If a
+node fails, it won't be unloaded and hence not be unmarked.
+
+If a SPI driver module is unloaded and reloaded, it will skip nodes that
+failed before.
+
+Skip device nodes that are already populated and mark them only in case
+of success.
+
+Note that the same issue exists for I2C.
+
+Fixes: bd6c164 ("spi: Mark instantiated device nodes with OF_POPULATE")
+Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
+Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/spi/spi.c
++++ b/drivers/spi/spi.c
+@@ -1607,9 +1607,11 @@ static void of_register_spi_devices(stru
+ if (of_node_test_and_set_flag(nc, OF_POPULATED))
+ continue;
+ spi = of_register_spi_device(master, nc);
+- if (IS_ERR(spi))
++ if (IS_ERR(spi)) {
+ dev_warn(&master->dev, "Failed to create SPI device for %s\n",
+ nc->full_name);
++ of_node_clear_flag(nc, OF_POPULATED);
++ }
+ }
+ }
+ #else
+@@ -3120,6 +3122,7 @@ static int of_spi_notify(struct notifier
+ if (IS_ERR(spi)) {
+ pr_err("%s: failed to create for '%s'\n",
+ __func__, rd->dn->full_name);
++ of_node_clear_flag(rd->dn, OF_POPULATED);
+ return notifier_from_errno(PTR_ERR(spi));
+ }
+ break;