dma_addr_t dma_addr;
int loops;
- dma_addr = pci_map_single(priv->pdev, data, length, PCI_DMA_TODEVICE);
- if (pci_dma_mapping_error(priv->pdev, dma_addr))
+ dma_addr = dma_map_single(&priv->pdev->dev, data, length,
+ DMA_TO_DEVICE);
+ if (dma_mapping_error(&priv->pdev->dev, dma_addr))
return -ENOMEM;
iowrite32(dma_addr, regs + MWL8K_HIU_GEN_PTR);
udelay(1);
} while (--loops);
- pci_unmap_single(priv->pdev, dma_addr, length, PCI_DMA_TODEVICE);
+ dma_unmap_single(&priv->pdev->dev, dma_addr, length, DMA_TO_DEVICE);
return loops ? 0 : -ETIMEDOUT;
}
size = MWL8K_RX_DESCS * priv->rxd_ops->rxd_size;
- rxq->rxd = pci_zalloc_consistent(priv->pdev, size, &rxq->rxd_dma);
+ rxq->rxd = dma_alloc_coherent(&priv->pdev->dev, size, &rxq->rxd_dma,
+ GFP_KERNEL);
if (rxq->rxd == NULL) {
wiphy_err(hw->wiphy, "failed to alloc RX descriptors\n");
return -ENOMEM;
rxq->buf = kcalloc(MWL8K_RX_DESCS, sizeof(*rxq->buf), GFP_KERNEL);
if (rxq->buf == NULL) {
- pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma);
+ dma_free_coherent(&priv->pdev->dev, size, rxq->rxd,
+ rxq->rxd_dma);
return -ENOMEM;
}
if (skb == NULL)
break;
- addr = pci_map_single(priv->pdev, skb->data,
+ addr = dma_map_single(&priv->pdev->dev, skb->data,
MWL8K_RX_MAXSZ, DMA_FROM_DEVICE);
rxq->rxd_count++;
for (i = 0; i < MWL8K_RX_DESCS; i++) {
if (rxq->buf[i].skb != NULL) {
- pci_unmap_single(priv->pdev,
+ dma_unmap_single(&priv->pdev->dev,
dma_unmap_addr(&rxq->buf[i], dma),
- MWL8K_RX_MAXSZ, PCI_DMA_FROMDEVICE);
+ MWL8K_RX_MAXSZ, DMA_FROM_DEVICE);
dma_unmap_addr_set(&rxq->buf[i], dma, 0);
kfree_skb(rxq->buf[i].skb);
kfree(rxq->buf);
rxq->buf = NULL;
- pci_free_consistent(priv->pdev,
- MWL8K_RX_DESCS * priv->rxd_ops->rxd_size,
- rxq->rxd, rxq->rxd_dma);
+ dma_free_coherent(&priv->pdev->dev,
+ MWL8K_RX_DESCS * priv->rxd_ops->rxd_size, rxq->rxd,
+ rxq->rxd_dma);
rxq->rxd = NULL;
}
rxq->buf[rxq->head].skb = NULL;
- pci_unmap_single(priv->pdev,
+ dma_unmap_single(&priv->pdev->dev,
dma_unmap_addr(&rxq->buf[rxq->head], dma),
- MWL8K_RX_MAXSZ, PCI_DMA_FROMDEVICE);
+ MWL8K_RX_MAXSZ, DMA_FROM_DEVICE);
dma_unmap_addr_set(&rxq->buf[rxq->head], dma, 0);
rxq->head++;
size = MWL8K_TX_DESCS * sizeof(struct mwl8k_tx_desc);
- txq->txd = pci_zalloc_consistent(priv->pdev, size, &txq->txd_dma);
+ txq->txd = dma_alloc_coherent(&priv->pdev->dev, size, &txq->txd_dma,
+ GFP_KERNEL);
if (txq->txd == NULL) {
wiphy_err(hw->wiphy, "failed to alloc TX descriptors\n");
return -ENOMEM;
txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL);
if (txq->skb == NULL) {
- pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma);
+ dma_free_coherent(&priv->pdev->dev, size, txq->txd,
+ txq->txd_dma);
return -ENOMEM;
}
txq->skb[tx] = NULL;
BUG_ON(skb == NULL);
- pci_unmap_single(priv->pdev, addr, size, PCI_DMA_TODEVICE);
+ dma_unmap_single(&priv->pdev->dev, addr, size, DMA_TO_DEVICE);
mwl8k_remove_dma_header(skb, tx_desc->qos_control);
kfree(txq->skb);
txq->skb = NULL;
- pci_free_consistent(priv->pdev,
- MWL8K_TX_DESCS * sizeof(struct mwl8k_tx_desc),
- txq->txd, txq->txd_dma);
+ dma_free_coherent(&priv->pdev->dev,
+ MWL8K_TX_DESCS * sizeof(struct mwl8k_tx_desc),
+ txq->txd, txq->txd_dma);
txq->txd = NULL;
}
qos |= MWL8K_QOS_ACK_POLICY_NORMAL;
}
- dma = pci_map_single(priv->pdev, skb->data,
- skb->len, PCI_DMA_TODEVICE);
+ dma = dma_map_single(&priv->pdev->dev, skb->data, skb->len,
+ DMA_TO_DEVICE);
- if (pci_dma_mapping_error(priv->pdev, dma)) {
+ if (dma_mapping_error(&priv->pdev->dev, dma)) {
wiphy_debug(hw->wiphy,
"failed to dma map skb, dropping TX frame.\n");
if (start_ba_session) {
}
mwl8k_tx_start(priv);
spin_unlock_bh(&priv->tx_lock);
- pci_unmap_single(priv->pdev, dma, skb->len,
- PCI_DMA_TODEVICE);
+ dma_unmap_single(&priv->pdev->dev, dma, skb->len,
+ DMA_TO_DEVICE);
dev_kfree_skb(skb);
return;
}
cmd->result = (__force __le16) 0xffff;
dma_size = le16_to_cpu(cmd->length);
- dma_addr = pci_map_single(priv->pdev, cmd, dma_size,
- PCI_DMA_BIDIRECTIONAL);
- if (pci_dma_mapping_error(priv->pdev, dma_addr)) {
+ dma_addr = dma_map_single(&priv->pdev->dev, cmd, dma_size,
+ DMA_BIDIRECTIONAL);
+ if (dma_mapping_error(&priv->pdev->dev, dma_addr)) {
rc = -ENOMEM;
goto exit;
}
priv->hostcmd_wait = NULL;
- pci_unmap_single(priv->pdev, dma_addr, dma_size,
- PCI_DMA_BIDIRECTIONAL);
+ dma_unmap_single(&priv->pdev->dev, dma_addr, dma_size,
+ DMA_BIDIRECTIONAL);
if (!timeout) {
wiphy_err(hw->wiphy, "Command %s timeout after %u ms\n",
tasklet_disable(&priv->poll_rx_task);
/* Power management cookie */
- priv->cookie = pci_alloc_consistent(priv->pdev, 4, &priv->cookie_dma);
+ priv->cookie = dma_alloc_coherent(&priv->pdev->dev, 4,
+ &priv->cookie_dma, GFP_KERNEL);
if (priv->cookie == NULL)
return -ENOMEM;
err_free_cookie:
if (priv->cookie != NULL)
- pci_free_consistent(priv->pdev, 4,
- priv->cookie, priv->cookie_dma);
+ dma_free_coherent(&priv->pdev->dev, 4, priv->cookie,
+ priv->cookie_dma);
return rc;
}
mwl8k_rxq_deinit(hw, 0);
- pci_free_consistent(priv->pdev, 4, priv->cookie, priv->cookie_dma);
+ dma_free_coherent(&priv->pdev->dev, 4, priv->cookie, priv->cookie_dma);
unmap:
pci_iounmap(pdev, priv->regs);