net/fec_mpc52xx: fix BUG on missing dma_ops
Subsystems (2)
PATCH 1/1 net/fec_mpc52xx: fix BUG on missing dma_ops
From: Grant Likely <[email protected]>
The driver triggers a BUG_ON() when allocating DMA buffers if the arch/powerpc dma_ops from the of_platform device are not copied into net_device structure.
---
Becky, does this look better to you?
g.
drivers/net/fec_mpc52xx.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-)
drivers/net/fec_mpc52xx.c +12 -7
@@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct net_device *dev, struct bcom_taskstruct sk_buff *skb; skb =bcom_retrieve_buffer (s,NULL , (struct bcom_bd **)&bd); -dma_unmap_single (&dev->dev, bd->skb_pa, skb->len,DMA_FROM_DEVICE ); +dma_unmap_single (dev->dev.parent, bd->skb_pa, skb->len, +DMA_FROM_DEVICE );kfree_skb (skb); } }
@@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct net_device *dev, struct bcom_task bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer (rxtsk); bd->status =FEC_RX_BUFFER_SIZE ; - bd->skb_pa =dma_map_single (&dev->dev, skb->data, + bd->skb_pa =dma_map_single (dev->dev.parent, skb->data,FEC_RX_BUFFER_SIZE ,DMA_FROM_DEVICE );bcom_submit_next_buffer (rxtsk, skb);
@@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *dbcom_prepare_next_buffer (priv->tx_dmatsk); bd->status = skb->len |BCOM_FEC_TX_BD_TFD |BCOM_FEC_TX_BD_TC ; - bd->skb_pa =dma_map_single (&dev->dev, skb->data, skb->len,DMA_TO_DEVICE ); + bd->skb_pa =dma_map_single (dev->dev.parent, skb->data, skb->len, +DMA_TO_DEVICE );bcom_submit_next_buffer (priv->tx_dmatsk, skb);
@@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id)struct bcom_fec_bd *bd; skb =bcom_retrieve_buffer (priv->tx_dmatsk,NULL , (struct bcom_bd **)&bd); -dma_unmap_single (&dev->dev, bd->skb_pa, skb->len,DMA_TO_DEVICE ); +dma_unmap_single (dev->dev.parent, bd->skb_pa, skb->len, +DMA_TO_DEVICE );dev_kfree_skb_irq (skb); }
@@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) rskb =bcom_retrieve_buffer (priv->rx_dmatsk, &status, (struct bcom_bd **)&bd); -dma_unmap_single (&dev->dev, bd->skb_pa, rskb->len,DMA_FROM_DEVICE ); +dma_unmap_single (dev->dev.parent, bd->skb_pa, rskb->len, +DMA_FROM_DEVICE );/* Test for errors in received frame */ if (status &BCOM_FEC_RX_BD_ERRORS ) {
@@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)bcom_prepare_next_buffer (priv->rx_dmatsk); bd->status =FEC_RX_BUFFER_SIZE ; - bd->skb_pa =dma_map_single (&dev->dev, rskb->data, + bd->skb_pa =dma_map_single (dev->dev.parent, + rskb->data,FEC_RX_BUFFER_SIZE ,DMA_FROM_DEVICE );bcom_submit_next_buffer (priv->rx_dmatsk, rskb);
@@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)bcom_prepare_next_buffer (priv->rx_dmatsk); bd->status =FEC_RX_BUFFER_SIZE ; - bd->skb_pa =dma_map_single (&dev->dev, skb->data, + bd->skb_pa =dma_map_single (dev->dev.parent, skb->data,FEC_RX_BUFFER_SIZE ,DMA_FROM_DEVICE );bcom_submit_next_buffer (priv->rx_dmatsk, skb);
Quoted 10 lines · Grant Likely
From: Grant Likely <[email protected]>
The driver triggers a
BUG_ON()when allocating DMA buffers if thearch/powerpcdma_opsfrom theof_platformdevice are not copied intonet_devicestructure.Signed-off-by Grant Likely <[email protected]>---
Becky, does this look better to you?
I think this is OK now, and Kumar agrees....
Thanks!
B
Quoted 89 lines
g.
drivers/net/fec_mpc52xx.c| 19 ++++++++++++-------1 files changed, 12 insertions(+), 7 deletions(-)drivers/net/fec_mpc52xx.c +0
-0@@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct
net_device*dev, structbcom_taskstruct sk_buff *skb; skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)&bd);drivers/net/fec_mpc52xx.c +2
-1-dma_unmap_single (&dev->dev, bd->skb_pa, skb->len,DMA_FROM_DEVICE ); +dma_unmap_single (dev->dev.parent, bd->skb_pa, skb->len, +DMA_FROM_DEVICE );kfree_skb(skb); } }drivers/net/fec_mpc52xx.c +0
-0@@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct
net_device*dev, structbcom_taskbd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk); bd->status = FEC_RX_BUFFER_SIZE;drivers/net/fec_mpc52xx.c +1
-1- bd->skb_pa = dma_map_single(&dev->dev, skb->data, + bd->skb_pa = dma_map_single(dev->dev.parent, skb->data,FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(rxtsk, skb);drivers/net/fec_mpc52xx.c +0
-0@@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct
sk_buff*skb, structnet_device*dbcom_prepare_next_buffer(priv->tx_dmatsk); bd->status = skb->len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC;drivers/net/fec_mpc52xx.c +0
-1- bd->skb_pa = dma_map_single(&dev->dev, skb->data, skb->len,
DMA_TO_DEVICE);drivers/net/fec_mpc52xx.c +2
-0+ bd->skb_pa =dma_map_single (dev->dev.parent, skb->data, skb->len, +DMA_TO_DEVICE );bcom_submit_next_buffer(priv->tx_dmatsk, skb);drivers/net/fec_mpc52xx.c +2
-1@@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id)struct bcom_fec_bd *bd; skb =bcom_retrieve_buffer (priv->tx_dmatsk,NULL , (struct bcom_bd **)&bd); -dma_unmap_single (&dev->dev, bd->skb_pa, skb->len,DMA_TO_DEVICE ); +dma_unmap_single (dev->dev.parent, bd->skb_pa, skb->len, +DMA_TO_DEVICE );dev_kfree_skb_irq (skb);}drivers/net/fec_mpc52xx.c +2
-1@@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) rskb =bcom_retrieve_buffer (priv->rx_dmatsk, &status, (struct bcom_bd **)&bd); -dma_unmap_single (&dev->dev, bd->skb_pa, rskb->len, DMA_FROM_DEVICE); +dma_unmap_single (dev->dev.parent, bd->skb_pa, rskb->len, +DMA_FROM_DEVICE );/* Test for errors in received frame */ if (status & BCOM_FEC_RX_BD_ERRORS) {drivers/net/fec_mpc52xx.c +2
-1@@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)bcom_prepare_next_buffer (priv->rx_dmatsk); bd->status =FEC_RX_BUFFER_SIZE ; - bd->skb_pa =dma_map_single (&dev->dev, rskb->data, + bd->skb_pa =dma_map_single (dev->dev.parent, + rskb->data,FEC_RX_BUFFER_SIZE ,DMA_FROM_DEVICE );bcom_submit_next_buffer(priv->rx_dmatsk, rskb);drivers/net/fec_mpc52xx.c +1
-1@@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)bcom_prepare_next_buffer (priv->rx_dmatsk); bd->status =FEC_RX_BUFFER_SIZE ; - bd->skb_pa =dma_map_single (&dev->dev, skb->data, + bd->skb_pa =dma_map_single (dev->dev.parent, skb->data,FEC_RX_BUFFER_SIZE ,DMA_FROM_DEVICE );bcom_submit_next_buffer(priv->rx_dmatsk, skb);
Thanks Becky.
g.
2009/3/31 Becky Bruce <[email protected]>:
Quoted 37 lines · Grant Likely
Quoted 11 lines
From: Grant Likely <[email protected]>
The driver triggers a
BUG_ON()when allocating DMA buffers if thearch/powerpcdma_opsfrom theof_platformdevice are not copied intonet_devicestructure.Signed-off-by Grant Likely <[email protected]>---
Becky, does this look better to you?
Reviewed-by Becky Bruce <[email protected]>I think this is OK now, and Kumar agrees....
Thanks!
BQuoted 16 lines
g.
drivers/net/fec_mpc52xx.c| =A0 19 ++++++++++++-------1 files changed, 12 insertions(+), 7 deletions(-)drivers/net/fec_mpc52xx.c +0
-0@@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct
net_device*dev, structbcom_task
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0structsk_buff*skb;
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0skb =3D bcom_retrieve_buffer(s, NULL, (st=
ruct bcom_bd
Quoted 2 lines
Quoted 2 lines
**)&bd);
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 dma_unmap_single(&dev->dev,bd->skb_pa, sk=
b->len,
Quoted 2 lines
Quoted 2 lines
DMA_FROM_DEVICE);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 dma_unmap_single(dev->dev.parent, bd->skb_=
pa, skb->len,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DMA_FRO=
M_DEVICE);
Quoted 6 lines
Quoted 6 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0kfree_skb(skb);
=A0 =A0 =A0 =A0}
}drivers/net/fec_mpc52xx.c +0
-0@@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct
net_device*dev, structbcom_task
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bd =3D (structbcom_fec_bd*)bcom_prepare=
_next_buffer(rxtsk);
Quoted 3 lines
Quoted 3 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bd->status =3D
FEC_RX_BUFFER_SIZE;
- =A0 =A0 =A0 =A0 =A0 =A0 =A0bd->skb_pa=3D dma_map_single(&dev->dev, s=
kb->data,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0
bd->skb_pa=3D dma_map_single(dev->dev.par=
ent, skb->data,
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0FEC_RX_BU=
FFER_SIZE, DMA_FROM_DEVICE);
Quoted 3 lines
drivers/net/fec_mpc52xx.c static int mpc52xx_fec_hard_start_xmit(struct sk_buf=
Quoted 3 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bcom_submit_next_buffer(rxtsk, skb);
drivers/net/fec_mpc52xx.c +0
-0@@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buf=
f
Quoted 2 lines
Quoted 2 lines
drivers/net/fec_mpc52xx.c +0
-0*skb, struct net_device *d=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bcom_prepare_next_buffer(priv->tx_dmatsk)=
;
Quoted 2 lines
Quoted 2 lines
=A0 =A0 =A0 =A0bd->status =3D
skb->len|BCOM_FEC_TX_BD_TFD| BCOM_FEC_T=
X_BD_TC;
Quoted 1 line
Quoted 1 line
- =A0 =A0 =A0
bd->skb_pa=3D dma_map_single(&dev->dev,skb->data, skb->l=
en,
Quoted 2 lines
Quoted 2 lines
DMA_TO_DEVICE);
+ =A0 =A0 =A0bd->skb_pa=3D dma_map_single(dev->dev.parent,skb->data, =
skb->len,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 DM=
A_TO_DEVICE);
Quoted 7 lines
Quoted 7 lines
=A0 =A0 =A0 =A0bcom_submit_next_buffer(priv->tx_dmatsk, skb);
drivers/net/fec_mpc52xx.c +0
-0@@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct bcom_fec_bd *bd;=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0skb =3D bcom_retrieve_buffer(priv->tx_dma=
tsk, NULL,
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(struct b=
com_bd **)&bd);
Quoted 1 line
Quoted 1 line
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 dma_unmap_single(&dev->dev,
bd->skb_pa, sk=
b->len,
Quoted 2 lines
Quoted 2 lines
DMA_TO_DEVICE);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 dma_unmap_single(dev->dev.parent, bd->skb_=
pa, skb->len,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DMA_TO_=
DEVICE);
Quoted 7 lines
Quoted 7 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dev_kfree_skb_irq(skb); =A0 =A0 =A0 =A0}
drivers/net/fec_mpc52xx.c +0
-0@@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rskb =3D bcom_retrieve_buffer(priv->rx_dm=
atsk, &status,
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(struct b=
com_bd **)&bd);
Quoted 1 line
Quoted 1 line
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 dma_unmap_single(&dev->dev,
bd->skb_pa, rs=
kb->len,
Quoted 2 lines
Quoted 2 lines
DMA_FROM_DEVICE);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 dma_unmap_single(dev->dev.parent, bd->skb_=
pa, rskb->len,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DMA_FRO=
M_DEVICE);
Quoted 6 lines
Quoted 6 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Test for errors in received frame */ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (status &
BCOM_FEC_RX_BD_ERRORS) {drivers/net/fec_mpc52xx.c +0
-0@@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bcom_prep=
are_next_buffer(priv->rx_dmatsk);
Quoted 2 lines
Quoted 2 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bd->status =3D FEC_RX_BUF=
FER_SIZE;
Quoted 1 line
Quoted 1 line
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
bd->skb_pa=3D dma_map_sin=
gle(&dev->dev, rskb->data,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
bd->skb_pa=3D dma_map_sin=
gle(dev->dev.parent,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 rskb->data,
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0FEC_RX_BUFFER_SIZE,
Quoted 3 lines
Quoted 3 lines
DMA_FROM_DEVICE);=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bcom_submit_next_buffer(p=
riv->rx_dmatsk, rskb);
Quoted 3 lines
Quoted 3 lines
drivers/net/fec_mpc52xx.c +0
-0@@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bcom_prepare_next_buffer(=
priv->rx_dmatsk);
Quoted 3 lines
Quoted 3 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bd->status =3D
FEC_RX_BUFFER_SIZE;
- =A0 =A0 =A0 =A0 =A0 =A0 =A0bd->skb_pa=3D dma_map_single(&dev->dev, s=
kb->data,
Quoted 1 line
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0
bd->skb_pa=3D dma_map_single(dev->dev.par=
ent, skb->data,
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0FEC_RX_BU=
FFER_SIZE, DMA_FROM_DEVICE);
Quoted 2 lines
Quoted 2 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bcom_submit_next_buffer(priv->rx_dmatsk, =
skb);
Quoted 2 lines
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.