public inbox for backports@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] backports: add GENMASK and GENMASK_ULL
@ 2014-11-16 13:39 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 ` [PATCH v2 3/3] backports: backport devm_kmemdup Felix Fietkau
  0 siblings, 2 replies; 4+ messages in thread
From: Felix Fietkau @ 2014-11-16 13:39 UTC (permalink / raw)
  To: backports; +Cc: hauke

I intend to use this for a new driver

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

diff --git a/backport/backport-include/linux/bitops.h b/backport/backport-include/linux/bitops.h
new file mode 100644
index 0000000..b0e9283
--- /dev/null
+++ b/backport/backport-include/linux/bitops.h
@@ -0,0 +1,19 @@
+#ifndef __BACKPORT_BITOPS_H
+#define __BACKPORT_BITOPS_H
+#include_next <linux/bitops.h>
+#include <linux/version.h>
+#include <generated/utsrelease.h>
+
+#ifndef GENMASK
+
+/*
+ * Create a contiguous bitmask starting at bit position @l and ending at
+ * position @h. For example
+ * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
+ */
+#define GENMASK(h, l)		(((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
+#define GENMASK_ULL(h, l)	(((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
+
+#endif
+
+#endif /* __BACKPORT_BITOPS_H */
-- 
2.1.2


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

* [PATCH v2 2/3] backports: add include/uapi/linux/pci_regs.h to copy-list
  2014-11-16 13:39 [PATCH v2 1/3] backports: add GENMASK and GENMASK_ULL Felix Fietkau
@ 2014-11-16 13:39 ` Felix Fietkau
  2014-11-16 13:39 ` [PATCH v2 3/3] backports: backport devm_kmemdup Felix Fietkau
  1 sibling, 0 replies; 4+ messages in thread
From: Felix Fietkau @ 2014-11-16 13:39 UTC (permalink / raw)
  To: backports; +Cc: hauke

Fixes a recent iwlwifi build error

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 copy-list | 1 +
 1 file changed, 1 insertion(+)

diff --git a/copy-list b/copy-list
index 75ef52f..6a6cb01 100644
--- a/copy-list
+++ b/copy-list
@@ -23,6 +23,7 @@ include/linux/wireless.h
 include/uapi/linux/wireless.h
 include/linux/ieee80211.h
 include/linux/pci_ids.h
+include/uapi/linux/pci_regs.h
 include/linux/mmc/sdio_ids.h
 include/linux/ath9k_platform.h
 include/uapi/linux/wil6210_uapi.h
-- 
2.1.2


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

* [PATCH v2 3/3] backports: backport devm_kmemdup
  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
  2014-11-16 16:46   ` Hauke Mehrtens
  1 sibling, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2014-11-16 13:39 UTC (permalink / raw)
  To: backports; +Cc: hauke

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


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

* Re: [PATCH v2 3/3] backports: backport devm_kmemdup
  2014-11-16 13:39 ` [PATCH v2 3/3] backports: backport devm_kmemdup Felix Fietkau
@ 2014-11-16 16:46   ` Hauke Mehrtens
  0 siblings, 0 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2014-11-16 16:46 UTC (permalink / raw)
  To: Felix Fietkau, backports

On 11/16/2014 02:39 PM, Felix Fietkau wrote:
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
> ---
Thank you for your patches, they are pushed upstream.

Hauke


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

end of thread, other threads:[~2014-11-16 16:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2 3/3] backports: backport devm_kmemdup Felix Fietkau
2014-11-16 16:46   ` Hauke Mehrtens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox