From: Rupesh Gujare <rupesh.gujare@atmel.com>
To: <devel@linuxdriverproject.org>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<gregkh@linuxfoundation.org>, <shigekatsu.tateno@atmel.com>
Subject: [PATCH] staging: ozwpan: Convert printk to dev_dbg()
Date: Tue, 25 Jun 2013 17:30:02 +0100 [thread overview]
Message-ID: <1372177802-11360-1-git-send-email-rupesh.gujare@atmel.com> (raw)
convert all debug messages from printk to dev_dbg() & add kernel config to
enable/disable these messages during compilation.
Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
---
drivers/staging/ozwpan/Kbuild | 2 +-
drivers/staging/ozwpan/Kconfig | 9 +++++++++
drivers/staging/ozwpan/ozcdev.c | 9 +++++----
drivers/staging/ozwpan/oztrace.h | 9 +++++----
4 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/ozwpan/Kbuild b/drivers/staging/ozwpan/Kbuild
index 1766a26..35a4278 100644
--- a/drivers/staging/ozwpan/Kbuild
+++ b/drivers/staging/ozwpan/Kbuild
@@ -15,4 +15,4 @@ ozwpan-y := \
ozurbparanoia.o \
oztrace.o
-
+ccflags-$(CONFIG_USB_WPAN_HCD_DEBUG) := -DDEBUG -DWANT_TRACE
diff --git a/drivers/staging/ozwpan/Kconfig b/drivers/staging/ozwpan/Kconfig
index 7904cae..ccee97c 100644
--- a/drivers/staging/ozwpan/Kconfig
+++ b/drivers/staging/ozwpan/Kconfig
@@ -7,3 +7,12 @@ config USB_WPAN_HCD
To compile this driver a module, choose M here: the module
will be called "ozwpan".
+
+if USB_WPAN_HCD
+
+config USB_WPAN_HCD_DEBUG
+ boolean "Debug support for USB over WiFi Host Controller"
+ help
+ Say "yes" to enable debug messages.
+
+endif # USB_WPAN_HCD
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
index 374fdc3..2fc944b 100644
--- a/drivers/staging/ozwpan/ozcdev.c
+++ b/drivers/staging/ozwpan/ozcdev.c
@@ -44,6 +44,7 @@ struct oz_serial_ctx {
*/
static struct oz_cdev g_cdev;
static struct class *g_oz_class;
+struct device *g_oz_wpan_dev;
/*------------------------------------------------------------------------------
* Context: process and softirq
*/
@@ -334,7 +335,6 @@ static const struct file_operations oz_fops = {
int oz_cdev_register(void)
{
int err;
- struct device *dev;
memset(&g_cdev, 0, sizeof(g_cdev));
err = alloc_chrdev_region(&g_cdev.devnum, 0, 1, "ozwpan");
if (err < 0)
@@ -357,10 +357,11 @@ int oz_cdev_register(void)
err = PTR_ERR(g_oz_class);
goto out1;
}
- dev = device_create(g_oz_class, NULL, g_cdev.devnum, NULL, "ozwpan");
- if (IS_ERR(dev)) {
+ g_oz_wpan_dev = device_create(g_oz_class, NULL, g_cdev.devnum, NULL,
+ "ozwpan");
+ if (IS_ERR(g_oz_wpan_dev)) {
oz_trace("Failed to create sysfs entry for cdev\n");
- err = PTR_ERR(dev);
+ err = PTR_ERR(g_oz_wpan_dev);
goto out1;
}
return 0;
diff --git a/drivers/staging/ozwpan/oztrace.h b/drivers/staging/ozwpan/oztrace.h
index 8293b24..8764f37 100644
--- a/drivers/staging/ozwpan/oztrace.h
+++ b/drivers/staging/ozwpan/oztrace.h
@@ -7,14 +7,15 @@
#define _OZTRACE_H_
#include "ozconfig.h"
-#define TRACE_PREFIX KERN_ALERT "OZWPAN: "
+extern struct device *g_oz_wpan_dev;
#ifdef WANT_TRACE
-#define oz_trace(...) printk(TRACE_PREFIX __VA_ARGS__)
+#define oz_trace(fmt, ...) dev_dbg(g_oz_wpan_dev, fmt, ##__VA_ARGS__);
#ifdef WANT_VERBOSE_TRACE
extern unsigned long trace_flags;
-#define oz_trace2(_flag, ...) \
- do { if (trace_flags & _flag) printk(TRACE_PREFIX __VA_ARGS__); \
+#define oz_trace2(_flag, fmt, ...) \
+ do { if (trace_flags & _flag) \
+ dev_dbg(g_oz_wpan_dev, fmt, ##__VA_ARGS__); \
} while (0)
#else
#define oz_trace2(...)
--
1.7.9.5
next reply other threads:[~2013-06-25 16:30 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 16:30 Rupesh Gujare [this message]
2013-06-25 16:40 ` Joe Perches
2013-06-25 17:02 ` Greg KH
2013-06-25 17:29 ` Joe Perches
2013-06-25 17:38 ` Greg KH
2013-06-25 17:56 ` Joe Perches
2013-06-25 18:03 ` Joe Perches
2013-06-26 17:51 ` Jason Baron
2013-06-26 1:00 ` [PATCH] staging: ozwpan: Use normal Makefile, convert oz_trace to oz_dbg Joe Perches
2013-06-26 11:53 ` Rupesh Gujare
2013-06-26 13:56 ` Joe Perches
2013-06-26 14:19 ` Joe Perches
2013-07-04 12:35 ` [PATCH v2 0/5] Replace debug macro Rupesh Gujare
2013-07-04 14:31 ` Joe Perches
2013-07-04 12:35 ` [PATCH v2 1/5] staging: ozwpan: Remove extra debug logs Rupesh Gujare
2013-07-04 12:35 ` [PATCH v2 2/5] staging: ozwpan: Replace oz_trace with oz_dbg Rupesh Gujare
2013-07-04 12:35 ` [PATCH v2 3/5] staging: ozwpan: Remove old debug macro Rupesh Gujare
2013-07-04 12:35 ` [PATCH v2 4/5] staging: ozwpan: Convert macro to function Rupesh Gujare
2013-07-04 12:35 ` [PATCH v2 5/5] staging: ozwpan: Rename Kbuild to Makefile Rupesh Gujare
2013-07-04 12:45 ` Rupesh Gujare
2013-07-22 17:43 ` Rupesh Gujare
2013-07-22 17:55 ` Greg Kroah-Hartman
2013-07-22 22:08 ` Gujare, Rupesh
2013-07-23 12:44 ` [PATCH v3 0/5] staging: ozwpan: Replace debug macro Rupesh Gujare
2013-07-23 12:44 ` [PATCH v3 1/5] staging: ozwpan: Remove extra debug logs Rupesh Gujare
2013-07-23 12:45 ` [PATCH v3 2/5] staging: ozwpan: Replace oz_trace with oz_dbg Rupesh Gujare
2013-07-23 12:45 ` [PATCH v3 3/5] staging: ozwpan: Remove old debug macro Rupesh Gujare
2013-07-23 12:45 ` [PATCH v3 4/5] staging: ozwpan: Convert macro to function Rupesh Gujare
2013-07-23 12:45 ` [PATCH v3 5/5] staging: ozwpan: Rename Kbuild to Makefile Rupesh Gujare
2013-06-26 17:46 ` [PATCH] staging: ozwpan: Convert printk to dev_dbg() Jason Baron
2013-06-27 0:26 ` Joe Perches
2013-06-25 17:49 ` Rupesh Gujare
2013-06-25 17:55 ` Alan Stern
2013-06-25 17:57 ` Greg KH
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=1372177802-11360-1-git-send-email-rupesh.gujare@atmel.com \
--to=rupesh.gujare@atmel.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shigekatsu.tateno@atmel.com \
/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®