From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932922AbbFVGMk (ORCPT ); Mon, 22 Jun 2015 02:12:40 -0400 Received: from smtprelay0242.hostedemail.com ([216.40.44.242]:52521 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932890AbbFVGMe (ORCPT ); Mon, 22 Jun 2015 02:12:34 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:152:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:3872:4321:4605:5007:6261:8784:10004:10400:10848:11026:11232:11473:11658:11914:12517:12519:12740:13069:13141:13230:13311:13357:13848:13894:21080,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 X-HE-Tag: girls82_505e23417ba29 X-Filterd-Recvd-Size: 2103 Message-ID: <1434953551.9808.19.camel@perches.com> Subject: Re: Coding style details (checkpatch) From: Joe Perches To: Krzysztof =?UTF-8?Q?Ha=C5=82asa?= Cc: Frans Klaver , Andy Whitcroft , lkml Date: Sun, 21 Jun 2015 23:12:31 -0700 In-Reply-To: References: <1434725667.2689.121.camel@perches.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2015-06-22 at 07:33 +0200, Krzysztof HaƂasa wrote: > Joe Perches writes: > > > How is the macro used? > > #define REG8_1(a0) ((const u16[8]){a0, a0 + 1, a0 + 2, a0 + 3}) > > #define REG8_1(a0) ((const u16[8]){a0, a0 + 1, a0 + 2, a0 + 3, a0 + 4, a0 + 5, a0 + 6, a0 + 7}) [] > #define VDMA_CHANNEL_CONFIG REG8_1(0x10) [] > reg_write(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch], dma_cfg); [] > ERROR: space required before the open brace '{' > +#define REG8_1(a0) ((const u16[8]){a0, a0 + 1, a0 + 2, a0 + 3}) > > Does this qualify as the "false positive"? Probably, yes. Is it worth fixing? Probably not. It might be better to use some base + index macro as it could be smaller object code. Something like: #define REG_NO(base, multiplier, index) (base + (multiplier * index)) reg_write(vc->dev, REG_NO(0x10, 1, vc->ch), dma_cfg); or #define VDMA_CHANNEL_CONFIG 0x10 reg_write(vc->dev, REG_NO(VDMA_CHANNEL_CONFIG, 1, vc->ch), dma_cfg); etc... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/