#ifndef NET_IRDA_H
#define NET_IRDA_H
-#include <linux/config.h>
#include <linux/skbuff.h> /* struct sk_buff */
#include <linux/kernel.h>
#include <linux/if.h> /* sa_family_t in <linux/irda.h> */
/* use 0 for production, 1 for verification, >2 for debug */
#define IRDA_DEBUG_LEVEL 0
-#define IRDA_DEBUG(n, args...) (irda_debug >= (n)) ? (printk(KERN_DEBUG args)) : 0
-#define ASSERT(expr, func) \
-if(!(expr)) { \
- printk( "Assertion failed! %s:%s:%d %s\n", \
- __FILE__,__FUNCTION__,__LINE__,(#expr)); \
- func }
+#define IRDA_DEBUG(n, args...) \
+do { if (irda_debug >= (n)) \
+ printk(KERN_DEBUG args); \
+} while (0)
+#define IRDA_ASSERT(expr, func) \
+do { if(!(expr)) { \
+ printk( "Assertion failed! %s:%s:%d %s\n", \
+ __FILE__,__FUNCTION__,__LINE__,(#expr) ); \
+ func } } while (0)
+#define IRDA_ASSERT_LABEL(label) label
#else
-#define IRDA_DEBUG(n, args...)
-#define ASSERT(expr, func) \
-if(!(expr)) do { \
- func } while (0)
+#define IRDA_DEBUG(n, args...) do { } while (0)
+#define IRDA_ASSERT(expr, func) do { (void)(expr); } while (0)
+#define IRDA_ASSERT_LABEL(label)
#endif /* CONFIG_IRDA_DEBUG */
-#define WARNING(args...) printk(KERN_WARNING args)
-#define MESSAGE(args...) printk(KERN_INFO args)
-#define ERROR(args...) printk(KERN_ERR args)
-
-#define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
+#define IRDA_WARNING(args...) do { if (net_ratelimit()) printk(KERN_WARNING args); } while (0)
+#define IRDA_MESSAGE(args...) do { if (net_ratelimit()) printk(KERN_INFO args); } while (0)
+#define IRDA_ERROR(args...) do { if (net_ratelimit()) printk(KERN_ERR args); } while (0)
/*
* Magic numbers used by Linux-IrDA. Random numbers which must be unique to