From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933562AbdGKPmu (ORCPT ); Tue, 11 Jul 2017 11:42:50 -0400 Received: from smtprelay0232.hostedemail.com ([216.40.44.232]:51268 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933490AbdGKPmt (ORCPT ); Tue, 11 Jul 2017 11:42:49 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::,RULES_HIT:41:355:379:541:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1381:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:4321:5007:6117:6119:7903:8527:10004:10400:10848:11026:11232:11473:11658:11914:12043:12438:12740:12895:13069:13311:13357:13439:13894:14181:14659:21080:21433:21451:21627:30012: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:3,LUA_SUMMARY:none X-HE-Tag: chain17_6fb9dca050363 X-Filterd-Recvd-Size: 1619 Message-ID: <1499787766.4457.14.camel@perches.com> Subject: Re: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro From: Joe Perches To: Lynn Lei , linux-kernel@vger.kernel.org Date: Tue, 11 Jul 2017 08:42:46 -0700 In-Reply-To: <20170711152350.GA10543@lynnl.yet> References: <20170711152350.GA10543@lynnl.yet> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 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 Tue, 2017-07-11 at 23:23 +0800, Lynn Lei wrote: > Fixed the unenclosed complex values macro issue generated by > scripts/checkpatch.pl: > ERROR: Macros with complex values should be enclosed in parentheses [] > diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c [] > @@ -35,7 +35,7 @@ > #define AAT1290_MM_CURRENT_RATIO_ADDR 20 > #define AAT1290_MM_TO_FL_1_92 1 > > -#define AAT1290_MM_TO_FL_RATIO 1000 / 1920 > +#define AAT1290_MM_TO_FL_RATIO (1000 / 1920) > #define AAT1290_MAX_MM_CURRENT(fl_max) (fl_max * AAT1290_MM_TO_FL_RATIO) Nope, try again. Look at one use of this macro and see how it could be improved. Think to yourself is AAT1290_MM_FL_RATIO a useful define. Think how adding parenthesis changes AAT1290_MAX_MM_CURRENT. checkpatch isn't always correct, but it can help improved the code even if the messages it emits aren't always intelligible.