Re: [PATCH v12 1/2] kernel.h: add u64_to_user_ptr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2016-04-26 at 11:29 -0300, Gustavo Padovan wrote:
> 2016-04-26 Lucas Stach <l.stach@xxxxxxxxxxxxxx>:
> > Am Donnerstag, den 21.04.2016, 12:38 -0300 schrieb Gustavo Padovan:
> > > From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
> > > 
> > > This function had copies in 3 different files. Unify them in kernel.h.
> > > 
> > > Cc: Joe Perches <joe@xxxxxxxxxxx>
> > > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > > Cc: David Airlie <airlied@xxxxxxxx>
> > > Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> > > Cc: Rob Clark <robdclark@xxxxxxxxx>
> > > Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
> > > 
> > 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.

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux