* [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro
@ 2017-07-11 15:21 Lynn Lei
2017-07-11 15:31 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Lynn Lei @ 2017-07-11 15:21 UTC (permalink / raw)
To: rpurdie; +Cc: jacek.anaszewski, pavel, linux-leds
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro
@ 2017-07-11 15:23 Lynn Lei
2017-07-11 15:42 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Lynn Lei @ 2017-07-11 15:23 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro
2017-07-11 15:21 [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro Lynn Lei
@ 2017-07-11 15:31 ` Pavel Machek
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2017-07-11 15:31 UTC (permalink / raw)
To: Lynn Lei; +Cc: rpurdie, jacek.anaszewski, linux-leds
[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]
On Tue 2017-07-11 23:21:01, 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
>
> Signed-off-by: Lynn Lei <lynnl.yet@gmail.com>
That's very very very stupid, right?
Please don't do random checkpatch cleanups, be careful and test your changes.
NAK.
Pavel
> ---
> 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
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro
2017-07-11 15:23 Lynn Lei
@ 2017-07-11 15:42 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2017-07-11 15:42 UTC (permalink / raw)
To: Lynn Lei, linux-kernel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-11 15:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-11 15:21 [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression macro Lynn Lei
2017-07-11 15:31 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2017-07-11 15:23 Lynn Lei
2017-07-11 15:42 ` Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.