warn: Turn the netdev timeout WARN_ON() into a WARN()
authorArjan van de Ven <arjan@linux.intel.com>
Mon, 15 Sep 2008 23:43:18 +0000 (16:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 17 Sep 2008 02:39:33 +0000 (19:39 -0700)
this patch turns the netdev timeout WARN_ON_ONCE() into a WARN_ONCE(),
so that the device and driver names are inside the warning message.
This helps automated tools like kerneloops.org to collect the data
and do statistics, as well as making it more likely that humans
cut-n-paste the important message as part of a bugreport.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/asm-generic/bug.h
net/sched/sch_generic.c

index a3f738cffdb61a0057ffb8a1cd9a012e30b72f24..edc6ba82e090961a841cd37b54cb6abc0311b4d7 100644 (file)
@@ -97,6 +97,16 @@ extern void warn_slowpath(const char *file, const int line,
        unlikely(__ret_warn_once);                              \
 })
 
+#define WARN_ONCE(condition, format...)        ({                      \
+       static int __warned;                                    \
+       int __ret_warn_once = !!(condition);                    \
+                                                               \
+       if (unlikely(__ret_warn_once))                          \
+               if (WARN(!__warned, format))                    \
+                       __warned = 1;                           \
+       unlikely(__ret_warn_once);                              \
+})
+
 #define WARN_ON_RATELIMIT(condition, state)                    \
                WARN_ON((condition) && __ratelimit(state))
 
index 9634091ee2f0f7f1c65059d6ae454281d2db0adf..ec0a0839ce512620231997be5f5c233b4bea423a 100644 (file)
@@ -215,10 +215,9 @@ static void dev_watchdog(unsigned long arg)
                            time_after(jiffies, (dev->trans_start +
                                                 dev->watchdog_timeo))) {
                                char drivername[64];
-                               printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
+                               WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
                                       dev->name, netdev_drivername(dev, drivername, 64));
                                dev->tx_timeout(dev);
-                               WARN_ON_ONCE(1);
                        }
                        if (!mod_timer(&dev->watchdog_timer,
                                       round_jiffies(jiffies +