driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: ks7010: Replace macros with do while loop.
@ 2021-02-21 20:13 chakravarthikulkarni
  2021-02-22  6:28 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: chakravarthikulkarni @ 2021-02-21 20:13 UTC (permalink / raw)
  Cc: devel, Greg Kroah-Hartman, chakravarthikulkarni2021,
	linux-kernel, Gustavo A. R. Silva

This commit fix errors found in checkpath.pl.
Error message is:
<Macros with complex values should be enclosed in parentheses.>
It is a good idea to keep complex macros in do while loop.
Otherwise result may have side effect.

Signed-off-by: chakravarthikulkarni <chakravarthikulkarni2021@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index 39138191a556..955499054d10 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -498,20 +498,20 @@ struct hostif_mic_failure_request {
 #define TX_RATE_FIXED		5
 
 /* 11b rate */
-#define TX_RATE_1M	(u8)(10 / 5)	/* 11b 11g basic rate */
-#define TX_RATE_2M	(u8)(20 / 5)	/* 11b 11g basic rate */
-#define TX_RATE_5M	(u8)(55 / 5)	/* 11g basic rate */
-#define TX_RATE_11M	(u8)(110 / 5)	/* 11g basic rate */
+#define TX_RATE_1M	do { (u8) (10 / 5) } while (0)	/* 11b 11g basic rate */
+#define TX_RATE_2M	do { (u8) (20 / 5) } while (0)	/* 11b 11g basic rate */
+#define TX_RATE_5M	do { (u8) (55 / 5) } while (0)	/* 11g basic rate */
+#define TX_RATE_11M	do { (u8) (110 / 5) } while (0)	/* 11g basic rate */
 
 /* 11g rate */
-#define TX_RATE_6M	(u8)(60 / 5)	/* 11g basic rate */
-#define TX_RATE_12M	(u8)(120 / 5)	/* 11g basic rate */
-#define TX_RATE_24M	(u8)(240 / 5)	/* 11g basic rate */
-#define TX_RATE_9M	(u8)(90 / 5)
-#define TX_RATE_18M	(u8)(180 / 5)
-#define TX_RATE_36M	(u8)(360 / 5)
-#define TX_RATE_48M	(u8)(480 / 5)
-#define TX_RATE_54M	(u8)(540 / 5)
+#define TX_RATE_6M	do { (u8) (60 / 5) } while (0)	/* 11g basic rate */
+#define TX_RATE_12M	do { (u8) (120 / 5) } while (0)	/* 11g basic rate */
+#define TX_RATE_24M	do { (u8) (240 / 5) } while (0)	/* 11g basic rate */
+#define TX_RATE_9M	do { (u8) (90 / 5) } while (0)
+#define TX_RATE_18M	do { (u8) (180 / 5) } while (0)
+#define TX_RATE_36M	do { (u8) (360 / 5) } while (0)
+#define TX_RATE_48M	do { (u8) (480 / 5) } while (0)
+#define TX_RATE_54M	do { (u8) (540 / 5) } while (0)
 
 static inline bool is_11b_rate(u8 rate)
 {
-- 
2.17.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: ks7010: Replace macros with do while loop.
  2021-02-21 20:13 [PATCH] staging: ks7010: Replace macros with do while loop chakravarthikulkarni
@ 2021-02-22  6:28 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-02-22  6:28 UTC (permalink / raw)
  To: chakravarthikulkarni
  Cc: devel, Greg Kroah-Hartman, linux-kernel, Gustavo A. R. Silva

On Mon, Feb 22, 2021 at 01:43:24AM +0530, chakravarthikulkarni wrote:
> This commit fix errors found in checkpath.pl.
> Error message is:
> <Macros with complex values should be enclosed in parentheses.>
> It is a good idea to keep complex macros in do while loop.
> Otherwise result may have side effect.
> 
> Signed-off-by: chakravarthikulkarni <chakravarthikulkarni2021@gmail.com>

This breaks the build.

Also just ignore this checkpatch warning.  The original defines are
fine.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-22  6:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-21 20:13 [PATCH] staging: ks7010: Replace macros with do while loop chakravarthikulkarni
2021-02-22  6:28 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).