* [PATCH] misc: genwqe: Use dma_set_mask_and_coherent to simplify code
@ 2020-12-01 21:01 Christophe JAILLET
0 siblings, 0 replies; only message in thread
From: Christophe JAILLET @ 2020-12-01 21:01 UTC (permalink / raw)
To: haver, arnd, gregkh; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by
an equivalent 'dma_set_mask_and_coherent()' which is much less verbose.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/misc/genwqe/card_base.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c
index c9b886618071..2e1befbd1ad9 100644
--- a/drivers/misc/genwqe/card_base.c
+++ b/drivers/misc/genwqe/card_base.c
@@ -1089,24 +1089,9 @@ static int genwqe_pci_setup(struct genwqe_dev *cd)
}
/* check for 64-bit DMA address supported (DAC) */
- if (!pci_set_dma_mask(pci_dev, DMA_BIT_MASK(64))) {
- err = pci_set_consistent_dma_mask(pci_dev, DMA_BIT_MASK(64));
- if (err) {
- dev_err(&pci_dev->dev,
- "err: DMA64 consistent mask error\n");
- err = -EIO;
- goto out_release_resources;
- }
/* check for 32-bit DMA address supported (SAC) */
- } else if (!pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32))) {
- err = pci_set_consistent_dma_mask(pci_dev, DMA_BIT_MASK(32));
- if (err) {
- dev_err(&pci_dev->dev,
- "err: DMA32 consistent mask error\n");
- err = -EIO;
- goto out_release_resources;
- }
- } else {
+ if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)) ||
+ dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32))) {
dev_err(&pci_dev->dev,
"err: neither DMA32 nor DMA64 supported\n");
err = -EIO;
--
2.27.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-01 21:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 21:01 [PATCH] misc: genwqe: Use dma_set_mask_and_coherent to simplify code Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).