From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751253AbdJDSH0 (ORCPT ); Wed, 4 Oct 2017 14:07:26 -0400 Received: from smtprelay0122.hostedemail.com ([216.40.44.122]:47930 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751167AbdJDSHY (ORCPT ); Wed, 4 Oct 2017 14:07:24 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3351:3622:3865:3867:3870:3871:3872:3873:4321:5007:6119:7903:10004:10400:10848:11026:11232:11473:11658:11914:12048:12114:12296:12438:12740:12760:12895:13069:13141:13161:13229:13230:13311:13357:13439:14659:14721:21080:21434:21451:21627:30029:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: girls27_40367febb4f0f X-Filterd-Recvd-Size: 1935 Message-ID: <1507140439.4434.14.camel@perches.com> Subject: Re: [PATCH] nfp: convert nfp_eth_set_bit_config() into a macro From: Joe Perches To: Matthias Kaehlcke , Jakub Kicinski , "David S . Miller" , Simon Horman , Dirk van der Merwe Cc: oss-drivers@netronome.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Renato Golin , Manoj Gupta , Guenter Roeck , Doug Anderson Date: Wed, 04 Oct 2017 11:07:19 -0700 In-Reply-To: <20171003200546.165731-1-mka@chromium.org> References: <20171003200546.165731-1-mka@chromium.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 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 On Tue, 2017-10-03 at 13:05 -0700, Matthias Kaehlcke wrote: > nfp_eth_set_bit_config() is marked as __always_inline to allow gcc to > identify the 'mask' parameter as known to be constant at compile time, > which is required to use the FIELD_GET() macro. > > The forced inlining does the trick for gcc, but for kernel builds with > clang it results in undefined symbols: Can't you use local different FIELD_PREP/FIELD_GET macros with a different name without the BUILD_BUG tests? i.e.: #define NFP_FIELD_PREP(_mask, _val) \ ({ \ ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \ }) #define NFP_FIELD_GET(_mask, _reg) \ ({ \ (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ }) Then the __always_inline can be removed from nfp_eth_set_bit_config too.