Skip to contentSkip to conversation

leds: leds-aat1290.c: enclosed arithmetic expression macro

PATCH In review Lynn Lei 2 participants 2 messages Jul 11, 2017 LED

lore
Share & tools
lore

Lynn Lei

author
#0 lore raw

PATCH 1/1 leds: leds-aat1290.c: enclosed arithmetic expression macro

Fixed the unenclosed complex values macro issue generated by scripts/checkpatch.pl:
ERROR: Macros with complex values should be enclosed in parentheses

---
 drivers/leds/leds-aat1290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aat1290.c +1 -1
index a21e19297745..061e2cfd8097 100644
@@ -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
Signature · 1 line
2.13.2
#1 lore raw
Quoted 3 lines · Lynn Lei

Fixed the unenclosed complex values macro issue generated by scripts/checkpatch.pl:
ERROR: Macros with complex values should be enclosed in parentheses

[]

drivers/leds/leds-aat1290.c

Quoted 1 line
drivers/leds/leds-aat1290.c +0 -0

[]

drivers/leds/leds-aat1290.c line 39

Quoted 7 lines
drivers/leds/leds-aat1290.c +1 -1
@@ -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.