diff options
Diffstat (limited to 'drivers/net/ethernet/micrel/ksz884x.c')
-rw-r--r-- | drivers/net/ethernet/micrel/ksz884x.c | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index 2ce7304d3753..bb646b65cc95 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -4390,9 +4390,9 @@ static int ksz_alloc_desc(struct dev_info *adapter) DESC_ALIGNMENT; adapter->desc_pool.alloc_virt = - pci_zalloc_consistent(adapter->pdev, - adapter->desc_pool.alloc_size, - &adapter->desc_pool.dma_addr); + dma_alloc_coherent(&adapter->pdev->dev, + adapter->desc_pool.alloc_size, + &adapter->desc_pool.dma_addr, GFP_KERNEL); if (adapter->desc_pool.alloc_virt == NULL) { adapter->desc_pool.alloc_size = 0; return 1; @@ -4431,7 +4431,8 @@ static int ksz_alloc_desc(struct dev_info *adapter) static void free_dma_buf(struct dev_info *adapter, struct ksz_dma_buf *dma_buf, int direction) { - pci_unmap_single(adapter->pdev, dma_buf->dma, dma_buf->len, direction); + dma_unmap_single(&adapter->pdev->dev, dma_buf->dma, dma_buf->len, + direction); dev_kfree_skb(dma_buf->skb); dma_buf->skb = NULL; dma_buf->dma = 0; @@ -4456,16 +4457,15 @@ static void ksz_init_rx_buffers(struct dev_info *adapter) dma_buf = DMA_BUFFER(desc); if (dma_buf->skb && dma_buf->len != adapter->mtu) - free_dma_buf(adapter, dma_buf, PCI_DMA_FROMDEVICE); + free_dma_buf(adapter, dma_buf, DMA_FROM_DEVICE); dma_buf->len = adapter->mtu; if (!dma_buf->skb) dma_buf->skb = alloc_skb(dma_buf->len, GFP_ATOMIC); if (dma_buf->skb && !dma_buf->dma) - dma_buf->dma = pci_map_single( - adapter->pdev, - skb_tail_pointer(dma_buf->skb), - dma_buf->len, - PCI_DMA_FROMDEVICE); + dma_buf->dma = dma_map_single(&adapter->pdev->dev, + skb_tail_pointer(dma_buf->skb), + dma_buf->len, + DMA_FROM_DEVICE); /* Set descriptor. */ set_rx_buf(desc, dma_buf->dma); @@ -4543,11 +4543,10 @@ static void ksz_free_desc(struct dev_info *adapter) /* Free memory. */ if (adapter->desc_pool.alloc_virt) - pci_free_consistent( - adapter->pdev, - adapter->desc_pool.alloc_size, - adapter->desc_pool.alloc_virt, - adapter->desc_pool.dma_addr); + dma_free_coherent(&adapter->pdev->dev, + adapter->desc_pool.alloc_size, + adapter->desc_pool.alloc_virt, + adapter->desc_pool.dma_addr); /* Reset resource pool. */ adapter->desc_pool.alloc_size = 0; @@ -4590,12 +4589,10 @@ static void ksz_free_buffers(struct dev_info *adapter, static void ksz_free_mem(struct dev_info *adapter) { /* Free transmit buffers. */ - ksz_free_buffers(adapter, &adapter->hw.tx_desc_info, - PCI_DMA_TODEVICE); + ksz_free_buffers(adapter, &adapter->hw.tx_desc_info, DMA_TO_DEVICE); /* Free receive buffers. */ - ksz_free_buffers(adapter, &adapter->hw.rx_desc_info, - PCI_DMA_FROMDEVICE); + ksz_free_buffers(adapter, &adapter->hw.rx_desc_info, DMA_FROM_DEVICE); /* Free descriptors. */ ksz_free_desc(adapter); @@ -4657,9 +4654,8 @@ static void send_packet(struct sk_buff *skb, struct net_device *dev) dma_buf->len = skb_headlen(skb); - dma_buf->dma = pci_map_single( - hw_priv->pdev, skb->data, dma_buf->len, - PCI_DMA_TODEVICE); + dma_buf->dma = dma_map_single(&hw_priv->pdev->dev, skb->data, + dma_buf->len, DMA_TO_DEVICE); set_tx_buf(desc, dma_buf->dma); set_tx_len(desc, dma_buf->len); @@ -4676,11 +4672,10 @@ static void send_packet(struct sk_buff *skb, struct net_device *dev) dma_buf = DMA_BUFFER(desc); dma_buf->len = skb_frag_size(this_frag); - dma_buf->dma = pci_map_single( - hw_priv->pdev, - skb_frag_address(this_frag), - dma_buf->len, - PCI_DMA_TODEVICE); + dma_buf->dma = dma_map_single(&hw_priv->pdev->dev, + skb_frag_address(this_frag), + dma_buf->len, + DMA_TO_DEVICE); set_tx_buf(desc, dma_buf->dma); set_tx_len(desc, dma_buf->len); @@ -4700,9 +4695,8 @@ static void send_packet(struct sk_buff *skb, struct net_device *dev) } else { dma_buf->len = len; - dma_buf->dma = pci_map_single( - hw_priv->pdev, skb->data, dma_buf->len, - PCI_DMA_TODEVICE); + dma_buf->dma = dma_map_single(&hw_priv->pdev->dev, skb->data, + dma_buf->len, DMA_TO_DEVICE); set_tx_buf(desc, dma_buf->dma); set_tx_len(desc, dma_buf->len); } @@ -4756,9 +4750,8 @@ static void transmit_cleanup(struct dev_info *hw_priv, int normal) } dma_buf = DMA_BUFFER(desc); - pci_unmap_single( - hw_priv->pdev, dma_buf->dma, dma_buf->len, - PCI_DMA_TODEVICE); + dma_unmap_single(&hw_priv->pdev->dev, dma_buf->dma, + dma_buf->len, DMA_TO_DEVICE); /* This descriptor contains the last buffer in the packet. */ if (dma_buf->skb) { @@ -4991,9 +4984,8 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw, packet_len = status.rx.frame_len - 4; dma_buf = DMA_BUFFER(desc); - pci_dma_sync_single_for_cpu( - hw_priv->pdev, dma_buf->dma, packet_len + 4, - PCI_DMA_FROMDEVICE); + dma_sync_single_for_cpu(&hw_priv->pdev->dev, dma_buf->dma, + packet_len + 4, DMA_FROM_DEVICE); do { /* skb->data != skb->head */ @@ -6935,8 +6927,8 @@ static int pcidev_init(struct pci_dev *pdev, const struct pci_device_id *id) result = -ENODEV; - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) || + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) return result; reg_base = pci_resource_start(pdev, 0); |