public inbox for openrisc@lists.librecores.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 2/2] dma-mapping: deprecate dma_zalloc_coherent
Date: Fri, 14 Dec 2018 09:25:15 +0100	[thread overview]
Message-ID: <20181214082515.14835-3-hch@lst.de> (raw)
In-Reply-To: <20181214082515.14835-1-hch@lst.de>

We now always return zeroed memory from dma_alloc_coherent.  Note that
simply passing GFP_ZERO to dma_alloc_coherent wasn't always doing the
right thing to start with given that various allocators are not backed
by the page allocator and thus would ignore GFP_ZERO.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 Documentation/DMA-API.txt   | 9 ---------
 include/linux/dma-mapping.h | 7 ++++---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index 016eb6909b8a..e133ccd60228 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -58,15 +58,6 @@ specify the ``GFP_`` flags (see kmalloc()) for the allocation (the
 implementation may choose to ignore flags that affect the location of
 the returned memory, like GFP_DMA).
 
-::
-
-	void *
-	dma_zalloc_coherent(struct device *dev, size_t size,
-			    dma_addr_t *dma_handle, gfp_t flag)
-
-Wraps dma_alloc_coherent() and also zeroes the returned memory if the
-allocation attempt succeeded.
-
 ::
 
 	void
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index f422aec0f53c..a52c6409bdc2 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -644,12 +644,13 @@ static inline unsigned long dma_max_pfn(struct device *dev)
 }
 #endif
 
+/*
+ * Please always use dma_alloc_coherent instead as it already zeroes the memory!
+ */
 static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
 					dma_addr_t *dma_handle, gfp_t flag)
 {
-	void *ret = dma_alloc_coherent(dev, size, dma_handle,
-				       flag | __GFP_ZERO);
-	return ret;
+	return dma_alloc_coherent(dev, size, dma_handle, flag);
 }
 
 static inline int dma_get_cache_alignment(void)
-- 
2.19.2


  parent reply	other threads:[~2018-12-14  8:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  8:25 [OpenRISC] ensure dma_alloc_coherent always returns zeroed memory Christoph Hellwig
2018-12-14  8:25 ` [OpenRISC] [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* Christoph Hellwig
2018-12-14  9:54   ` Geert Uytterhoeven
2018-12-14  9:55     ` Geert Uytterhoeven
2018-12-14 11:47     ` Christoph Hellwig
2018-12-14 12:36       ` Geert Uytterhoeven
2018-12-14 14:14       ` Greg Ungerer
2018-12-17 11:59         ` Christoph Hellwig
2018-12-14 12:12   ` Eugeniy Paltsev
2018-12-14 12:21     ` hch
2018-12-14 18:10   ` Sam Ravnborg
2018-12-14 18:35     ` Christoph Hellwig
2018-12-14  8:25 ` Christoph Hellwig [this message]
2018-12-14 13:33 ` [OpenRISC] ensure dma_alloc_coherent always returns zeroed memory Christoph Hellwig
2018-12-19 16:59 ` Christoph Hellwig
     [not found]   ` <1545316369.14089.20.camel@synopsys.com>
2018-12-20 14:34     ` hch
     [not found]       ` <1545316759.14089.22.camel@synopsys.com>
2018-12-20 14:46         ` hch
2018-12-20 17:37           ` hch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181214082515.14835-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=openrisc@lists.librecores.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox