Skip to content

Commit 13cb8a5

Browse files
rmurphy-armKalle Valo
authored andcommitted
qtnfmac: Tidy up DMA mask setting
As the only caller of dma_supported() outside of DMA API internals, the qtfnmac driver stands out and invites scrutiny. Thankfully, it's not being used for evil, but it is entirely redundant, since it open-codes a check that the DMA mask setting functions are going to perform anyway. In fact, the whole qtnf_pcie_init_dma_mask() function is nothing more than a rather long-winded implementation of dma_set_mask_and_coherent(), so let's just use that directly. Signed-off-by: Robin Murphy <[email protected]> Acked-by: Sergey Matyukevich <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 805b28c commit 13cb8a5

File tree

1 file changed

+1
-27
lines changed
  • drivers/net/wireless/quantenna/qtnfmac/pearl

1 file changed

+1
-27
lines changed

drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -274,32 +274,6 @@ static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)
274274
return 0;
275275
}
276276

277-
static int
278-
qtnf_pcie_init_dma_mask(struct qtnf_pcie_bus_priv *priv, u64 dma_mask)
279-
{
280-
int ret;
281-
282-
ret = dma_supported(&priv->pdev->dev, dma_mask);
283-
if (!ret) {
284-
pr_err("DMA mask %llu not supported\n", dma_mask);
285-
return ret;
286-
}
287-
288-
ret = pci_set_dma_mask(priv->pdev, dma_mask);
289-
if (ret) {
290-
pr_err("failed to set DMA mask %llu\n", dma_mask);
291-
return ret;
292-
}
293-
294-
ret = pci_set_consistent_dma_mask(priv->pdev, dma_mask);
295-
if (ret) {
296-
pr_err("failed to set consistent DMA mask %llu\n", dma_mask);
297-
return ret;
298-
}
299-
300-
return ret;
301-
}
302-
303277
static void qtnf_tune_pcie_mps(struct qtnf_pcie_bus_priv *priv)
304278
{
305279
struct pci_dev *pdev = priv->pdev;
@@ -1212,7 +1186,7 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
12121186
goto err_base;
12131187
}
12141188

1215-
ret = qtnf_pcie_init_dma_mask(pcie_priv, DMA_BIT_MASK(32));
1189+
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
12161190
if (ret) {
12171191
pr_err("PCIE DMA mask init failed\n");
12181192
goto err_base;

0 commit comments

Comments
 (0)