public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Lynn Lei <lynnl.yet@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro
Date: Tue, 11 Jul 2017 08:42:46 -0700	[thread overview]
Message-ID: <1499787766.4457.14.camel@perches.com> (raw)
In-Reply-To: <20170711152350.GA10543@lynnl.yet>

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.

      reply	other threads:[~2017-07-11 15:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 15:23 [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro Lynn Lei
2017-07-11 15:42 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1499787766.4457.14.camel@perches.com \
    --to=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lynnl.yet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox