linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset
@ 2017-12-30 15:51 Himanshu Jha
  2017-12-31 12:07 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Himanshu Jha @ 2017-12-30 15:51 UTC (permalink / raw)
  To: arend.vanspriel
  Cc: franky.lin, hante.meuleman, chi-hsien.lin, wright.feng, kvalo,
	linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
	netdev, linux-kernel, mcgrof, Himanshu Jha

Use dma_zalloc_coherent for allocating zeroed
memory and remove unnecessary memset function.

Done using Coccinelle.
Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
0-day tested with no failures.

Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c    | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 3c87157..bdef2ac 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -1251,14 +1251,13 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
 	u64 address;
 	u32 addr;
 
-	devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev,
-		BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
-		&devinfo->shared.scratch_dmahandle, GFP_KERNEL);
+	devinfo->shared.scratch =
+		dma_zalloc_coherent(&devinfo->pdev->dev,
+					BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
+					&devinfo->shared.scratch_dmahandle,
+					GFP_KERNEL);
 	if (!devinfo->shared.scratch)
 		goto fail;
 
-	memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
-
 	addr = devinfo->shared.tcm_base_address +
 	       BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
 	address = (u64)devinfo->shared.scratch_dmahandle;
@@ -1268,14 +1267,13 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
 	       BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET;
 	brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
 
-	devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev,
-		BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
-		&devinfo->shared.ringupd_dmahandle, GFP_KERNEL);
+	devinfo->shared.ringupd =
+		dma_zalloc_coherent(&devinfo->pdev->dev,
+					BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
+					&devinfo->shared.ringupd_dmahandle,
+					GFP_KERNEL);
 	if (!devinfo->shared.ringupd)
 		goto fail;
 
-	memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
-
 	addr = devinfo->shared.tcm_base_address +
 	       BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
 	address = (u64)devinfo->shared.ringupd_dmahandle;
-- 
2.7.4

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

* Re: [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset
  2017-12-30 15:51 [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset Himanshu Jha
@ 2017-12-31 12:07 ` Andy Shevchenko
  2018-01-08 17:23 ` Kalle Valo
       [not found] ` <20180108172322.6AD8560B1B@smtp.codeaurora.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2017-12-31 12:07 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman, Chi-Hsien Lin,
	Wright Feng, Kalle Valo, open list:TI WILINK WIRELES...,
	open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER,
	brcm80211-dev-list, netdev, Linux Kernel Mailing List,
	Luis R. Rodriguez

On Sat, Dec 30, 2017 at 5:51 PM, Himanshu Jha
<himanshujha199640@gmail.com> wrote:
> Use dma_zalloc_coherent for allocating zeroed
> memory and remove unnecessary memset function.
>
> Done using Coccinelle.
> Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> 0-day tested with no failures.
>

Makes sense.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
>  .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c    | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index 3c87157..bdef2ac 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> @@ -1251,14 +1251,13 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
>         u64 address;
>         u32 addr;
>
> -       devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev,
> -               BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
> -               &devinfo->shared.scratch_dmahandle, GFP_KERNEL);
> +       devinfo->shared.scratch =
> +               dma_zalloc_coherent(&devinfo->pdev->dev,
> +                                       BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
> +                                       &devinfo->shared.scratch_dmahandle,
> +                                       GFP_KERNEL);
>         if (!devinfo->shared.scratch)
>                 goto fail;
>
> -       memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
> -
>         addr = devinfo->shared.tcm_base_address +
>                BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
>         address = (u64)devinfo->shared.scratch_dmahandle;
> @@ -1268,14 +1267,13 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
>                BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET;
>         brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
>
> -       devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev,
> -               BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
> -               &devinfo->shared.ringupd_dmahandle, GFP_KERNEL);
> +       devinfo->shared.ringupd =
> +               dma_zalloc_coherent(&devinfo->pdev->dev,
> +                                       BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
> +                                       &devinfo->shared.ringupd_dmahandle,
> +                                       GFP_KERNEL);
>         if (!devinfo->shared.ringupd)
>                 goto fail;
>
> -       memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
> -
>         addr = devinfo->shared.tcm_base_address +
>                BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
>         address = (u64)devinfo->shared.ringupd_dmahandle;
> --
> 2.7.4
>



-- 
With Best Regards,
Andy Shevchenko

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

* Re: brcmfmac: Use zeroing memory allocator than allocator/memset
  2017-12-30 15:51 [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset Himanshu Jha
  2017-12-31 12:07 ` Andy Shevchenko
@ 2018-01-08 17:23 ` Kalle Valo
       [not found] ` <20180108172322.6AD8560B1B@smtp.codeaurora.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-01-08 17:23 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: arend.vanspriel, franky.lin, hante.meuleman, chi-hsien.lin,
	wright.feng, linux-wireless, brcm80211-dev-list.pdl,
	brcm80211-dev-list, netdev, linux-kernel, mcgrof, Himanshu Jha

Himanshu Jha <himanshujha199640@gmail.com> wrote:

> Use dma_zalloc_coherent for allocating zeroed
> memory and remove unnecessary memset function.
> 
> Done using Coccinelle.
> Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> 0-day tested with no failures.
> 
> Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Failed to apply:

fatal: corrupt patch at line 29
error: could not build fake ancestor
Applying: brcmfmac: Use zeroing memory allocator than allocator/memset
Patch failed at 0001 brcmfmac: Use zeroing memory allocator than allocator/memset
The copy of the patch that failed is found in: .git/rebase-apply/patch

Patch set to Changes Requested.

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

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

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

* Re: brcmfmac: Use zeroing memory allocator than allocator/memset
       [not found] ` <20180108172322.6AD8560B1B@smtp.codeaurora.org>
@ 2018-01-08 18:24   ` Himanshu Jha
  0 siblings, 0 replies; 4+ messages in thread
From: Himanshu Jha @ 2018-01-08 18:24 UTC (permalink / raw)
  To: Kalle Valo
  Cc: arend.vanspriel, franky.lin, hante.meuleman, chi-hsien.lin,
	wright.feng, linux-wireless, brcm80211-dev-list.pdl,
	brcm80211-dev-list, netdev, linux-kernel, mcgrof

On Mon, Jan 08, 2018 at 05:23:22PM +0000, Kalle Valo wrote:
> Himanshu Jha <himanshujha199640@gmail.com> wrote:
> 
> > Use dma_zalloc_coherent for allocating zeroed
> > memory and remove unnecessary memset function.
> > 
> > Done using Coccinelle.
> > Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> > 0-day tested with no failures.
> > 
> > Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> Failed to apply:
> 
> fatal: corrupt patch at line 29
> error: could not build fake ancestor
> Applying: brcmfmac: Use zeroing memory allocator than allocator/memset
> Patch failed at 0001 brcmfmac: Use zeroing memory allocator than allocator/memset
> The copy of the patch that failed is found in: .git/rebase-apply/patch
> 
> Patch set to Changes Requested.

Sorry! That failed because I manually adjusted the arguments to prevent
80 character limit in the patch generated.

I will rebase and send v2 with updates.

-- 
Thanks
Himanshu Jha

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

end of thread, other threads:[~2018-01-08 18:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-30 15:51 [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset Himanshu Jha
2017-12-31 12:07 ` Andy Shevchenko
2018-01-08 17:23 ` Kalle Valo
     [not found] ` <20180108172322.6AD8560B1B@smtp.codeaurora.org>
2018-01-08 18:24   ` Himanshu Jha

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