Skip to content

Commit

Permalink
drivers/net/bnx2x: Use (pr|netdev|netif)_<level> macro helpers
Browse files Browse the repository at this point in the history
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: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Joe Perches authored and David S. Miller committed Feb 18, 2010
1 parent 3a9c6a4 commit 7995c64
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 138 deletions.
49 changes: 29 additions & 20 deletions drivers/net/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
/* error/debug prints */

#define DRV_MODULE_NAME "bnx2x"
#define PFX DRV_MODULE_NAME ": "

/* for messages that are currently off */
#define BNX2X_MSG_OFF 0
Expand All @@ -58,30 +57,40 @@
#define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */

/* regular debug print */
#define DP(__mask, __fmt, __args...) do { \
if (bp->msglevel & (__mask)) \
printk(DP_LEVEL "[%s:%d(%s)]" __fmt, __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", ##__args); \
} while (0)
#define DP(__mask, __fmt, __args...) \
do { \
if (bp->msg_enable & (__mask)) \
printk(DP_LEVEL "[%s:%d(%s)]" __fmt, \
__func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)

/* errors debug print */
#define BNX2X_DBG_ERR(__fmt, __args...) do { \
if (bp->msglevel & NETIF_MSG_PROBE) \
printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", ##__args); \
} while (0)
#define BNX2X_DBG_ERR(__fmt, __args...) \
do { \
if (netif_msg_probe(bp)) \
pr_err("[%s:%d(%s)]" __fmt, \
__func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)

/* for errors (never masked) */
#define BNX2X_ERR(__fmt, __args...) do { \
printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", ##__args); \
} while (0)
#define BNX2X_ERR(__fmt, __args...) \
do { \
pr_err("[%s:%d(%s)]" __fmt, \
__func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)

/* before we have a dev->name use dev_info() */
#define BNX2X_DEV_INFO(__fmt, __args...) do { \
if (bp->msglevel & NETIF_MSG_PROBE) \
dev_info(&bp->pdev->dev, __fmt, ##__args); \
} while (0)
#define BNX2X_DEV_INFO(__fmt, __args...) \
do { \
if (netif_msg_probe(bp)) \
dev_info(&bp->pdev->dev, __fmt, ##__args); \
} while (0)


#ifdef BNX2X_STOP_ON_ERROR
Expand Down Expand Up @@ -882,7 +891,7 @@ struct bnx2x {
/* End of fields used in the performance code paths */

int panic;
int msglevel;
int msg_enable;

u32 flags;
#define PCIX_FLAG 1
Expand Down
21 changes: 6 additions & 15 deletions drivers/net/bnx2x_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/pci.h>
Expand Down Expand Up @@ -2987,11 +2989,8 @@ static u8 bnx2x_verify_sfp_module(struct link_params *params)
else
vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0';

printk(KERN_INFO PFX "Warning: "
"Unqualified SFP+ module "
"detected on %s, Port %d from %s part number %s\n"
, bp->dev->name, params->port,
vendor_name, vendor_pn);
netdev_info(bp->dev, "Warning: Unqualified SFP+ module detected, Port %d from %s part number %s\n",
params->port, vendor_name, vendor_pn);
return -EINVAL;
}

Expand Down Expand Up @@ -4846,16 +4845,8 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
" has been detected on "
"port %d\n",
params->port);
printk(KERN_ERR PFX "Error: Power"
" fault on %s 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"
, bp->dev->name, params->port);
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",
params->port);
/*
* Disable all RX_ALARMs except for
* mod_abs
Expand Down
Loading

0 comments on commit 7995c64

Please sign in to comment.