* [PATCH V3 1/7] dma: dw-edma-pcie: switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
@ 2021-10-08 3:28 ` Qing Wang
2021-10-08 3:28 ` [PATCH V3 5/7] dma: ioat: " Qing Wang
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Qing Wang @ 2021-10-08 3:28 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul, Viresh Kumar, Andy Shevchenko,
Zhou Wang, Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
Cc: Qing Wang
From: Wang Qing <wangqing@vivo.com>
The wrappers in include/linux/pci-dma-compat.h should go away.
pci_set_dma_mask()/pci_set_consistent_dma_mask() should be
replaced with dma_set_mask()/dma_set_coherent_mask(),
and use dma_set_mask_and_coherent() for both.
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
drivers/dma/dw-edma/dw-edma-pcie.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c
index 44f6e09..198f6cd
--- a/drivers/dma/dw-edma/dw-edma-pcie.c
+++ b/drivers/dma/dw-edma/dw-edma-pcie.c
@@ -186,27 +186,18 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
pci_set_master(pdev);
/* DMA configuration */
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (!err) {
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
- if (err) {
- pci_err(pdev, "consistent DMA mask 64 set failed\n");
- return err;
- }
+ pci_err(pdev, "DMA mask 64 set failed\n");
+ return err;
} else {
pci_err(pdev, "DMA mask 64 set failed\n");
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
pci_err(pdev, "DMA mask 32 set failed\n");
return err;
}
-
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
- if (err) {
- pci_err(pdev, "consistent DMA mask 32 set failed\n");
- return err;
- }
}
/* Data structure allocation */
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH V3 5/7] dma: ioat: switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
2021-10-08 3:28 ` [PATCH V3 1/7] dma: dw-edma-pcie: " Qing Wang
@ 2021-10-08 3:28 ` Qing Wang
2021-10-08 3:28 ` [PATCH V3 4/7] dma: hsu: " Qing Wang
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Qing Wang @ 2021-10-08 3:28 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul, Viresh Kumar, Andy Shevchenko,
Zhou Wang, Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
Cc: Qing Wang
The wrappers in include/linux/pci-dma-compat.h should go away.
pci_set_dma_mask()/pci_set_consistent_dma_mask() should be
replaced with dma_set_mask()/dma_set_coherent_mask(),
and use dma_set_mask_and_coherent() for both.
Signed-off-by: Qing Wang <wangqing@vivo.com>
---
drivers/dma/ioat/init.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index 191b592..373b8da
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -1363,15 +1363,9 @@ static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!iomap)
return -ENOMEM;
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (err)
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
- if (err)
- return err;
-
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
- if (err)
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err)
return err;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH V3 4/7] dma: hsu: switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
2021-10-08 3:28 ` [PATCH V3 1/7] dma: dw-edma-pcie: " Qing Wang
2021-10-08 3:28 ` [PATCH V3 5/7] dma: ioat: " Qing Wang
@ 2021-10-08 3:28 ` Qing Wang
2021-10-08 3:28 ` [PATCH V3 3/7] dma: hisi_dma: " Qing Wang
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Qing Wang @ 2021-10-08 3:28 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul, Viresh Kumar, Andy Shevchenko,
Zhou Wang, Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
Cc: Qing Wang
The wrappers in include/linux/pci-dma-compat.h should go away.
pci_set_dma_mask()/pci_set_consistent_dma_mask() should be
replaced with dma_set_mask()/dma_set_coherent_mask(),
and use dma_set_mask_and_coherent() for both.
Signed-off-by: Qing Wang <wangqing@vivo.com>
---
drivers/dma/hsu/pci.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c
index 9045a6f..6a2df3d
--- a/drivers/dma/hsu/pci.c
+++ b/drivers/dma/hsu/pci.c
@@ -65,11 +65,7 @@ static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_master(pdev);
pci_try_set_mwi(pdev);
- ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
- if (ret)
- return ret;
-
- ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret)
return ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH V3 3/7] dma: hisi_dma: switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
` (2 preceding siblings ...)
2021-10-08 3:28 ` [PATCH V3 4/7] dma: hsu: " Qing Wang
@ 2021-10-08 3:28 ` Qing Wang
2021-10-08 3:28 ` [PATCH V3 2/7] dma: dw: " Qing Wang
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Qing Wang @ 2021-10-08 3:28 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul, Viresh Kumar, Andy Shevchenko,
Zhou Wang, Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
Cc: Qing Wang
The wrappers in include/linux/pci-dma-compat.h should go away.
pci_set_dma_mask()/pci_set_consistent_dma_mask() should be
replaced with dma_set_mask()/dma_set_coherent_mask(),
and use dma_set_mask_and_coherent() for both.
Signed-off-by: Qing Wang <wangqing@vivo.com>
---
drivers/dma/hisi_dma.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c
index a259ee0..b86f856
--- a/drivers/dma/hisi_dma.c
+++ b/drivers/dma/hisi_dma.c
@@ -524,11 +524,7 @@ static int hisi_dma_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return ret;
}
- ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
- if (ret)
- return ret;
-
- ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (ret)
return ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH V3 2/7] dma: dw: switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
` (3 preceding siblings ...)
2021-10-08 3:28 ` [PATCH V3 3/7] dma: hisi_dma: " Qing Wang
@ 2021-10-08 3:28 ` Qing Wang
2021-10-08 3:28 ` [PATCH V3 6/7] dma: dmaengine: " Qing Wang
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Qing Wang @ 2021-10-08 3:28 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul, Viresh Kumar, Andy Shevchenko,
Zhou Wang, Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
Cc: Qing Wang
The wrappers in include/linux/pci-dma-compat.h should go away.
pci_set_dma_mask()/pci_set_consistent_dma_mask() should be
replaced with dma_set_mask()/dma_set_coherent_mask(),
and use dma_set_mask_and_coherent() for both.
Signed-off-by: Qing Wang <wangqing@vivo.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/dma/dw/pci.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
index 1142aa6..1dec1ae
--- a/drivers/dma/dw/pci.c
+++ b/drivers/dma/dw/pci.c
@@ -32,11 +32,7 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
pci_set_master(pdev);
pci_try_set_mwi(pdev);
- ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
- if (ret)
- return ret;
-
- ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret)
return ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH V3 6/7] dma: dmaengine: switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
` (4 preceding siblings ...)
2021-10-08 3:28 ` [PATCH V3 2/7] dma: dw: " Qing Wang
@ 2021-10-08 3:28 ` Qing Wang
2021-10-08 3:28 ` [PATCH V3 7/7] message: fusion: " Qing Wang
2021-10-25 6:55 ` [PATCH V3 0/7] " Vinod Koul
7 siblings, 0 replies; 9+ messages in thread
From: Qing Wang @ 2021-10-08 3:28 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul, Viresh Kumar, Andy Shevchenko,
Zhou Wang, Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
Cc: Qing Wang
The wrappers in include/linux/pci-dma-compat.h should go away.
pci_set_dma_mask()/pci_set_consistent_dma_mask() should be
replaced with dma_set_mask()/dma_set_coherent_mask(),
and use dma_set_mask_and_coherent() for both.
Signed-off-by: Qing Wang <wangqing@vivo.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
---
drivers/dma/plx_dma.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/plx_dma.c b/drivers/dma/plx_dma.c
index 1669345..1ffcb5c
--- a/drivers/dma/plx_dma.c
+++ b/drivers/dma/plx_dma.c
@@ -563,15 +563,9 @@ static int plx_dma_probe(struct pci_dev *pdev,
if (rc)
return rc;
- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(48));
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(48));
if (rc)
- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
- if (rc)
- return rc;
-
- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(48));
- if (rc)
- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (rc)
return rc;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH V3 7/7] message: fusion: switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
` (5 preceding siblings ...)
2021-10-08 3:28 ` [PATCH V3 6/7] dma: dmaengine: " Qing Wang
@ 2021-10-08 3:28 ` Qing Wang
2021-10-25 6:55 ` [PATCH V3 0/7] " Vinod Koul
7 siblings, 0 replies; 9+ messages in thread
From: Qing Wang @ 2021-10-08 3:28 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul, Viresh Kumar, Andy Shevchenko,
Zhou Wang, Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
Cc: Qing Wang
The wrappers in include/linux/pci-dma-compat.h should go away.
pci_set_dma_mask()/pci_set_consistent_dma_mask() should be
replaced with dma_set_mask()/dma_set_coherent_mask(),
and use dma_set_mask_and_coherent() for both.
Signed-off-by: Qing Wang <wangqing@vivo.com>
---
drivers/message/fusion/mptbase.c | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 7f7abc9..c255d8a
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1666,16 +1666,12 @@ mpt_mapresources(MPT_ADAPTER *ioc)
const uint64_t required_mask = dma_get_required_mask
(&pdev->dev);
if (required_mask > DMA_BIT_MASK(32)
- && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
- && !pci_set_consistent_dma_mask(pdev,
- DMA_BIT_MASK(64))) {
+ && dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
ioc->dma_mask = DMA_BIT_MASK(64);
dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
ioc->name));
- } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
- && !pci_set_consistent_dma_mask(pdev,
- DMA_BIT_MASK(32))) {
+ } else if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
ioc->dma_mask = DMA_BIT_MASK(32);
dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
@@ -1686,9 +1682,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
goto out_pci_release_region;
}
} else {
- if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
- && !pci_set_consistent_dma_mask(pdev,
- DMA_BIT_MASK(32))) {
+ if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
ioc->dma_mask = DMA_BIT_MASK(32);
dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
@@ -4452,9 +4446,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
*/
if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078 &&
ioc->dma_mask > DMA_BIT_MASK(35)) {
- if (!pci_set_dma_mask(ioc->pcidev, DMA_BIT_MASK(32))
- && !pci_set_consistent_dma_mask(ioc->pcidev,
- DMA_BIT_MASK(32))) {
+ if (!dma_set_mask_and_coherent(&ioc->pcidev, DMA_BIT_MASK(32))) {
dma_mask = DMA_BIT_MASK(35);
d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"setting 35 bit addressing for "
@@ -4462,10 +4454,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
ioc->name));
} else {
/*Reseting DMA mask to 64 bit*/
- pci_set_dma_mask(ioc->pcidev,
- DMA_BIT_MASK(64));
- pci_set_consistent_dma_mask(ioc->pcidev,
- DMA_BIT_MASK(64));
+ dma_set_mask_and_coherent(&ioc->pcidev, DMA_BIT_MASK(64));
printk(MYIOC_s_ERR_FMT
"failed setting 35 bit addressing for "
@@ -4600,9 +4589,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
alloc_dma += ioc->reply_sz;
}
- if (dma_mask == DMA_BIT_MASK(35) && !pci_set_dma_mask(ioc->pcidev,
- ioc->dma_mask) && !pci_set_consistent_dma_mask(ioc->pcidev,
- ioc->dma_mask))
+ if (dma_mask == DMA_BIT_MASK(35) &&
+ !dma_set_mask_and_coherent(&ioc->pcidev, ioc->dma_mask))
d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"restoring 64 bit addressing\n", ioc->name));
@@ -4625,9 +4613,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
ioc->sense_buf_pool = NULL;
}
- if (dma_mask == DMA_BIT_MASK(35) && !pci_set_dma_mask(ioc->pcidev,
- DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(ioc->pcidev,
- DMA_BIT_MASK(64)))
+ if (dma_mask == DMA_BIT_MASK(35) &&
+ !dma_set_mask_and_coherent(&ioc->pcidev, DMA_BIT_MASK(64)))
d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"restoring 64 bit addressing\n", ioc->name));
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH V3 0/7] switch from 'pci_' to 'dma_' API
2021-10-08 3:28 [PATCH V3 0/7] switch from 'pci_' to 'dma_' API Qing Wang
` (6 preceding siblings ...)
2021-10-08 3:28 ` [PATCH V3 7/7] message: fusion: " Qing Wang
@ 2021-10-25 6:55 ` Vinod Koul
7 siblings, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2021-10-25 6:55 UTC (permalink / raw)
To: Qing Wang
Cc: Gustavo Pimentel, Viresh Kumar, Andy Shevchenko, Zhou Wang,
Logan Gunthorpe, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, dmaengine, linux-kernel,
MPT-FusionLinux.pdl, linux-scsi
On 07-10-21, 20:28, Qing Wang wrote:
> The wrappers in include/linux/pci-dma-compat.h should go away.
>
> The patch has been generated with the coccinelle script below.
> expression e1, e2;
> @@
> - pci_set_dma_mask(e1, e2)
> + dma_set_mask(&e1->dev, e2)
>
> @@
> expression e1, e2;
> @@
> - pci_set_consistent_dma_mask(e1, e2)
> + dma_set_coherent_mask(&e1->dev, e2)
>
> While at it, some 'dma_set_mask()/dma_set_coherent_mask()' have been
> updated to a much less verbose 'dma_set_mask_and_coherent()'.
>
> This type of patches has been going on for a long time, I plan to
> clean it up in the near future. If needed, see post from
> Christoph Hellwig on the kernel-janitors ML:
> https://marc.info/?l=kernel-janitors&m=158745678307186&w=4
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 9+ messages in thread