netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qtfnmac: Tidy up DMA mask setting
@ 2017-07-24 17:41 Robin Murphy
       [not found] ` <2c3f47792b2e38d5584d641d98e82f8318fefc72.1500917445.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robin Murphy @ 2017-07-24 17:41 UTC (permalink / raw)
  To: imitsyanko-P/7pdk10T0iB+jHODAdFcQ,
	avinashp-P/7pdk10T0iB+jHODAdFcQ,
	smatyukevich-P/7pdk10T0iB+jHODAdFcQ, kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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 <robin.murphy-5wv7dgnIgG8@public.gmane.org>
---
 .../net/wireless/quantenna/qtnfmac/pearl/pcie.c    | 28 +---------------------
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
index 7fc4f0d6a9ad..2c065ffda070 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
@@ -274,32 +274,6 @@ static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)
 	return 0;
 }
 
-static int
-qtnf_pcie_init_dma_mask(struct qtnf_pcie_bus_priv *priv, u64 dma_mask)
-{
-	int ret;
-
-	ret = dma_supported(&priv->pdev->dev, dma_mask);
-	if (!ret) {
-		pr_err("DMA mask %llu not supported\n", dma_mask);
-		return ret;
-	}
-
-	ret = pci_set_dma_mask(priv->pdev, dma_mask);
-	if (ret) {
-		pr_err("failed to set DMA mask %llu\n", dma_mask);
-		return ret;
-	}
-
-	ret = pci_set_consistent_dma_mask(priv->pdev, dma_mask);
-	if (ret) {
-		pr_err("failed to set consistent DMA mask %llu\n", dma_mask);
-		return ret;
-	}
-
-	return ret;
-}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] qtfnmac: Tidy up DMA mask setting
       [not found] ` <2c3f47792b2e38d5584d641d98e82f8318fefc72.1500917445.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
@ 2017-07-25 22:00   ` Sergey Matyukevich
  0 siblings, 0 replies; 4+ messages in thread
From: Sergey Matyukevich @ 2017-07-25 22:00 UTC (permalink / raw)
  To: Robin Murphy
  Cc: imitsyanko-P/7pdk10T0iB+jHODAdFcQ,
	avinashp-P/7pdk10T0iB+jHODAdFcQ,
	smatyukevich-P/7pdk10T0iB+jHODAdFcQ, kvalo-sgV2jX0FEOL9JmXXK+q4OQ,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

> 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 <robin.murphy-5wv7dgnIgG8@public.gmane.org>


Nice, thanks you !

Acked-by: Sergey Matyukevich <sergey.matyukevich.os-P/7pdk10T0iB+jHODAdFcQ@public.gmane.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: qtfnmac: Tidy up DMA mask setting
  2017-07-24 17:41 [PATCH] qtfnmac: Tidy up DMA mask setting Robin Murphy
       [not found] ` <2c3f47792b2e38d5584d641d98e82f8318fefc72.1500917445.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
@ 2017-08-03  9:57 ` Kalle Valo
  2017-08-03 10:01 ` qtnfmac: " Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-08-03  9:57 UTC (permalink / raw)
  To: Robin Murphy
  Cc: imitsyanko, avinashp, smatyukevich, linux-wireless, netdev,
	linux-kernel

Robin Murphy <robin.murphy@arm.com> wrote:

> 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 <robin.murphy@arm.com>
> Acked-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>

There's a typo in title prefix, I'll fix it to "qtnfmac:".

-- 
https://patchwork.kernel.org/patch/9859961/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: qtnfmac: Tidy up DMA mask setting
  2017-07-24 17:41 [PATCH] qtfnmac: Tidy up DMA mask setting Robin Murphy
       [not found] ` <2c3f47792b2e38d5584d641d98e82f8318fefc72.1500917445.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
  2017-08-03  9:57 ` Kalle Valo
@ 2017-08-03 10:01 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-08-03 10:01 UTC (permalink / raw)
  To: Robin Murphy
  Cc: imitsyanko, avinashp, smatyukevich, linux-wireless, netdev,
	linux-kernel

Robin Murphy <robin.murphy@arm.com> wrote:

> 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 <robin.murphy@arm.com>
> Acked-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>

Patch applied to wireless-drivers-next.git, thanks.

13cb8a5845ff qtnfmac: Tidy up DMA mask setting

-- 
https://patchwork.kernel.org/patch/9859961/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-03 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 17:41 [PATCH] qtfnmac: Tidy up DMA mask setting Robin Murphy
     [not found] ` <2c3f47792b2e38d5584d641d98e82f8318fefc72.1500917445.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2017-07-25 22:00   ` Sergey Matyukevich
2017-08-03  9:57 ` Kalle Valo
2017-08-03 10:01 ` qtnfmac: " Kalle Valo

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).