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 1/3] backports: add GENMASK and GENMASK_ULL
Date: Sun, 16 Nov 2014 14:39:57 +0100	[thread overview]
Message-ID: <1416145199-44209-1-git-send-email-nbd@openwrt.org> (raw)

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


             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 Felix Fietkau [this message]
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

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-1-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