Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752078AbcKGWNe (ORCPT ); Mon, 7 Nov 2016 17:13:34 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:35734 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbcKGWNc (ORCPT ); Mon, 7 Nov 2016 17:13:32 -0500 Date: Tue, 8 Nov 2016 02:52:08 +0530 From: Nadim Almas To: gregkh@linuxfoundation.org, bhumirks@gmail.com Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] Staging: used dma_map_single in place of pci_map_single Message-ID: <20161107212208.GA5673@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4897 Lines: 129 pci_map_single is unneeded and can be replaced with dma_map_single to avoid inconcitent api usage. The Coccinelle semantic patch used to make this change is as follows: @@ expression E1,E2,E3; @@ - pci_map_single(E1, + dma_map_single(&E1->dev, E2, E3, ( - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRCTIONAL | - PCI_DMA_TODEVICE + DMA_TO_DEVICE | - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE | - PCI_DMA_NONE + DMA_NONE_DEVICE ) ) Signed-off-by: Nadim Almas --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 10 ++++++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 12 ++++++------ drivers/staging/slicoss/slicoss.c | 12 ++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 8d6bca6..a3c8c3a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1184,8 +1184,9 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, struct cb_desc *cb_desc, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); - dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); + dma_addr_t mapping = dma_map_single(&priv->pdev->dev, skb->data, + skb->len, + DMA_TO_DEVICE); struct tx_fwinfo_8190pci *pTxFwInfo; pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data; @@ -1292,8 +1293,9 @@ void rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry, struct cb_desc *cb_desc, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); - dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); + dma_addr_t mapping = dma_map_single(&priv->pdev->dev, skb->data, + skb->len, + DMA_TO_DEVICE); if (pci_dma_mapping_error(priv->pdev, mapping)) netdev_err(dev, "%s(): DMA Mapping error\n", __func__); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f985d88..ddd6523 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1826,10 +1826,10 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev) skb->dev = dev; priv->rx_buf[rx_queue_idx][i] = skb; mapping = (dma_addr_t *)skb->cb; - *mapping = pci_map_single(priv->pdev, + *mapping = dma_map_single(&priv->pdev->dev, skb_tail_pointer_rsl(skb), priv->rxbuffersize, - PCI_DMA_FROMDEVICE); + DMA_FROM_DEVICE); if (pci_dma_mapping_error(priv->pdev, *mapping)) { dev_kfree_skb_any(skb); return -1; @@ -2104,10 +2104,10 @@ static void _rtl92e_rx_normal(struct net_device *dev) priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = skb; - *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, - skb_tail_pointer_rsl(skb), - priv->rxbuffersize, - PCI_DMA_FROMDEVICE); + *((dma_addr_t *) skb->cb) = dma_map_single(&priv->pdev->dev, + skb_tail_pointer_rsl(skb), + priv->rxbuffersize, + DMA_FROM_DEVICE); if (pci_dma_mapping_error(priv->pdev, *((dma_addr_t *)skb->cb))) { dev_kfree_skb_any(skb); diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 062307a..2d76bfd 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1452,10 +1452,10 @@ static int slic_rcvqueue_fill(struct adapter *adapter) skb = alloc_skb(SLIC_RCVQ_RCVBUFSIZE, GFP_ATOMIC); if (skb) { paddr = (void *)(unsigned long) - pci_map_single(adapter->pcidev, + dma_map_single(&adapter->pcidev->dev, skb->data, SLIC_RCVQ_RCVBUFSIZE, - PCI_DMA_FROMDEVICE); + DMA_FROM_DEVICE); paddrl = SLIC_GET_ADDR_LOW(paddr); paddrh = SLIC_GET_ADDR_HIGH(paddr); @@ -1608,8 +1608,8 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb) struct device *dev; paddr = (void *)(unsigned long) - pci_map_single(adapter->pcidev, skb->head, - SLIC_RCVQ_RCVBUFSIZE, PCI_DMA_FROMDEVICE); + dma_map_single(&adapter->pcidev->dev, skb->head, + SLIC_RCVQ_RCVBUFSIZE, DMA_FROM_DEVICE); rcvbuf->status = 0; skb->next = NULL; @@ -1774,8 +1774,8 @@ static void slic_xmit_build_request(struct adapter *adapter, ihcmd->flags = adapter->port << IHFLG_IFSHFT; ihcmd->command = IHCMD_XMT_REQ; ihcmd->u.slic_buffers.totlen = skb->len; - phys_addr = pci_map_single(adapter->pcidev, skb->data, skb->len, - PCI_DMA_TODEVICE); + phys_addr = dma_map_single(&adapter->pcidev->dev, skb->data, skb->len, + DMA_TO_DEVICE); if (pci_dma_mapping_error(adapter->pcidev, phys_addr)) { kfree_skb(skb); dev_err(&adapter->pcidev->dev, "DMA mapping error\n"); -- 2.7.4