From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752163AbbCPEvH (ORCPT ); Mon, 16 Mar 2015 00:51:07 -0400 Received: from smtprelay0116.hostedemail.com ([216.40.44.116]:33137 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750844AbbCPEvE (ORCPT ); Mon, 16 Mar 2015 00:51:04 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:968: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:2828:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:3872:3874:4321:5007:6261:7974:8957:10004:10400:10848:11026:11232:11473:11658:11914:12043:12296:12438:12517:12519:12740:13069:13161:13229:13255:13311:13357:13848: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: burst37_433cf56b3864c X-Filterd-Recvd-Size: 2557 Message-ID: <1426481460.2678.35.camel@perches.com> Subject: Re: [PATCH v4 3/5] staging: rtl8192e: fix coding style errors (macros in parentheses) From: Joe Perches To: Mateusz Kulikowski Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Sun, 15 Mar 2015 21:51:00 -0700 In-Reply-To: <1426451987-24519-4-git-send-email-mateusz.kulikowski@gmail.com> References: <1426451987-24519-1-git-send-email-mateusz.kulikowski@gmail.com> <1426451987-24519-4-git-send-email-mateusz.kulikowski@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 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 Sun, 2015-03-15 at 21:39 +0100, Mateusz Kulikowski wrote: > Fix checkpatch.pl errors 'Macros with complex values should be enclosed in parentheses'. [] > diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h [] > @@ -78,7 +78,7 @@ enum chnl_op { > }; > > #define CHHLOP_IN_PROGRESS(_pHTInfo) \ > - ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false > + (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false) This would perhaps be better without the ternary as the compiler might not optimize the ternary away #define CHHLOP_IN_PROGRESS(_pHTInfo) \ ((_pHTInfo)->ChnOp > CHNLOP_NONE) This would also probably be better as a static inline not a macro, but as this is never used it's actually better just to remove it. > @@ -385,8 +385,8 @@ extern u8 MCS_FILTER_1SS[16]; > #define LEGACY_WIRELESS_MODE IEEE_MODE_MASK > > #define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \ > - ((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \ > - (LegacyRate) : (PICK_RATE(LegacyRate, HTRate)) > + (((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \ > + (LegacyRate) : (PICK_RATE(LegacyRate, HTRate))) This would be better with the various macro arguments parenthesized (especially WirelessMode) #define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \ (((WirelessMode) & LEGACY_WIRELESS_MODE) ? \ (LegacyRate) : PICK_RATE((LegacyRate), HTRate)) As this is used exactly once, it's probably better expanded in that one place and the macro removed. That's true for PICK_RATE as well.