drivers/net/mlx4: Use %pV, pr_<level>, printk_once
Remove near duplication of format string constants by using the newly introduced vsprintf extention %pV to reduce text by 20k or so. $ size drivers/net/mlx4/built-in.o* text data bss dec hex filename 161367 1866 48784 212017 33c31 drivers/net/mlx4/built-in.o 142621 1866 46248 190735 2e90f drivers/net/mlx4/built-in.o.new Use printk_once as appropriate. Convert printks to pr_<level>, some bare printks now use pr_cont. Remove now unused #define PFX. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
5487486858
commit
0a645e8097
@@ -79,6 +79,29 @@ MLX4_EN_PARM_INT(pfctx, 0, "Priority based Flow Control policy on TX[7:0]."
|
||||
MLX4_EN_PARM_INT(pfcrx, 0, "Priority based Flow Control policy on RX[7:0]."
|
||||
" Per priority bit mask");
|
||||
|
||||
int en_print(const char *level, const struct mlx4_en_priv *priv,
|
||||
const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
struct va_format vaf;
|
||||
int i;
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
vaf.fmt = format;
|
||||
vaf.va = &args;
|
||||
if (priv->registered)
|
||||
i = printk("%s%s: %s: %pV",
|
||||
level, DRV_NAME, priv->dev->name, &vaf);
|
||||
else
|
||||
i = printk("%s%s: %s: Port %d: %pV",
|
||||
level, DRV_NAME, dev_name(&priv->mdev->pdev->dev),
|
||||
priv->port, &vaf);
|
||||
va_end(args);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
|
||||
{
|
||||
struct mlx4_en_profile *params = &mdev->profile;
|
||||
@@ -152,15 +175,11 @@ static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr)
|
||||
|
||||
static void *mlx4_en_add(struct mlx4_dev *dev)
|
||||
{
|
||||
static int mlx4_en_version_printed;
|
||||
struct mlx4_en_dev *mdev;
|
||||
int i;
|
||||
int err;
|
||||
|
||||
if (!mlx4_en_version_printed) {
|
||||
printk(KERN_INFO "%s", mlx4_en_version);
|
||||
mlx4_en_version_printed++;
|
||||
}
|
||||
printk_once(KERN_INFO "%s", mlx4_en_version);
|
||||
|
||||
mdev = kzalloc(sizeof *mdev, GFP_KERNEL);
|
||||
if (!mdev) {
|
||||
|
Reference in New Issue
Block a user