lantiq: linux 5.4: remove support for the linux,mtd-name OF property
[openwrt/staging/wigyori.git] / target / linux / lantiq / patches-5.4 / 0005-lantiq_etop-pass-struct-device-to-DMA-API-functions.patch
1 From 74e0deb89a8ba27c132b1f0e08643e215b5c1f92 Mon Sep 17 00:00:00 2001
2 From: Christoph Hellwig <hch@lst.de>
3 Date: Mon, 11 Feb 2019 14:20:00 +0100
4 Subject: [PATCH] lantiq_etop: pass struct device to DMA API functions
5
6 The DMA API generally relies on a struct device to work properly, and
7 only barely works without one for legacy reasons. Pass the easily
8 available struct device from the platform_device to remedy this.
9
10 Note this driver seems to lack dma_unmap_* calls entirely, but fixing
11 that is left for another time.
12
13 Signed-off-by: Christoph Hellwig <hch@lst.de>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 ---
16 drivers/net/ethernet/lantiq_etop.c | 6 ++++--
17 1 file changed, 4 insertions(+), 2 deletions(-)
18
19 --- a/drivers/net/ethernet/lantiq_etop.c
20 +++ b/drivers/net/ethernet/lantiq_etop.c
21 @@ -112,10 +112,12 @@ struct ltq_etop_priv {
22 static int
23 ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
24 {
25 + struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
26 +
27 ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN);
28 if (!ch->skb[ch->dma.desc])
29 return -ENOMEM;
30 - ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL,
31 + ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(&priv->pdev->dev,
32 ch->skb[ch->dma.desc]->data, MAX_DMA_DATA_LEN,
33 DMA_FROM_DEVICE);
34 ch->dma.desc_base[ch->dma.desc].addr =
35 @@ -493,7 +495,7 @@ ltq_etop_tx(struct sk_buff *skb, struct
36 netif_trans_update(dev);
37
38 spin_lock_irqsave(&priv->lock, flags);
39 - desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len,
40 + desc->addr = ((unsigned int) dma_map_single(&priv->pdev->dev, skb->data, len,
41 DMA_TO_DEVICE)) - byte_offset;
42 wmb();
43 desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP |