linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Wolfram Sang <wsa@the-dreams.de>, linux-i2c@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH] i2c: algo-bit: Move debug variable
Date: Fri, 16 Feb 2018 13:44:55 +0100	[thread overview]
Message-ID: <20180216124455.20491-1-linus.walleij@linaro.org> (raw)

The variable "i2c_debug" is in a real weird place. If DEBUG
happens to be defined (because someone wants to do debugging)
the macro bit_dbg() is already using it some lines up in
the code, so compilation will fail.

After this patch, it is possible to define DEBUG and then
pass a debug level to the module with the i2c_debug
parameter, which is probably what is intended.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/i2c/algos/i2c-algo-bit.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 3df0efd69ae3..47e0088ab904 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -29,6 +29,10 @@
 /* ----- global defines ----------------------------------------------- */
 
 #ifdef DEBUG
+static int i2c_debug = 1;
+module_param(i2c_debug, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(i2c_debug,
+		 "debug level - 0 off; 1 normal; 2 verbose; 3 very verbose");
 #define bit_dbg(level, dev, format, args...) \
 	do { \
 		if (i2c_debug >= level) \
@@ -45,13 +49,6 @@ static int bit_test;	/* see if the line-setting functions work	*/
 module_param(bit_test, int, S_IRUGO);
 MODULE_PARM_DESC(bit_test, "lines testing - 0 off; 1 report; 2 fail if stuck");
 
-#ifdef DEBUG
-static int i2c_debug = 1;
-module_param(i2c_debug, int, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(i2c_debug,
-		 "debug level - 0 off; 1 normal; 2 verbose; 3 very verbose");
-#endif
-
 /* --- setting states on the bus with the right timing: ---------------	*/
 
 #define setsda(adap, val)	adap->setsda(adap->data, val)
-- 
2.14.3

                 reply	other threads:[~2018-02-16 12:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180216124455.20491-1-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).