Re: [PATCH] mellanox: mlx5: Use logging functions to reduce text ~10k/5%

From: Saeed Mahameed
Date: Thu Jun 23 2016 - 04:10:31 EST


On Wed, Jun 22, 2016 at 9:23 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
[...]
> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> @@ -1557,3 +1557,37 @@ static void __exit cleanup(void)
>
> module_init(init);
> module_exit(cleanup);
> +
> +void mlx5_core_err(struct mlx5_core_dev *dev, const char *fmt, ...)
> +{
> + struct va_format vaf;
> + va_list args;
> +
> + va_start(args, fmt);
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + dev_err(&dev->pdev->dev, "%s:%pS:(pid %d): %pV",
> + dev->priv.name, __builtin_return_address(0), current->pid,
> + &vaf);
> +
> + va_end(args);
> +}
> +
> +void mlx5_core_warn(struct mlx5_core_dev *dev, const char *fmt, ...)
> +{
> + struct va_format vaf;
> + va_list args;
> +
> + va_start(args, fmt);
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + dev_warn(&dev->pdev->dev, "%s:%pS:(pid %d): %pV",
> + dev->priv.name, __builtin_return_address(0), current->pid,
> + &vaf);
> +
> + va_end(args);
> +}

Hi Joe,

I like to keep the file organized in a bottom-up fashion. Those
functions need to appear as early as possible in the file, just move
them up to appear after the MACROs defines and static fields
declarations.