From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: David Airlie <airlied@linux.ie>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Yishai Hadas <yishaih@mellanox.com>,
Matan Barak <matanb@mellanox.com>,
Leon Romanovsky <leonro@mellanox.com>,
dri-devel@lists.freedesktop.org,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header
Date: Thu, 3 May 2018 16:36:55 +0300 [thread overview]
Message-ID: <20180503133715.15276-2-leon@kernel.org> (raw)
In-Reply-To: <20180503133715.15276-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
The macro u64_to_ptr() and function ptr_to_u64() are useful enough
to be part of general header, so move them there and allow RDMA
subsystem reuse them.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/gpu/drm/i915/i915_utils.h | 12 ++----------
include/linux/kernel.h | 12 ++++++++++++
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 51dbfe5bb418..de3bfda7bf96 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -25,6 +25,8 @@
#ifndef __I915_UTILS_H
#define __I915_UTILS_H
+#include <linux/kernel.h>
+
#undef WARN_ON
/* Many gcc seem to no see through this and fall over :( */
#if 0
@@ -102,16 +104,6 @@
__T; \
})
-static inline u64 ptr_to_u64(const void *ptr)
-{
- return (uintptr_t)ptr;
-}
-
-#define u64_to_ptr(T, x) ({ \
- typecheck(u64, x); \
- (T *)(uintptr_t)(x); \
-})
-
#define __mask_next_bit(mask) ({ \
int __idx = ffs(mask) - 1; \
mask &= ~BIT(__idx); \
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 6a1eb0b0aad9..a738393c9694 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -70,6 +70,18 @@
*/
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+static inline u64 ptr_to_u64(const void *ptr)
+{
+ return (uintptr_t)ptr;
+}
+
+#define u64_to_ptr(T, x) ( \
+{ \
+ typecheck(u64, x); \
+ (T *)(uintptr_t)(x); \
+} \
+)
+
#define u64_to_user_ptr(x) ( \
{ \
typecheck(u64, x); \
--
2.14.3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next parent reply other threads:[~2018-05-03 13:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180503133715.15276-1-leon@kernel.org>
2018-05-03 13:36 ` Leon Romanovsky [this message]
2018-05-03 16:41 ` [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header Joonas Lahtinen
2018-05-14 20:10 ` Jason Gunthorpe
2018-05-15 9:04 ` Leon Romanovsky
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=20180503133715.15276-2-leon@kernel.org \
--to=leon@kernel.org \
--cc=airlied@linux.ie \
--cc=dledford@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jgg@mellanox.com \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
--cc=rodrigo.vivi@intel.com \
--cc=yishaih@mellanox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.