diff options
author | Joe Perches <joe@perches.com> | 2010-07-10 07:22:46 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-15 19:05:17 -0700 |
commit | 0a645e809759a4b9c876d3e9ca6c139784a97a38 (patch) | |
tree | d9e2e46a9207020fc840f52a869eed045e03fa97 /drivers/net/mlx4/en_main.c | |
parent | 54874868585ffa5d73d7ab8a5a32ea7dcdec1441 (diff) | |
download | op-kernel-dev-0a645e809759a4b9c876d3e9ca6c139784a97a38.zip op-kernel-dev-0a645e809759a4b9c876d3e9ca6c139784a97a38.tar.gz |
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>
Diffstat (limited to 'drivers/net/mlx4/en_main.c')
-rw-r--r-- | drivers/net/mlx4/en_main.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c index cbabf14..97934f1 100644 --- a/drivers/net/mlx4/en_main.c +++ b/drivers/net/mlx4/en_main.c @@ -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) { |