linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header
       [not found] <20180503133715.15276-1-leon@kernel.org>
@ 2018-05-03 13:36 ` Leon Romanovsky
  2018-05-03 16:41   ` Joonas Lahtinen
  2018-05-14 20:10   ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Leon Romanovsky @ 2018-05-03 13:36 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: David Airlie, RDMA mailing list, Yishai Hadas, Matan Barak,
	Leon Romanovsky, dri-devel, Rodrigo Vivi, intel-gfx

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

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

* Re: [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header
  2018-05-03 13:36 ` [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header Leon Romanovsky
@ 2018-05-03 16:41   ` Joonas Lahtinen
  2018-05-14 20:10   ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Joonas Lahtinen @ 2018-05-03 16:41 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe, Leon Romanovsky
  Cc: David Airlie, RDMA mailing list, Yishai Hadas, Matan Barak,
	Leon Romanovsky, dri-devel, Rodrigo Vivi, intel-gfx

Quoting Leon Romanovsky (2018-05-03 16:36:55)
> 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>

Feel free to merge this through an appropriate tree, I guess you could
get some acks from LKML.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas

> ---
>  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
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header
  2018-05-03 13:36 ` [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header Leon Romanovsky
  2018-05-03 16:41   ` Joonas Lahtinen
@ 2018-05-14 20:10   ` Jason Gunthorpe
  2018-05-15  9:04     ` Leon Romanovsky
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2018-05-14 20:10 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: David Airlie, RDMA mailing list, Yishai Hadas, Matan Barak,
	Leon Romanovsky, Doug Ledford, dri-devel, Rodrigo Vivi,
	intel-gfx

On Thu, May 03, 2018 at 04:36:55PM +0300, Leon Romanovsky wrote:
> 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(-)

This patch and the next one to kernel.h will need to be Ack'd be
someone.. But I am not sure who.. AndrewM perhaps?

Jason
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header
  2018-05-14 20:10   ` Jason Gunthorpe
@ 2018-05-15  9:04     ` Leon Romanovsky
  0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2018-05-15  9:04 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: RDMA mailing list, Yishai Hadas, Matan Barak, David Airlie,
	Doug Ledford, dri-devel, Rodrigo Vivi, intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 826 bytes --]

On Mon, May 14, 2018 at 02:10:54PM -0600, Jason Gunthorpe wrote:
> On Thu, May 03, 2018 at 04:36:55PM +0300, Leon Romanovsky wrote:
> > 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(-)
>
> This patch and the next one to kernel.h will need to be Ack'd be
> someone.. But I am not sure who.. AndrewM perhaps?

Why is that?

The kernel.h doesn't have explicit maintainer and is managed by
community effort.

Thanks

>
> Jason

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-05-15  9:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180503133715.15276-1-leon@kernel.org>
2018-05-03 13:36 ` [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header Leon Romanovsky
2018-05-03 16:41   ` Joonas Lahtinen
2018-05-14 20:10   ` Jason Gunthorpe
2018-05-15  9:04     ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).