* [2.6 patch] drivers/net/8139too.c: rework the debug levels
@ 2005-07-22 21:13 Adrian Bunk
2005-07-31 4:45 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2005-07-22 21:13 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linux-kernel
I started looking at this driver after seeing the following warnings
with -Wundef:
<-- snip -->
...
CC drivers/net/8139too.o
drivers/net/8139too.c:1961:5: warning: "RTL8139_DEBUG" is not defined
drivers/net/8139too.c:2047:5: warning: "RTL8139_DEBUG" is not defined
...
<-- snip -->
Looking at this driver, I wondered why there were two different
#define's controlling the debug output of the driver.
This patch consolidates this to one debug level, and the default
setting "1" results in exactly the same 8139too.o as with the old
defaults.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
---
drivers/net/8139too.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
--- linux-2.6.13-rc3-mm1-full/drivers/net/8139too.c.old 2005-07-22 18:25:11.000000000 +0200
+++ linux-2.6.13-rc3-mm1-full/drivers/net/8139too.c 2005-07-22 18:32:17.000000000 +0200
@@ -85,7 +85,8 @@
Submitting bug reports:
"rtl8139-diag -mmmaaavvveefN" output
- enable RTL8139_DEBUG below, and look at 'dmesg' or kernel log
+ set RTL8139_DEBUG to a higher debug level below,
+ and look at 'dmesg' or kernel log
*/
@@ -126,21 +127,18 @@
#define USE_IO_OPS 1
#endif
-/* define to 1 to enable copious debugging info */
-#undef RTL8139_DEBUG
+/* debug levels: 0-4 */
+#define RTL8139_DEBUG 1
-/* define to 1 to disable lightweight runtime debugging checks */
-#undef RTL8139_NDEBUG
-
-#ifdef RTL8139_DEBUG
+#if RTL8139_DEBUG > 1
/* note: prints function name for you */
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
#else
# define DPRINTK(fmt, args...)
#endif
-#ifdef RTL8139_NDEBUG
+#if RTL8139_DEBUG == 0
# define assert(expr) do {} while (0)
#else
# define assert(expr) \
@@ -1794,13 +1792,13 @@
tx_left--;
}
-#ifndef RTL8139_NDEBUG
+#if RTL8139_DEBUG > 0
if (tp->cur_tx - dirty_tx > NUM_TX_DESC) {
printk (KERN_ERR "%s: Out-of-sync dirty pointer, %ld vs. %ld.\n",
dev->name, dirty_tx, tp->cur_tx);
dirty_tx += NUM_TX_DESC;
}
-#endif /* RTL8139_NDEBUG */
+#endif /* RTL8139_DEBUG > 0 */
/* only wake the queue if we did work, and the queue is stopped */
if (tp->dirty_tx != dirty_tx) {
@@ -1958,7 +1956,7 @@
printk(KERN_DEBUG "%s: rtl8139_rx() status %4.4x, size %4.4x,"
" cur %4.4x.\n", dev->name, rx_status,
rx_size, cur_rx);
-#if RTL8139_DEBUG > 2
+#if RTL8139_DEBUG > 3
{
int i;
DPRINTK ("%s: Frame contents ", dev->name);
@@ -2044,7 +2042,7 @@
if (unlikely(!received || rx_size == 0xfff0))
rtl8139_isr_ack(tp);
-#if RTL8139_DEBUG > 1
+#if RTL8139_DEBUG > 2
DPRINTK ("%s: Done rtl8139_rx(), current %4.4x BufAddr %4.4x,"
" free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx,
RTL_R16 (RxBufAddr),
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [2.6 patch] drivers/net/8139too.c: rework the debug levels
2005-07-22 21:13 [2.6 patch] drivers/net/8139too.c: rework the debug levels Adrian Bunk
@ 2005-07-31 4:45 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2005-07-31 4:45 UTC (permalink / raw)
To: Adrian Bunk; +Cc: netdev, linux-kernel
Adrian Bunk wrote:
> Looking at this driver, I wondered why there were two different
> #define's controlling the debug output of the driver.
Because debug output and runtime checks are two different concepts, two
different behaviors.
Jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-07-31 4:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-22 21:13 [2.6 patch] drivers/net/8139too.c: rework the debug levels Adrian Bunk
2005-07-31 4:45 ` Jeff Garzik
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).