public inbox for backports@vger.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: backports@vger.kernel.org
Cc: hauke@hauke-m.de
Subject: [PATCH v2 3/3] backports: backport devm_kmemdup
Date: Sun, 16 Nov 2014 14:39:59 +0100	[thread overview]
Message-ID: <1416145199-44209-3-git-send-email-nbd@openwrt.org> (raw)
In-Reply-To: <1416145199-44209-1-git-send-email-nbd@openwrt.org>

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 backport/backport-include/linux/device.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h
index 41f06c3..29dc077 100644
--- a/backport/backport-include/linux/device.h
+++ b/backport/backport-include/linux/device.h
@@ -177,4 +177,20 @@ static inline void *devm_kmalloc_array(struct device *dev,
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
+#define devm_kmemdup LINUX_BACKPORT(devm_kmemdup)
+static inline void *devm_kmemdup(struct device *dev, const void *src,
+				 size_t len, gfp_t gfp)
+{
+	void *p;
+
+	p = devm_kmalloc(dev, len, gfp);
+	if (p)
+		memcpy(p, src, len);
+
+	return p;
+}
+#endif
+
+
 #endif /* __BACKPORT_DEVICE_H */
-- 
2.1.2


  parent reply	other threads:[~2014-11-16 13:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-16 13:39 [PATCH v2 1/3] backports: add GENMASK and GENMASK_ULL Felix Fietkau
2014-11-16 13:39 ` [PATCH v2 2/3] backports: add include/uapi/linux/pci_regs.h to copy-list Felix Fietkau
2014-11-16 13:39 ` Felix Fietkau [this message]
2014-11-16 16:46   ` [PATCH v2 3/3] backports: backport devm_kmemdup Hauke Mehrtens

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=1416145199-44209-3-git-send-email-nbd@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=backports@vger.kernel.org \
    --cc=hauke@hauke-m.de \
    /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