linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Use dma_pool_zalloc
@ 2016-04-29 20:09 Julia Lawall
  2016-04-29 20:09 ` [PATCH 5/5] dmaengine: fsldma: " Julia Lawall
  2016-05-03  6:55 ` [PATCH 0/5] " Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2016-04-29 20:09 UTC (permalink / raw)
  To: linux-crypto
  Cc: kernel-janitors, linux-arm-kernel, Sören Brinkmann,
	linux-kernel, Dan Williams, dmaengine, linuxppc-dev

Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
that makes this transformation is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
T *d;
expression e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(T));

@@
expression d,e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(*d));
// </smpl>

---

 drivers/crypto/marvell/tdma.c    |    5 ++---
 drivers/dma/fsldma.c             |    3 +--
 drivers/dma/ioat/init.c          |    5 ++---
 drivers/dma/mmp_pdma.c           |    3 +--
 drivers/dma/xilinx/xilinx_vdma.c |    3 +--
 5 files changed, 7 insertions(+), 12 deletions(-)

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

* [PATCH 5/5] dmaengine: fsldma: Use dma_pool_zalloc
  2016-04-29 20:09 [PATCH 0/5] Use dma_pool_zalloc Julia Lawall
@ 2016-04-29 20:09 ` Julia Lawall
  2016-04-29 20:48   ` Yang-Leo Li
  2016-05-03  6:55 ` [PATCH 0/5] " Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2016-04-29 20:09 UTC (permalink / raw)
  To: Li Yang
  Cc: kernel-janitors, Zhang Wei, Vinod Koul, Dan Williams,
	linuxppc-dev, dmaengine, linux-kernel

Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
that makes this transformation is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression d,e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(*d));
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/dma/fsldma.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index aac85c3..a8828ed 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -462,13 +462,12 @@ static struct fsl_desc_sw *fsl_dma_alloc_descriptor(struct fsldma_chan *chan)
 	struct fsl_desc_sw *desc;
 	dma_addr_t pdesc;
 
-	desc = dma_pool_alloc(chan->desc_pool, GFP_ATOMIC, &pdesc);
+	desc = dma_pool_zalloc(chan->desc_pool, GFP_ATOMIC, &pdesc);
 	if (!desc) {
 		chan_dbg(chan, "out of memory for link descriptor\n");
 		return NULL;
 	}
 
-	memset(desc, 0, sizeof(*desc));
 	INIT_LIST_HEAD(&desc->tx_list);
 	dma_async_tx_descriptor_init(&desc->async_tx, &chan->common);
 	desc->async_tx.tx_submit = fsl_dma_tx_submit;

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

* RE: [PATCH 5/5] dmaengine: fsldma: Use dma_pool_zalloc
  2016-04-29 20:09 ` [PATCH 5/5] dmaengine: fsldma: " Julia Lawall
@ 2016-04-29 20:48   ` Yang-Leo Li
  0 siblings, 0 replies; 4+ messages in thread
From: Yang-Leo Li @ 2016-04-29 20:48 UTC (permalink / raw)
  To: Julia Lawall, Li Yang
  Cc: kernel-janitors@vger.kernel.org, Zhang Wei, Vinod Koul,
	Dan Williams, linuxppc-dev@lists.ozlabs.org,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Julia Lawall [mailto:Julia.Lawall@lip6.fr]
> Sent: Friday, April 29, 2016 3:09 PM
> To: Li Yang <leoli@freescale.com>
> Cc: kernel-janitors@vger.kernel.org; Zhang Wei <zw@zh-kernel.org>; Vinod
> Koul <vinod.koul@intel.com>; Dan Williams <dan.j.williams@intel.com>;
> linuxppc-dev@lists.ozlabs.org; dmaengine@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH 5/5] dmaengine: fsldma: Use dma_pool_zalloc
>=20
> Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
> that makes this transformation is as follows: (http://coccinelle.lip6.fr/=
)
>=20
> // <smpl>
> @@
> expression d,e;
> statement S;
> @@
>=20
>         d =3D
> -            dma_pool_alloc
> +            dma_pool_zalloc
>              (...);
>         if (!d) S
> -       memset(d, 0, sizeof(*d));
> // </smpl>
>=20
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Li Yang <leoyang.li@nxp.com>

>=20
> ---
>  drivers/dma/fsldma.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>=20
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index
> aac85c3..a8828ed 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -462,13 +462,12 @@ static struct fsl_desc_sw
> *fsl_dma_alloc_descriptor(struct fsldma_chan *chan)
>  	struct fsl_desc_sw *desc;
>  	dma_addr_t pdesc;
>=20
> -	desc =3D dma_pool_alloc(chan->desc_pool, GFP_ATOMIC, &pdesc);
> +	desc =3D dma_pool_zalloc(chan->desc_pool, GFP_ATOMIC, &pdesc);
>  	if (!desc) {
>  		chan_dbg(chan, "out of memory for link descriptor\n");
>  		return NULL;
>  	}
>=20
> -	memset(desc, 0, sizeof(*desc));
>  	INIT_LIST_HEAD(&desc->tx_list);
>  	dma_async_tx_descriptor_init(&desc->async_tx, &chan->common);
>  	desc->async_tx.tx_submit =3D fsl_dma_tx_submit;

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

* Re: [PATCH 0/5] Use dma_pool_zalloc
  2016-04-29 20:09 [PATCH 0/5] Use dma_pool_zalloc Julia Lawall
  2016-04-29 20:09 ` [PATCH 5/5] dmaengine: fsldma: " Julia Lawall
@ 2016-05-03  6:55 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2016-05-03  6:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-crypto, kernel-janitors, linux-arm-kernel,
	Sören Brinkmann, linux-kernel, Dan Williams, dmaengine,
	linuxppc-dev

On Fri, Apr 29, 2016 at 10:09:07PM +0200, Julia Lawall wrote:
> Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
> that makes this transformation is as follows: (http://coccinelle.lip6.fr/)

Applied all dmaengine patches

-- 
~Vinod

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

end of thread, other threads:[~2016-05-03  6:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-29 20:09 [PATCH 0/5] Use dma_pool_zalloc Julia Lawall
2016-04-29 20:09 ` [PATCH 5/5] dmaengine: fsldma: " Julia Lawall
2016-04-29 20:48   ` Yang-Leo Li
2016-05-03  6:55 ` [PATCH 0/5] " Vinod Koul

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