aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/patches-4.19/0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch
diff options
context:
space:
mode:
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>2019-07-02 07:25:58 +0200
committerMathias Kresin <dev@kresin.me>2019-07-04 08:29:13 +0200
commit7305e2057a5db05ccca740a0f17caadc89dfb66c (patch)
treebc898de794071cb6a81d362cde04faecc3ba0a3e /target/linux/lantiq/patches-4.19/0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch
parent961b8efb5b12fee42bec5b93ec31912af5eee995 (diff)
downloadupstream-7305e2057a5db05ccca740a0f17caadc89dfb66c.tar.gz
upstream-7305e2057a5db05ccca740a0f17caadc89dfb66c.tar.bz2
upstream-7305e2057a5db05ccca740a0f17caadc89dfb66c.zip
lantiq: 4.19: fix panic when using the DMA API
With kernel 4.19 the DMA API relies on a struct device to work properly. Backport upstream patches which passed a struct device instead of NULL to the DMA API. Fixes kernel panics during boot. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'target/linux/lantiq/patches-4.19/0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch')
-rw-r--r--target/linux/lantiq/patches-4.19/0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/target/linux/lantiq/patches-4.19/0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch b/target/linux/lantiq/patches-4.19/0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch
new file mode 100644
index 0000000000..ccde787d2d
--- /dev/null
+++ b/target/linux/lantiq/patches-4.19/0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch
@@ -0,0 +1,43 @@
+From 74e0deb89a8ba27c132b1f0e08643e215b5c1f92 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Mon, 11 Feb 2019 14:20:00 +0100
+Subject: [PATCH] lantiq_etop: pass struct device to DMA API functions
+
+The DMA API generally relies on a struct device to work properly, and
+only barely works without one for legacy reasons. Pass the easily
+available struct device from the platform_device to remedy this.
+
+Note this driver seems to lack dma_unmap_* calls entirely, but fixing
+that is left for another time.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/lantiq_etop.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/lantiq_etop.c
++++ b/drivers/net/ethernet/lantiq_etop.c
+@@ -112,10 +112,12 @@ struct ltq_etop_priv {
+ static int
+ ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
+ {
++ struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
++
+ ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN);
+ if (!ch->skb[ch->dma.desc])
+ return -ENOMEM;
+- ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL,
++ ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(&priv->pdev->dev,
+ ch->skb[ch->dma.desc]->data, MAX_DMA_DATA_LEN,
+ DMA_FROM_DEVICE);
+ ch->dma.desc_base[ch->dma.desc].addr =
+@@ -493,7 +495,7 @@ ltq_etop_tx(struct sk_buff *skb, struct
+ netif_trans_update(dev);
+
+ spin_lock_irqsave(&priv->lock, flags);
+- desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len,
++ desc->addr = ((unsigned int) dma_map_single(&priv->pdev->dev, skb->data, len,
+ DMA_TO_DEVICE)) - byte_offset;
+ wmb();
+ desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP |