--- /dev/null
+From 10fbd36e362a0f367e34a7cd876a81295d8fc5ca Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Wed, 27 May 2015 15:32:15 -0700
+Subject: blk: rq_data_dir() should not return a boolean
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 10fbd36e362a0f367e34a7cd876a81295d8fc5ca upstream.
+
+rq_data_dir() returns either READ or WRITE (0 == READ, 1 == WRITE), not
+a boolean value.
+
+Now, admittedly the "!= 0" doesn't really change the value (0 stays as
+zero, 1 stays as one), but it's not only redundant, it confuses gcc, and
+causes gcc to warn about the construct
+
+ switch (rq_data_dir(req)) {
+ case READ:
+ ...
+ case WRITE:
+ ...
+
+that we have in a few drivers.
+
+Now, the gcc warning is silly and stupid (it seems to warn not about the
+switch value having a different type from the case statements, but about
+_any_ boolean switch value), but in this case the code itself is silly
+and stupid too, so let's just change it, and get rid of warnings like
+this:
+
+ drivers/block/hd.c: In function ‘hd_request’:
+ drivers/block/hd.c:630:11: warning: switch condition has boolean value [-Wswitch-bool]
+ switch (rq_data_dir(req)) {
+
+The odd '!= 0' came in when "cmd_flags" got turned into a "u64" in
+commit 5953316dbf90 ("block: make rq->cmd_flags be 64-bit") and is
+presumably because the old code (that just did a logical 'and' with 1)
+would then end up making the type of rq_data_dir() be u64 too.
+
+But if we want to retain the old regular integer type, let's just cast
+the result to 'int' rather than use that rather odd '!= 0'.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/blkdev.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/blkdev.h
++++ b/include/linux/blkdev.h
+@@ -616,7 +616,7 @@ static inline void queue_flag_clear(unsi
+
+ #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
+
+-#define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0)
++#define rq_data_dir(rq) ((int)((rq)->cmd_flags & 1))
+
+ /*
+ * Driver can handle struct request, if it either has an old style
--- /dev/null
+From 5f74f82ea34c0da80ea0b49192bb5ea06e063593 Mon Sep 17 00:00:00 2001
+From: Hans Westgaard Ry <hans.westgaard.ry@oracle.com>
+Date: Wed, 3 Feb 2016 09:26:57 +0100
+Subject: net:Add sysctl_max_skb_frags
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Hans Westgaard Ry <hans.westgaard.ry@oracle.com>
+
+commit 5f74f82ea34c0da80ea0b49192bb5ea06e063593 upstream.
+
+Devices may have limits on the number of fragments in an skb they support.
+Current codebase uses a constant as maximum for number of fragments one
+skb can hold and use.
+When enabling scatter/gather and running traffic with many small messages
+the codebase uses the maximum number of fragments and may thereby violate
+the max for certain devices.
+The patch introduces a global variable as max number of fragments.
+
+Signed-off-by: Hans Westgaard Ry <hans.westgaard.ry@oracle.com>
+Reviewed-by: Håkon Bugge <haakon.bugge@oracle.com>
+Acked-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/skbuff.h | 1 +
+ net/core/skbuff.c | 2 ++
+ net/core/sysctl_net_core.c | 10 ++++++++++
+ net/ipv4/tcp.c | 4 ++--
+ 4 files changed, 15 insertions(+), 2 deletions(-)
+
+--- a/include/linux/skbuff.h
++++ b/include/linux/skbuff.h
+@@ -188,6 +188,7 @@ struct sk_buff;
+ #else
+ #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
+ #endif
++extern int sysctl_max_skb_frags;
+
+ typedef struct skb_frag_struct skb_frag_t;
+
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -77,6 +77,8 @@
+
+ struct kmem_cache *skbuff_head_cache __read_mostly;
+ static struct kmem_cache *skbuff_fclone_cache __read_mostly;
++int sysctl_max_skb_frags __read_mostly = MAX_SKB_FRAGS;
++EXPORT_SYMBOL(sysctl_max_skb_frags);
+
+ /**
+ * skb_panic - private function for out-of-line support
+--- a/net/core/sysctl_net_core.c
++++ b/net/core/sysctl_net_core.c
+@@ -27,6 +27,7 @@ static int one = 1;
+ static int ushort_max = USHRT_MAX;
+ static int min_sndbuf = SOCK_MIN_SNDBUF;
+ static int min_rcvbuf = SOCK_MIN_RCVBUF;
++static int max_skb_frags = MAX_SKB_FRAGS;
+
+ #ifdef CONFIG_RPS
+ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
+@@ -363,6 +364,15 @@ static struct ctl_table net_core_table[]
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+ },
++ {
++ .procname = "max_skb_frags",
++ .data = &sysctl_max_skb_frags,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = proc_dointvec_minmax,
++ .extra1 = &one,
++ .extra2 = &max_skb_frags,
++ },
+ { }
+ };
+
+--- a/net/ipv4/tcp.c
++++ b/net/ipv4/tcp.c
+@@ -939,7 +939,7 @@ new_segment:
+
+ i = skb_shinfo(skb)->nr_frags;
+ can_coalesce = skb_can_coalesce(skb, i, page, offset);
+- if (!can_coalesce && i >= MAX_SKB_FRAGS) {
++ if (!can_coalesce && i >= sysctl_max_skb_frags) {
+ tcp_mark_push(tp, skb);
+ goto new_segment;
+ }
+@@ -1225,7 +1225,7 @@ new_segment:
+
+ if (!skb_can_coalesce(skb, i, pfrag->page,
+ pfrag->offset)) {
+- if (i == MAX_SKB_FRAGS || !sg) {
++ if (i == sysctl_max_skb_frags || !sg) {
+ tcp_mark_push(tp, skb);
+ goto new_segment;
+ }
staging-rtl8723au-core-rtw_wlan_util-fix-misleading-indentation.patch
usb-renesas_usbhs-fix-build-warning-if-64-bit-architecture.patch
x86-boot-add-config_paravirt_spinlocks-quirk-to-arch-x86-boot-compressed-misc.h.patch
+spi-dw-mid-refactor-to-use-helpers.patch
+blk-rq_data_dir-should-not-return-a-boolean.patch
+net-add-sysctl_max_skb_frags.patch
--- /dev/null
+From a5c2db964d3eb26b41bd7abc1b13486f732b3aa2 Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Tue, 28 Oct 2014 18:25:01 +0200
+Subject: spi: dw-mid: refactor to use helpers
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+commit a5c2db964d3eb26b41bd7abc1b13486f732b3aa2 upstream.
+
+This patch splits few helpers, namely dw_spi_dma_prepare_rx(),
+dw_spi_dma_prepare_tx(), and dw_spi_dma_setup() which will be useful for the
+consequent improvements.
+
+There is no functional change.
+
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+[removes a build warning with newer versions of gcc - gregkh]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi-dw-mid.c | 69 ++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 48 insertions(+), 21 deletions(-)
+
+--- a/drivers/spi/spi-dw-mid.c
++++ b/drivers/spi/spi-dw-mid.c
+@@ -111,28 +111,11 @@ static void dw_spi_dma_done(void *arg)
+ dw_spi_xfer_done(dws);
+ }
+
+-static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
++static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws)
+ {
+- struct dma_async_tx_descriptor *txdesc, *rxdesc;
+- struct dma_slave_config txconf, rxconf;
+- u16 dma_ctrl = 0;
+-
+- /* 1. setup DMA related registers */
+- if (cs_change) {
+- spi_enable_chip(dws, 0);
+- dw_writew(dws, DW_SPI_DMARDLR, 0xf);
+- dw_writew(dws, DW_SPI_DMATDLR, 0x10);
+- if (dws->tx_dma)
+- dma_ctrl |= SPI_DMA_TDMAE;
+- if (dws->rx_dma)
+- dma_ctrl |= SPI_DMA_RDMAE;
+- dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
+- spi_enable_chip(dws, 1);
+- }
++ struct dma_slave_config txconf;
++ struct dma_async_tx_descriptor *txdesc;
+
+- dws->dma_chan_done = 0;
+-
+- /* 2. Prepare the TX dma transfer */
+ txconf.direction = DMA_MEM_TO_DEV;
+ txconf.dst_addr = dws->dma_addr;
+ txconf.dst_maxburst = LNW_DMA_MSIZE_16;
+@@ -157,7 +140,14 @@ static int mid_spi_dma_transfer(struct d
+ txdesc->callback = dw_spi_dma_done;
+ txdesc->callback_param = dws;
+
+- /* 3. Prepare the RX dma transfer */
++ return txdesc;
++}
++
++static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws)
++{
++ struct dma_slave_config rxconf;
++ struct dma_async_tx_descriptor *rxdesc;
++
+ rxconf.direction = DMA_DEV_TO_MEM;
+ rxconf.src_addr = dws->dma_addr;
+ rxconf.src_maxburst = LNW_DMA_MSIZE_16;
+@@ -182,6 +172,43 @@ static int mid_spi_dma_transfer(struct d
+ rxdesc->callback = dw_spi_dma_done;
+ rxdesc->callback_param = dws;
+
++ return rxdesc;
++}
++
++static void dw_spi_dma_setup(struct dw_spi *dws)
++{
++ u16 dma_ctrl = 0;
++
++ spi_enable_chip(dws, 0);
++
++ dw_writew(dws, DW_SPI_DMARDLR, 0xf);
++ dw_writew(dws, DW_SPI_DMATDLR, 0x10);
++
++ if (dws->tx_dma)
++ dma_ctrl |= SPI_DMA_TDMAE;
++ if (dws->rx_dma)
++ dma_ctrl |= SPI_DMA_RDMAE;
++ dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
++
++ spi_enable_chip(dws, 1);
++}
++
++static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
++{
++ struct dma_async_tx_descriptor *txdesc, *rxdesc;
++
++ /* 1. setup DMA related registers */
++ if (cs_change)
++ dw_spi_dma_setup(dws);
++
++ dws->dma_chan_done = 0;
++
++ /* 2. Prepare the TX dma transfer */
++ txdesc = dw_spi_dma_prepare_tx(dws);
++
++ /* 3. Prepare the RX dma transfer */
++ rxdesc = dw_spi_dma_prepare_rx(dws);
++
+ /* rx must be started before tx due to spi instinct */
+ dmaengine_submit(rxdesc);
+ dma_async_issue_pending(dws->rxchan);