mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 08:44:21 +08:00
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>
This commit is contained in:
parent
4ecdf77091
commit
2d946e5bcd
@ -40,6 +40,7 @@ struct ltq_dma_channel {
|
|||||||
int desc; /* the current descriptor */
|
int desc; /* the current descriptor */
|
||||||
struct ltq_dma_desc *desc_base; /* the descriptor base */
|
struct ltq_dma_desc *desc_base; /* the descriptor base */
|
||||||
int phys; /* physical addr */
|
int phys; /* physical addr */
|
||||||
|
struct device *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -130,7 +130,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch)
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
ch->desc = 0;
|
ch->desc = 0;
|
||||||
ch->desc_base = dma_zalloc_coherent(NULL,
|
ch->desc_base = dma_zalloc_coherent(ch->dev,
|
||||||
LTQ_DESC_NUM * LTQ_DESC_SIZE,
|
LTQ_DESC_NUM * LTQ_DESC_SIZE,
|
||||||
&ch->phys, GFP_ATOMIC);
|
&ch->phys, GFP_ATOMIC);
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ ltq_dma_free(struct ltq_dma_channel *ch)
|
|||||||
if (!ch->desc_base)
|
if (!ch->desc_base)
|
||||||
return;
|
return;
|
||||||
ltq_dma_close(ch);
|
ltq_dma_close(ch);
|
||||||
dma_free_coherent(NULL, LTQ_DESC_NUM * LTQ_DESC_SIZE,
|
dma_free_coherent(ch->dev, LTQ_DESC_NUM * LTQ_DESC_SIZE,
|
||||||
ch->desc_base, ch->phys);
|
ch->desc_base, ch->phys);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ltq_dma_free);
|
EXPORT_SYMBOL_GPL(ltq_dma_free);
|
||||||
|
@ -274,6 +274,7 @@ ltq_etop_hw_init(struct net_device *dev)
|
|||||||
struct ltq_etop_chan *ch = &priv->ch[i];
|
struct ltq_etop_chan *ch = &priv->ch[i];
|
||||||
|
|
||||||
ch->idx = ch->dma.nr = i;
|
ch->idx = ch->dma.nr = i;
|
||||||
|
ch->dma.dev = &priv->pdev->dev;
|
||||||
|
|
||||||
if (IS_TX(i)) {
|
if (IS_TX(i)) {
|
||||||
ltq_dma_alloc_tx(&ch->dma);
|
ltq_dma_alloc_tx(&ch->dma);
|
||||||
|
Loading…
Reference in New Issue
Block a user