Skip to contentSkip to conversation

compat: backport dma_alloc_coherent

PATCH In review Johannes Berg 1 participant 2 messages Jan 5, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: backport dma_alloc_coherent

From: Johannes Berg <[email protected]>

This is needed now for some wireless drivers.
Simply copy the upstream implementation.

---

include/linux/compat-3.2.h +9 -0
@@ -10,6 +10,15 @@
 
 #define PMSG_IS_AUTO(msg)	(((msg).event & PM_EVENT_AUTO) != 0)
 
+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);
+	if (ret)
+		memset(ret, 0, size);
+	return ret;
+}
+
 /**
  * skb_frag_page - retrieve the page refered to by a paged fragment
  * @frag: the paged fragment
#1 lore raw

Err, subject should be "backport dma_zalloc_coherent" ...

johannes