From c1641862f88367602f8f34a17b21bdf1eee912ee Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 6 Jul 2010 21:05:17 +0200 Subject: Staging: batman-adv: Move printk to simplified macros Each general printk which is not informative by itself for a specific batX device were moved to pr_(info|warning|err) as it provides an easy interface which for example resolves the problem to add the prefix "batman-adv: " before each line. All information which is specific to a batX device will be printed using a bat_(info|err|warning) macro to prefix it also with "batman-adv: batX:" in each line. Reported-by: Joe Perches Signed-off-by: Sven Eckelmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/batman-adv/main.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'drivers/staging/batman-adv/main.h') diff --git a/drivers/staging/batman-adv/main.h b/drivers/staging/batman-adv/main.h index dc42d44..8513261 100644 --- a/drivers/staging/batman-adv/main.h +++ b/drivers/staging/batman-adv/main.h @@ -86,10 +86,13 @@ /* * Debug Messages */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt /* Append 'batman-adv: ' before + * kernel messages */ #define DBG_BATMAN 1 /* all messages related to routing / flooding / * broadcasting / etc */ #define DBG_ROUTES 2 /* route or hna added / changed / deleted */ +#define DBG_ALL 3 #define LOG_BUF_LEN 8192 /* has to be a power of 2 */ @@ -171,4 +174,26 @@ static inline void bat_dbg(char type __attribute__((unused)), } #endif +#define bat_warning(net_dev, fmt, arg...) \ + do { \ + struct net_device *_netdev = (net_dev); \ + struct bat_priv *_batpriv = netdev_priv(_netdev); \ + bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ + pr_warning("%s: " fmt, _netdev->name, ## arg); \ + } while (0) +#define bat_info(net_dev, fmt, arg...) \ + do { \ + struct net_device *_netdev = (net_dev); \ + struct bat_priv *_batpriv = netdev_priv(_netdev); \ + bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ + pr_info("%s: " fmt, _netdev->name, ## arg); \ + } while (0) +#define bat_err(net_dev, fmt, arg...) \ + do { \ + struct net_device *_netdev = (net_dev); \ + struct bat_priv *_batpriv = netdev_priv(_netdev); \ + bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ + pr_err("%s: " fmt, _netdev->name, ## arg); \ + } while (0) + #endif /* _NET_BATMAN_ADV_MAIN_H_ */ -- cgit v1.1