* [PATCH net] net: bcmgenet: Utilize correct struct device for all DMA operations
@ 2016-12-01 5:15 Florian Fainelli
2016-12-01 17:26 ` Florian Fainelli
0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2016-12-01 5:15 UTC (permalink / raw)
To: netdev; +Cc: davem, pgynther, jaedon.shin, opendmb, Florian Fainelli
__bcmgenet_tx_reclaim() is not using the struct device reference when
doing its unmap operation, which made the DMA-API debugging warn about
it. Fix this by always using &priv->pdev->dev throughout the driver,
using an identical device reference for all map/unmap calls.
Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4464bc5db934..d7b553020d66 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1172,6 +1172,7 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
struct bcmgenet_tx_ring *ring)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
+ struct device *kdev = &priv->pdev->dev;
struct enet_cb *tx_cb_ptr;
struct netdev_queue *txq;
unsigned int pkts_compl = 0;
@@ -1199,13 +1200,13 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
if (tx_cb_ptr->skb) {
pkts_compl++;
bytes_compl += GENET_CB(tx_cb_ptr->skb)->bytes_sent;
- dma_unmap_single(&dev->dev,
+ dma_unmap_single(kdev,
dma_unmap_addr(tx_cb_ptr, dma_addr),
dma_unmap_len(tx_cb_ptr, dma_len),
DMA_TO_DEVICE);
bcmgenet_free_cb(tx_cb_ptr);
} else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) {
- dma_unmap_page(&dev->dev,
+ dma_unmap_page(kdev,
dma_unmap_addr(tx_cb_ptr, dma_addr),
dma_unmap_len(tx_cb_ptr, dma_len),
DMA_TO_DEVICE);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: bcmgenet: Utilize correct struct device for all DMA operations
2016-12-01 5:15 [PATCH net] net: bcmgenet: Utilize correct struct device for all DMA operations Florian Fainelli
@ 2016-12-01 17:26 ` Florian Fainelli
0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2016-12-01 17:26 UTC (permalink / raw)
To: netdev; +Cc: davem, pgynther, jaedon.shin, opendmb
On 11/30/2016 09:15 PM, Florian Fainelli wrote:
> __bcmgenet_tx_reclaim() is not using the struct device reference when
> doing its unmap operation, which made the DMA-API debugging warn about
> it. Fix this by always using &priv->pdev->dev throughout the driver,
> using an identical device reference for all map/unmap calls.
>
> Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
There is another wrong struct device used by bcmgenet_free_rx_buffers
that I missed here (thanks Doug), let's fix it.
--
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-01 17:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01 5:15 [PATCH net] net: bcmgenet: Utilize correct struct device for all DMA operations Florian Fainelli
2016-12-01 17:26 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).