diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2018-09-09 15:26:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-12 02:33:19 -0400 |
commit | 2d946e5bcdabc1deef72d01bc92a2801c71d6d8d (patch) | |
tree | 604421402a13b43b4f246c69c9982192c766f6ea | |
parent | 4ecdf770914392eb654d24f00e301d3e6afd1cfc (diff) |
MIPS: lantiq: dma: add dev pointer
dma_zalloc_coherent() now crashes if no dev pointer is given.
Add a dev pointer to the ltq_dma_channel structure and fill it in the
driver using it.
This fixes a bug introduced in kernel 4.19.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/mips/include/asm/mach-lantiq/xway/xway_dma.h | 1 | ||||
-rw-r--r-- | arch/mips/lantiq/xway/dma.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/lantiq_etop.c | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h index 4901833498f7..8441b2698e64 100644 --- a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h +++ b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h | |||
@@ -40,6 +40,7 @@ struct ltq_dma_channel { | |||
40 | int desc; /* the current descriptor */ | 40 | int desc; /* the current descriptor */ |
41 | struct ltq_dma_desc *desc_base; /* the descriptor base */ | 41 | struct ltq_dma_desc *desc_base; /* the descriptor base */ |
42 | int phys; /* physical addr */ | 42 | int phys; /* physical addr */ |
43 | struct device *dev; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | enum { | 46 | enum { |
diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c index 4b9fbb6744ad..664f2f7f55c1 100644 --- a/arch/mips/lantiq/xway/dma.c +++ b/arch/mips/lantiq/xway/dma.c | |||
@@ -130,7 +130,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch) | |||
130 | unsigned long flags; | 130 | unsigned long flags; |
131 | 131 | ||
132 | ch->desc = 0; | 132 | ch->desc = 0; |
133 | ch->desc_base = dma_zalloc_coherent(NULL, | 133 | ch->desc_base = dma_zalloc_coherent(ch->dev, |
134 | LTQ_DESC_NUM * LTQ_DESC_SIZE, | 134 | LTQ_DESC_NUM * LTQ_DESC_SIZE, |
135 | &ch->phys, GFP_ATOMIC); | 135 | &ch->phys, GFP_ATOMIC); |
136 | 136 | ||
@@ -182,7 +182,7 @@ ltq_dma_free(struct ltq_dma_channel *ch) | |||
182 | if (!ch->desc_base) | 182 | if (!ch->desc_base) |
183 | return; | 183 | return; |
184 | ltq_dma_close(ch); | 184 | ltq_dma_close(ch); |
185 | dma_free_coherent(NULL, LTQ_DESC_NUM * LTQ_DESC_SIZE, | 185 | dma_free_coherent(ch->dev, LTQ_DESC_NUM * LTQ_DESC_SIZE, |
186 | ch->desc_base, ch->phys); | 186 | ch->desc_base, ch->phys); |
187 | } | 187 | } |
188 | EXPORT_SYMBOL_GPL(ltq_dma_free); | 188 | EXPORT_SYMBOL_GPL(ltq_dma_free); |
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 7a637b51c7d2..e08301d833e2 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
@@ -274,6 +274,7 @@ ltq_etop_hw_init(struct net_device *dev) | |||
274 | struct ltq_etop_chan *ch = &priv->ch[i]; | 274 | struct ltq_etop_chan *ch = &priv->ch[i]; |
275 | 275 | ||
276 | ch->idx = ch->dma.nr = i; | 276 | ch->idx = ch->dma.nr = i; |
277 | ch->dma.dev = &priv->pdev->dev; | ||
277 | 278 | ||
278 | if (IS_TX(i)) { | 279 | if (IS_TX(i)) { |
279 | ltq_dma_alloc_tx(&ch->dma); | 280 | ltq_dma_alloc_tx(&ch->dma); |