From: Valentine Fatiev <valentinef@nvidia.com>
Subject: [PATCH] BACKPORT: drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

Change-Id: I6f3406defefae7023d53acefdeb84d89fd4f0bac
---
 .../ethernet/mellanox/mlx5/core/mlx5_core.h   | 42 +++++++------------
 1 file changed, 14 insertions(+), 28 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -45,6 +45,10 @@
 
 #define DRIVER_VERSION	"24.07-0.6.1"
 
+#ifndef BITS_TO_BYTES
+#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE)
+#endif
+
 extern uint mlx5_core_debug_mask;
 
 #define mlx5_core_dbg(__dev, format, ...)				\
@@ -116,30 +120,6 @@ struct mlx5_cmd_alias_obj_create_attr {
 	u8 access_key[ACCESS_KEY_LEN];
 };
 
-static inline void mlx5_printk(struct mlx5_core_dev *dev, int level, const char *format, ...)
-{
-	struct device *device = dev->device;
-	struct va_format vaf;
-	va_list args;
-
-	if (WARN_ONCE(level < LOGLEVEL_EMERG || level > LOGLEVEL_DEBUG,
-		      "Level %d is out of range, set to default level\n", level))
-		level = LOGLEVEL_DEFAULT;
-
-	va_start(args, format);
-	vaf.fmt = format;
-	vaf.va = &args;
-
-	dev_printk_emit(level, device, "%s %s: %pV", dev_driver_string(device), dev_name(device),
-			&vaf);
-	va_end(args);
-}
-
-#define mlx5_log(__dev, level, format, ...)			\
-	mlx5_printk(__dev, level, "%s:%d:(pid %d): " format,	\
-		    __func__, __LINE__, current->pid,		\
-		    ##__VA_ARGS__)
-
 static inline struct device *mlx5_core_dma_dev(struct mlx5_core_dev *dev)
 {
 	return &dev->pdev->dev;
@@ -343,7 +323,9 @@ void mlx5_detach_device(struct mlx5_core
 void mlx5_attach_device_by_protocol(struct mlx5_core_dev *dev, int protocol);
 int mlx5_register_device(struct mlx5_core_dev *dev);
 void mlx5_unregister_device(struct mlx5_core_dev *dev);
+#if defined(HAVE_LIGHT_SFS)
 void mlx5_dev_set_lightweight(struct mlx5_core_dev *dev);
+#endif
 bool mlx5_dev_is_lightweight(struct mlx5_core_dev *dev);
 
 void mlx5_fw_reporters_create(struct mlx5_core_dev *dev);
@@ -360,8 +342,8 @@ void mlx5_dm_cleanup(struct mlx5_core_de
 			    MLX5_CAP_MCAM_FEATURE((mdev), mtpps_fs) &&	\
 			    MLX5_CAP_MCAM_FEATURE((mdev), mtpps_enh_out_per_adj))
 
-int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw,
-			struct netlink_ext_ack *extack);
+int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw
+			, struct netlink_ext_ack *extack);
 int mlx5_fw_version_query(struct mlx5_core_dev *dev,
 			  u32 *running_ver, u32 *stored_ver);
 
@@ -447,15 +429,19 @@ static inline bool mlx5_core_is_sf(const
 int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx);
 void mlx5_mdev_uninit(struct mlx5_core_dev *dev);
 int mlx5_init_one(struct mlx5_core_dev *dev);
-int mlx5_init_one_devl_locked(struct mlx5_core_dev *dev);
 void mlx5_uninit_one(struct mlx5_core_dev *dev);
+int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery);
 void mlx5_unload_one(struct mlx5_core_dev *dev, bool suspend);
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER
+int mlx5_init_one_devl_locked(struct mlx5_core_dev *dev);
 void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend);
-int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery);
 int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery);
+#endif
+#if defined(HAVE_DEVL_PARAM_DRIVERINIT_VALUE_GET)
 int mlx5_init_one_light(struct mlx5_core_dev *dev);
 void mlx5_uninit_one_light(struct mlx5_core_dev *dev);
 void mlx5_unload_one_light(struct mlx5_core_dev *dev);
+#endif
 
 int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_cap, u16 vport,
 				  u16 opmod);
