staging: vt6655: remove deprecated use of pci api
Replace occurences of the pci api by appropriate call to the dma api. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @deprecated@ idexpression id; position p; @@ ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @bad1@ idexpression id; position deprecated.p; @@ ...when != &id->dev when != pci_get_drvdata ( id ) when != pci_enable_device ( id ) ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @depends on !bad1@ idexpression id; expression direction; position deprecated.p; @@ ( - pci_dma_supported@p ( id, + dma_supported ( &id->dev, ... + , GFP_ATOMIC ) | - pci_alloc_consistent@p ( id, + dma_alloc_coherent ( &id->dev, ... + , GFP_ATOMIC ) ) Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
875887c308
commit
a1c6dcda80
2 changed files with 22 additions and 21 deletions
|
@ -540,12 +540,12 @@ static bool device_init_rings(struct vnt_private *pDevice)
|
||||||
void *vir_pool;
|
void *vir_pool;
|
||||||
|
|
||||||
/*allocate all RD/TD rings a single pool*/
|
/*allocate all RD/TD rings a single pool*/
|
||||||
vir_pool = pci_zalloc_consistent(pDevice->pcid,
|
vir_pool = dma_zalloc_coherent(&pDevice->pcid->dev,
|
||||||
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
|
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
|
||||||
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
|
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
|
||||||
pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
|
pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
|
||||||
pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc),
|
pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc),
|
||||||
&pDevice->pool_dma);
|
&pDevice->pool_dma, GFP_ATOMIC);
|
||||||
if (vir_pool == NULL) {
|
if (vir_pool == NULL) {
|
||||||
dev_err(&pDevice->pcid->dev, "allocate desc dma memory failed\n");
|
dev_err(&pDevice->pcid->dev, "allocate desc dma memory failed\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -559,16 +559,17 @@ static bool device_init_rings(struct vnt_private *pDevice)
|
||||||
pDevice->rd1_pool_dma = pDevice->rd0_pool_dma +
|
pDevice->rd1_pool_dma = pDevice->rd0_pool_dma +
|
||||||
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
|
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
|
||||||
|
|
||||||
pDevice->tx0_bufs = pci_zalloc_consistent(pDevice->pcid,
|
pDevice->tx0_bufs = dma_zalloc_coherent(&pDevice->pcid->dev,
|
||||||
pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
|
pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
|
||||||
pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
|
pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
|
||||||
CB_BEACON_BUF_SIZE +
|
CB_BEACON_BUF_SIZE +
|
||||||
CB_MAX_BUF_SIZE,
|
CB_MAX_BUF_SIZE,
|
||||||
&pDevice->tx_bufs_dma0);
|
&pDevice->tx_bufs_dma0,
|
||||||
|
GFP_ATOMIC);
|
||||||
if (pDevice->tx0_bufs == NULL) {
|
if (pDevice->tx0_bufs == NULL) {
|
||||||
dev_err(&pDevice->pcid->dev, "allocate buf dma memory failed\n");
|
dev_err(&pDevice->pcid->dev, "allocate buf dma memory failed\n");
|
||||||
|
|
||||||
pci_free_consistent(pDevice->pcid,
|
dma_free_coherent(&pDevice->pcid->dev,
|
||||||
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
|
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
|
||||||
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
|
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
|
||||||
pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
|
pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
|
||||||
|
@ -614,7 +615,7 @@ static bool device_init_rings(struct vnt_private *pDevice)
|
||||||
|
|
||||||
static void device_free_rings(struct vnt_private *pDevice)
|
static void device_free_rings(struct vnt_private *pDevice)
|
||||||
{
|
{
|
||||||
pci_free_consistent(pDevice->pcid,
|
dma_free_coherent(&pDevice->pcid->dev,
|
||||||
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
|
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
|
||||||
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
|
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
|
||||||
pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
|
pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
|
||||||
|
@ -624,7 +625,7 @@ static void device_free_rings(struct vnt_private *pDevice)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (pDevice->tx0_bufs)
|
if (pDevice->tx0_bufs)
|
||||||
pci_free_consistent(pDevice->pcid,
|
dma_free_coherent(&pDevice->pcid->dev,
|
||||||
pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
|
pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
|
||||||
pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
|
pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
|
||||||
CB_BEACON_BUF_SIZE +
|
CB_BEACON_BUF_SIZE +
|
||||||
|
@ -689,8 +690,8 @@ static void device_free_rd0_ring(struct vnt_private *pDevice)
|
||||||
PSRxDesc pDesc = &(pDevice->aRD0Ring[i]);
|
PSRxDesc pDesc = &(pDevice->aRD0Ring[i]);
|
||||||
PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo;
|
PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo;
|
||||||
|
|
||||||
pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma,
|
dma_unmap_single(&pDevice->pcid->dev, pRDInfo->skb_dma,
|
||||||
pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
|
pDevice->rx_buf_sz, DMA_FROM_DEVICE);
|
||||||
|
|
||||||
dev_kfree_skb(pRDInfo->skb);
|
dev_kfree_skb(pRDInfo->skb);
|
||||||
|
|
||||||
|
@ -706,8 +707,8 @@ static void device_free_rd1_ring(struct vnt_private *pDevice)
|
||||||
PSRxDesc pDesc = &(pDevice->aRD1Ring[i]);
|
PSRxDesc pDesc = &(pDevice->aRD1Ring[i]);
|
||||||
PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo;
|
PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo;
|
||||||
|
|
||||||
pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma,
|
dma_unmap_single(&pDevice->pcid->dev, pRDInfo->skb_dma,
|
||||||
pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
|
pDevice->rx_buf_sz, DMA_FROM_DEVICE);
|
||||||
|
|
||||||
dev_kfree_skb(pRDInfo->skb);
|
dev_kfree_skb(pRDInfo->skb);
|
||||||
|
|
||||||
|
@ -775,8 +776,8 @@ static void device_free_td0_ring(struct vnt_private *pDevice)
|
||||||
PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
|
PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
|
||||||
|
|
||||||
if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
|
if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
|
||||||
pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma,
|
dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma,
|
||||||
pTDInfo->skb->len, PCI_DMA_TODEVICE);
|
pTDInfo->skb->len, DMA_TO_DEVICE);
|
||||||
|
|
||||||
if (pTDInfo->skb)
|
if (pTDInfo->skb)
|
||||||
dev_kfree_skb(pTDInfo->skb);
|
dev_kfree_skb(pTDInfo->skb);
|
||||||
|
@ -794,8 +795,8 @@ static void device_free_td1_ring(struct vnt_private *pDevice)
|
||||||
PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
|
PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
|
||||||
|
|
||||||
if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
|
if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
|
||||||
pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma,
|
dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma,
|
||||||
pTDInfo->skb->len, PCI_DMA_TODEVICE);
|
pTDInfo->skb->len, DMA_TO_DEVICE);
|
||||||
|
|
||||||
if (pTDInfo->skb)
|
if (pTDInfo->skb)
|
||||||
dev_kfree_skb(pTDInfo->skb);
|
dev_kfree_skb(pTDInfo->skb);
|
||||||
|
@ -841,9 +842,9 @@ static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pRD)
|
||||||
ASSERT(pRDInfo->skb);
|
ASSERT(pRDInfo->skb);
|
||||||
|
|
||||||
pRDInfo->skb_dma =
|
pRDInfo->skb_dma =
|
||||||
pci_map_single(pDevice->pcid,
|
dma_map_single(&pDevice->pcid->dev,
|
||||||
skb_put(pRDInfo->skb, skb_tailroom(pRDInfo->skb)),
|
skb_put(pRDInfo->skb, skb_tailroom(pRDInfo->skb)),
|
||||||
pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
|
pDevice->rx_buf_sz, DMA_FROM_DEVICE);
|
||||||
|
|
||||||
*((unsigned int *)&(pRD->m_rd0RD0)) = 0; /* FIX cast */
|
*((unsigned int *)&(pRD->m_rd0RD0)) = 0; /* FIX cast */
|
||||||
|
|
||||||
|
@ -994,8 +995,8 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc)
|
||||||
|
|
||||||
/* pre-allocated buf_dma can't be unmapped. */
|
/* pre-allocated buf_dma can't be unmapped. */
|
||||||
if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) {
|
if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) {
|
||||||
pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma, skb->len,
|
dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma,
|
||||||
PCI_DMA_TODEVICE);
|
skb->len, DMA_TO_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTDInfo->byFlags & TD_FLAGS_NETIF_SKB)
|
if (pTDInfo->byFlags & TD_FLAGS_NETIF_SKB)
|
||||||
|
|
|
@ -140,8 +140,8 @@ bool vnt_receive_frame(struct vnt_private *priv, PSRxDesc curr_rd)
|
||||||
|
|
||||||
skb = rd_info->skb;
|
skb = rd_info->skb;
|
||||||
|
|
||||||
pci_unmap_single(priv->pcid, rd_info->skb_dma,
|
dma_unmap_single(&priv->pcid->dev, rd_info->skb_dma,
|
||||||
priv->rx_buf_sz, PCI_DMA_FROMDEVICE);
|
priv->rx_buf_sz, DMA_FROM_DEVICE);
|
||||||
|
|
||||||
frame_size = le16_to_cpu(curr_rd->m_rd1RD1.wReqCount)
|
frame_size = le16_to_cpu(curr_rd->m_rd1RD1.wReqCount)
|
||||||
- cpu_to_le16(curr_rd->m_rd0RD0.wResCount);
|
- cpu_to_le16(curr_rd->m_rd0RD0.wResCount);
|
||||||
|
|
Loading…
Add table
Reference in a new issue