Commit 7995c64e authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

drivers/net/bnx2x: Use (pr|netdev|netif)_<level> macro helpers

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert struct bnx2x member msglevel to msg_enable for netif_msg_<foo> macros
Remove #define PFX
Use pr_<level>
Use netdev_<level>
Use netif_<level>
Coalesce long formats
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3a9c6a49
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
/* error/debug prints */ /* error/debug prints */
#define DRV_MODULE_NAME "bnx2x" #define DRV_MODULE_NAME "bnx2x"
#define PFX DRV_MODULE_NAME ": "
/* for messages that are currently off */ /* for messages that are currently off */
#define BNX2X_MSG_OFF 0 #define BNX2X_MSG_OFF 0
...@@ -58,30 +57,40 @@ ...@@ -58,30 +57,40 @@
#define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */ #define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */
/* regular debug print */ /* regular debug print */
#define DP(__mask, __fmt, __args...) do { \ #define DP(__mask, __fmt, __args...) \
if (bp->msglevel & (__mask)) \ do { \
printk(DP_LEVEL "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ if (bp->msg_enable & (__mask)) \
bp->dev ? (bp->dev->name) : "?", ##__args); \ printk(DP_LEVEL "[%s:%d(%s)]" __fmt, \
} while (0) __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)
/* errors debug print */ /* errors debug print */
#define BNX2X_DBG_ERR(__fmt, __args...) do { \ #define BNX2X_DBG_ERR(__fmt, __args...) \
if (bp->msglevel & NETIF_MSG_PROBE) \ do { \
printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ if (netif_msg_probe(bp)) \
bp->dev ? (bp->dev->name) : "?", ##__args); \ pr_err("[%s:%d(%s)]" __fmt, \
} while (0) __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)
/* for errors (never masked) */ /* for errors (never masked) */
#define BNX2X_ERR(__fmt, __args...) do { \ #define BNX2X_ERR(__fmt, __args...) \
printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ do { \
bp->dev ? (bp->dev->name) : "?", ##__args); \ pr_err("[%s:%d(%s)]" __fmt, \
} while (0) __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)
/* before we have a dev->name use dev_info() */ /* before we have a dev->name use dev_info() */
#define BNX2X_DEV_INFO(__fmt, __args...) do { \ #define BNX2X_DEV_INFO(__fmt, __args...) \
if (bp->msglevel & NETIF_MSG_PROBE) \ do { \
dev_info(&bp->pdev->dev, __fmt, ##__args); \ if (netif_msg_probe(bp)) \
} while (0) dev_info(&bp->pdev->dev, __fmt, ##__args); \
} while (0)
#ifdef BNX2X_STOP_ON_ERROR #ifdef BNX2X_STOP_ON_ERROR
...@@ -882,7 +891,7 @@ struct bnx2x { ...@@ -882,7 +891,7 @@ struct bnx2x {
/* End of fields used in the performance code paths */ /* End of fields used in the performance code paths */
int panic; int panic;
int msglevel; int msg_enable;
u32 flags; u32 flags;
#define PCIX_FLAG 1 #define PCIX_FLAG 1
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -2987,11 +2989,8 @@ static u8 bnx2x_verify_sfp_module(struct link_params *params) ...@@ -2987,11 +2989,8 @@ static u8 bnx2x_verify_sfp_module(struct link_params *params)
else else
vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0'; vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0';
printk(KERN_INFO PFX "Warning: " netdev_info(bp->dev, "Warning: Unqualified SFP+ module detected, Port %d from %s part number %s\n",
"Unqualified SFP+ module " params->port, vendor_name, vendor_pn);
"detected on %s, Port %d from %s part number %s\n"
, bp->dev->name, params->port,
vendor_name, vendor_pn);
return -EINVAL; return -EINVAL;
} }
...@@ -4846,16 +4845,8 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params, ...@@ -4846,16 +4845,8 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
" has been detected on " " has been detected on "
"port %d\n", "port %d\n",
params->port); params->port);
printk(KERN_ERR PFX "Error: Power" netdev_err(bp->dev, "Error: Power fault on Port %d has been detected and the power to that SFP+ module has been removed to prevent failure of the card. Please remove the SFP+ module and restart the system to clear this error.\n",
" fault on %s Port %d has" params->port);
" been detected and the"
" power to that SFP+ module"
" has been removed to prevent"
" failure of the card. Please"
" remove the SFP+ module and"
" restart the system to clear"
" this error.\n"
, bp->dev->name, params->port);
/* /*
* Disable all RX_ALARMs except for * Disable all RX_ALARMs except for
* mod_abs * mod_abs
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment