linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: algo-bit: Move debug variable
@ 2018-02-16 12:44 Linus Walleij
  0 siblings, 0 replies; only message in thread
From: Linus Walleij @ 2018-02-16 12:44 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Linus Walleij

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-16 12:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-16 12:44 [PATCH] i2c: algo-bit: Move debug variable Linus Walleij

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).