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

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