Re: [PATCH] mellanox: mlx5: Use logging functions to reduce text ~10k/5%
From: Saeed Mahameed <hidden>
Date: 2016-06-23 08:10:25
Also in:
linux-rdma, lkml
On Wed, Jun 22, 2016 at 9:23 PM, Joe Perches [off-list ref] wrote: [...]
quoted hunk ↗ jump to hunk
--- 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. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html