lkml.org 
[lkml]   [2016]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v12 1/2] kernel.h: add u64_to_user_ptr()
From
Date
On Tue, 2016-04-26 at 11:29 -0300, Gustavo Padovan wrote:
> 2016-04-26 Lucas Stach <l.stach@pengutronix.de>:
> > Am Donnerstag, den 21.04.2016, 12:38 -0300 schrieb Gustavo Padovan:
> > > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > >
> > > This function had copies in 3 different files. Unify them in kernel.h.
> > >
> > > Cc: Joe Perches <joe@perches.com>
> > > Cc: Andrew Morton <akpm@linux-foundation.org>
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > > Cc: Rob Clark <robdclark@gmail.com>
> > > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > >
> > Though I normally prefer static inline functions, I see the benefits of
> > using the macro form here.

An inline could still work
static inline void __user *u64_to_user_ptr(u64 address)
{
return (void __user *)(uintptr_t)address;
}
if the macro was
#define u64_to_user_ptr(x) \
({ \
typecheck(u64, x); \
(u64_to_user_ptr)(x); \
})

the parenthesis around the u64_to_user_ptr
in the macro should prevent expansion.

\
 
 \ /
  Last update: 2016-04-26 17:01    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog