Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbcDZOkt (ORCPT ); Tue, 26 Apr 2016 10:40:49 -0400 Received: from smtprelay0247.hostedemail.com ([216.40.44.247]:43769 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750843AbcDZOks (ORCPT ); Tue, 26 Apr 2016 10:40:48 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3870:4321:5007:6742:7514:7576:10004:10400:10848:11026:11473:11658:11914:12043:12517:12519:12740:13069:13156:13161:13228:13229:13311:13357:13439:14040:14181:14659:14721:21080:30003:30051:30054:30064:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: home87_5dcbec4778021 X-Filterd-Recvd-Size: 2467 Message-ID: <1461681643.2726.140.camel@perches.com> Subject: Re: [PATCH v12 1/2] kernel.h: add u64_to_user_ptr() From: Joe Perches To: Gustavo Padovan , Lucas Stach Cc: Gustavo Padovan , Greg Kroah-Hartman , devel@driverdev.osuosl.org, Daniel Stone , Daniel Vetter , Riley Andrews , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Arve =?ISO-8859-1?Q?Hj=F8nnev=E5g?= , Daniel Vetter , Andrew Morton , John Harrison Date: Tue, 26 Apr 2016 07:40:43 -0700 In-Reply-To: <20160426142906.GI7857@joana> References: <1461253130-9266-1-git-send-email-gustavo@padovan.org> <1461253130-9266-2-git-send-email-gustavo@padovan.org> <1461661318.7839.5.camel@pengutronix.de> <20160426142906.GI7857@joana> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1076 Lines: 31 On Tue, 2016-04-26 at 11:29 -0300, Gustavo Padovan wrote: > 2016-04-26 Lucas Stach : > > Am Donnerstag, den 21.04.2016, 12:38 -0300 schrieb Gustavo Padovan: > > > From: Gustavo Padovan > > > > > > This function had copies in 3 different files. Unify them in kernel.h. > > > > > > Cc: Joe Perches > > > Cc: Andrew Morton > > > Cc: David Airlie > > > Cc: Daniel Vetter > > > Cc: Rob Clark > > > Signed-off-by: Gustavo Padovan > > > > > 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.