From: Jorgyano Vieira <jorgyano@gmail.com>
To: gregkh@linuxfoundation.org
Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
Jorgyano Vieira <jorgyano@gmail.com>
Subject: [PATCH] Staging: crystalhd: crystalhd_misc: improved debug macros
Date: Wed, 15 Feb 2012 00:20:06 -0200 [thread overview]
Message-ID: <1329272406-26198-1-git-send-email-jorgyano@gmail.com> (raw)
Improvement of debug macros to ensure safe use on if/else statements.
Signed-off-by: Jorgyano Vieira <jorgyano@gmail.com>
---
drivers/staging/crystalhd/crystalhd_misc.h | 46 +++++++++++++++-------------
1 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/crystalhd/crystalhd_misc.h b/drivers/staging/crystalhd/crystalhd_misc.h
index 4d61723..e0aa361 100644
--- a/drivers/staging/crystalhd/crystalhd_misc.h
+++ b/drivers/staging/crystalhd/crystalhd_misc.h
@@ -203,26 +203,30 @@ enum _chd_log_levels {
BCMLOG_ENTER_LEAVE = 0x00000008, /* stack tracking */
};
-#define BCMLOG_ENTER \
-if (g_linklog_level & BCMLOG_ENTER_LEAVE) { \
- printk(KERN_DEBUG "Entered %s\n", __func__); \
-}
-
-#define BCMLOG_LEAVE \
-if (g_linklog_level & BCMLOG_ENTER_LEAVE) { \
- printk(KERN_DEBUG "Leaving %s\n", __func__); \
-}
-
-#define BCMLOG(trace, fmt, args...) \
-if (g_linklog_level & trace) { \
- printk(fmt, ##args); \
-}
-
-#define BCMLOG_ERR(fmt, args...) \
-do { \
- if (g_linklog_level & BCMLOG_ERROR) { \
- printk(KERN_ERR "*ERR*:%s:%d: "fmt, __FILE__, __LINE__, ##args); \
- } \
-} while (0);
+#define BCMLOG_ENTER \
+do { \
+ if (g_linklog_level & BCMLOG_ENTER_LEAVE) \
+ printk(KERN_DEBUG "Entered %s\n", __func__); \
+} while (0)
+
+#define BCMLOG_LEAVE \
+do { \
+ if (g_linklog_level & BCMLOG_ENTER_LEAVE) \
+ printk(KERN_DEBUG "Leaving %s\n", __func__); \
+} while (0) \
+
+#define BCMLOG(trace, fmt, args...) \
+do { \
+ if (g_linklog_level & trace) \
+ printk(fmt, ##args); \
+} while (0)
+
+
+#define BCMLOG_ERR(fmt, args...) \
+do { \
+ if (g_linklog_level & BCMLOG_ERROR) \
+ printk(KERN_ERR "*ERR*:%s:%d: "fmt, \
+ __FILE__, __LINE__, ##args); \
+} while (0)
#endif
--
1.7.2.5
next reply other threads:[~2012-02-15 2:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 2:20 Jorgyano Vieira [this message]
2012-02-15 6:40 ` Dan Carpenter
2012-02-15 11:26 ` Jorgyano vieira
2012-02-15 13:35 ` Dan Carpenter
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=1329272406-26198-1-git-send-email-jorgyano@gmail.com \
--to=jorgyano@gmail.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®