Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685137 > unrolled thread

[PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro

Started byLynn Lei <lynnl.yet@gmail.com>
First post2017-07-11 17:30 +0200
Last post2017-07-11 17:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro Lynn Lei <lynnl.yet@gmail.com> - 2017-07-11 17:30 +0200
    Re: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression  macro Joe Perches <joe@perches.com> - 2017-07-11 17:50 +0200

#1685137 — [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro

FromLynn Lei <lynnl.yet@gmail.com>
Date2017-07-11 17:30 +0200
Subject[PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro
Message-ID<u25gS-41E-11@gated-at.bofh.it>
Fixed the unenclosed complex values macro issue generated by
scripts/checkpatch.pl:
	ERROR: Macros with complex values should be enclosed in parentheses

Signed-off-by: Lynn Lei <lynnl.yet@gmail.com>
---
 drivers/leds/leds-aat1290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index a21e19297745..061e2cfd8097 100644
--- 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)
 
 #define AAT1290_LATCH_TIME_MIN_US	500
-- 
2.13.2

[toc] | [next] | [standalone]


#1685163 — Re: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro

FromJoe Perches <joe@perches.com>
Date2017-07-11 17:50 +0200
SubjectRe: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro
Message-ID<u25Ae-48y-15@gated-at.bofh.it>
In reply to#1685137
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web